Schedule posts to Bluesky with Cloudflare workers. skyscheduler.work
cf tool bsky-tool cloudflare bluesky schedule bsky service social-media cloudflare-workers

update rate limiter

for #96

+16 -2
+1 -1
src/middleware/rateLimit.ts
··· 19 19 if (success) { 20 20 await next(); 21 21 } else { 22 - return c.json({ok: false, msg: "you are currently rate limited, try again in a minute"}); 22 + return c.json({ok: false, msg: "you are currently rate limited, try again in a minute"}, 429); 23 23 } 24 24 }); 25 25 };
+2
src/types.ts
··· 62 62 SIGNUP_SETTINGS: SignupConfigSettings; 63 63 TASK_SETTINGS: AgentConfigSettings; 64 64 R2_SETTINGS: R2ConfigSettings; 65 + POST_LIMITER: RateLimit; 66 + REPOST_LIMITER: RateLimit; 65 67 DEFAULT_ADMIN_USER: string; 66 68 DEFAULT_ADMIN_PASS: string; 67 69 DEFAULT_ADMIN_BSKY_PASS: string;
+3 -1
src/wrangler.d.ts
··· 1 1 /* eslint-disable */ 2 - // Generated by Wrangler by running `wrangler types src/wrangler.d.ts` (hash: 8550579ced1c27a295d15876d569afef) 2 + // Generated by Wrangler by running `wrangler types src/wrangler.d.ts` (hash: 83f9928a213fc29feaa94a1417c98771) 3 3 // Runtime types generated with workerd@1.20260305.0 2025-11-18 disable_ctx_exports,disable_nodejs_http_server_modules,nodejs_compat,nodejs_compat_do_not_populate_process_env 4 4 declare namespace Cloudflare { 5 5 interface GlobalProps { ··· 13 13 DB: D1Database; 14 14 POST_QUEUE: Queue; 15 15 REPOST_QUEUE: Queue; 16 + REPOST_LIMITER: RateLimit; 17 + POST_LIMITER: RateLimit; 16 18 IMAGES: ImagesBinding; 17 19 ASSETS: Fetcher; 18 20 IMAGE_SETTINGS: {"enabled":true,"steps":[95,85,75],"bucket_url":"https://resize.skyscheduler.work/","max_width":3000};
+10
wrangler.toml
··· 38 38 binding = "R2RESIZE" 39 39 bucket_name = "skyscheduler-resize" 40 40 41 + # rate limits to help combat abuse 42 + [[ratelimits]] 43 + name = "REPOST_LIMITER" 44 + namespace_id = "1001" 45 + simple = { limit = 5, period = 60 } 46 + [[ratelimits]] 47 + name = "POST_LIMITER" 48 + namespace_id = "1002" 49 + simple = { limit = 2, period = 10 } 50 + 41 51 [triggers] 42 52 # Schedule cron triggers at the start of every hour and ~5:30pm on sunday for big cleanups: 43 53 crons = [ "0 * * * *", "30 17 * * sun" ]