atmosphere explorer

add wrangler config

handle.invalid 689360dd 8a2d7596

verified
+48 -13
+1
.gitignore
··· 2 2 dist 3 3 .env 4 4 .DS_Store 5 + public/oauth-client-metadata.json
+2
package.json
··· 4 4 "type": "module", 5 5 "scripts": { 6 6 "start": "vite", 7 + "predev": "node scripts/generate-oauth-metadata.js", 7 8 "dev": "vite", 9 + "prebuild": "node scripts/generate-oauth-metadata.js", 8 10 "build": "vite build", 9 11 "serve": "vite preview" 10 12 },
-13
public/oauth-client-metadata.json
··· 1 - { 2 - "client_id": "https://pdsls.dev/oauth-client-metadata.json", 3 - "client_name": "PDSls", 4 - "client_uri": "https://pdsls.dev", 5 - "logo_uri": "https://pdsls.dev/favicon.ico", 6 - "redirect_uris": ["https://pdsls.dev/"], 7 - "scope": "atproto repo:*?action=create repo:*?action=update repo:*?action=delete blob:*/*", 8 - "grant_types": ["authorization_code", "refresh_token"], 9 - "response_types": ["code"], 10 - "token_endpoint_auth_method": "none", 11 - "application_type": "web", 12 - "dpop_bound_access_tokens": true 13 - }
+35
scripts/generate-oauth-metadata.js
··· 1 + import { mkdirSync, writeFileSync } from "fs"; 2 + import { dirname } from "path"; 3 + import { fileURLToPath } from "url"; 4 + 5 + const __filename = fileURLToPath(import.meta.url); 6 + const __dirname = dirname(__filename); 7 + 8 + const domain = process.env.APP_DOMAIN || "pdsls.dev"; 9 + const protocol = process.env.APP_PROTOCOL || "https"; 10 + const baseUrl = `${protocol}://${domain}`; 11 + 12 + const metadata = { 13 + client_id: `${baseUrl}/oauth-client-metadata.json`, 14 + client_name: "PDSls", 15 + client_uri: baseUrl, 16 + logo_uri: `${baseUrl}/favicon.ico`, 17 + redirect_uris: [`${baseUrl}/`], 18 + scope: "atproto repo:*?action=create repo:*?action=update repo:*?action=delete blob:*/*", 19 + grant_types: ["authorization_code", "refresh_token"], 20 + response_types: ["code"], 21 + token_endpoint_auth_method: "none", 22 + application_type: "web", 23 + dpop_bound_access_tokens: true, 24 + }; 25 + 26 + const outputPath = `${__dirname}/../public/oauth-client-metadata.json`; 27 + 28 + try { 29 + mkdirSync(dirname(outputPath), { recursive: true }); 30 + writeFileSync(outputPath, JSON.stringify(metadata, null, 2) + "\n"); 31 + console.log(`Generated OAuth metadata for ${baseUrl}`); 32 + } catch (error) { 33 + console.error("Failed to generate OAuth metadata:", error); 34 + process.exit(1); 35 + }
+10
wrangler.jsonc
··· 1 + { 2 + "$schema": "https://developers.cloudflare.com/workers/wrangler/configuration/", 3 + "name": "pdsls", 4 + "compatibility_date": "2025-01-22", 5 + "pages_build_output_dir": "dist", 6 + 7 + // Note: The oauth-client-metadata.json file will be generated during build 8 + // based on the APP_DOMAIN environment variable (defaults to pdsls.dev) 9 + // Set APP_DOMAIN in Cloudflare Pages environment variables for custom domains 10 + }