Commit Graph

59 Commits

Author SHA1 Message Date
Peter Cai d3745ae188
add MIT LICENSE 2020-04-18 18:21:41 +08:00
Peter Cai eeb13b44e9
blog: use ExtendableEvent.wait_until()
we need to guarantee the promise will not be cancelled
2020-04-18 18:07:16 +08:00
Peter Cai ffb4c24292
get rid of dead code warnings 2020-04-18 16:49:32 +08:00
Peter Cai 5c2615a6cb
blog: get rid of Vec allocation in render for good
just spawn the cache whitelist task onto the js ev loop and don't care
about it; the write only need to succeed once and that normally happens
at the very first time.
2020-04-18 16:46:11 +08:00
Peter Cai e0d8c94986
blog: remove useless lifetime parameter 2020-04-18 16:36:36 +08:00
Peter Cai 10339daf09
blog: refactor: rewrite more transform as iterator operations 2020-04-18 16:35:38 +08:00
Peter Cai 994da996bc
blog: refactor: apply highlight via idomatic Iterator operations 2020-04-18 16:05:34 +08:00
Peter Cai 81fda6e1c8
add a preferred_url option 2020-04-16 16:21:21 +08:00
Peter Cai a9e3490478
sn: implement the Delete action 2020-04-16 15:59:42 +08:00
Peter Cai 3a1520f0db
blog: take non-labelled code blocks into account 2020-04-15 21:06:30 +08:00
Peter Cai 5f790e4b37
blog: make links open in new tab by default 2020-04-15 20:58:54 +08:00
Peter Cai 4bf676419d
blog: use RegExp from js_sys to handle headings and code blocks 2020-04-15 19:28:52 +08:00
Peter Cai e1033ff0b3
support adding description meta tag to pages
using the page context
2020-04-15 15:21:51 +08:00
Peter Cai 15f78ea632
lib: get rid of the "hello world" endpoint 2020-04-15 14:28:28 +08:00
Peter Cai 2064f36b14
lib: remove TODO for page rendering 2020-04-15 14:02:53 +08:00
Peter Cai 1ddd586694
sn: return error instead of fail silently for malformed metadata
protect people from accidentally submitting malformed header and then
making things public on accident.
2020-04-14 21:17:32 +08:00
Peter Cai d6b479ec15
support per-post theme_config in custom metadata 2020-04-14 21:11:21 +08:00
Peter Cai 800a39956a
render: add pathname to the page context
needed when we need to insert a comment system
2020-04-14 20:36:00 +08:00
Peter Cai daccf6c142
add support for hard-coded extra proxied resources 2020-04-13 18:52:16 +08:00
Peter Cai 44ca2f6de3
support cache-control for static resources 2020-04-13 18:10:34 +08:00
Peter Cai e727bce188
add support for hard-coded redirects in config.json 2020-04-13 16:50:36 +08:00
Peter Cai 2ee88e11b0
drop rbtag and use our own hand-rolled implementation
because we need to update build timestamp each time anything related to
rendering is changed. The rbtag crate only supports git commit times.

Also, reproducible build isn't exactly a goal of this project.
2020-04-12 17:25:55 +08:00
Peter Cai 54ca223ed6
blog: use build timestamp as CACHE_VERSION 2020-04-12 17:14:10 +08:00
Peter Cai 311b9a0d26
hljs: binding: catch hljs errors when specifying language
the language may not exist. do not crash the entire program due to this
2020-04-12 17:01:45 +08:00
Peter Cai f519152465
integrate hljs into backend to provide code highlighting
1. Use hljs and wasm_bindgen to parse code
2. Allow the final user to choose what language to include by generating
   inline_js in build.rs for #[wasm_bindgen] (a thin wrapper around the
   raw hljs to load whatever is needed by config.json statically rather
   than dynamically)
3. Integrate the monokai color scheme into our default theme
2020-04-12 16:53:51 +08:00
Peter Cai 26bb98b11e
blog: enable all markdown extensions supported by pulldown_cmark 2020-04-12 15:36:37 +08:00
Peter Cai de8eace92e
render: use static Handlebars instance 2020-04-12 15:10:46 +08:00
Peter Cai 1f2fee8341
implement RSS feed
as an alternative common template for home page
2020-04-12 14:28:26 +08:00
Peter Cai f714591b25
implement manual summary marker 2020-04-11 19:15:34 +08:00
Peter Cai 9b018b559d
implement automatic anchor generation for headings 2020-04-11 19:01:30 +08:00
Peter Cai 23d899dd0e
support build-time theme selection via build.rs 2020-04-11 09:52:45 +08:00
Peter Cai d8f05bad95
render: remove dummy argument in handlebars helper
turns out they just can't handle `||` -- adding a space in between fixes
the problem.
2020-04-11 09:18:02 +08:00
Peter Cai bbcb48beeb
implement post page rendering 2020-04-10 21:10:30 +08:00
Peter Cai 1110a2614b
render: implement pagination 2020-04-10 20:57:53 +08:00
Peter Cai e599007ed4
use build datetime as version string on static resources 2020-04-10 20:42:55 +08:00
Peter Cai 150940cd8c
add template and implement rendering 2020-04-10 20:38:53 +08:00
Peter Cai b2d6678405
sanitize proxied remote content response
re-construct the Response object to make sure no strange headers slip
into our own response.
2020-04-09 20:11:48 +08:00
Peter Cai d8edb51d6a
add explanation why we need a custom binding 2020-04-09 19:18:48 +08:00
Peter Cai 4474769004
proxy remote media inserted in posts
To protect user privacy and speed up page loading
2020-04-09 19:15:45 +08:00
Peter Cai 1b42c65294
blog: add more comment on PostContentCache 2020-04-09 17:18:52 +08:00
Peter Cai 2bd9b169f3
blog: add more comment on cache version 2020-04-09 17:16:04 +08:00
Peter Cai 8ba086a9ec
implement Markdown rendering 2020-04-09 14:47:46 +08:00
Peter Cai fe22944cb4
add some no-cache headers 2020-04-08 21:12:58 +08:00
Peter Cai cd8f761fcf
implement showing blog
no rendering yet
2020-04-08 20:00:40 +08:00
Peter Cai aa95d978ec
add alias support for `unlisted` 2020-04-08 18:11:35 +08:00
Peter Cai 7de1212993
also remove post from list if unlist is set 2020-04-08 18:10:13 +08:00
Peter Cai c68263a7bd
add comments to note on unlisted notes 2020-04-08 17:58:33 +08:00
Peter Cai b337306799
utils: also kill punctuations when generating URLs 2020-04-08 17:56:36 +08:00
Peter Cai b87c97c8ed
support unlisted posts 2020-04-08 17:56:27 +08:00
Peter Cai 8fe31281f0
support customized metadata 2020-04-08 17:39:44 +08:00