image cache on cloudflare r2

feat: add slack bot upload

dunkirk.sh 33060f4d f5cb0710

verified
Changed files
+9
src
+1
CRUSH.md
··· 60 60 61 61 Config (wrangler.toml): 62 62 - `PUBLIC_URL` - Public URL of the service (e.g., https://l4.dunkirk.sh) 63 + - `ALLOWED_CHANNELS` - Comma-separated Slack channel IDs (e.g., "C12345,C67890"). Leave empty to allow all channels. 63 64 64 65 Secrets: 65 66 - `AUTH_TOKEN` - Auth token for API uploads
+7
src/index.ts
··· 26 26 return; 27 27 } 28 28 29 + // Check if channel is allowed 30 + const allowedChannels = env.ALLOWED_CHANNELS?.split(",").map(c => c.trim()) || []; 31 + if (allowedChannels.length > 0 && !allowedChannels.includes(payload.channel)) { 32 + return; 33 + } 34 + 29 35 // React with loading emoji 30 36 await context.client.reactions.add({ 31 37 channel: payload.channel, ··· 302 308 IMAGES: R2Bucket; 303 309 AUTH_TOKEN: string; 304 310 PUBLIC_URL: string; 311 + ALLOWED_CHANNELS?: string; 305 312 }
+1
wrangler.toml
··· 12 12 13 13 [vars] 14 14 PUBLIC_URL = "https://l4.dunkirk.sh" 15 + ALLOWED_CHANNELS = "C08EKUY7QVA" # Comma-separated channel IDs 15 16 16 17 # Set secrets: 17 18 # wrangler secret put AUTH_TOKEN