diff --git a/.codegraph/.gitignore b/.codegraph/.gitignore new file mode 100644 index 0000000..d20c0fe --- /dev/null +++ b/.codegraph/.gitignore @@ -0,0 +1,5 @@ +# CodeGraph data files — local to each machine, not for committing. +# Ignore everything in .codegraph/ except this file itself, so transient +# files (the database, daemon.pid, sockets, logs) never show up in git. +* +!.gitignore diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index f690016..4459db8 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -13,7 +13,10 @@ jobs: - name: Build Docker image run: | - docker build -t awesome-index:latest . + docker build \ + --build-arg GIT_BRANCH="${GITHUB_REF_NAME:-unknown}" \ + --build-arg BUILD_TIME="$(date +%Y%m%d%H%M%S)" \ + -t awesome-index:latest . deploy: needs: build diff --git a/Dockerfile b/Dockerfile index eaea0ed..92533f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,10 @@ RUN npm ci --omit=dev --no-audit --no-fund FROM node:22-bookworm-slim WORKDIR /app ENV NODE_ENV=production +ARG GIT_BRANCH=unknown +ARG BUILD_TIME=unknown +ENV GIT_BRANCH=$GIT_BRANCH +ENV BUILD_TIME=$BUILD_TIME COPY --from=deps /app/node_modules ./node_modules COPY package.json ./ COPY src ./src diff --git a/public/css/main.css b/public/css/main.css index 3c928d1..b4a126c 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -1676,32 +1676,44 @@ button.chip:hover { } .ai-key-field .input { width: 100%; - padding-right: 42px; + padding-right: 40px; } .pwd-field { position: relative; } .pwd-field .input { width: 100%; - padding-right: 42px; + padding-right: 40px; } .eye-toggle { position: absolute; - right: 8px; + right: 2px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; justify-content: center; - padding: 4px; + width: 34px; + height: 100%; + padding: 0; border: 0; background: none; cursor: pointer; color: var(--ink-dim); + border-radius: 0 8px 8px 0; } .eye-toggle:hover { color: var(--ink); } +.eye-toggle .eye-closed { + display: none; +} +.eye-toggle[data-show] .eye-open { + display: none; +} +.eye-toggle[data-show] .eye-closed { + display: inline; +} .auth-row { margin-top: 14px; display: flex; diff --git a/public/js/main.js b/public/js/main.js index c41b684..0c128d6 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -127,10 +127,8 @@ var show = input.type === "password"; input.type = show ? "text" : "password"; btn.setAttribute("aria-label", show ? "隐藏密码" : "显示密码"); - var open = btn.querySelector(".eye-open"); - var closed = btn.querySelector(".eye-closed"); - if (open) open.hidden = show; - if (closed) closed.hidden = !show; + if (show) btn.setAttribute("data-show", ""); + else btn.removeAttribute("data-show"); }); }); diff --git a/src/config.js b/src/config.js index 3dc121a..c06cda3 100644 --- a/src/config.js +++ b/src/config.js @@ -20,6 +20,8 @@ export const config = { aiIngestKey: str(env.AI_INGEST_KEY, ""), baseUrl: str(env.BASE_URL, `http://localhost:${num(env.PORT, 3000)}`), schedulerEnabled: env.SCHEDULER_DISABLED !== "1", + gitBranch: str(env.GIT_BRANCH, "dev"), + buildTime: str(env.BUILD_TIME, new Date().toISOString().replace(/[-T:]/g, "").slice(0, 14)), }; export function ensureDataDir() { diff --git a/src/mcp/tools.js b/src/mcp/tools.js index d2a65ac..40b8085 100644 --- a/src/mcp/tools.js +++ b/src/mcp/tools.js @@ -32,6 +32,7 @@ export function registerTools(server) { stars: Number(e.stars), license: e.license, tags: e.tags, + summary: e.summary, description: e.description_md, })), }); diff --git a/src/routes/entries.routes.js b/src/routes/entries.routes.js index 6e3c92f..f879dc2 100644 --- a/src/routes/entries.routes.js +++ b/src/routes/entries.routes.js @@ -44,7 +44,7 @@ const entryInput = z.object({ title: z.string().min(1), url: z.string().url(), type: z.enum(entryService.ENTRY_TYPES), - summary: z.string().max(1000).optional(), + summary: z.string().max(200).optional(), description_md: z.string().max(5000).optional(), license: z.string().optional(), stars: z.number().nonnegative().optional(), @@ -78,7 +78,7 @@ const patchInput = z.object({ title: z.string().min(1).optional(), url: z.string().url().optional(), type: z.enum(entryService.ENTRY_TYPES).optional(), - summary: z.string().max(1000).optional(), + summary: z.string().max(200).optional(), description_md: z.string().max(5000).optional(), license: z.string().optional(), stars: z.number().nonnegative().optional(), diff --git a/src/views/admin-entry-edit.ejs b/src/views/admin-entry-edit.ejs index c9bb533..e87c71c 100644 --- a/src/views/admin-entry-edit.ejs +++ b/src/views/admin-entry-edit.ejs @@ -15,12 +15,10 @@