From 8b17f8177c336c66cf9c4cdabc058aca87d84177 Mon Sep 17 00:00:00 2001 From: alikia2x Date: Sun, 30 Mar 2025 07:31:24 +0800 Subject: [PATCH] update: song page --- deno.json | 3 +- packages/{crawler => core}/db/pgConfig.ts | 9 ++ packages/crawler/db/init.ts | 2 +- packages/frontend/package.json | 38 ++++---- .../frontend/src/components/SearchBox.svelte | 15 +++- .../src/components/TitleBarMobile.svelte | 11 ++- packages/frontend/src/pages/404.astro | 10 +++ .../frontend/src/pages/song/[aid]/info.astro | 40 --------- .../frontend/src/pages/song/[id]/info.astro | 88 +++++++++++++++++++ packages/frontend/tsconfig.json | 3 +- 10 files changed, 153 insertions(+), 66 deletions(-) rename packages/{crawler => core}/db/pgConfig.ts (75%) create mode 100644 packages/frontend/src/pages/404.astro delete mode 100644 packages/frontend/src/pages/song/[aid]/info.astro create mode 100644 packages/frontend/src/pages/song/[id]/info.astro diff --git a/deno.json b/deno.json index 947c793..5e9eac4 100644 --- a/deno.json +++ b/deno.json @@ -14,6 +14,7 @@ }, "imports": { "@astrojs/node": "npm:@astrojs/node@^9.1.3", - "@astrojs/svelte": "npm:@astrojs/svelte@^7.0.8" + "@astrojs/svelte": "npm:@astrojs/svelte@^7.0.8", + "@core/db/": "./packages/core/db/" } } diff --git a/packages/crawler/db/pgConfig.ts b/packages/core/db/pgConfig.ts similarity index 75% rename from packages/crawler/db/pgConfig.ts rename to packages/core/db/pgConfig.ts index 5410760..adea921 100644 --- a/packages/crawler/db/pgConfig.ts +++ b/packages/core/db/pgConfig.ts @@ -8,6 +8,7 @@ if (unsetVars.length > 0) { const databaseHost = Deno.env.get("DB_HOST")!; const databaseName = Deno.env.get("DB_NAME")!; +const databaseNameCred = Deno.env.get("DB_NAME_CRED")!; const databaseUser = Deno.env.get("DB_USER")!; const databasePassword = Deno.env.get("DB_PASSWORD")!; const databasePort = Deno.env.get("DB_PORT")!; @@ -19,3 +20,11 @@ export const postgresConfig = { user: databaseUser, password: databasePassword, }; + +export const postgresConfigCred = { + hostname: databaseHost, + port: parseInt(databasePort), + database: databaseNameCred, + user: databaseUser, + password: databasePassword, +} \ No newline at end of file diff --git a/packages/crawler/db/init.ts b/packages/crawler/db/init.ts index a1835b0..33bc3c6 100644 --- a/packages/crawler/db/init.ts +++ b/packages/crawler/db/init.ts @@ -1,5 +1,5 @@ import { Pool } from "https://deno.land/x/postgres@v0.19.3/mod.ts"; -import { postgresConfig } from "db/pgConfig.ts"; +import { postgresConfig } from "@core/db/pgConfig.ts"; const pool = new Pool(postgresConfig, 12); diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 78da34b..377d360 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -1,19 +1,23 @@ { - "name": "frontend", - "type": "module", - "version": "0.0.1", - "scripts": { - "dev": "astro dev", - "build": "astro build", - "preview": "astro preview", - "astro": "astro" - }, - "dependencies": { - "@astrojs/tailwind": "^6.0.2", - "astro": "^5.5.5", - "autoprefixer": "^10.4.21", - "postcss": "^8.5.3", - "tailwindcss": "^3.0.24", - "vite-tsconfig-paths": "^5.1.4" - } + "name": "frontend", + "type": "module", + "version": "0.0.1", + "scripts": { + "dev": "astro dev", + "build": "astro build", + "preview": "astro preview", + "astro": "astro" + }, + "dependencies": { + "@astrojs/tailwind": "^6.0.2", + "astro": "^5.5.5", + "autoprefixer": "^10.4.21", + "pg": "^8.11.11", + "postcss": "^8.5.3", + "tailwindcss": "^3.0.24", + "vite-tsconfig-paths": "^5.1.4" + }, + "devDependencies": { + "@types/pg": "^8.11.11" + } } diff --git a/packages/frontend/src/components/SearchBox.svelte b/packages/frontend/src/components/SearchBox.svelte index f851224..e23c47f 100644 --- a/packages/frontend/src/components/SearchBox.svelte +++ b/packages/frontend/src/components/SearchBox.svelte @@ -1,5 +1,14 @@
{#if !showSearchBox} -
+
+
{/if} {#if showSearchBox} - + {/if}