From f7806c6a39a2ec9e70f295652dd36704c9a70a73 Mon Sep 17 00:00:00 2001 From: alikia2x Date: Sun, 30 Mar 2025 03:23:38 +0800 Subject: [PATCH 01/12] add: tailwind dependency --- packages/frontend/package.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 8761ba2..ed2b48a 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -9,6 +9,10 @@ "astro": "astro" }, "dependencies": { - "astro": "^5.5.5" + "@astrojs/tailwind": "^6.0.2", + "astro": "^5.5.5", + "autoprefixer": "^10.4.21", + "postcss": "^8.5.3", + "tailwindcss": "^4.0.17" } } From f585b49ee4dcce193ae884bba58d6cb54e3b7eb3 Mon Sep 17 00:00:00 2001 From: alikia2x Date: Sun, 30 Mar 2025 03:57:21 +0800 Subject: [PATCH 02/12] add: frontend with Astro --- packages/frontend/astro.config.mjs | 5 +++ packages/frontend/package.json | 3 +- packages/frontend/src/layouts/Layout.astro | 35 +++++++--------- packages/frontend/src/pages/index.astro | 7 +--- .../frontend/src/pages/song/[aid]/info.astro | 40 +++++++++++++++++++ packages/frontend/src/styles/global.css | 3 ++ packages/frontend/tailwind.config.js | 8 ++++ packages/frontend/tsconfig.json | 16 ++++++-- 8 files changed, 87 insertions(+), 30 deletions(-) create mode 100644 packages/frontend/src/pages/song/[aid]/info.astro create mode 100644 packages/frontend/src/styles/global.css create mode 100644 packages/frontend/tailwind.config.js diff --git a/packages/frontend/astro.config.mjs b/packages/frontend/astro.config.mjs index e6619b2..4baabd1 100644 --- a/packages/frontend/astro.config.mjs +++ b/packages/frontend/astro.config.mjs @@ -1,13 +1,18 @@ // @ts-check import { defineConfig } from "astro/config"; +import tailwind from "@astrojs/tailwind"; // https://astro.build/config +import tsconfigPaths from "vite-tsconfig-paths"; + export default defineConfig({ + integrations: [tailwind()], vite: { server: { fs: { allow: [".", "../../"], }, }, + plugins: [tsconfigPaths(),] }, }); diff --git a/packages/frontend/package.json b/packages/frontend/package.json index ed2b48a..78da34b 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -13,6 +13,7 @@ "astro": "^5.5.5", "autoprefixer": "^10.4.21", "postcss": "^8.5.3", - "tailwindcss": "^4.0.17" + "tailwindcss": "^3.0.24", + "vite-tsconfig-paths": "^5.1.4" } } diff --git a/packages/frontend/src/layouts/Layout.astro b/packages/frontend/src/layouts/Layout.astro index e455c61..9c3c39f 100644 --- a/packages/frontend/src/layouts/Layout.astro +++ b/packages/frontend/src/layouts/Layout.astro @@ -1,22 +1,15 @@ - - - - - - - - Astro Basics - - - - - +--- +import "../styles/global.css"; +--- - + + + + + + CVSA 前端 + + + + + diff --git a/packages/frontend/src/pages/index.astro b/packages/frontend/src/pages/index.astro index c04f360..2dffcbe 100644 --- a/packages/frontend/src/pages/index.astro +++ b/packages/frontend/src/pages/index.astro @@ -1,9 +1,6 @@ --- -import Welcome from '../components/Welcome.astro'; -import Layout from '../layouts/Layout.astro'; - -// Welcome to Astro! Wondering what to do next? Check out the Astro documentation at https://docs.astro.build -// Don't want to use any of this? Delete everything in this file, the `assets`, `components`, and `layouts` directories, and start fresh. +import Welcome from '@components/Welcome.astro'; +import Layout from '@layouts/Layout.astro'; --- diff --git a/packages/frontend/src/pages/song/[aid]/info.astro b/packages/frontend/src/pages/song/[aid]/info.astro new file mode 100644 index 0000000..063a644 --- /dev/null +++ b/packages/frontend/src/pages/song/[aid]/info.astro @@ -0,0 +1,40 @@ +--- +import Layout from "@layouts/Layout.astro"; + +// 路由参数 +const { aid } = Astro.params; +const videoAid = Number(aid); + +// 数据库查询函数 +async function getVideoMetadata(aid: number) { + // TODO: 实现bilibili_metadata表查询 + return {}; +} + +async function getVideoSnapshots(aid: number) { + // TODO: 实现video_snapshot表查询,按created_at排序,限制100条 + return []; +} + +// 获取数据 +const videoInfo = await getVideoMetadata(videoAid); +const snapshots = await getVideoSnapshots(videoAid); +--- + + +
+

视频信息: {videoAid}

+ + +
+

基本信息

+
{JSON.stringify(videoInfo, null, 2)}
+
+ + +
+

历史数据 (最新100条)

+
{JSON.stringify(snapshots, null, 2)}
+
+
+
diff --git a/packages/frontend/src/styles/global.css b/packages/frontend/src/styles/global.css new file mode 100644 index 0000000..b5c61c9 --- /dev/null +++ b/packages/frontend/src/styles/global.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/packages/frontend/tailwind.config.js b/packages/frontend/tailwind.config.js new file mode 100644 index 0000000..b34cf45 --- /dev/null +++ b/packages/frontend/tailwind.config.js @@ -0,0 +1,8 @@ +/** @type {import('tailwindcss').Config} */ +module.exports = { + content: ["./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}"], + theme: { + extend: {}, + }, + plugins: [], +}; diff --git a/packages/frontend/tsconfig.json b/packages/frontend/tsconfig.json index a9210e6..9c3f979 100644 --- a/packages/frontend/tsconfig.json +++ b/packages/frontend/tsconfig.json @@ -1,5 +1,15 @@ { - "extends": "astro/tsconfigs/strict", - "include": [".astro/types.d.ts", "**/*"], - "exclude": ["dist"] + "extends": "astro/tsconfigs/strict", + "include": [".astro/types.d.ts", "**/*"], + "exclude": ["dist"], + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@components/*": ["src/components/*"], + "@layouts/*": ["src/layouts/*"], + "@utils/*": ["src/utils/*"], + "@assets/*": ["src/assets/*"], + "@styles": ["src/styles/*"] + } + } } From 4fe266ce82e239e5e2afe74cdec75077e60e66a1 Mon Sep 17 00:00:00 2001 From: alikia2x Date: Sun, 30 Mar 2025 06:45:27 +0800 Subject: [PATCH 03/12] add: few pages --- .tokeignore | 3 +- deno.json | 35 ++- packages/frontend/astro.config.mjs | 10 +- .../src/assets/TitleBar Mobile Dark.svg | 7 + .../src/assets/TitleBar Mobile Light.svg | 7 + .../frontend/src/assets/TitleBar-Dark.svg | 15 ++ .../frontend/src/assets/TitleBar-Light.svg | 15 ++ packages/frontend/src/assets/astro.svg | 1 - packages/frontend/src/assets/background.svg | 1 - .../frontend/src/assets/header-logo-dark.svg | 15 ++ .../frontend/src/assets/header-logo-light.svg | 15 ++ packages/frontend/src/assets/标题-浅色.svg | 15 ++ packages/frontend/src/assets/标题-深色.svg | 15 ++ .../frontend/src/components/CloseIcon.svelte | 12 + .../src/components/DarkModeImage.svelte | 41 ++++ .../frontend/src/components/MenuIcon.svelte | 20 ++ .../frontend/src/components/SearchBox.svelte | 37 +++ .../frontend/src/components/SearchIcon.svelte | 12 + .../frontend/src/components/TitleBar.astro | 30 +++ .../src/components/TitleBarMobile.svelte | 42 ++++ .../frontend/src/components/Welcome.astro | 211 +----------------- packages/frontend/src/layouts/Layout.astro | 2 +- packages/frontend/src/pages/about.astro | 15 ++ .../frontend/src/pages/song/[aid]/info.astro | 10 +- 24 files changed, 351 insertions(+), 235 deletions(-) create mode 100644 packages/frontend/src/assets/TitleBar Mobile Dark.svg create mode 100644 packages/frontend/src/assets/TitleBar Mobile Light.svg create mode 100644 packages/frontend/src/assets/TitleBar-Dark.svg create mode 100644 packages/frontend/src/assets/TitleBar-Light.svg delete mode 100644 packages/frontend/src/assets/astro.svg delete mode 100644 packages/frontend/src/assets/background.svg create mode 100644 packages/frontend/src/assets/header-logo-dark.svg create mode 100644 packages/frontend/src/assets/header-logo-light.svg create mode 100644 packages/frontend/src/assets/标题-浅色.svg create mode 100644 packages/frontend/src/assets/标题-深色.svg create mode 100644 packages/frontend/src/components/CloseIcon.svelte create mode 100644 packages/frontend/src/components/DarkModeImage.svelte create mode 100644 packages/frontend/src/components/MenuIcon.svelte create mode 100644 packages/frontend/src/components/SearchBox.svelte create mode 100644 packages/frontend/src/components/SearchIcon.svelte create mode 100644 packages/frontend/src/components/TitleBar.astro create mode 100644 packages/frontend/src/components/TitleBarMobile.svelte create mode 100644 packages/frontend/src/pages/about.astro diff --git a/.tokeignore b/.tokeignore index 0c4d337..aafc28c 100644 --- a/.tokeignore +++ b/.tokeignore @@ -2,4 +2,5 @@ data *.json *.svg *.txt -*.md \ No newline at end of file +*.md +*config* \ No newline at end of file diff --git a/deno.json b/deno.json index 43d84de..947c793 100644 --- a/deno.json +++ b/deno.json @@ -1,20 +1,19 @@ { - "lock": false, - "workspace": [ - "./packages/crawler", - "./packages/frontend", - "./packages/backend", - "./packages/core" - ], - "nodeModulesDir": "auto", - "tasks": { - "crawler": "deno task --filter 'crawler' all" - }, - "fmt": { - "useTabs": true, - "lineWidth": 120, - "indentWidth": 4, - "semiColons": true, - "proseWrap": "always" - } + "lock": false, + "workspace": ["./packages/crawler", "./packages/frontend", "./packages/backend", "./packages/core"], + "nodeModulesDir": "auto", + "tasks": { + "crawler": "deno task --filter 'crawler' all" + }, + "fmt": { + "useTabs": true, + "lineWidth": 120, + "indentWidth": 4, + "semiColons": true, + "proseWrap": "always" + }, + "imports": { + "@astrojs/node": "npm:@astrojs/node@^9.1.3", + "@astrojs/svelte": "npm:@astrojs/svelte@^7.0.8" + } } diff --git a/packages/frontend/astro.config.mjs b/packages/frontend/astro.config.mjs index 4baabd1..79ca8e0 100644 --- a/packages/frontend/astro.config.mjs +++ b/packages/frontend/astro.config.mjs @@ -4,15 +4,21 @@ import tailwind from "@astrojs/tailwind"; // https://astro.build/config import tsconfigPaths from "vite-tsconfig-paths"; +import node from "@astrojs/node"; +import svelte from "@astrojs/svelte"; export default defineConfig({ - integrations: [tailwind()], + output: "server", + adapter: node({ + mode: "standalone", + }), + integrations: [tailwind(), svelte()], vite: { server: { fs: { allow: [".", "../../"], }, }, - plugins: [tsconfigPaths(),] + plugins: [tsconfigPaths()], }, }); diff --git a/packages/frontend/src/assets/TitleBar Mobile Dark.svg b/packages/frontend/src/assets/TitleBar Mobile Dark.svg new file mode 100644 index 0000000..3b1a7e5 --- /dev/null +++ b/packages/frontend/src/assets/TitleBar Mobile Dark.svg @@ -0,0 +1,7 @@ + + + Created with Pixso. + + + + diff --git a/packages/frontend/src/assets/TitleBar Mobile Light.svg b/packages/frontend/src/assets/TitleBar Mobile Light.svg new file mode 100644 index 0000000..365e6a4 --- /dev/null +++ b/packages/frontend/src/assets/TitleBar Mobile Light.svg @@ -0,0 +1,7 @@ + + + Created with Pixso. + + + + diff --git a/packages/frontend/src/assets/TitleBar-Dark.svg b/packages/frontend/src/assets/TitleBar-Dark.svg new file mode 100644 index 0000000..02f0398 --- /dev/null +++ b/packages/frontend/src/assets/TitleBar-Dark.svg @@ -0,0 +1,15 @@ + + + Created with Pixso. + + + + + + + + + + + + diff --git a/packages/frontend/src/assets/TitleBar-Light.svg b/packages/frontend/src/assets/TitleBar-Light.svg new file mode 100644 index 0000000..92482e0 --- /dev/null +++ b/packages/frontend/src/assets/TitleBar-Light.svg @@ -0,0 +1,15 @@ + + + Created with Pixso. + + + + + + + + + + + + diff --git a/packages/frontend/src/assets/astro.svg b/packages/frontend/src/assets/astro.svg deleted file mode 100644 index 8cf8fb0..0000000 --- a/packages/frontend/src/assets/astro.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/packages/frontend/src/assets/background.svg b/packages/frontend/src/assets/background.svg deleted file mode 100644 index 4b2be0a..0000000 --- a/packages/frontend/src/assets/background.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/packages/frontend/src/assets/header-logo-dark.svg b/packages/frontend/src/assets/header-logo-dark.svg new file mode 100644 index 0000000..002540f --- /dev/null +++ b/packages/frontend/src/assets/header-logo-dark.svg @@ -0,0 +1,15 @@ + + + Created with Pixso. + + + + + + + + + + + + diff --git a/packages/frontend/src/assets/header-logo-light.svg b/packages/frontend/src/assets/header-logo-light.svg new file mode 100644 index 0000000..acc0c15 --- /dev/null +++ b/packages/frontend/src/assets/header-logo-light.svg @@ -0,0 +1,15 @@ + + + Created with Pixso. + + + + + + + + + + + + diff --git a/packages/frontend/src/assets/标题-浅色.svg b/packages/frontend/src/assets/标题-浅色.svg new file mode 100644 index 0000000..77e3e1e --- /dev/null +++ b/packages/frontend/src/assets/标题-浅色.svg @@ -0,0 +1,15 @@ + + + Created with Pixso. + + + + + + + + + + + + diff --git a/packages/frontend/src/assets/标题-深色.svg b/packages/frontend/src/assets/标题-深色.svg new file mode 100644 index 0000000..a24984d --- /dev/null +++ b/packages/frontend/src/assets/标题-深色.svg @@ -0,0 +1,15 @@ + + + Created with Pixso. + + + + + + + + + + + + diff --git a/packages/frontend/src/components/CloseIcon.svelte b/packages/frontend/src/components/CloseIcon.svelte new file mode 100644 index 0000000..cb98947 --- /dev/null +++ b/packages/frontend/src/components/CloseIcon.svelte @@ -0,0 +1,12 @@ + + +
+ + + +
diff --git a/packages/frontend/src/components/DarkModeImage.svelte b/packages/frontend/src/components/DarkModeImage.svelte new file mode 100644 index 0000000..aa4caeb --- /dev/null +++ b/packages/frontend/src/components/DarkModeImage.svelte @@ -0,0 +1,41 @@ + + + \ No newline at end of file diff --git a/packages/frontend/src/components/MenuIcon.svelte b/packages/frontend/src/components/MenuIcon.svelte new file mode 100644 index 0000000..1c74e68 --- /dev/null +++ b/packages/frontend/src/components/MenuIcon.svelte @@ -0,0 +1,20 @@ + + +
+ + + Created with Pixso. + + + + + + + + + + + +
diff --git a/packages/frontend/src/components/SearchBox.svelte b/packages/frontend/src/components/SearchBox.svelte new file mode 100644 index 0000000..f851224 --- /dev/null +++ b/packages/frontend/src/components/SearchBox.svelte @@ -0,0 +1,37 @@ + + + +
+ +
+ + diff --git a/packages/frontend/src/components/SearchIcon.svelte b/packages/frontend/src/components/SearchIcon.svelte new file mode 100644 index 0000000..d23c8be --- /dev/null +++ b/packages/frontend/src/components/SearchIcon.svelte @@ -0,0 +1,12 @@ + + +
+ + + +
\ No newline at end of file diff --git a/packages/frontend/src/components/TitleBar.astro b/packages/frontend/src/components/TitleBar.astro new file mode 100644 index 0000000..af6d723 --- /dev/null +++ b/packages/frontend/src/components/TitleBar.astro @@ -0,0 +1,30 @@ +--- +import astroLogoLight from "@assets/标题-浅色.svg"; +import astroLogoDark from "@assets/标题-深色.svg"; +import DarkModeImage from "@components/DarkModeImage.svelte"; +import SearchBox from "@components/SearchBox.svelte"; +import TitleBarMobile from "@components/TitleBarMobile.svelte"; +--- + + + + diff --git a/packages/frontend/src/components/TitleBarMobile.svelte b/packages/frontend/src/components/TitleBarMobile.svelte new file mode 100644 index 0000000..bcdd28b --- /dev/null +++ b/packages/frontend/src/components/TitleBarMobile.svelte @@ -0,0 +1,42 @@ + + +
+ {#if !showSearchBox} +
+ +
+
+ + + +
+ {/if} + {#if showSearchBox} + + {/if} + +
diff --git a/packages/frontend/src/components/Welcome.astro b/packages/frontend/src/components/Welcome.astro index 52e0333..c55f130 100644 --- a/packages/frontend/src/components/Welcome.astro +++ b/packages/frontend/src/components/Welcome.astro @@ -1,210 +1,9 @@ --- -import astroLogo from '../assets/astro.svg'; -import background from '../assets/background.svg'; +import TitleBar from "@components/TitleBar.astro"; --- - - - +
+

正在施工中……

+
diff --git a/packages/frontend/src/layouts/Layout.astro b/packages/frontend/src/layouts/Layout.astro index 9c3c39f..e33cf4b 100644 --- a/packages/frontend/src/layouts/Layout.astro +++ b/packages/frontend/src/layouts/Layout.astro @@ -9,7 +9,7 @@ import "../styles/global.css"; CVSA 前端 - + diff --git a/packages/frontend/src/pages/about.astro b/packages/frontend/src/pages/about.astro new file mode 100644 index 0000000..9fe94a6 --- /dev/null +++ b/packages/frontend/src/pages/about.astro @@ -0,0 +1,15 @@ +--- +import TitleBar from "@components/TitleBar.astro"; +import Layout from '@layouts/Layout.astro'; +--- + + + + + + +
+

正在施工中……

+
+ + diff --git a/packages/frontend/src/pages/song/[aid]/info.astro b/packages/frontend/src/pages/song/[aid]/info.astro index 063a644..dd5778f 100644 --- a/packages/frontend/src/pages/song/[aid]/info.astro +++ b/packages/frontend/src/pages/song/[aid]/info.astro @@ -22,19 +22,19 @@ const snapshots = await getVideoSnapshots(videoAid); --- -
+

视频信息: {videoAid}

-
+

基本信息

-
{JSON.stringify(videoInfo, null, 2)}
+
{JSON.stringify(videoInfo, null, 2)}
-
+

历史数据 (最新100条)

-
{JSON.stringify(snapshots, null, 2)}
+
{JSON.stringify(snapshots, null, 2)}
From 8b17f8177c336c66cf9c4cdabc058aca87d84177 Mon Sep 17 00:00:00 2001 From: alikia2x Date: Sun, 30 Mar 2025 07:31:24 +0800 Subject: [PATCH 04/12] 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}
diff --git a/packages/frontend/src/pages/song/[id]/info.astro b/packages/frontend/src/pages/song/[id]/info.astro index 566a1fa..6651ca3 100644 --- a/packages/frontend/src/pages/song/[id]/info.astro +++ b/packages/frontend/src/pages/song/[id]/info.astro @@ -97,48 +97,48 @@ interface Snapshot { - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + +
ID{videoInfo?.id}ID{videoInfo?.id}
AID{videoInfo?.aid}AID{videoInfo?.aid}
BVID{videoInfo?.bvid}BVID{videoInfo?.bvid}
标题{videoInfo?.title}标题{videoInfo?.title}
描述{videoInfo?.description}描述{videoInfo?.description}
UID{videoInfo?.uid}UID{videoInfo?.uid}
标签{videoInfo?.tags}标签{videoInfo?.tags}
发布时间{videoInfo?.published_at ? format(new Date(videoInfo.published_at), 'yyyy-MM-dd HH:mm:ss', { locale: zhCN }) : '-'}发布时间{videoInfo?.published_at ? format(new Date(videoInfo.published_at), 'yyyy-MM-dd HH:mm:ss', { locale: zhCN }) : '-'}
时长 (秒){videoInfo?.duration}时长 (秒){videoInfo?.duration}
创建时间{videoInfo?.created_at ? format(new Date(videoInfo.created_at), 'yyyy-MM-dd HH:mm:ss', { locale: zhCN }) : '-'}创建时间{videoInfo?.created_at ? format(new Date(videoInfo.created_at), 'yyyy-MM-dd HH:mm:ss', { locale: zhCN }) : '-'}
封面{videoInfo?.cover_url ? videoInfo.cover_url : '-'}封面{videoInfo?.cover_url ? videoInfo.cover_url : '-'}
@@ -152,27 +152,27 @@ interface Snapshot { - - - - - - - - + + + + + + + + {snapshots.map((snapshot: Snapshot) => ( - - - - - - - - + + + + + + + + ))} From 7aa988f0fea56a0becbd5131fc35276dfc93a1b1 Mon Sep 17 00:00:00 2001 From: alikia2x Date: Sun, 30 Mar 2025 19:07:02 +0800 Subject: [PATCH 11/12] fix: remove deno from building & previewing --- packages/frontend/deno.json | 7 +++++++ packages/frontend/main.ts | 7 +++++++ packages/frontend/src/pages/song/[id]/info.astro | 15 ++++++++++++++- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 packages/frontend/deno.json create mode 100644 packages/frontend/main.ts diff --git a/packages/frontend/deno.json b/packages/frontend/deno.json new file mode 100644 index 0000000..acc30c9 --- /dev/null +++ b/packages/frontend/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@cvsa/frontend", + "tasks": { + "preview": "bun run astro preview" + }, + "exports": "./main.ts" +} diff --git a/packages/frontend/main.ts b/packages/frontend/main.ts new file mode 100644 index 0000000..f31ba12 --- /dev/null +++ b/packages/frontend/main.ts @@ -0,0 +1,7 @@ +// DENO ASK ME TO EXPORT SOMETHING WHEN 'name' IS SPECIFIED +// AND IF I DON'T SPECIFY 'name', THE --filter FLAG IN `deno task` WON'T WORK. +// I DONT'T KNOW WHY +// SO HERE'S A PLACHOLDER EXPORT FOR DENO: +export const DENO = "FUCK YOU DENO"; +// Oh, maybe export the version is a good idea +export const VERSION = "1.0.13"; diff --git a/packages/frontend/src/pages/song/[id]/info.astro b/packages/frontend/src/pages/song/[id]/info.astro index 6651ca3..f6fd40b 100644 --- a/packages/frontend/src/pages/song/[id]/info.astro +++ b/packages/frontend/src/pages/song/[id]/info.astro @@ -2,10 +2,23 @@ import Layout from "@layouts/Layout.astro"; import TitleBar from "@components/TitleBar.astro"; import pg from "pg"; -import { postgresConfig } from "@core/db/pgConfig.ts"; import { format } from 'date-fns'; import { zhCN } from 'date-fns/locale'; +const databaseHost = process.env.DB_HOST +const databaseName = process.env.DB_NAME +const databaseUser = process.env.DB_USER +const databasePassword = process.env.DB_PASSWORD +const databasePort = process.env.DB_PORT + +const postgresConfig = { + hostname: databaseHost, + port: parseInt(databasePort!), + database: databaseName, + user: databaseUser, + password: databasePassword, +}; + // 路由参数 const { id } = Astro.params; const { Client } = pg; From 39acac09e7b24c261608f4b688fbc67eade989ba Mon Sep 17 00:00:00 2001 From: alikia2x Date: Sun, 30 Mar 2025 19:10:23 +0800 Subject: [PATCH 12/12] version: frontend/1.2.6 --- packages/frontend/README.md | 50 ------------------------------------- packages/frontend/deno.json | 3 ++- packages/frontend/main.ts | 8 +----- 3 files changed, 3 insertions(+), 58 deletions(-) delete mode 100644 packages/frontend/README.md diff --git a/packages/frontend/README.md b/packages/frontend/README.md deleted file mode 100644 index 0eb9af9..0000000 --- a/packages/frontend/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# Astro Starter Kit: Basics - -```sh -deno create astro@latest -- --template basics -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/basics) -[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/basics) -[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/basics/devcontainer.json) - -> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun! - -![just-the-basics](https://github.com/withastro/astro/assets/2244813/a0a5533c-a856-4198-8470-2d67b1d7c554) - -## 🚀 Project Structure - -Inside of your Astro project, you'll see the following folders and files: - -```text -/ -├── public/ -│ └── favicon.svg -├── src/ -│ ├── layouts/ -│ │ └── Layout.astro -│ └── pages/ -│ └── index.astro -└── package.json -``` - -To learn more about the folder structure of an Astro project, refer to -[our guide on project structure](https://docs.astro.build/en/basics/project-structure/). - -## 🧞 Commands - -All commands are run from the root of the project, from a terminal: - -| Command | Action | -| :--------------------- | :----------------------------------------------- | -| `deno install` | Installs dependencies | -| `deno dev` | Starts local dev server at `localhost:4321` | -| `deno build` | Build your production site to `./dist/` | -| `deno preview` | Preview your build locally, before deploying | -| `deno astro ...` | Run CLI commands like `astro add`, `astro check` | -| `deno astro -- --help` | Get help using the Astro CLI | - -## 👀 Want to learn more? - -Feel free to check [our documentation](https://docs.astro.build) or jump into our -[Discord server](https://astro.build/chat). diff --git a/packages/frontend/deno.json b/packages/frontend/deno.json index acc30c9..675c374 100644 --- a/packages/frontend/deno.json +++ b/packages/frontend/deno.json @@ -1,7 +1,8 @@ { "name": "@cvsa/frontend", "tasks": { - "preview": "bun run astro preview" + "preview": "bun run astro preview", + "build": "bun run astro build" }, "exports": "./main.ts" } diff --git a/packages/frontend/main.ts b/packages/frontend/main.ts index f31ba12..f6ef10d 100644 --- a/packages/frontend/main.ts +++ b/packages/frontend/main.ts @@ -1,7 +1 @@ -// DENO ASK ME TO EXPORT SOMETHING WHEN 'name' IS SPECIFIED -// AND IF I DON'T SPECIFY 'name', THE --filter FLAG IN `deno task` WON'T WORK. -// I DONT'T KNOW WHY -// SO HERE'S A PLACHOLDER EXPORT FOR DENO: -export const DENO = "FUCK YOU DENO"; -// Oh, maybe export the version is a good idea -export const VERSION = "1.0.13"; +export const VERSION = "1.2.6"; \ No newline at end of file
创建时间观看硬币点赞收藏分享弹幕评论创建时间观看硬币点赞收藏分享弹幕评论
{format(new Date(snapshot.created_at), 'yyyy-MM-dd HH:mm:ss', { locale: zhCN })}{snapshot.views}{snapshot.coins}{snapshot.likes}{snapshot.favorites}{snapshot.shares}{snapshot.danmakus}{snapshot.replies}{format(new Date(snapshot.created_at), 'yyyy-MM-dd HH:mm:ss', { locale: zhCN })}{snapshot.views}{snapshot.coins}{snapshot.likes}{snapshot.favorites}{snapshot.shares}{snapshot.danmakus}{snapshot.replies}