feat: 版本时间+8区、首页随机卡片点击进详情;chore: 优雅关闭DuckDB、start.sh改用docker stop
This commit is contained in:
parent
64f3f6ea58
commit
381e6a780d
@ -15,7 +15,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
docker build \
|
docker build \
|
||||||
--build-arg GIT_BRANCH="${GITHUB_REF_NAME:-unknown}" \
|
--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 .
|
-t awesome-index:latest .
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
|
|||||||
@ -465,6 +465,13 @@ button.chip:hover {
|
|||||||
padding: 18px;
|
padding: 18px;
|
||||||
transform: rotate(-3deg);
|
transform: rotate(-3deg);
|
||||||
box-shadow: 9px 9px 0 var(--riso-blue);
|
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 {
|
.spec-human h3 {
|
||||||
font-size: 16.5px;
|
font-size: 16.5px;
|
||||||
|
|||||||
17
src/index.js
17
src/index.js
@ -1,5 +1,5 @@
|
|||||||
import { config, ensureDataDir } from "./config.js";
|
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 { runMigrate } from "./db/migrate.js";
|
||||||
import { buildApp } from "./app.js";
|
import { buildApp } from "./app.js";
|
||||||
import { startScheduler } from "./ingest/scheduler.js";
|
import { startScheduler } from "./ingest/scheduler.js";
|
||||||
@ -19,8 +19,19 @@ async function main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const shutdown = async () => {
|
const shutdown = async () => {
|
||||||
server.close(() => process.exit(0));
|
console.log("[awesome-index] shutting down...");
|
||||||
setTimeout(() => process.exit(0), 2000).unref();
|
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("SIGINT", shutdown);
|
||||||
process.on("SIGTERM", shutdown);
|
process.on("SIGTERM", shutdown);
|
||||||
|
|||||||
@ -43,13 +43,13 @@
|
|||||||
"stars": <%= Number(h.stars) %>,
|
"stars": <%= Number(h.stars) %>,
|
||||||
"status": "active"
|
"status": "active"
|
||||||
}</div>
|
}</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>
|
<span class="chip chip-type"><%= h.type %></span>
|
||||||
<h3><%= h.title %></h3>
|
<h3><%= h.title %></h3>
|
||||||
<p><%= h.summary || excerpt(h.description_md, 90) %></p>
|
<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>
|
<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>
|
<p class="card-meta">★ <%= fmtStars(h.stars) %> · 随机一条,点击查看详情</p>
|
||||||
</div>
|
</a>
|
||||||
<button class="btn btn-random" id="random-btn" type="button" title="随机打开一条收录,没有头绪时让库替你挑一个">
|
<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>
|
<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>
|
||||||
随机游览
|
随机游览
|
||||||
|
|||||||
5
start.sh
5
start.sh
@ -16,9 +16,10 @@ if [ ! -f .env ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 停止并删除旧容器
|
# 停止并删除旧容器(先优雅停止,让应用关闭 DuckDB 完成 checkpoint)
|
||||||
echo "停止旧容器..."
|
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..."
|
echo "启动 Awesome Index..."
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user