feat: 版本时间+8区、首页随机卡片点击进详情;chore: 优雅关闭DuckDB、start.sh改用docker stop
Some checks failed
Build and Deploy / build (push) Successful in 10s
Build and Deploy / deploy (push) Failing after 45s

This commit is contained in:
cheney 2026-09-01 11:40:21 +08:00
parent 64f3f6ea58
commit 381e6a780d
5 changed files with 28 additions and 9 deletions

View File

@ -15,7 +15,7 @@ jobs:
run: |
docker build \
--build-arg GIT_BRANCH="${GITHUB_REF_NAME:-unknown}" \
--build-arg BUILD_TIME="$(date +%Y%m%d%H%M%S)" \
--build-arg BUILD_TIME="$(TZ=Asia/Shanghai date +%Y%m%d%H%M%S)" \
-t awesome-index:latest .
deploy:

View File

@ -465,6 +465,13 @@ button.chip:hover {
padding: 18px;
transform: rotate(-3deg);
box-shadow: 9px 9px 0 var(--riso-blue);
color: inherit;
text-decoration: none;
transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.spec-human:hover {
transform: rotate(0deg) translateY(-2px);
box-shadow: 9px 12px 0 var(--riso-blue);
}
.spec-human h3 {
font-size: 16.5px;

View File

@ -1,5 +1,5 @@
import { config, ensureDataDir } from "./config.js";
import { connect } from "./db/connection.js";
import { connect, close } from "./db/connection.js";
import { runMigrate } from "./db/migrate.js";
import { buildApp } from "./app.js";
import { startScheduler } from "./ingest/scheduler.js";
@ -19,8 +19,19 @@ async function main() {
}
const shutdown = async () => {
server.close(() => process.exit(0));
setTimeout(() => process.exit(0), 2000).unref();
console.log("[awesome-index] shutting down...");
try {
server.close();
if (config.schedulerEnabled) {
const { stopAll } = await import("./ingest/scheduler.js");
stopAll();
}
await close();
console.log("[awesome-index] duckdb closed (wal checkpointed)");
} catch (err) {
console.error("[awesome-index] shutdown error:", err);
}
process.exit(0);
};
process.on("SIGINT", shutdown);
process.on("SIGTERM", shutdown);

View File

@ -43,13 +43,13 @@
"stars": <%= Number(h.stars) %>,
"status": "active"
}</div>
<div class="spec-human" aria-hidden="true">
<a class="spec-human" href="/entries/<%= h.slug %>" aria-label="查看 <%= h.title %> 详情">
<span class="chip chip-type"><%= h.type %></span>
<h3><%= h.title %></h3>
<p><%= h.summary || excerpt(h.description_md, 90) %></p>
<div class="card-tags"><% for (const t of (h.tags || []).slice(0, 3)) { %><span class="chip"><%= t %></span><% } %></div>
<p class="card-meta">★ <%= fmtStars(h.stars) %> · 随机一条,看看这个库</p>
</div>
<p class="card-meta">★ <%= fmtStars(h.stars) %> · 随机一条,点击查看详情</p>
</a>
<button class="btn btn-random" id="random-btn" type="button" title="随机打开一条收录,没有头绪时让库替你挑一个">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" aria-hidden="true"><path d="M3 7h4l10 10h4M17 3l4 4-4 4M3 17h4l2.5-2.5M21 17l-4 4"/></svg>
随机游览

View File

@ -16,9 +16,10 @@ if [ ! -f .env ]; then
fi
fi
# 停止并删除旧容器
# 停止并删除旧容器(先优雅停止,让应用关闭 DuckDB 完成 checkpoint
echo "停止旧容器..."
docker rm -f awesome-index 2>/dev/null || true
docker stop awesome-index 2>/dev/null || true
docker rm awesome-index 2>/dev/null || true
# 用新镜像启动容器
echo "启动 Awesome Index..."