### Install dependencies Source: https://github.com/andyhazz/bookends.koplugin/blob/master/tools/submit-worker/README.md Installs dependencies for the submit-worker before deploying. ```bash cd tools/submit-worker npm install ``` -------------------------------- ### Tail live request logs with wrangler Source: https://github.com/andyhazz/bookends.koplugin/blob/master/tools/submit-worker/README.md Streams live request logs for debugging the Worker. Requires wrangler and a valid Cloudflare setup. ```bash npx wrangler tail ``` -------------------------------- ### Deploy Worker Source: https://github.com/andyhazz/bookends.koplugin/blob/master/tools/submit-worker/README.md Deploys the Worker. Output includes the live URL. ```bash npx wrangler deploy ``` -------------------------------- ### Conditional tokens: [if:condition]...[/if] with [else] Source: https://github.com/andyhazz/bookends.koplugin/blob/master/README.md Conditional token syntax for showing or hiding content based on device state, reading progress, time, and more. Use `[if:condition]...[/if]` with optional `[else]`. Supports comparison operators `=`, `!=`, `<`, `>`, `<=`, `>=`; boolean operators `and`, `or`, `not` with parentheses; nesting to any depth; and composition with `[else]`. ```text [if:wifi=on]📶[/if] [if:batt<20]LOW %batt[/if] [if:charging=yes]⚡[/if] %batt [if:page=odd]%title[else]%chap_title[/if] [if:book_pct>90]Almost done![/if] [if:time>22:00]Late night reading![/if] [if:day=Sat]Weekend![else]%weekday_short[/if] [if:chap_title_2]%chap_title_2[else]%chap_title_1[/if] [if:not series]Standalone[/if] [if:day=Sat or day=Sun]Weekend[/if] [if:format=PDF]%page_num / %page_count[/if] [if:chap_title_1!=@title]%chap_title_1 · [/if] [if:batt!=100]charging…[/if] ``` -------------------------------- ### Run kv-usage.sh to check KV usage Source: https://github.com/andyhazz/bookends.koplugin/blob/master/tools/submit-worker/README.md Checks daily KV operations against free-tier caps. Run without arguments for the last 7 days, or with '1 hourly' for today's usage. Useful when a Cloudflare limit email arrives, as emails are batched and may not reflect the current state. ```bash ./scripts/kv-usage.sh # last 7 days ./scripts/kv-usage.sh 1 hourly # today, accumulating toward the daily caps ``` -------------------------------- ### Log wrangler into Cloudflare Source: https://github.com/andyhazz/bookends.koplugin/blob/master/tools/submit-worker/README.md Logs wrangler into your Cloudflare account. Opens a browser for you to sign in and approve. ```bash npx wrangler login ``` -------------------------------- ### Redeploy submit-worker with wrangler Source: https://github.com/andyhazz/bookends.koplugin/blob/master/tools/submit-worker/README.md Redeploy the submit-worker after code changes. Run from the tools/submit-worker directory. ```bash cd tools/submit-worker npx wrangler deploy ``` -------------------------------- ### Smoke-test health endpoint Source: https://github.com/andyhazz/bookends.koplugin/blob/master/tools/submit-worker/README.md Smoke-tests the deployed Worker's health endpoint. Expected output is {"ok":true}. ```bash curl -s https://bookends-submit..workers.dev/health # → {"ok":true} ``` -------------------------------- ### Set GITHUB_TOKEN secret Source: https://github.com/andyhazz/bookends.koplugin/blob/master/tools/submit-worker/README.md Sets the GITHUB_TOKEN secret for the Worker. Paste the token when prompted. ```bash npx wrangler secret put GITHUB_TOKEN # paste the token when prompted ``` -------------------------------- ### Mass-close submission PRs Source: https://github.com/andyhazz/bookends.koplugin/blob/master/tools/submit-worker/README.md Mass-close submission PRs to clear a flooded queue. Closes up to 100 open submission PRs and deletes their branches. ```bash gh pr list --repo AndyHazz/bookends-presets --label submission --limit 100 --json number -q '.[].number' | xargs -I{} gh pr close --repo AndyHazz/bookends-presets --delete-branch {} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.