improving the site (2025)

Sat Apr 08 2023

tags: public blog programming draft featured

previous posts in this entry:

Claude Code is incredible

architecture

data store

  1. Blob storage
  2. Second brain (Obsidian + GitHub repo)
  3. 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:

  1. 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.
  2. R2 bucket binding.
  3. 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:

  1. Go to your Worker's Settings in Cloudflare dashboard
  2. Look for "R2 Bucket Bindings" section (not Environment Variables)
  3. Click "Add binding"
  4. Set:
  • Variable name: LIEU_BUCKET (this is what your code references) - R2 bucket: Select your actual R2 bucket from the dropdown

This 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 files
  • env.LIEU_BUCKET.get() - retrieve files
  • env.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 at

The binding connects your Worker to your R2 bucket without needing access keys - Cloudflare handles the authentication internally.

After set