improving the site (2025)
Sat Apr 08 2023tags: public blog programming draft featured
previous posts in this entry:
Claude Code is incredible
architecture
data store
- Blob storage
- Second brain (Obsidian + GitHub repo)
- secrets vault
views
- lieuzhenghong.com (static site, public by default)
- lieu.gg:
(Purpose? )
- (seems like SSG is not the right fit...)
- private by default (requires a password to sign in)
- file browser (blobs and vault)
- full-text search <--- public feature
- canvas display support <-- this seems like a feature I would want in my public view, too?
- comment feature, ideally with threads
services (maybe)
- be my friends' "webmaster"
- let them put in their details, create an account with me
- (semi-custodial?) crypto wallet, so I can help all my friends have crypto "bank accounts"
- chat?
problems/bugs
- obsidian cannot open .njk or .js files
- figure out a way to improve over .njk files (markdown is still king)
- but we require a filter to display stuff
setting up blob storage
R2 and cron
Set up a Cloudflare account, set up R2 Object Storage
Set up rclone
on the desktop
Set up bisync:
rclone bisync ~/Documents/lieu-blobs/ r2:lieu-files/ --resync
for first time, then
Set up cronjob to sync
crontab -e
*/2 * * * * /opt/homebrew/bin/rclone bisync ~/Documents/lieu-blobs/ r2:lieu-files/
log show --predicate 'process == "cron"' --info --last 1d
second brain + blob store ==>
feature set
- [ ] all screenshots from the phone should be captured automatically onto blob storage
- [ ] all photos, videos should be captured automatically onto blob storage
- [x] screenshots from my Mac are captured automatically into
Documents/lieu-blobs
todo
-
[ ] get everything into blob storage
- [x] download binaries from sourcehut (https://git.sr.ht/~lieu/binaries/commit/908b46f4bbdb6c409cc9833718589c5792f08ef7), or pull them out of old laptop
- [ ] pull .epubs out of Google Pixel
- [ ] pull .epubs out of old Xiaomi phone
- [ ] pull things out of Notes, Google Docs, Supernotes, Notion, Slack
-
[x] set up custom domain on cloudflare
-
[ ] build out capture flow from phone
- [ ] Tasker?
-
[x] fix ppe-work repo
-
[x] convert all links right now in my second brain (/img, /docs, /ppe-work, /xccelerate) into
-
[ ] (NOT IN SCOPE) fine-grained permissions atop a private-by-default repo
password system redesign
Problems with current system: doesn't really reflect my needs
(nice to have)
- [ ] collaborative/sharable solution
- [ ] (so I can send a lieu.space/.... link and have it be shared only with particular email addys)
- [ ] canvas display (lieu.space)
- [ ]
Cloudflare worker setup
Set up the following:
- secret environment variable:
env.UPLOAD_TOKEN
is the password we will need to enter to access the worker. set it up by going into Cloudflare's worker settings and adding new Secret. - R2 bucket binding.
- public URL environment variable (files.lieu.gg for me)
LIEU_BUCKET
should be set up as an R2 bucket binding, not an environment variable. Here's how to set it up:
- Go to your Worker's Settings in Cloudflare dashboard
- Look for "R2 Bucket Bindings" section (not Environment Variables)
- Click "Add binding"
- Set:
- Variable name:
LIEU_BUCKET
(this is what your code references) - R2 bucket: Select your actual R2 bucket from the dropdownThis binding gives your Worker direct access to your R2 bucket through the
env.LIEU_BUCKET
object in your code. That's how your Worker can do operations like:
env.LIEU_BUCKET.put()
- upload filesenv.LIEU_BUCKET.get()
- retrieve filesenv.LIEU_BUCKET.list()
- list files
So in summary:
UPLOAD_TOKEN
= Environment variable (for authentication)LIEU_BUCKET
= R2 bucket binding (for bucket access)PUBLIC_URL
= URL for Worker to create files atThe binding connects your Worker to your R2 bucket without needing access keys - Cloudflare handles the authentication internally.
After set