From eba047328a9114ff0d48632704fc80f71ebd7c22 Mon Sep 17 00:00:00 2001 From: hahaqwq <68942049+hahaQWQ@users.noreply.github.com> Date: Fri, 8 May 2026 15:06:44 +0800 Subject: [PATCH] revert(server): remove .well-known/assetlinks.json (revert #1772) (#1789) --- apps/server/.env | 5 ---- apps/server/src/app.ts | 2 -- apps/server/src/libs/env.ts | 6 ---- apps/server/src/routes/well-known/index.ts | 34 ---------------------- 4 files changed, 47 deletions(-) delete mode 100644 apps/server/src/routes/well-known/index.ts diff --git a/apps/server/.env b/apps/server/.env index 679d3684f..2895eb0a0 100644 --- a/apps/server/.env +++ b/apps/server/.env @@ -20,8 +20,3 @@ API_SERVER_URL="" GATEWAY_BASE_URL="http://localhost:18080" DEFAULT_CHAT_MODEL="openai/gpt-5-mini" DEFAULT_TTS_MODEL="microsoft/v1" - - -ASSETLINKS_PACKAGE_NAME="ai.moeru.airi_pocket" -ASSETLINKS_SHA256_FINGERPRINTS="1D:E5:2D:DC:89:DA:C9:C1:4B:5F:4A:48:E4:2D:62:E5:52:82:B7:41:D3:96:73:13:91:C8:41:D2:84:DF:84:55" - diff --git a/apps/server/src/app.ts b/apps/server/src/app.ts index 94bd6c67e..2dc42ed93 100644 --- a/apps/server/src/app.ts +++ b/apps/server/src/app.ts @@ -50,7 +50,6 @@ import { createFluxRoutes } from './routes/flux' import { createV1CompletionsRoutes } from './routes/openai/v1' import { createProviderRoutes } from './routes/providers' import { createStripeRoutes } from './routes/stripe' -import { createWellKnownRoutes } from './routes/well-known' import { createFluxGrantBatchService } from './services/admin-flux-grant-batch/flux-grant-batch-service' import { createBillingMq } from './services/billing/billing-events' import { createBillingService } from './services/billing/billing-service' @@ -195,7 +194,6 @@ export async function buildApp(deps: AppDeps) { env: deps.env, configKV: deps.configKV, })) - .route('/.well-known', createWellKnownRoutes({ env: deps.env })) /** * Character routes are handled by the character service. diff --git a/apps/server/src/libs/env.ts b/apps/server/src/libs/env.ts index c7f3198d9..32db0248e 100644 --- a/apps/server/src/libs/env.ts +++ b/apps/server/src/libs/env.ts @@ -89,12 +89,6 @@ const EnvSchema = object({ OTEL_EXPORTER_OTLP_ENDPOINT: optional(string()), OTEL_EXPORTER_OTLP_HEADERS: optional(string()), OTEL_DEBUG: optional(string()), - // Asset Links (Android deep link delegation) - // Example: ASSETLINKS_PACKAGE_NAME=com.example.app - // ASSETLINKS_SHA256_FINGERPRINTS=AB:CD:... ,EF:12:... - ASSETLINKS_PACKAGE_NAME: optional(string(), 'ai.moeru.airi_pocket'), - ASSETLINKS_SHA256_FINGERPRINTS: optional(string(), ''), - // Admin allowlist for /api/admin/* routes. Comma-separated email addresses. // Match is case-insensitive, but the user must also have `email_verified = true` // — otherwise an attacker could register a fresh account with the admin email diff --git a/apps/server/src/routes/well-known/index.ts b/apps/server/src/routes/well-known/index.ts deleted file mode 100644 index 75b9a8308..000000000 --- a/apps/server/src/routes/well-known/index.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { Env } from '../../libs/env' -import type { HonoEnv } from '../../types/hono' - -import { Hono } from 'hono' - -export interface WellKnownDeps { - env: Env -} - -export function createWellKnownRoutes(deps: WellKnownDeps) { - return new Hono() - .get('/assetlinks.json', (c) => { - const pkg = deps.env.ASSETLINKS_PACKAGE_NAME - const fingerprintsRaw = deps.env.ASSETLINKS_SHA256_FINGERPRINTS - - const fingerprints = fingerprintsRaw - .split(',') - .map(s => s.trim()) - .filter(Boolean) - - const payload = [ - { - relation: ['delegate_permission/common.handle_all_urls'], - target: { - namespace: 'android_app', - package_name: pkg, - sha256_cert_fingerprints: fingerprints, - }, - }, - ] - - return c.json(payload) - }) -}