Compare commits
No commits in common. "main" and "v1.3.4-live" have entirely different histories.
main
...
v1.3.4-liv
14
README.md
14
README.md
|
|
@ -3,7 +3,7 @@
|
|||
> 目标实例:`https://git.qyhhh.top`(`Gitea 1.21.11`,二进制 `/usr/local/bin/gitea`,运行用户 `git:git`)
|
||||
> 本仓库是**外观定制的工作目录(staging)**。所有改动先在这里做出来、经确认后再复制进 `/var/lib/gitea/custom`。
|
||||
|
||||
当前状态:**`v1.4.1-live` 已上线**(2026-11-05 部署到 `https://git.qyhhh.top`;未登录落地页改为方案 A+B:左文右图首屏 + 热门公开仓库三卡,`DEFAULT_THEME = qq-auto`,旧主题全部保留可切回)。
|
||||
当前状态:**`v1.0-live` 已上线**(2026-11-03 部署到 `https://git.qyhhh.top`,`DEFAULT_THEME = qq-auto`,旧主题全部保留可切回)。
|
||||
|
||||
## 一、铁律(不可违反)
|
||||
|
||||
|
|
@ -64,8 +64,8 @@
|
|||
# 改配色只需动 scripts/build_theme.py 顶部的常量,然后:
|
||||
python3 scripts/build_theme.py && python3 scripts/audit_colors.py
|
||||
|
||||
# 2) 打候选版本,等批准(按实际版本号替换 X.Y.Z)
|
||||
git tag vX.Y.Z-rc1
|
||||
# 2) 打候选版本,等批准
|
||||
git tag v1.0-rc1
|
||||
|
||||
# 3) 批准后部署(先备份,再同步、修权限、重启)
|
||||
./scripts/deploy.sh # 预演,安全
|
||||
|
|
@ -78,14 +78,12 @@ git tag vX.Y.Z-rc1
|
|||
|
||||
## 六、版本标签约定
|
||||
|
||||
| `v1.0-rc2` | 品牌定名 QQGit(APP_NAME 已改,页签标题实测生效),口号「自己的代码,自己的地方。」 |
|
||||
| 标签 | 含义 |
|
||||
| --- | --- |
|
||||
| `v0.0-baseline` | 线上原始状态 + 官方 1.21.11 模板快照 |
|
||||
| `vX.Y.Z-rcN` | 已完成本地检查、等待批准部署的候选版本 |
|
||||
| `vX.Y.Z-live` | 已部署到线上并通过验收的版本 |
|
||||
| `v1.4.1-live` | 当前线上版本:字标改 Inter 800;明亮模式去背景粒子/hero 光斑/分支卡毛玻璃,仓库卡改不透明白底 |
|
||||
| `v1.4-live` | 方案 A+B 落地页:方案 A+B 落地页(首屏分栏 + terminal 复制窗 + 热门公开仓库三卡,删数字条) |
|
||||
| `v1.3.13-live` | 上一版:搜索框去内框 + 最近动态首项直角修复 |
|
||||
| `v1.0-rc2` | 工作目录候选版:Logo 全套 + 三主题 + 模板钩子 + 预览页,**未上线** |
|
||||
| `v1.0-live` | 已部署到线上并通过验收(当前线上版本) |
|
||||
|
||||
## 七、上传限制(现状记录,不在本次改动范围)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,39 +4,34 @@
|
|||
只在 .qq-landing / .qq-dash 作用域内生效,不影响其它页面。
|
||||
=================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------- 首页落地页 v1.4 */
|
||||
/* 方案 A 首屏(左文右图)+ 热门公开仓库;与控制台同一 1280px 限宽 */
|
||||
/* ---------------------------------------------------------------- 首页落地页 */
|
||||
.page-content.home.qq-landing {
|
||||
max-width: 1280px;
|
||||
max-width: 1080px;
|
||||
margin: 0 auto;
|
||||
padding: 5vh 32px 9vh;
|
||||
padding: 7vh 20px 10vh;
|
||||
}
|
||||
|
||||
/* ① 首屏:左 7 / 右 5 */
|
||||
.qq-lp-hero {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
|
||||
gap: 56px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
--qq-mx: 24%;
|
||||
--qq-my: 32%;
|
||||
text-align: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
/* 跟随鼠标的柔光:JS 只改两个变量,不触发重排 */
|
||||
.qq-lp-hero-copy,
|
||||
.qq-lp-visual {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
min-width: 0;
|
||||
.qq-lp-logo {
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.qq-lp-hero-copy {
|
||||
text-align: left;
|
||||
.qq-lp-logo img {
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.qq-lp-eyebrow {
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
padding: 4px 12px;
|
||||
border: 1px solid var(--color-secondary);
|
||||
|
|
@ -48,42 +43,29 @@
|
|||
}
|
||||
|
||||
.qq-lp-title {
|
||||
margin: 18px 0 0;
|
||||
font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
|
||||
font-size: clamp(52px, 6.6vw, 86px);
|
||||
margin: 6px 0 0;
|
||||
font-size: clamp(44px, 7.6vw, 74px);
|
||||
font-weight: 800;
|
||||
letter-spacing: -0.025em;
|
||||
line-height: 1.02;
|
||||
background: linear-gradient(100deg, #1D4ED8 0%, #2563EB 24%, #3B82F6 52%, #60A5FA 78%, #38BDF8 100%);
|
||||
letter-spacing: -0.02em;
|
||||
line-height: 1.05;
|
||||
background: linear-gradient(100deg, #2563eb 0%, #3b82f6 38%, #38bdf8 70%, #60a5fa 100%);
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
color: transparent;
|
||||
-webkit-text-fill-color: transparent;
|
||||
}
|
||||
|
||||
.qq-lp-sub {
|
||||
min-height: 1.7em;
|
||||
margin: 16px 0 0;
|
||||
font-size: clamp(16px, 1.6vw, 20px);
|
||||
letter-spacing: 0.01em;
|
||||
margin: 0;
|
||||
font-size: 17px;
|
||||
color: var(--color-text-light-2);
|
||||
}
|
||||
|
||||
.qq-lp-sub.qq-typing::after,
|
||||
.qq-lp-sub.qq-typed::after {
|
||||
content: "▌";
|
||||
margin-left: 2px;
|
||||
color: var(--color-primary);
|
||||
animation: qq-caret 1.1s step-end infinite;
|
||||
}
|
||||
|
||||
/* 搜索框:左对齐,跟随左栏宽度 */
|
||||
.qq-lp-search {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
max-width: 560px;
|
||||
margin: 28px 0 0;
|
||||
margin: 18px auto 4px;
|
||||
}
|
||||
|
||||
.qq-lp-search input[type="search"] {
|
||||
|
|
@ -113,16 +95,16 @@
|
|||
font-size: 14px;
|
||||
white-space: nowrap;
|
||||
color: #fff !important;
|
||||
background: linear-gradient(120deg, #2563EB, #3B82F6 55%, #38BDF8 100%);
|
||||
background: linear-gradient(120deg, var(--color-primary), #38bdf8 60%, var(--color-primary));
|
||||
}
|
||||
|
||||
.qq-lp-cta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
margin-top: 20px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.qq-lp-cta .ui.button {
|
||||
|
|
@ -134,10 +116,11 @@
|
|||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* 主按钮:渐变底 + 白字;次按钮:描边(不依赖 Fomantic 的具体实现) */
|
||||
.qq-lp-cta .ui.primary.button {
|
||||
border: 0;
|
||||
color: #fff !important;
|
||||
background: linear-gradient(120deg, #1D4ED8, #2563EB 45%, #3B82F6 100%);
|
||||
background: linear-gradient(120deg, #2563eb, #3b82f6 45%, #38bdf8 100%);
|
||||
box-shadow: 0 8px 20px -12px color-mix(in srgb, var(--color-primary) 90%, transparent);
|
||||
}
|
||||
|
||||
|
|
@ -166,640 +149,96 @@
|
|||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
/* 右侧:毛玻璃卡片里的 SVG 分支图 */
|
||||
.qq-lp-visual {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.qq-lp-graph {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
aspect-ratio: 6 / 5;
|
||||
min-height: 320px;
|
||||
border: 1px solid color-mix(in srgb, var(--color-primary) 13%, var(--color-secondary));
|
||||
border-radius: 18px;
|
||||
background: linear-gradient(180deg,
|
||||
color-mix(in srgb, var(--color-primary) 5%, var(--color-box-body)) 0%,
|
||||
var(--color-box-body) 76%);
|
||||
box-shadow: 0 22px 44px -40px color-mix(in srgb, var(--color-primary) 55%, transparent);
|
||||
}
|
||||
|
||||
.qq-lp-graph-svg {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.qqg-edge {
|
||||
fill: none;
|
||||
stroke: url(#qqg-line);
|
||||
stroke-width: 2;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.qqg-edge-faint {
|
||||
fill: none;
|
||||
stroke: color-mix(in srgb, var(--color-primary) 22%, transparent);
|
||||
stroke-width: 1;
|
||||
stroke-linecap: round;
|
||||
}
|
||||
|
||||
.qqg-flow {
|
||||
stroke-dasharray: 5 11;
|
||||
animation: qqg-dash 22s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes qqg-dash {
|
||||
to { stroke-dashoffset: -320; }
|
||||
}
|
||||
|
||||
.qqg-node {
|
||||
fill: var(--color-box-body);
|
||||
stroke: #3B82F6;
|
||||
stroke-width: 2;
|
||||
}
|
||||
|
||||
.qqg-node-core {
|
||||
fill: #3B82F6;
|
||||
stroke: none;
|
||||
}
|
||||
|
||||
.qqg-node-soft {
|
||||
fill: color-mix(in srgb, #93C5FD 55%, transparent);
|
||||
stroke: none;
|
||||
}
|
||||
|
||||
.qqg-link {
|
||||
stroke: color-mix(in srgb, var(--color-primary) 30%, transparent);
|
||||
stroke-width: 1;
|
||||
stroke-dasharray: 3 5;
|
||||
}
|
||||
|
||||
/* 叠在右下角的 terminal 小窗 */
|
||||
.qq-lp-term {
|
||||
position: absolute;
|
||||
right: 14px;
|
||||
bottom: 14px;
|
||||
width: min(94%, 468px);
|
||||
overflow: hidden;
|
||||
border: 1px solid rgba(148, 163, 184, 0.22);
|
||||
border-radius: 12px;
|
||||
background: #0B1220;
|
||||
box-shadow: 0 20px 44px -24px rgba(2, 6, 23, 0.9);
|
||||
}
|
||||
|
||||
.qq-lp-term-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
height: 26px;
|
||||
padding: 0 10px;
|
||||
border-bottom: 1px solid rgba(148, 163, 184, 0.12);
|
||||
background: rgba(148, 163, 184, 0.08);
|
||||
}
|
||||
|
||||
.qq-lp-term-dots {
|
||||
display: inline-flex;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.qq-lp-term-dots i {
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
border-radius: 50%;
|
||||
background: #334155;
|
||||
}
|
||||
|
||||
.qq-lp-term-title {
|
||||
font-family: var(--qq-font-mono);
|
||||
font-size: 10px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.1em;
|
||||
text-transform: none;
|
||||
color: #94A3B8;
|
||||
}
|
||||
|
||||
.qq-lp-term-line {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 12px 12px 13px;
|
||||
}
|
||||
|
||||
.qq-lp-term-code {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
overflow-x: auto;
|
||||
white-space: nowrap;
|
||||
font-family: var(--qq-font-mono);
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
line-height: 1.5;
|
||||
color: #E2E8F0;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
.qq-lp-term-code::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.qq-prompt {
|
||||
margin-right: 2px;
|
||||
color: #38BDF8;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.qq-url {
|
||||
color: #93C5FD;
|
||||
}
|
||||
|
||||
.qq-lp-copy {
|
||||
flex: 0 0 auto;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 8px;
|
||||
background: rgba(148, 163, 184, 0.12);
|
||||
color: #CBD5E1;
|
||||
cursor: pointer;
|
||||
transition: background 0.16s ease, color 0.16s ease;
|
||||
}
|
||||
|
||||
.qq-lp-copy:hover {
|
||||
background: rgba(56, 189, 248, 0.18);
|
||||
color: #E0F2FE;
|
||||
}
|
||||
|
||||
.qq-lp-copy:focus-visible {
|
||||
outline: 2px solid #38BDF8;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.qq-lp-copy svg {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
}
|
||||
|
||||
.qq-lp-copy .qq-copy-check {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.qq-lp-copy.is-copied {
|
||||
background: rgba(37, 99, 235, 0.32);
|
||||
color: #DBEAFE;
|
||||
}
|
||||
|
||||
.qq-lp-copy.is-copied .qq-copy-icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.qq-lp-copy.is-copied .qq-copy-check {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.qq-qc-tip {
|
||||
position: absolute;
|
||||
right: 48px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
padding: 3px 8px;
|
||||
border-radius: 6px;
|
||||
font-size: 11px;
|
||||
line-height: 1.4;
|
||||
color: #DBEAFE;
|
||||
background: rgba(37, 99, 235, 0.9);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.16s ease;
|
||||
}
|
||||
|
||||
.qq-qc-tip.is-on {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* ② 热门公开仓库 */
|
||||
.qq-lp-hot {
|
||||
margin-top: 76px;
|
||||
}
|
||||
|
||||
.qq-lp-sec-head {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.qq-lp-sec-head h2 {
|
||||
margin: 0;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.01em;
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.qq-lp-more {
|
||||
font-size: 13px;
|
||||
color: var(--color-text-light-2);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.qq-lp-more:hover {
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
.qq-hot-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.qq-repo-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
padding: 16px 18px 14px;
|
||||
border: 1px solid var(--color-secondary);
|
||||
border-radius: 8px;
|
||||
background: var(--color-box-body);
|
||||
color: var(--color-text);
|
||||
text-decoration: none;
|
||||
transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
|
||||
}
|
||||
|
||||
.qq-repo-card:hover,
|
||||
.qq-repo-card:focus {
|
||||
transform: translateY(-2px);
|
||||
border-color: var(--color-primary);
|
||||
color: var(--color-text);
|
||||
text-decoration: none;
|
||||
box-shadow: 0 14px 28px -22px color-mix(in srgb, var(--color-primary) 70%, transparent);
|
||||
}
|
||||
|
||||
.qq-repo-card:focus-visible {
|
||||
outline: 2px solid var(--color-primary);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* 卡片整体是 <a>:Gitea 基础样式会给链接 hover 加下划线,这里单独压掉 */
|
||||
.qq-landing a.qq-repo-card,
|
||||
.qq-landing a.qq-repo-card:hover,
|
||||
.qq-landing a.qq-repo-card:focus {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.qq-repo-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.qq-repo-avatar {
|
||||
flex: 0 0 auto;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 4px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.qq-repo-avatar-fallback {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
font-family: var(--qq-font-mono);
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
color: var(--color-primary);
|
||||
background: color-mix(in srgb, var(--color-primary) 16%, transparent);
|
||||
}
|
||||
|
||||
.qq-repo-name {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
font-family: var(--qq-font-mono);
|
||||
font-size: 13.5px;
|
||||
font-weight: 500;
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
.qq-repo-owner {
|
||||
font-weight: 400;
|
||||
color: var(--color-text-light-2);
|
||||
}
|
||||
|
||||
.qq-repo-desc {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
min-height: 2.6em;
|
||||
margin: 0;
|
||||
font-size: 12.5px;
|
||||
line-height: 1.65;
|
||||
color: var(--color-text-light-2);
|
||||
}
|
||||
|
||||
.qq-repo-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
margin-top: auto;
|
||||
font-size: 11.5px;
|
||||
white-space: nowrap;
|
||||
color: var(--color-text-light-2);
|
||||
}
|
||||
|
||||
.qq-repo-lang {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.qq-repo-lang-name {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.qq-repo-dot {
|
||||
flex: 0 0 auto;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: var(--qq-dot, #3B82F6);
|
||||
}
|
||||
|
||||
.qq-repo-stat {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.qq-repo-stat-icon {
|
||||
font-size: 10px;
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
.qq-repo-time {
|
||||
overflow: hidden;
|
||||
margin-left: auto;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
/* 骨架屏 */
|
||||
.qq-skeleton {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.qq-skeleton::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: linear-gradient(100deg,
|
||||
transparent 18%,
|
||||
color-mix(in srgb, var(--color-primary) 9%, transparent) 50%,
|
||||
transparent 82%);
|
||||
transform: translateX(-100%);
|
||||
animation: qq-skeleton-sweep 1.5s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.qq-skeleton {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.qq-sk-bar {
|
||||
display: block;
|
||||
height: 10px;
|
||||
border-radius: 5px;
|
||||
background: color-mix(in srgb, var(--color-text-light-2) 14%, transparent);
|
||||
}
|
||||
|
||||
.qq-sk-title {
|
||||
width: 52%;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
.qq-sk-desc {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.qq-sk-desc-2 {
|
||||
width: 68%;
|
||||
}
|
||||
|
||||
.qq-sk-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.qq-sk-pill {
|
||||
width: 54px;
|
||||
height: 9px;
|
||||
}
|
||||
|
||||
.qq-sk-pill-end {
|
||||
width: 66px;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
@keyframes qq-skeleton-sweep {
|
||||
to { transform: translateX(100%); }
|
||||
}
|
||||
|
||||
/* ③ 功能卡:收尾,视觉降一级(不再用毛玻璃与上浮) */
|
||||
/* 三张功能卡 */
|
||||
.qq-lp-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 16px;
|
||||
margin-top: 64px;
|
||||
padding-top: 40px;
|
||||
border-top: 1px solid var(--color-secondary);
|
||||
gap: 18px;
|
||||
margin-top: 9vh;
|
||||
}
|
||||
|
||||
.qq-lp-card {
|
||||
padding: 18px;
|
||||
padding: 22px 20px;
|
||||
border: 1px solid var(--color-secondary);
|
||||
border-radius: 12px;
|
||||
background: transparent;
|
||||
transition: border-color 0.18s ease;
|
||||
border-radius: 14px;
|
||||
background: color-mix(in srgb, var(--color-box-body) 88%, transparent);
|
||||
backdrop-filter: blur(10px);
|
||||
-webkit-backdrop-filter: blur(10px);
|
||||
transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
|
||||
}
|
||||
|
||||
.qq-lp-card:hover {
|
||||
border-color: color-mix(in srgb, var(--color-primary) 34%, var(--color-secondary));
|
||||
transform: translateY(-3px);
|
||||
border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-secondary));
|
||||
box-shadow: 0 12px 30px -18px color-mix(in srgb, var(--color-primary) 70%, transparent);
|
||||
}
|
||||
|
||||
.qq-lp-icon {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 8px;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border-radius: 10px;
|
||||
color: var(--color-primary);
|
||||
background: color-mix(in srgb, var(--color-primary) 12%, transparent);
|
||||
background: color-mix(in srgb, var(--color-primary) 14%, transparent);
|
||||
}
|
||||
|
||||
.qq-lp-card h2 {
|
||||
margin: 12px 0 4px;
|
||||
font-size: 15px;
|
||||
margin: 14px 0 6px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.qq-lp-card p {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
font-size: 13.5px;
|
||||
line-height: 1.7;
|
||||
color: var(--color-text-light-2);
|
||||
}
|
||||
|
||||
/* 响应式:>1024 分栏;641–1024 上下堆叠;≤640 单列 + 分支图隐藏 */
|
||||
@media (max-width: 1024px) {
|
||||
.page-content.home.qq-landing {
|
||||
padding: 4vh 24px 9vh;
|
||||
/* 事实条 */
|
||||
.qq-lp-stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 1px;
|
||||
margin-top: 7vh;
|
||||
border: 1px solid var(--color-secondary);
|
||||
border-radius: 14px;
|
||||
overflow: hidden;
|
||||
background: var(--color-secondary);
|
||||
}
|
||||
|
||||
.qq-lp-stat {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 18px 12px;
|
||||
background: var(--color-box-body);
|
||||
}
|
||||
|
||||
.qq-lp-stat strong {
|
||||
font-size: 17px;
|
||||
font-weight: 600;
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.qq-lp-stat span {
|
||||
font-size: 12px;
|
||||
color: var(--color-text-light-2);
|
||||
}
|
||||
|
||||
@media (max-width: 860px) {
|
||||
.qq-lp-grid {
|
||||
grid-template-columns: 1fr;
|
||||
margin-top: 6vh;
|
||||
}
|
||||
|
||||
.qq-lp-hero {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: 38px;
|
||||
--qq-mx: 20%;
|
||||
}
|
||||
|
||||
.qq-lp-visual {
|
||||
width: 100%;
|
||||
max-width: 660px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.qq-lp-graph {
|
||||
aspect-ratio: 16 / 10;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.qq-hot-grid {
|
||||
.qq-lp-stats {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.qq-lp-grid {
|
||||
margin-top: 48px;
|
||||
padding-top: 32px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.page-content.home.qq-landing {
|
||||
padding: 24px 18px 72px;
|
||||
}
|
||||
|
||||
.qq-lp-hero {
|
||||
gap: 26px;
|
||||
}
|
||||
|
||||
.qq-lp-title {
|
||||
margin-top: 14px;
|
||||
font-size: clamp(44px, 13vw, 56px);
|
||||
}
|
||||
|
||||
.qq-lp-sub {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.qq-lp-search {
|
||||
gap: 8px;
|
||||
margin-top: 22px;
|
||||
}
|
||||
|
||||
.qq-lp-search input[type="search"] {
|
||||
height: 44px;
|
||||
padding: 0 12px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.qq-lp-search .ui.primary.button {
|
||||
height: 44px;
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
.qq-lp-cta {
|
||||
gap: 10px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.qq-lp-cta .ui.button {
|
||||
padding: 9px 16px;
|
||||
}
|
||||
|
||||
/* 分支图隐藏,terminal 变单行可横向滚动 */
|
||||
.qq-lp-graph {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.qq-lp-term {
|
||||
position: static;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.qq-lp-term-line {
|
||||
padding: 11px 10px 12px;
|
||||
}
|
||||
|
||||
.qq-lp-term-code {
|
||||
font-size: 11px;
|
||||
/* 小屏单行可横滑:右缘渐隐提示还有内容 */
|
||||
-webkit-mask-image: linear-gradient(90deg, #000 84%, transparent 100%);
|
||||
mask-image: linear-gradient(90deg, #000 84%, transparent 100%);
|
||||
}
|
||||
|
||||
.qq-lp-hot {
|
||||
margin-top: 44px;
|
||||
}
|
||||
|
||||
.qq-lp-sec-head {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.qq-lp-sec-head h2 {
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
.qq-hot-grid {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.qq-lp-grid {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: 12px;
|
||||
margin-top: 40px;
|
||||
padding-top: 28px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 减少动效:分支图静止、骨架不闪 */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.qqg-flow {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
.qq-skeleton::after {
|
||||
animation: none;
|
||||
opacity: 0.35;
|
||||
}
|
||||
|
||||
.qq-lp-sub.qq-typing::after,
|
||||
.qq-lp-sub.qq-typed::after {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- Dashboard */
|
||||
|
|
@ -969,15 +408,15 @@
|
|||
}
|
||||
|
||||
/* 中栏 */
|
||||
/* 问候语:顶部通栏,位于热力图上方 */
|
||||
/* 页头问候语:横跨整页、左对齐,位于三栏之上 */
|
||||
.qq-dash-hello {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
box-sizing: border-box;
|
||||
margin: 0 0 14px;
|
||||
font-size: 24px;
|
||||
margin: 0 0 18px;
|
||||
font-size: 22px;
|
||||
font-weight: 650;
|
||||
line-height: 1.25;
|
||||
letter-spacing: -0.01em;
|
||||
|
|
@ -1021,21 +460,12 @@
|
|||
opacity: 0.72;
|
||||
}
|
||||
|
||||
/* 输入框本身不画任何框:外层胶囊已经是唯一的一层框。
|
||||
Gitea 主题会给 input 描边+焦点阴影,这里逐项压掉(含浏览器原生 search 外观)。 */
|
||||
.qq-dash-search input,
|
||||
.qq-dash-search input[type="search"] {
|
||||
.qq-dash-search input {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
height: 100%;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
border: 0 !important;
|
||||
border-radius: 0 !important;
|
||||
background: transparent !important;
|
||||
box-shadow: none !important;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--color-text);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
|
@ -1045,11 +475,8 @@
|
|||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.qq-dash-search input:focus,
|
||||
.qq-dash-search input:focus-visible {
|
||||
outline: 0 !important;
|
||||
border: 0 !important;
|
||||
box-shadow: none !important;
|
||||
.qq-dash-search input:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.qq-dash-card {
|
||||
|
|
@ -1111,41 +538,19 @@
|
|||
font-size: 12px;
|
||||
color: var(--color-text-light-2);
|
||||
}
|
||||
/* 浏览器计算样式确认:内圈来自 .vch__container 的 box-shadow 描边,
|
||||
#user-heatmap 的 border 会额外画出外圈,因此这里只保留组件的内圈。
|
||||
局部色阶变量不保证能覆盖其他主题的格子规则;颜色需单独视觉验收。
|
||||
外包装不留左右缩进,让内圈与下方三栏外沿对齐;保留 SVG overflow。 */
|
||||
.qq-dash-card.qq-dash-heat {
|
||||
padding: 0;
|
||||
border: 0 !important;
|
||||
border-radius: 0;
|
||||
background: transparent !important;
|
||||
box-shadow: none !important;
|
||||
margin: 0 0 18px;
|
||||
}
|
||||
|
||||
.qq-dash-heat #user-heatmap {
|
||||
--color-primary-light-4: #dbeafe;
|
||||
--color-primary-light-2: #93c5fd;
|
||||
--color-primary: #3b82f6;
|
||||
--color-primary-dark-2: #2563eb;
|
||||
--color-primary-dark-4: #1d4ed8;
|
||||
box-sizing: border-box;
|
||||
padding: 12px 1px 6px; /* 为组件向外绘制的 1px 阴影描边留位,对齐三栏外沿 */
|
||||
border: 0 !important;
|
||||
border-radius: 0;
|
||||
background: transparent !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.qq-dash-heat #user-heatmap .vch__wrapper {
|
||||
overflow: visible;
|
||||
/* 热力图卡片:官方模板自带 divider,卡片里不需要 */
|
||||
.qq-dash-heat {
|
||||
padding: 14px 16px 8px;
|
||||
}
|
||||
|
||||
.qq-dash-heat .divider {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.qq-dash-heat #user-heatmap {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
||||
/* 动态流:Gitea 1.21 用的是 .flex-list / .flex-item(不是老的 .ui.feed),
|
||||
|
|
@ -1161,19 +566,7 @@
|
|||
}
|
||||
|
||||
.qq-dash-feed .flex-item:first-child {
|
||||
border-top: 1px solid var(--color-secondary);
|
||||
}
|
||||
|
||||
/* 「最近动态」外卡保留圆角;第一条动态与标题栏无缝相接,自己不画上圆角。 */
|
||||
.qq-dash-card.qq-dash-feed {
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.qq-dash-feed #activity-feed,
|
||||
.qq-dash-feed .flex-item:first-child {
|
||||
border-top-left-radius: 0 !important;
|
||||
border-top-right-radius: 0 !important;
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
.qq-dash-feed .flex-item-main {
|
||||
|
|
@ -1344,4 +737,3 @@
|
|||
border-bottom: 1px solid var(--color-secondary);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,13 +6,6 @@
|
|||
*/
|
||||
|
||||
/* ---------------------------------------------------------------- 字体 */
|
||||
@font-face {
|
||||
font-family: "Inter";
|
||||
font-style: normal;
|
||||
font-weight: 800;
|
||||
font-display: swap;
|
||||
src: url("../fonts/inter-latin-800-normal.woff2") format("woff2");
|
||||
}
|
||||
@font-face {
|
||||
font-family: "JetBrains Mono";
|
||||
font-style: normal;
|
||||
|
|
@ -62,10 +55,6 @@ samp,
|
|||
|
||||
/* ---------------------------------------------------------------- 顶栏:细线 + 轻磨砂 */
|
||||
#navbar {
|
||||
/* backdrop-filter 创建独立层叠上下文;将整个导航层抬到正文和 sticky 侧栏之上。
|
||||
仅提高菜单自身 z-index 无法越过父层;30 仍低于原生模态遮罩。 */
|
||||
position: relative;
|
||||
z-index: 30;
|
||||
border-bottom: 1px solid var(--color-secondary);
|
||||
backdrop-filter: saturate(150%) blur(8px);
|
||||
-webkit-backdrop-filter: saturate(150%) blur(8px);
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -5,7 +5,7 @@
|
|||
* 其余页面直接 return,一点开销都不加。
|
||||
*
|
||||
* 做三件事:
|
||||
* 1. 背景粒子星座(仅登录页;落地页保持干净的白底)
|
||||
* 1. 背景粒子星座(canvas,40 个慢速漂移的点 + 近邻连线,颜色取 --color-primary)
|
||||
* 2. 首页大标题下的口号打字机(data-qq-type),打完留着光标闪烁
|
||||
* 3. 首页 hero 跟随鼠标的柔和光斑(只改两个 CSS 变量,不做重排)
|
||||
*
|
||||
|
|
@ -177,7 +177,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
if (!isHome) initParticles();
|
||||
initParticles();
|
||||
initTyping();
|
||||
initSpotlight();
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -1,274 +0,0 @@
|
|||
/*
|
||||
* qq-home.js —— 未登录首页的两件小事(纯前端,无依赖)
|
||||
* ---------------------------------------------------------------------------
|
||||
* 1. 热门公开仓库:调 Gitea 公开 API → 前端过滤/排序 → 渲染 3 张卡片
|
||||
* 2. terminal 小窗的「复制 clone 命令」按钮
|
||||
*
|
||||
* 只在首页存在 #qq-hot-repos 时启动;其余页面直接 return。
|
||||
* 取数失败的策略是「静默隐藏整块」,不弹错、不留空框。
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/* ---------------- 0. 小工具 ---------------- */
|
||||
var HOT_LIMIT = 3; // 最终展示几条
|
||||
var FETCH_LIMIT = 50; // 接口多取一些,前端再筛
|
||||
var FETCH_TIMEOUT = 5000; // 5s 超时后静默隐藏
|
||||
// 语言圆点:只用品牌蓝色阶(按语言名哈希取色),不用 Gitea 原生语言色
|
||||
var DOT_COLORS = ['#1D4ED8', '#3B82F6', '#60A5FA', '#93C5FD'];
|
||||
var reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
|
||||
function make(tag, className, text) {
|
||||
var node = document.createElement(tag);
|
||||
if (className) node.className = className;
|
||||
if (text != null) node.textContent = text;
|
||||
return node;
|
||||
}
|
||||
|
||||
function hashStr(str) {
|
||||
var h = 0;
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
h = (h * 31 + str.charCodeAt(i)) | 0;
|
||||
}
|
||||
return Math.abs(h);
|
||||
}
|
||||
|
||||
function dotColor(language) {
|
||||
if (!language) return DOT_COLORS[1];
|
||||
return DOT_COLORS[hashStr(language) % DOT_COLORS.length];
|
||||
}
|
||||
|
||||
/* 相对时间:刚刚 / N 分钟前 / N 小时前 / N 天前 / N 个月前 / N 年前 */
|
||||
function relativeTime(iso) {
|
||||
var t = Date.parse(iso || '');
|
||||
if (isNaN(t)) return '';
|
||||
var sec = Math.max(0, (Date.now() - t) / 1000);
|
||||
if (sec < 60) return '刚刚';
|
||||
if (sec < 3600) return Math.floor(sec / 60) + ' 分钟前';
|
||||
if (sec < 86400) return Math.floor(sec / 3600) + ' 小时前';
|
||||
if (sec < 2592000) return Math.floor(sec / 86400) + ' 天前';
|
||||
if (sec < 31536000) return Math.floor(sec / 2592000) + ' 个月前';
|
||||
return Math.floor(sec / 31536000) + ' 年前';
|
||||
}
|
||||
|
||||
/* 过滤 + 排序:排除 fork / 镜像 / 私有 / 归档;星标降序,同星按更新时间降序 */
|
||||
function pickRepos(list) {
|
||||
return (list || []).filter(function (repo) {
|
||||
return repo && repo.full_name && !repo.fork && !repo.mirror && !repo.private && !repo.archived;
|
||||
}).sort(function (a, b) {
|
||||
var byStars = (b.stars_count || 0) - (a.stars_count || 0);
|
||||
if (byStars) return byStars;
|
||||
return Date.parse(b.updated_at || 0) - Date.parse(a.updated_at || 0);
|
||||
}).slice(0, HOT_LIMIT);
|
||||
}
|
||||
|
||||
/* ---------------- 1. 热门公开仓库 ---------------- */
|
||||
function initHotRepos() {
|
||||
var section = document.getElementById('qq-hot-repos');
|
||||
if (!section) return;
|
||||
var grid = section.querySelector('[data-qq-hot-grid]');
|
||||
if (!grid) return;
|
||||
|
||||
function hide() {
|
||||
section.hidden = true;
|
||||
grid.textContent = '';
|
||||
}
|
||||
|
||||
function skeletonCard() {
|
||||
var card = make('div', 'qq-repo-card qq-skeleton');
|
||||
card.setAttribute('aria-hidden', 'true');
|
||||
card.appendChild(make('span', 'qq-sk-bar qq-sk-title'));
|
||||
card.appendChild(make('span', 'qq-sk-bar qq-sk-desc'));
|
||||
card.appendChild(make('span', 'qq-sk-bar qq-sk-desc qq-sk-desc-2'));
|
||||
var meta = make('div', 'qq-sk-meta');
|
||||
meta.appendChild(make('span', 'qq-sk-bar qq-sk-pill'));
|
||||
meta.appendChild(make('span', 'qq-sk-bar qq-sk-pill'));
|
||||
meta.appendChild(make('span', 'qq-sk-bar qq-sk-pill qq-sk-pill-end'));
|
||||
card.appendChild(meta);
|
||||
return card;
|
||||
}
|
||||
|
||||
function showSkeletons() {
|
||||
grid.textContent = '';
|
||||
for (var i = 0; i < HOT_LIMIT; i++) grid.appendChild(skeletonCard());
|
||||
section.hidden = false;
|
||||
}
|
||||
|
||||
function avatar(repo) {
|
||||
var owner = (repo.owner && repo.owner.login) || (repo.full_name || '').split('/')[0] || '?';
|
||||
var src = repo.owner && repo.owner.avatar_url;
|
||||
if (src) {
|
||||
var img = document.createElement('img');
|
||||
img.className = 'qq-repo-avatar';
|
||||
img.src = src;
|
||||
img.alt = '';
|
||||
img.width = 20;
|
||||
img.height = 20;
|
||||
img.loading = 'lazy';
|
||||
img.decoding = 'async';
|
||||
// 头像挂了就退回首字母,不出现破图
|
||||
img.addEventListener('error', function () {
|
||||
var fallback = make('span', 'qq-repo-avatar qq-repo-avatar-fallback', owner.charAt(0).toUpperCase());
|
||||
if (img.parentNode) img.parentNode.replaceChild(fallback, img);
|
||||
});
|
||||
return img;
|
||||
}
|
||||
return make('span', 'qq-repo-avatar qq-repo-avatar-fallback', owner.charAt(0).toUpperCase());
|
||||
}
|
||||
|
||||
function repoCard(repo) {
|
||||
var card = document.createElement('a');
|
||||
card.className = 'qq-repo-card';
|
||||
card.href = repo.html_url || '#';
|
||||
|
||||
var head = make('div', 'qq-repo-head');
|
||||
head.appendChild(avatar(repo));
|
||||
var name = make('span', 'qq-repo-name');
|
||||
var parts = String(repo.full_name).split('/');
|
||||
name.appendChild(make('span', 'qq-repo-owner', parts[0] + '/'));
|
||||
name.appendChild(make('span', 'qq-repo-repo', parts.slice(1).join('/')));
|
||||
name.title = repo.full_name;
|
||||
head.appendChild(name);
|
||||
card.appendChild(head);
|
||||
|
||||
var desc = make('p', 'qq-repo-desc', repo.description || '暂无简介');
|
||||
card.appendChild(desc);
|
||||
|
||||
var meta = make('div', 'qq-repo-meta');
|
||||
var lang = make('span', 'qq-repo-lang');
|
||||
var dot = make('span', 'qq-repo-dot');
|
||||
dot.style.setProperty('--qq-dot', dotColor(repo.language));
|
||||
lang.appendChild(dot);
|
||||
lang.appendChild(make('span', 'qq-repo-lang-name', repo.language || '未标注语言'));
|
||||
meta.appendChild(lang);
|
||||
|
||||
var stars = make('span', 'qq-repo-stat');
|
||||
stars.appendChild(make('span', 'qq-repo-stat-icon', '★'));
|
||||
stars.appendChild(make('span', null, String(repo.stars_count || 0)));
|
||||
stars.title = '星标';
|
||||
meta.appendChild(stars);
|
||||
|
||||
var forks = make('span', 'qq-repo-stat');
|
||||
forks.appendChild(make('span', 'qq-repo-stat-icon', '⑂'));
|
||||
forks.appendChild(make('span', null, String(repo.forks_count || 0)));
|
||||
forks.title = '分支';
|
||||
meta.appendChild(forks);
|
||||
|
||||
var updated = relativeTime(repo.updated_at);
|
||||
meta.appendChild(make('span', 'qq-repo-time', updated ? updated + '更新' : ''));
|
||||
|
||||
card.appendChild(meta);
|
||||
return card;
|
||||
}
|
||||
|
||||
function render(list) {
|
||||
if (!list.length) { hide(); return; }
|
||||
grid.textContent = '';
|
||||
list.forEach(function (repo) { grid.appendChild(repoCard(repo)); });
|
||||
section.hidden = false;
|
||||
}
|
||||
|
||||
/* 离线预览:不碰网络,直接用页面里的假数据 */
|
||||
var demo = section.getAttribute('data-demo') === '1' && window.QQ_HOT_REPOS_DEMO;
|
||||
if (demo) {
|
||||
showSkeletons();
|
||||
window.setTimeout(function () { render(pickRepos(window.QQ_HOT_REPOS_DEMO)); }, reduceMotion ? 0 : 320);
|
||||
return;
|
||||
}
|
||||
|
||||
var endpoint = section.getAttribute('data-endpoint');
|
||||
if (!endpoint) { hide(); return; }
|
||||
|
||||
showSkeletons();
|
||||
|
||||
var controller = window.AbortController ? new window.AbortController() : null;
|
||||
var settled = false;
|
||||
var timer = window.setTimeout(function () {
|
||||
if (settled) return;
|
||||
settled = true;
|
||||
if (controller) {
|
||||
try { controller.abort(); } catch (e) { /* ignore */ }
|
||||
}
|
||||
hide();
|
||||
}, FETCH_TIMEOUT);
|
||||
|
||||
function done() {
|
||||
settled = true;
|
||||
window.clearTimeout(timer);
|
||||
}
|
||||
|
||||
var sep = endpoint.indexOf('?') === -1 ? '?' : '&';
|
||||
var url = endpoint + sep + 'sort=updated&order=desc&limit=' + FETCH_LIMIT + '&mode=source';
|
||||
|
||||
window.fetch(url, {
|
||||
method: 'GET',
|
||||
credentials: 'same-origin',
|
||||
headers: { Accept: 'application/json' },
|
||||
signal: controller ? controller.signal : undefined
|
||||
}).then(function (res) {
|
||||
if (!res.ok) throw new Error('HTTP ' + res.status);
|
||||
return res.json();
|
||||
}).then(function (data) {
|
||||
done();
|
||||
render(pickRepos(data && data.data));
|
||||
}).catch(function () {
|
||||
if (settled) return;
|
||||
done();
|
||||
hide();
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------------- 2. 复制 clone 命令 ---------------- */
|
||||
function fallbackCopy(text) {
|
||||
var area = document.createElement('textarea');
|
||||
area.value = text;
|
||||
area.setAttribute('readonly', '');
|
||||
area.style.position = 'fixed';
|
||||
area.style.top = '-1000px';
|
||||
area.style.opacity = '0';
|
||||
document.body.appendChild(area);
|
||||
area.select();
|
||||
var ok = false;
|
||||
try { ok = document.execCommand('copy'); } catch (e) { ok = false; }
|
||||
document.body.removeChild(area);
|
||||
return ok;
|
||||
}
|
||||
|
||||
function initCopy() {
|
||||
var buttons = document.querySelectorAll('[data-qq-copy]');
|
||||
Array.prototype.forEach.call(buttons, function (btn) {
|
||||
var text = btn.getAttribute('data-qq-copy');
|
||||
if (!text) return;
|
||||
var tip = btn.parentNode ? btn.parentNode.querySelector('.qq-qc-tip') : null;
|
||||
var resetTimer = 0;
|
||||
|
||||
function feedback() {
|
||||
btn.classList.add('is-copied');
|
||||
btn.setAttribute('aria-label', '已复制');
|
||||
if (tip) {
|
||||
tip.classList.add('is-on');
|
||||
tip.textContent = '已复制';
|
||||
}
|
||||
window.clearTimeout(resetTimer);
|
||||
resetTimer = window.setTimeout(function () {
|
||||
btn.classList.remove('is-copied');
|
||||
btn.setAttribute('aria-label', '复制 clone 命令');
|
||||
if (tip) tip.classList.remove('is-on');
|
||||
}, 1600);
|
||||
}
|
||||
|
||||
btn.addEventListener('click', function () {
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||
navigator.clipboard.writeText(text).then(feedback, function () {
|
||||
if (fallbackCopy(text)) feedback();
|
||||
});
|
||||
} else if (fallbackCopy(text)) {
|
||||
feedback();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
initHotRepos();
|
||||
initCopy();
|
||||
})();
|
||||
|
|
@ -15,4 +15,4 @@
|
|||
动效层:只在首页(.page-content.home)和登录页(.page-content.user.signin)生效,
|
||||
其它页面 qq-fx.js 里第一行就 return,不会加载 canvas、不会挂 rAF。
|
||||
*/}}
|
||||
<script src="{{AssetUrlPrefix}}/js/qq-fx.js?v=3" defer></script>
|
||||
<script src="{{AssetUrlPrefix}}/js/qq-fx.js" defer></script>
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
注意:只做外观增强,不引入任何外部依赖,全部资源随 custom/ 一起发布
|
||||
*/}}
|
||||
<link rel="preload" href="{{AssetUrlPrefix}}/fonts/jetbrains-mono-latin-400-normal.woff2" as="font" type="font/woff2" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/qq-ui.css?v=31">
|
||||
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/qq-fx.css?v=26">
|
||||
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/qq-pages.css?v=32">
|
||||
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/qq-ui.css?v=14">
|
||||
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/qq-fx.css?v=14">
|
||||
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/qq-pages.css?v=14">
|
||||
<meta name="theme-color" content="#60A5FA" media="(prefers-color-scheme: light)">
|
||||
<meta name="theme-color" content="#0D1117" media="(prefers-color-scheme: dark)">
|
||||
|
||||
|
|
|
|||
|
|
@ -1,105 +1,34 @@
|
|||
{{/* home.tmpl —— 未登录首页(模板覆盖,不改源码;删掉本文件即回到官方首页)
|
||||
v1.4 版式(方案 A + B 合并):
|
||||
· 首屏左右分栏:左 7/12 标题/口号/搜索/按钮,右 5/12 毛玻璃分支图 + terminal 小窗
|
||||
· 热门公开仓库:/api/v1/repos/search 取数,前端过滤排序后只留 3 条
|
||||
· 三张功能卡收尾,数字条已按方案 A 删除
|
||||
品牌色仍是蓝白;动效(粒子星座 / 光雾 / 打字机)由 qq-fx.css + qq-fx.js 提供。
|
||||
版式参考 GitHub 首页:
|
||||
· 居中的大标题 + 一句话说明 + 搜索框 + 主次按钮
|
||||
· 下面一排功能卡片,再往下一条数字/事实带
|
||||
· 品牌色仍是蓝白,动效(粒子星座 / 光雾)由 qq-fx.css + qq-fx.js 提供
|
||||
i18n:新的标题/卡片文案是本项目自己的,直接写中文;Gitea 版本号用 {{AppVer}}。 */}}
|
||||
{{template "base/head" .}}
|
||||
<div role="main" aria-label="{{ctx.Locale.Tr "home"}}" class="page-content home qq-landing">
|
||||
|
||||
<section class="qq-lp-hero">
|
||||
<div class="qq-lp-hero-copy">
|
||||
<p class="qq-lp-eyebrow">私有部署 · 轻量 · 全功能</p>
|
||||
<h1 class="qq-lp-title">{{AppName}}</h1>
|
||||
<p class="qq-lp-sub" data-qq-type="自己的代码,自己的地方。">自己的代码,自己的地方。</p>
|
||||
|
||||
<form class="qq-lp-search" action="{{AppSubUrl}}/explore/repos" method="get">
|
||||
<input type="search" name="q" placeholder="搜索仓库、用户、组织…" aria-label="搜索仓库">
|
||||
<button class="ui primary button" type="submit">搜索</button>
|
||||
</form>
|
||||
|
||||
<div class="qq-lp-cta">
|
||||
{{if .IsSigned}}
|
||||
<a class="ui primary button" href="{{AppSubUrl}}/">进入控制台</a>
|
||||
<a class="ui basic button" href="{{AppSubUrl}}/repo/create">新建仓库</a>
|
||||
{{else}}
|
||||
<a class="ui primary button" href="{{AppSubUrl}}/user/sign_up">免费注册</a>
|
||||
<a class="ui basic button" href="{{AppSubUrl}}/user/login">登录</a>
|
||||
{{end}}
|
||||
<a class="qq-lp-link" href="{{AppSubUrl}}/explore/repos">浏览全部仓库 →</a>
|
||||
</div>
|
||||
<div class="qq-logo-halo qq-lp-logo">
|
||||
<img width="72" height="72" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{AppName}}">
|
||||
</div>
|
||||
<p class="qq-lp-eyebrow">私有部署 · 轻量 · 全功能</p>
|
||||
<h1 class="qq-lp-title">{{AppName}}</h1>
|
||||
<p class="qq-lp-sub">自己的代码,自己的地方。</p>
|
||||
|
||||
<div class="qq-lp-visual">
|
||||
<div class="qq-lp-graph" aria-hidden="true">
|
||||
<svg class="qq-lp-graph-svg" viewBox="0 0 600 400" preserveAspectRatio="xMidYMid meet" focusable="false">
|
||||
<defs>
|
||||
<linearGradient id="qqg-line" x1="0" y1="1" x2="1" y2="0">
|
||||
<stop offset="0%" stop-color="#1D4ED8"/>
|
||||
<stop offset="55%" stop-color="#3B82F6"/>
|
||||
<stop offset="100%" stop-color="#60A5FA"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g class="qqg-faint">
|
||||
<path class="qqg-edge-faint" d="M46 300 C120 300 130 260 200 260 C280 260 300 300 370 300 C440 300 460 260 540 260"/>
|
||||
<path class="qqg-edge-faint qqg-flow" d="M46 240 C120 240 120 150 200 150 C270 150 280 240 350 240 C420 240 430 150 510 150 C545 150 560 160 574 166"/>
|
||||
<path class="qqg-link" d="M200 150 L200 260"/>
|
||||
<path class="qqg-link" d="M350 240 L370 300"/>
|
||||
<path class="qqg-link" d="M510 150 L540 260"/>
|
||||
<circle class="qqg-node-soft" cx="46" cy="300" r="2.5"/>
|
||||
<circle class="qqg-node-soft" cx="370" cy="300" r="2.5"/>
|
||||
<circle class="qqg-node-soft" cx="540" cy="260" r="2.5"/>
|
||||
</g>
|
||||
<path class="qqg-edge" d="M46 240 C120 240 120 150 200 150 C270 150 280 240 350 240 C420 240 430 150 510 150 C545 150 560 160 574 166"/>
|
||||
<path class="qqg-edge" d="M46 300 C120 300 130 260 200 260 C280 260 300 300 370 300 C440 300 460 260 540 260"/>
|
||||
<path class="qqg-edge" d="M200 150 C235 150 240 205 275 205 C310 205 315 240 350 240"/>
|
||||
<g class="qqg-nodes">
|
||||
<circle class="qqg-node" cx="46" cy="240" r="5"/>
|
||||
<circle class="qqg-node-core" cx="200" cy="150" r="6"/>
|
||||
<circle class="qqg-node-core" cx="350" cy="240" r="6"/>
|
||||
<circle class="qqg-node" cx="510" cy="150" r="5"/>
|
||||
<circle class="qqg-node" cx="574" cy="166" r="4"/>
|
||||
<circle class="qqg-node" cx="46" cy="300" r="5"/>
|
||||
<circle class="qqg-node" cx="200" cy="260" r="4"/>
|
||||
<circle class="qqg-node-core" cx="370" cy="300" r="6"/>
|
||||
<circle class="qqg-node" cx="540" cy="260" r="4"/>
|
||||
<circle class="qqg-node" cx="275" cy="205" r="4"/>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
<form class="qq-lp-search" action="{{AppSubUrl}}/explore/repos" method="get">
|
||||
<input type="search" name="q" placeholder="搜索仓库、用户、组织…" aria-label="搜索仓库">
|
||||
<button class="ui primary button" type="submit">搜索</button>
|
||||
</form>
|
||||
|
||||
<div class="qq-lp-term">
|
||||
<div class="qq-lp-term-bar" aria-hidden="true">
|
||||
<span class="qq-lp-term-dots"><i></i><i></i><i></i></span>
|
||||
<span class="qq-lp-term-title">terminal</span>
|
||||
</div>
|
||||
<div class="qq-lp-term-line">
|
||||
<code class="qq-lp-term-code"><span class="qq-prompt">$</span> git clone <span class="qq-url">https://git.qyhhh.top/qq/repo.git</span></code>
|
||||
<span class="qq-qc-tip" aria-hidden="true">已复制</span>
|
||||
<button class="qq-lp-copy" type="button" data-qq-copy="git clone https://git.qyhhh.top/qq/repo.git" aria-label="复制 clone 命令">
|
||||
<svg class="qq-copy-icon" viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<rect x="5.5" y="5.5" width="8" height="8" rx="1.6"/>
|
||||
<path d="M10.5 5.5V4a1.5 1.5 0 0 0-1.5-1.5H4A1.5 1.5 0 0 0 2.5 4v5A1.5 1.5 0 0 0 4 10.5h1.5"/>
|
||||
</svg>
|
||||
<svg class="qq-copy-check" viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<path d="M3 8.5 6.2 11.7 13 4.5"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="qq-lp-hot" id="qq-hot-repos" data-endpoint="{{AppSubUrl}}/api/v1/repos/search" hidden>
|
||||
<div class="qq-lp-sec-head">
|
||||
<h2>热门公开仓库</h2>
|
||||
<a class="qq-lp-more" href="{{AppSubUrl}}/explore/repos?sort=moststars">查看全部 →</a>
|
||||
</div>
|
||||
<div class="qq-hot-grid" data-qq-hot-grid>
|
||||
<div class="qq-repo-card qq-skeleton" aria-hidden="true"><span class="qq-sk-bar qq-sk-title"></span><span class="qq-sk-bar qq-sk-desc"></span><span class="qq-sk-bar qq-sk-desc qq-sk-desc-2"></span><div class="qq-sk-meta"><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill qq-sk-pill-end"></span></div></div>
|
||||
<div class="qq-repo-card qq-skeleton" aria-hidden="true"><span class="qq-sk-bar qq-sk-title"></span><span class="qq-sk-bar qq-sk-desc"></span><span class="qq-sk-bar qq-sk-desc qq-sk-desc-2"></span><div class="qq-sk-meta"><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill qq-sk-pill-end"></span></div></div>
|
||||
<div class="qq-repo-card qq-skeleton" aria-hidden="true"><span class="qq-sk-bar qq-sk-title"></span><span class="qq-sk-bar qq-sk-desc"></span><span class="qq-sk-bar qq-sk-desc qq-sk-desc-2"></span><div class="qq-sk-meta"><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill qq-sk-pill-end"></span></div></div>
|
||||
<div class="qq-lp-cta">
|
||||
{{if .IsSigned}}
|
||||
<a class="ui primary button" href="{{AppSubUrl}}/">进入控制台</a>
|
||||
<a class="ui basic button" href="{{AppSubUrl}}/repo/create">新建仓库</a>
|
||||
{{else}}
|
||||
<a class="ui primary button" href="{{AppSubUrl}}/user/sign_up">免费注册</a>
|
||||
<a class="ui basic button" href="{{AppSubUrl}}/user/login">登录</a>
|
||||
{{end}}
|
||||
<a class="qq-lp-link" href="{{AppSubUrl}}/explore/repos">浏览全部仓库 →</a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
|
@ -121,6 +50,24 @@
|
|||
</article>
|
||||
</section>
|
||||
|
||||
<section class="qq-lp-stats">
|
||||
<div class="qq-lp-stat">
|
||||
<strong>{{AppVer}}</strong>
|
||||
<span>Gitea 版本</span>
|
||||
</div>
|
||||
<div class="qq-lp-stat">
|
||||
<strong>MIT</strong>
|
||||
<span>开源协议</span>
|
||||
</div>
|
||||
<div class="qq-lp-stat">
|
||||
<strong>SQLite</strong>
|
||||
<span>零依赖存储</span>
|
||||
</div>
|
||||
<div class="qq-lp-stat">
|
||||
<strong>1 台</strong>
|
||||
<span>服务器即可跑</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<script src="{{AssetUrlPrefix}}/js/qq-home.js?v=1" defer></script>
|
||||
{{template "base/footer" .}}
|
||||
|
|
|
|||
|
|
@ -9,15 +9,11 @@
|
|||
<div class="qq-dash-shell">
|
||||
{{template "base/alert" .}}
|
||||
|
||||
{{/* 顶部通栏:欢迎语在上,贡献热力图在下;三栏在它们下面 */}}
|
||||
{{/* 问候语单独做成页头:左置顶,横跨整页;下面三栏再在它下面顶部对齐 */}}
|
||||
<h1 class="qq-dash-hello">
|
||||
{{.SignedUser.Name}}<span class="qq-dash-hi">,欢迎回来</span>
|
||||
</h1>
|
||||
|
||||
<section class="qq-dash-card qq-dash-heat qq-dash-heat-top">
|
||||
{{template "user/heatmap" .}}
|
||||
</section>
|
||||
|
||||
<div class="qq-dash-grid">
|
||||
|
||||
<aside class="qq-dash-side">
|
||||
|
|
@ -71,6 +67,10 @@
|
|||
</div>
|
||||
</section>
|
||||
|
||||
<section class="qq-dash-card qq-dash-heat">
|
||||
{{template "user/heatmap" .}}
|
||||
</section>
|
||||
|
||||
<section class="qq-dash-card qq-dash-feed">
|
||||
<div class="qq-panel-head">最近动态</div>
|
||||
{{template "user/dashboard/feeds" .}}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
## 一、前提
|
||||
|
||||
1. 已在本地/镜像里打开 `preview/index.html`,日夜两种模式都看过,认可配色与留白。
|
||||
2. 仓库已按实际版本打候选标签 `vX.Y.Z-rcN`(`git tag -l` 可查)。
|
||||
2. 仓库已打标签 `v1.0-rc1`(`git tag -l` 可查)。
|
||||
3. QQ 明确说过「可以部署」。
|
||||
|
||||
## 二、预演(随时可做,零风险)
|
||||
|
|
@ -30,15 +30,12 @@ cd ~/projects/Gitea-font
|
|||
|
||||
## 四、回滚
|
||||
|
||||
部署脚本会完整备份 `custom/`(包含三套 `theme-qq*.css`)和 `app.ini`,并在重启或 HTTP 健康检查失败时自动回滚。人工回滚统一使用:
|
||||
|
||||
```bash
|
||||
./scripts/rollback.sh --list
|
||||
./scripts/rollback.sh /var/backups/gitea-custom-<时间戳>.tar.gz
|
||||
sudo tar xzf /var/backups/gitea-custom-<时间戳>.tar.gz -C /
|
||||
sudo chown -R git:git /var/lib/gitea/custom
|
||||
sudo systemctl restart gitea
|
||||
```
|
||||
|
||||
`rollback.sh` 会先校验归档、再备份当前状态、停止服务,并通过 `rsync --delete` 精确恢复。旧版本部署脚本生成的备份缺少 QQ 主题,默认拒绝;只有确认承担主题缺失风险时才可附加 `--allow-incomplete`。
|
||||
|
||||
## 五、部署后自查清单
|
||||
|
||||
- [ ] `https://git.qyhhh.top/` 首页 logo 变成蓝白 Git-Q,圆外无白框
|
||||
|
|
|
|||
|
|
@ -1,140 +0,0 @@
|
|||
# 规划 · 未登录首页 v1.4(方案 A 首屏 + 热门公开仓库)
|
||||
|
||||
> 状态:**仅规划,未动任何代码**(2026-11-05)
|
||||
> 目标实例:`https://git.qyhhh.top`(Gitea 1.21.11)
|
||||
> 铁律不变:只走 `custom/` 覆盖、先 `preview/` 后线上、蓝白配色、**禁止绿色**、大量留白。
|
||||
|
||||
---
|
||||
|
||||
## 1. 已确认的决策
|
||||
|
||||
| # | 问题 | 决定 |
|
||||
| --- | --- | --- |
|
||||
| 1 | 热门仓库放几个 | **单行 3 个**(宽屏 3 列 × 1 行) |
|
||||
| 2 | 排序 | **星标优先**(同星数再按最近更新) |
|
||||
| 3 | Fork / 镜像仓库 | **排除** |
|
||||
| 4 | 数字条 | **待定**,默认建议:删除(见 §6) |
|
||||
| 5 | 终端 `git clone` 示例 | **占位地址** `https://git.qyhhh.top/qq/repo.git` |
|
||||
|
||||
参考效果图:`dsh-image-gen/image-5f71a3ab.png`(方案 A)、`dsh-image-gen/image-c8208180.png`(方案 B 的仓库区)。
|
||||
|
||||
---
|
||||
|
||||
## 2. 页面结构(自上而下)
|
||||
|
||||
| 区块 | 内容 | 备注 |
|
||||
| --- | --- | --- |
|
||||
| 顶栏 | Gitea 原生顶栏 | 不动,沿用 `qq-ui.css` 毛玻璃 |
|
||||
| ① 首屏 Hero(左右分栏) | **左 7/12**:渐变大标题 `{{AppName}}`、口号「自己的代码,自己的地方。」、搜索框(提交到 `/explore/repos`)、主按钮「免费注册」/ 次按钮「登录」/ 文字链「浏览全部仓库 →」<br>**右 5/12**:毛玻璃卡片,内含 SVG 提交分支图(蓝色节点 + 分叉线),右下叠终端小窗 `$ git clone https://git.qyhhh.top/qq/repo.git` + 复制按钮 | 方案 A |
|
||||
| ② 热门公开仓库 | 标题「热门公开仓库」+ 右侧「查看全部 →」(`/explore/repos?sort=moststars`);**3 张卡片单行** | 方案 B 的仓库区 |
|
||||
| ③ 功能卡 | 沿用现有三卡(版本控制 / 议题与看板 / 数据自持),视觉降一级作为收尾 | 文案不变 |
|
||||
| ④ 数字条 | 待定(§6) | — |
|
||||
| 页脚 | 左站点信息 / 中语言切换 / 右 ICP 备案号 | 不动 |
|
||||
|
||||
整体限宽 **1280px 居中**,与登录后控制台一致。
|
||||
|
||||
---
|
||||
|
||||
## 3. 仓库卡片规格
|
||||
|
||||
```
|
||||
┌────────────────────────────────────┐
|
||||
│ (头像20px) owner/仓库名 │
|
||||
│ 描述文字,最多两行,超出省略…… │
|
||||
│ ● 语言 ★ 12 ⑂ 3 3 天前更新 │
|
||||
└────────────────────────────────────┘
|
||||
```
|
||||
|
||||
- 语言圆点:**只用品牌蓝色阶**(`#1D4ED8` / `#3B82F6` / `#60A5FA` / `#93C5FD` 按语言名哈希取色),不用 Gitea 原生语言色(含绿色)。
|
||||
- hover:上浮 2px,描边变主色 `#3B82F6`(深色 `#38BDF8`)。
|
||||
- 深色模式:卡片底 `#161B22`,沿用 `qq-dark` 变量。
|
||||
- 圆角 8px,字体 JetBrains Mono(数字/仓库名)。
|
||||
|
||||
---
|
||||
|
||||
## 4. 数据来源(关键技术点)
|
||||
|
||||
Gitea 1.21 的首页 handler **不给模板传仓库列表**,因此改为前端调用官方公开 API:
|
||||
|
||||
```
|
||||
GET /api/v1/repos/search?sort=stars&order=desc&limit=10&mode=source
|
||||
```
|
||||
|
||||
- 匿名调用只返回公开仓库,不会泄露私有仓库。
|
||||
- 取多一些(10 个)在前端二次过滤:去掉 `fork === true`、`mirror === true`、`private === true`、`archived === true`(归档是否排除可再议),按 `stars_count` 降序、同星按 `updated_at` 降序,截取前 **3** 个。
|
||||
- 使用字段:`full_name`、`html_url`、`description`、`language`、`stars_count`、`forks_count`、`updated_at`、`owner.avatar_url`。
|
||||
- 状态处理:
|
||||
- 加载中:3 张骨架卡占位(无闪烁时遵守 `prefers-reduced-motion`);
|
||||
- 结果为 0:整块隐藏,只留首屏「浏览全部仓库 →」;
|
||||
- 接口失败 / 超时(5s):静默隐藏,不报错。
|
||||
- **前置条件**:需实测匿名能访问该接口(`REQUIRE_SIGNIN_VIEW=false` 且 API 未禁用)。若不可用,退路是只放「查看全部仓库」入口,不做卡片。
|
||||
|
||||
---
|
||||
|
||||
## 5. 涉及文件
|
||||
|
||||
| 文件 | 改动 |
|
||||
| --- | --- |
|
||||
| `custom/templates/home.tmpl` | 重写 Hero 为左右分栏;新增仓库区空容器 `#qq-hot-repos` + 3 张骨架卡;`<script defer src="{{AssetUrlPrefix}}/js/qq-home.js?v=…">` 仅在首页引入 |
|
||||
| `custom/public/assets/css/qq-pages.css` | 新增 `.qq-lp-split` / `.qq-lp-graph` / `.qq-lp-term` / `.qq-repo-card` / `.qq-skeleton` 等样式,沿用 `.qq-lp-*` 前缀 |
|
||||
| `custom/public/assets/js/qq-home.js`(新增) | 拉 API → 过滤排序 → 渲染卡片;复制 clone 命令(`navigator.clipboard`,失败回退 `execCommand`);相对时间格式化 |
|
||||
| `custom/public/assets/js/qq-fx.js` | 光斑 / 打字机挂载点随新 Hero 结构调整(选择器更新) |
|
||||
| `custom/public/assets/css/qq-fx.css` | 如有 Hero 相关选择器同步调整 |
|
||||
| `preview/index.html`(+ `preview/app.js`) | 落地页段换成新版式,仓库区用**本地假数据**,不打线上 |
|
||||
| `docs/TODO.md` | 新增「阶段 8 · 首页 v1.4」条目与部署记录 |
|
||||
|
||||
不新增模板钩子以外的任何覆盖,不改 `app.ini`。
|
||||
|
||||
---
|
||||
|
||||
## 6. 关于「数字条」(待确认)
|
||||
|
||||
数字条指当前首页最底部那一排四格:
|
||||
|
||||
| 1.21.11 | MIT | MySQL | 1 台 |
|
||||
| --- | --- | --- | --- |
|
||||
| Gitea 版本 | 开源协议 | 独立数据库存储 | 服务器即可跑 |
|
||||
|
||||
对访客价值不高,且新版已有仓库区和功能卡,页面会偏长。三个选项:
|
||||
|
||||
- **A. 删除(默认建议)**
|
||||
- B. 缩成首屏标题下一行小字:`Gitea 1.21.11 · MIT · 自托管`
|
||||
- C. 保持原样放在功能卡下面
|
||||
|
||||
未回复则按 **A** 执行。
|
||||
|
||||
---
|
||||
|
||||
## 7. 响应式与无障碍
|
||||
|
||||
| 断点 | 行为 |
|
||||
| --- | --- |
|
||||
| > 1024px | Hero 左右分栏;仓库 3 列 |
|
||||
| 641–1024px | Hero 上下堆叠(分支图卡片在文字下方);仓库 3 列压缩 → 不足时 2 列 + 第三张换行 |
|
||||
| ≤ 640px | 仓库 1 列;终端小窗缩为单行可横向滚动;分支图隐藏 |
|
||||
|
||||
- `prefers-reduced-motion`:分支图静止、骨架不闪、关闭光斑。
|
||||
- 仓库卡片整卡为 `<a>`,有可见焦点环;复制按钮有 `aria-label` 和「已复制」反馈。
|
||||
|
||||
---
|
||||
|
||||
## 8. 执行步骤(待批准后进行)
|
||||
|
||||
1. **接口验证**:匿名 `curl https://git.qyhhh.top/api/v1/repos/search?sort=stars&order=desc&limit=10&mode=source`,确认可用并记录当前公开仓库数量。
|
||||
2. **离线预览**:在 `preview/` 做出新版,截图 日间 / 夜间 / 375px 移动端 交 QQ 确认。
|
||||
3. **接入模板**:改 `home.tmpl` / `qq-pages.css` / 新增 `qq-home.js`;跑 `scripts/audit_colors.py` 确认无绿色;提交并打 `v1.4-rc1`。
|
||||
4. **部署**:`./scripts/deploy.sh` 预演 → QQ 批准 → `./scripts/deploy.sh --yes`(自动备份到 `/var/backups/`)→ 线上实拍复核 → 打 `v1.4-live`。
|
||||
5. **回滚预案**:`./scripts/rollback.sh /var/backups/gitea-custom-<时间戳>.tar.gz`。
|
||||
|
||||
---
|
||||
|
||||
## 9. 验收清单
|
||||
|
||||
- [ ] 未登录访问首页:首屏左右分栏,分支图 + 终端正常显示
|
||||
- [ ] 复制按钮可复制 `git clone https://git.qyhhh.top/qq/repo.git`
|
||||
- [ ] 热门仓库显示 ≤3 个,按星标降序,无 fork / 镜像 / 私有仓库
|
||||
- [ ] 无公开仓库或接口失败时整块隐藏,页面无报错
|
||||
- [ ] 日间 / 夜间 / 跟随系统 三主题无绿色、无白边
|
||||
- [ ] 375px 移动端无横向溢出
|
||||
- [ ] 登录后首页仍为控制台,不受影响
|
||||
- [ ] 页脚 ICP 备案号与语言切换正常
|
||||
20
docs/TODO.md
20
docs/TODO.md
|
|
@ -2,15 +2,14 @@
|
|||
|
||||
> 仓库里唯一持久化的进度清单。`[x]` 完成 `[~]` 进行中 `[ ]` 未开始 `[!]` 等待批准
|
||||
|
||||
## 当前状态(2026-11-05)
|
||||
## 当前状态(2026-11-03)
|
||||
|
||||
| 项目 | 值 |
|
||||
| --- | --- |
|
||||
| 线上地址 | <https://git.qyhhh.top> |
|
||||
| Gitea 版本 | 1.21.11(生产数据库:MySQL) |
|
||||
| Gitea 版本 | 1.21.11(`bindata, sqlite`) |
|
||||
| 生效主题 | `DEFAULT_THEME = qq-auto`(浅色 `qq-light` / 深色 `qq-dark` / 跟随系统 `qq-auto`) |
|
||||
| 当前标签 | `v1.4.1-live`(字标 Inter + 明亮模式去粒子/去毛玻璃) |
|
||||
| 上一版 | `v1.4-live`(方案 A+B 落地页) |
|
||||
| 当前标签 | `v1.3.3-live`(右栏去重 + 热力图单层框) |
|
||||
| 源码仓库 | <https://github.com/newbieQQ/QQGit>(private) |
|
||||
| 回滚方式 | `./scripts/rollback.sh /var/backups/gitea-custom-<时间戳>.tar.gz` |
|
||||
|
||||
|
|
@ -76,23 +75,10 @@
|
|||
- [x] 7.6 提交 `dd19bbb`(tag `v1.1-rc1`)→ 部署 → 实拍复核 → 修布局 `25d8895`(tag `v1.1-live`)
|
||||
- [x] 7.7 移动端 375px 适配:光斑横向溢出裁剪、光环与标题字号压缩
|
||||
|
||||
## 阶段 8 · 落地页 v1.4(方案 A + B)— 完成,已上线
|
||||
|
||||
- [x] 8.1 按 `docs/PLAN-landing-v1.4.md` 重写 `custom/templates/home.tmpl`:首屏左 7 / 右 5 分栏(标题 / 口号 / 搜索 / 双按钮 + 毛玻璃分支图 + terminal 复制窗)
|
||||
- [x] 8.2 新增 `custom/public/assets/js/qq-home.js`:公开 API 取数(`sort=updated`,客户端按星标→更新时间排序,排除 fork/镜像/私有/归档),骨架屏 → 3 张卡片;失败或 0 条静默隐藏
|
||||
- [x] 8.3 `qq-pages.css` 重写落地页段(1280px 限宽、蓝白色阶、语言圆点仅品牌蓝、hover / 焦点环、暗色变量、1024 / 640 断点、reduced-motion);Dashboard 段原样保留
|
||||
- [x] 8.4 删除数字条(方案 A);三张功能卡降级为分隔线下方收尾
|
||||
- [x] 8.5 离线预览更新:`preview/index.html` 首页段 + 假数据 6 条、`?only=home&bare=1` 截图模式、`preview/mobile-frame.html` 供 375px 复核(headless Chrome 窗口宽度下限 500px)
|
||||
- [x] 8.6 截图 1440 / 834 / 375 的浅色与深色;`audit_colors.py`、`check_preview.py` 全绿
|
||||
- [x] 8.7 提交并打标签 `v1.4-rc1`(`bbce78a`)→ `deploy.sh` 预演 → QQ 批准 → `--yes` 上线 → 浅色/深色实拍复核 → 打标签 `v1.4-live`
|
||||
|
||||
## 部署记录
|
||||
|
||||
| 时间 | 动作 | 备份 |
|
||||
| --- | --- | --- |
|
||||
| 2026-11-05 15:46 | **v1.4.2** 仓库卡 hover 下划线修复(Gitea 基础 `a:hover` 覆盖) | `gitea-custom-20261105-154643.tar.gz` |
|
||||
| 2026-11-05 15:36 | **v1.4.1 字标与明净度**上线:QQGit 字标改 Inter 800,落地页去背景粒子、hero 光斑、分支卡毛玻璃,仓库卡改不透明白底 | `gitea-custom-20261105-153634.tar.gz` |
|
||||
| 2026-11-05 11:03 | **v1.4 落地页**上线(方案 A+B:首屏分栏 + terminal 复制窗 + 热门仓库三卡,删数字条) | `gitea-custom-20261105-110309.tar.gz` |
|
||||
| 2026-11-03 09:37 | 首次上线:`deploy.sh --yes --patch-ini`(custom/ 全量 + `[ui]` 切 `qq-auto`) | `gitea-custom-20261103-093751.tar.gz` |
|
||||
| 2026-11-03 09:39 | 语言圆点统一品牌蓝 + 页脚去重 | `gitea-custom-20261103-093913.tar.gz` |
|
||||
| 2026-11-03 09:40 | 主题选择器显示名(`QQGit · 浅色/深色/跟随系统`) | `gitea-custom-20261103-094007.tar.gz` |
|
||||
|
|
|
|||
|
|
@ -31,37 +31,16 @@
|
|||
})();
|
||||
|
||||
|
||||
/* ?only=login | ?only=home —— 只显示某一演示区(方便单独截图/对比) */
|
||||
/* ?only=login —— 只显示登录页演示区(方便单独截图/对比) */
|
||||
(function () {
|
||||
var params = new URLSearchParams(location.search);
|
||||
var only = params.get('only');
|
||||
if (!only) return;
|
||||
var id = { login: 'login-demo', home: 'landing-demo' }[only];
|
||||
if (!id) return;
|
||||
var only = new URLSearchParams(location.search).get('only');
|
||||
if (only !== 'login') return;
|
||||
var page = document.querySelector('.page');
|
||||
var keep = document.getElementById(id);
|
||||
if (!page || !keep) return;
|
||||
var label = keep.previousElementSibling;
|
||||
if (!page) return;
|
||||
var keep = document.getElementById('login-demo');
|
||||
var label = keep && keep.previousElementSibling;
|
||||
Array.prototype.forEach.call(page.children, function (el) {
|
||||
if (el === keep || el === label) return;
|
||||
el.style.display = 'none';
|
||||
});
|
||||
if (only === 'home') {
|
||||
/* 让离线预览也按线上 1280px 的容器宽度呈现 */
|
||||
page.style.maxWidth = '1320px';
|
||||
page.style.paddingTop = '0';
|
||||
keep.style.border = '0';
|
||||
keep.style.background = 'transparent';
|
||||
keep.style.borderRadius = '0';
|
||||
if (label) label.style.display = 'none';
|
||||
if (params.get('bare') === '1') {
|
||||
/* 截图用:预览器自己的导航会撑宽小屏,隐藏它才能看到真实 375px 版式 */
|
||||
page.style.padding = '0';
|
||||
page.style.maxWidth = 'none';
|
||||
['#navbar', '.switcher'].forEach(function (sel) {
|
||||
var el = document.querySelector(sel);
|
||||
if (el) el.style.display = 'none';
|
||||
});
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -29,19 +29,14 @@
|
|||
<input type="search" placeholder="搜索仓库…" style="max-width:180px;margin-right:10px">
|
||||
<span class="avatar">Q</span>
|
||||
</nav>
|
||||
|
||||
<div role="main" aria-label="仪表盘" class="page-content dashboard feeds qq-dash">
|
||||
<div class="qq-dash-shell">
|
||||
|
||||
<h1 class="qq-dash-hello">newbie<span class="qq-dash-hi">,欢迎回来</span></h1>
|
||||
|
||||
<section class="qq-dash-card qq-dash-heat qq-dash-heat-top">
|
||||
<div class="qq-heatmap-mock">
|
||||
<div class="qq-heatmap-cells"></div>
|
||||
<div class="qq-heatmap-legend"><span>少</span><i></i><i></i><i></i><i></i><i></i><span>多</span></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="qq-dash-grid">
|
||||
|
||||
<aside class="qq-dash-side">
|
||||
<details class="qq-quicknav">
|
||||
<summary>
|
||||
|
|
@ -77,7 +72,6 @@
|
|||
|
||||
<main class="qq-dash-main">
|
||||
|
||||
|
||||
<form class="qq-dash-search" onsubmit="return false">
|
||||
<span>⌕</span>
|
||||
<input type="search" placeholder="前往仓库…(输入关键字回车搜索)">
|
||||
|
|
@ -104,6 +98,12 @@
|
|||
</div>
|
||||
</section>
|
||||
|
||||
<section class="qq-dash-card qq-dash-heat">
|
||||
<div class="qq-heatmap-mock">
|
||||
<div class="qq-heatmap-cells"></div>
|
||||
<div class="qq-heatmap-legend"><span>少</span><i></i><i></i><i></i><i></i><i></i><span>多</span></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="qq-dash-card qq-dash-feed">
|
||||
<div class="qq-panel-head">最近动态</div>
|
||||
|
|
|
|||
|
|
@ -40,93 +40,21 @@
|
|||
|
||||
<!-- ============ 1. 未登录首页 ============ -->
|
||||
<div class="section-label">首页(未登录 · custom/templates/home.tmpl)</div>
|
||||
<div class="segment" id="landing-demo" style="padding:0">
|
||||
<div class="page-content home qq-landing">
|
||||
<div class="segment" style="padding:0">
|
||||
<div class="page-content home qq-landing" style="padding-top:24px">
|
||||
<section class="qq-lp-hero">
|
||||
<div class="qq-lp-hero-copy">
|
||||
<p class="qq-lp-eyebrow">私有部署 · 轻量 · 全功能</p>
|
||||
<h1 class="qq-lp-title">QQGit</h1>
|
||||
<p class="qq-lp-sub" data-qq-type="自己的代码,自己的地方。">自己的代码,自己的地方。</p>
|
||||
<form class="qq-lp-search" onsubmit="return false">
|
||||
<input type="search" placeholder="搜索仓库、用户、组织…">
|
||||
<button class="ui primary button" type="submit">搜索</button>
|
||||
</form>
|
||||
<div class="qq-lp-cta">
|
||||
<a class="ui primary button" href="#">免费注册</a>
|
||||
<a class="ui basic button" href="#">登录</a>
|
||||
<a class="qq-lp-link" href="#">浏览全部仓库 →</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="qq-lp-visual">
|
||||
<div class="qq-lp-graph" aria-hidden="true">
|
||||
<svg class="qq-lp-graph-svg" viewBox="0 0 600 400" preserveAspectRatio="xMidYMid meet" focusable="false">
|
||||
<defs>
|
||||
<linearGradient id="qqg-line" x1="0" y1="1" x2="1" y2="0">
|
||||
<stop offset="0%" stop-color="#1D4ED8"/>
|
||||
<stop offset="55%" stop-color="#3B82F6"/>
|
||||
<stop offset="100%" stop-color="#60A5FA"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g class="qqg-faint">
|
||||
<path class="qqg-edge-faint" d="M46 300 C120 300 130 260 200 260 C280 260 300 300 370 300 C440 300 460 260 540 260"/>
|
||||
<path class="qqg-edge-faint qqg-flow" d="M46 240 C120 240 120 150 200 150 C270 150 280 240 350 240 C420 240 430 150 510 150 C545 150 560 160 574 166"/>
|
||||
<path class="qqg-link" d="M200 150 L200 260"/>
|
||||
<path class="qqg-link" d="M350 240 L370 300"/>
|
||||
<path class="qqg-link" d="M510 150 L540 260"/>
|
||||
<circle class="qqg-node-soft" cx="46" cy="300" r="2.5"/>
|
||||
<circle class="qqg-node-soft" cx="370" cy="300" r="2.5"/>
|
||||
<circle class="qqg-node-soft" cx="540" cy="260" r="2.5"/>
|
||||
</g>
|
||||
<path class="qqg-edge" d="M46 240 C120 240 120 150 200 150 C270 150 280 240 350 240 C420 240 430 150 510 150 C545 150 560 160 574 166"/>
|
||||
<path class="qqg-edge" d="M46 300 C120 300 130 260 200 260 C280 260 300 300 370 300 C440 300 460 260 540 260"/>
|
||||
<path class="qqg-edge" d="M200 150 C235 150 240 205 275 205 C310 205 315 240 350 240"/>
|
||||
<g class="qqg-nodes">
|
||||
<circle class="qqg-node" cx="46" cy="240" r="5"/>
|
||||
<circle class="qqg-node-core" cx="200" cy="150" r="6"/>
|
||||
<circle class="qqg-node-core" cx="350" cy="240" r="6"/>
|
||||
<circle class="qqg-node" cx="510" cy="150" r="5"/>
|
||||
<circle class="qqg-node" cx="574" cy="166" r="4"/>
|
||||
<circle class="qqg-node" cx="46" cy="300" r="5"/>
|
||||
<circle class="qqg-node" cx="200" cy="260" r="4"/>
|
||||
<circle class="qqg-node-core" cx="370" cy="300" r="6"/>
|
||||
<circle class="qqg-node" cx="540" cy="260" r="4"/>
|
||||
<circle class="qqg-node" cx="275" cy="205" r="4"/>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<div class="qq-lp-term">
|
||||
<div class="qq-lp-term-bar" aria-hidden="true">
|
||||
<span class="qq-lp-term-dots"><i></i><i></i><i></i></span>
|
||||
<span class="qq-lp-term-title">terminal</span>
|
||||
</div>
|
||||
<div class="qq-lp-term-line">
|
||||
<code class="qq-lp-term-code"><span class="qq-prompt">$</span> git clone <span class="qq-url">https://git.qyhhh.top/qq/repo.git</span></code>
|
||||
<span class="qq-qc-tip" aria-hidden="true">已复制</span>
|
||||
<button class="qq-lp-copy" type="button" data-qq-copy="git clone https://git.qyhhh.top/qq/repo.git" aria-label="复制 clone 命令">
|
||||
<svg class="qq-copy-icon" viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<rect x="5.5" y="5.5" width="8" height="8" rx="1.6"/>
|
||||
<path d="M10.5 5.5V4a1.5 1.5 0 0 0-1.5-1.5H4A1.5 1.5 0 0 0 2.5 4v5A1.5 1.5 0 0 0 4 10.5h1.5"/>
|
||||
</svg>
|
||||
<svg class="qq-copy-check" viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<path d="M3 8.5 6.2 11.7 13 4.5"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="qq-lp-hot" id="qq-hot-repos" data-demo="1" hidden>
|
||||
<div class="qq-lp-sec-head">
|
||||
<h2>热门公开仓库</h2>
|
||||
<a class="qq-lp-more" href="#">查看全部 →</a>
|
||||
</div>
|
||||
<div class="qq-hot-grid" data-qq-hot-grid>
|
||||
<div class="qq-repo-card qq-skeleton" aria-hidden="true"><span class="qq-sk-bar qq-sk-title"></span><span class="qq-sk-bar qq-sk-desc"></span><span class="qq-sk-bar qq-sk-desc qq-sk-desc-2"></span><div class="qq-sk-meta"><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill qq-sk-pill-end"></span></div></div>
|
||||
<div class="qq-repo-card qq-skeleton" aria-hidden="true"><span class="qq-sk-bar qq-sk-title"></span><span class="qq-sk-bar qq-sk-desc"></span><span class="qq-sk-bar qq-sk-desc qq-sk-desc-2"></span><div class="qq-sk-meta"><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill qq-sk-pill-end"></span></div></div>
|
||||
<div class="qq-repo-card qq-skeleton" aria-hidden="true"><span class="qq-sk-bar qq-sk-title"></span><span class="qq-sk-bar qq-sk-desc"></span><span class="qq-sk-bar qq-sk-desc qq-sk-desc-2"></span><div class="qq-sk-meta"><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill qq-sk-pill-end"></span></div></div>
|
||||
<div class="qq-logo-halo qq-lp-logo"><img src="../custom/public/assets/img/logo.svg" alt="logo"></div>
|
||||
<p class="qq-lp-eyebrow">私有部署 · 轻量 · 全功能</p>
|
||||
<h1 class="qq-lp-title">QQGit</h1>
|
||||
<p class="qq-lp-sub" data-qq-type="自己的代码,自己的地方。">自己的代码,自己的地方。</p>
|
||||
<form class="qq-lp-search" onsubmit="return false">
|
||||
<input type="search" placeholder="搜索仓库、用户、组织…">
|
||||
<button class="ui primary button" type="submit">搜索</button>
|
||||
</form>
|
||||
<div class="qq-lp-cta">
|
||||
<a class="ui primary button" href="#">免费注册</a>
|
||||
<a class="ui basic button" href="#">登录</a>
|
||||
<a class="qq-lp-link" href="#">浏览全部仓库 →</a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
|
@ -147,6 +75,13 @@
|
|||
<p>跑在自己的服务器上,仓库、用户与备份都由自己掌握。</p>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section class="qq-lp-stats">
|
||||
<div class="qq-lp-stat"><strong>1.21.11</strong><span>Gitea 版本</span></div>
|
||||
<div class="qq-lp-stat"><strong>MIT</strong><span>开源协议</span></div>
|
||||
<div class="qq-lp-stat"><strong>SQLite</strong><span>零依赖存储</span></div>
|
||||
<div class="qq-lp-stat"><strong>1 台</strong><span>服务器即可跑</span></div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -304,22 +239,6 @@ DARK_PRIMARY = <span style="color:var(--color-primary)">"#38BDF8"</span>
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
/* 离线预览用的假数据:字段与 /api/v1/repos/search 保持一致 */
|
||||
(function () {
|
||||
var h = 3600e3, d = 24 * h;
|
||||
function ago(ms) { return new Date(Date.now() - ms).toISOString(); }
|
||||
window.QQ_HOT_REPOS_DEMO = [
|
||||
{ full_name: 'newbie/QQgit', html_url: '#', description: 'Gitea 蓝白 ins 风外观定制:主题、模板钩子与 Logo 套件。', language: 'CSS', stars_count: 12, forks_count: 2, updated_at: ago(2 * h), fork: false, mirror: false, private: false, archived: false, owner: { login: 'newbie' } },
|
||||
{ full_name: 'newbie/Actuators', html_url: '#', description: '执行器选型笔记、固件脚本与实测数据整理。', language: 'Python', stars_count: 8, forks_count: 1, updated_at: ago(9 * d), fork: false, mirror: false, private: false, archived: false, owner: { login: 'newbie' } },
|
||||
{ full_name: 'newbie/OMZ', html_url: '#', description: 'oh-my-zsh 个人配置:主题、插件与常用别名。', language: 'Shell', stars_count: 5, forks_count: 0, updated_at: ago(23 * d), fork: false, mirror: false, private: false, archived: false, owner: { login: 'newbie' } },
|
||||
{ full_name: 'Skills/YYCangle-skill', html_url: '#', description: '角度/姿态相关的技能脚本与文档。', language: 'Markdown', stars_count: 3, forks_count: 0, updated_at: ago(40 * d), fork: false, mirror: false, private: false, archived: false, owner: { login: 'Skills' } },
|
||||
{ full_name: 'newbie/nvim', html_url: '#', description: 'Neovim 配置,JetBrains Mono Nerd Font + LSP 全套。', language: 'Lua', stars_count: 2, forks_count: 0, updated_at: ago(60 * d), fork: false, mirror: false, private: false, archived: false, owner: { login: 'newbie' } },
|
||||
{ full_name: 'Skills/QQzot-skill', html_url: '#', description: 'Zotero 文献库操作与 AI 笔记生成的技能封装。', language: 'Python', stars_count: 1, forks_count: 0, updated_at: ago(70 * d), fork: false, mirror: false, private: false, archived: false, owner: { login: 'Skills' } }
|
||||
];
|
||||
})();
|
||||
</script>
|
||||
<script src="../custom/public/assets/js/qq-home.js" defer></script>
|
||||
<script src="../custom/public/assets/js/qq-fx.js" defer></script>
|
||||
<script src="app.js"></script>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>QQGit 预览 · 375px frame</title>
|
||||
<style>
|
||||
html, body { margin: 0; padding: 0; background: #fff; }
|
||||
iframe { display: block; width: 375px; height: 2400px; border: 0; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<iframe id="f" src="index.html?only=home&bare=1&theme=light"></iframe>
|
||||
<script>
|
||||
var t = new URLSearchParams(location.search).get('theme') || 'light';
|
||||
document.getElementById('f').src = 'index.html?only=home&bare=1&theme=' + t;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -15,14 +15,7 @@ CSS_DIR = ROOT / "custom" / "public" / "assets" / "css"
|
|||
HEX_RE = re.compile(r"#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})\b")
|
||||
GREEN_RANGE = (60, 170) # 色相区间:绿 → 黄绿
|
||||
|
||||
FILES = [
|
||||
"theme-qq-auto.css",
|
||||
"theme-qq-light.css",
|
||||
"theme-qq-dark.css",
|
||||
"qq-ui.css",
|
||||
"qq-pages.css",
|
||||
"qq-fx.css",
|
||||
]
|
||||
FILES = ["theme-qq-auto.css", "theme-qq-light.css", "theme-qq-dark.css", "qq-ui.css"]
|
||||
|
||||
|
||||
def hue_of(h):
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ OWN = {'--qq-font-mono', '--disc', '--mark'}
|
|||
|
||||
def vars_in(p):
|
||||
out = set()
|
||||
for v in re.findall(r'--[a-z0-9-]+', pathlib.Path(p).read_text(encoding="utf-8")):
|
||||
for v in re.findall(r'--[a-z0-9-]+', pathlib.Path(p).read_text()):
|
||||
if v.strip('-') and not v.endswith('-'):
|
||||
out.add(v)
|
||||
return out
|
||||
|
|
@ -32,15 +32,15 @@ def main():
|
|||
print(f'{name:5s} 缺失变量: {missing if missing else "无"}')
|
||||
ok = ok and not missing
|
||||
|
||||
tmpl = (ROOT / 'custom/templates/home.tmpl').read_text(encoding="utf-8")
|
||||
tmpl = (ROOT / 'custom/templates/home.tmpl').read_text()
|
||||
classes = sorted({c for group in re.findall(r'class="([^"]+)"', tmpl) for c in group.split()})
|
||||
ui = (CSS / 'qq-ui.css').read_text(encoding="utf-8")
|
||||
ui = (CSS / 'qq-ui.css').read_text()
|
||||
for cls in ('qq-home-cards', 'qq-home-card', 'qq-footer', 'page-content'):
|
||||
has = ('.' + cls) in ui
|
||||
print(f'qq-ui 含 .{cls}: {has}')
|
||||
ok = ok and has
|
||||
|
||||
auto = (CSS / 'theme-qq-auto.css').read_text(encoding="utf-8").replace(' ', '')
|
||||
auto = (CSS / 'theme-qq-auto.css').read_text().replace(' ', '')
|
||||
has_media = '@media(prefers-color-scheme:dark)' in auto
|
||||
print('theme-qq-auto 含日夜媒体查询:', has_media)
|
||||
ok = ok and has_media
|
||||
|
|
|
|||
|
|
@ -1,9 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
# =============================================================================
|
||||
# deploy.sh —— 把工作目录里验收通过的 custom/ 同步到线上 Gitea
|
||||
# deploy.sh —— 把工作目录里验收通过的 custom/ 拷进线上 Gitea
|
||||
#
|
||||
# 默认:只做预演,打印动作,不修改线上文件。
|
||||
# 真正执行:必须显式加 --yes;只有 QQ 明确同意后才能运行。
|
||||
# 默认:只做「预演」(dry-run),打印将要发生的一切,不动线上任何文件。
|
||||
# 真正执行:必须显式加 --yes。
|
||||
#
|
||||
# 用法:
|
||||
# ./scripts/deploy.sh # 预演,安全
|
||||
# ./scripts/deploy.sh --yes # 真部署(备份 → 复制 → chown → 重启)
|
||||
# ./scripts/deploy.sh --yes --patch-ini # 同时把 app.ini 的 [ui] 主题列表换成 qq 系列
|
||||
#
|
||||
# 铁律:
|
||||
# 1. 任何写入前先备份 /var/lib/gitea/custom 与 /etc/gitea/app.ini,备份落在
|
||||
# /var/backups/gitea-custom-<时间戳>.tar.gz(含恢复脚本说明)。
|
||||
# 2. 只覆盖 custom/,绝不触碰 /usr/local/bin/gitea 与数据库。
|
||||
# 3. 只有 QQ 明确同意后才能加 --yes 运行。
|
||||
# =============================================================================
|
||||
set -euo pipefail
|
||||
|
||||
|
|
@ -18,143 +29,101 @@ DO_IT=0
|
|||
PATCH_INI=0
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--yes) DO_IT=1 ;;
|
||||
--yes) DO_IT=1 ;;
|
||||
--patch-ini) PATCH_INI=1 ;;
|
||||
-h|--help) sed -n '2,8p' "$0"; exit 0 ;;
|
||||
-h|--help) sed -n '2,20p' "$0"; exit 0 ;;
|
||||
*) echo "未知参数: $arg" >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
say() { printf '\033[36m==>\033[0m %s\n' "$*"; }
|
||||
warn() { printf '\033[33m[!]\033[0m %s\n' "$*"; }
|
||||
fail() { printf '\033[31m[错误]\033[0m %s\n' "$*" >&2; exit 1; }
|
||||
|
||||
[ -d "$SRC_CUSTOM" ] || fail "找不到 $SRC_CUSTOM"
|
||||
for required in \
|
||||
templates/base/footer_content.tmpl \
|
||||
public/assets/css/qq-pages.css \
|
||||
public/assets/css/theme-qq-auto.css \
|
||||
public/assets/css/theme-qq-light.css \
|
||||
public/assets/css/theme-qq-dark.css; do
|
||||
[ -f "$SRC_CUSTOM/$required" ] || fail "源码缺少关键文件:custom/$required"
|
||||
done
|
||||
[ -d "$SRC_CUSTOM" ] || { echo "找不到 $SRC_CUSTOM" >&2; exit 1; }
|
||||
|
||||
# ---------------------------------------------------------------- 1. 内容清单
|
||||
say "源目录:$SRC_CUSTOM"
|
||||
find "$SRC_CUSTOM" -type f | sed "s|$SRC_CUSTOM/| custom/|" | sort
|
||||
|
||||
if [ "$DO_IT" -eq 0 ]; then
|
||||
say "预演:加 --yes 后会执行"
|
||||
echo " 1) 完整备份 $DST_CUSTOM 与 $APP_INI -> $BACKUP"
|
||||
echo " 2) 校验备份含 app.ini、QQ 主题与关键模板"
|
||||
echo " 3) rsync --delete-delay 同步 custom/(保留线上额外的 theme-*.css)"
|
||||
echo " 4) 修正权限、重启并执行 HTTP 健康检查"
|
||||
echo " 5) 任一步骤失败时调用 rollback.sh 精确回滚"
|
||||
[ "$PATCH_INI" -eq 1 ] && echo " 6) 同步改写 $APP_INI 的 [ui] DEFAULT_THEME / THEMES"
|
||||
say "预演:下面这些动作会在加 --yes 后真正执行"
|
||||
echo " 1) tar 备份 $DST_CUSTOM 与 $APP_INI -> $BACKUP"
|
||||
echo " 2) rsync 复制 custom/ -> $DST_CUSTOM/"
|
||||
echo " 3) chown -R git:git $DST_CUSTOM"
|
||||
echo " 4) systemctl restart gitea"
|
||||
[ "$PATCH_INI" -eq 1 ] && echo " 5) 改写 $APP_INI 的 [ui] DEFAULT_THEME / THEMES(先备份 .bak-$STAMP)"
|
||||
echo
|
||||
warn "线上未做任何修改。获得 QQ 明确批准后才能执行:./scripts/deploy.sh --yes"
|
||||
warn "线上未做任何修改。确认外观无误后,再由 QQ 批准执行:./scripts/deploy.sh --yes"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
say "完整备份到 $BACKUP"
|
||||
# ---------------------------------------------------------------- 2. 备份
|
||||
say "备份到 $BACKUP"
|
||||
sudo mkdir -p /var/backups
|
||||
sudo tar czf "$BACKUP" -C / var/lib/gitea/custom etc/gitea/app.ini
|
||||
sudo tar czf "$BACKUP" -C / \
|
||||
--exclude='custom/public/assets/css/theme-qq*.css' \
|
||||
var/lib/gitea/custom etc/gitea/app.ini
|
||||
sudo chmod 600 "$BACKUP"
|
||||
sudo tar tzf "$BACKUP" >/dev/null
|
||||
for required in \
|
||||
var/lib/gitea/custom/templates/base/footer_content.tmpl \
|
||||
var/lib/gitea/custom/public/assets/css/qq-pages.css \
|
||||
var/lib/gitea/custom/public/assets/css/theme-qq-auto.css \
|
||||
var/lib/gitea/custom/public/assets/css/theme-qq-light.css \
|
||||
var/lib/gitea/custom/public/assets/css/theme-qq-dark.css \
|
||||
etc/gitea/app.ini; do
|
||||
sudo tar tzf "$BACKUP" | grep -Fx "$required" >/dev/null || fail "备份缺少关键文件:$required"
|
||||
done
|
||||
say "备份校验通过:$(sudo du -h "$BACKUP" | cut -f1)"
|
||||
say "备份完成:$(sudo du -h "$BACKUP" | cut -f1)"
|
||||
|
||||
rollback_on_failure() {
|
||||
trap - ERR
|
||||
warn "部署验证失败,立即从 $BACKUP 精确回滚"
|
||||
"$REPO_DIR/scripts/rollback.sh" --yes "$BACKUP" || {
|
||||
printf '\033[31m[严重]\033[0m 自动回滚失败,请立即人工处理。备份:%s\n' "$BACKUP" >&2
|
||||
exit 1
|
||||
}
|
||||
fail "部署失败,已恢复到部署前状态"
|
||||
}
|
||||
trap 'rollback_on_failure' ERR
|
||||
|
||||
say "同步 custom/ -> $DST_CUSTOM/"
|
||||
# ---------------------------------------------------------------- 3. 复制
|
||||
say "复制 custom/ -> $DST_CUSTOM/"
|
||||
sudo mkdir -p "$DST_CUSTOM"
|
||||
# theme-*.css 可能是管理员另外安装的旧主题;保护它们不被 --delete 删除,
|
||||
# 同名 QQ 主题仍会从源码正常更新。
|
||||
if ! sudo rsync -a --delete-delay \
|
||||
--exclude='.git*' \
|
||||
--filter='protect public/assets/css/theme-*.css' \
|
||||
"$SRC_CUSTOM/" "$DST_CUSTOM/"; then
|
||||
rollback_on_failure
|
||||
fi
|
||||
sudo rsync -a --exclude='.git*' "$SRC_CUSTOM/" "$DST_CUSTOM/"
|
||||
sudo chown -R git:git "$DST_CUSTOM"
|
||||
say "复制完成"
|
||||
|
||||
# ---------------------------------------------------------------- 4. app.ini 可选
|
||||
if [ "$PATCH_INI" -eq 1 ]; then
|
||||
say "改写 $APP_INI 的 [ui] 段"
|
||||
sudo cp -a "$APP_INI" "$APP_INI.bak-$STAMP"
|
||||
if ! sudo python3 - "$APP_INI" <<'PY'
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
sudo python3 - "$APP_INI" <<'PY'
|
||||
import sys, re, pathlib
|
||||
p = pathlib.Path(sys.argv[1])
|
||||
txt = p.read_text(encoding="utf-8")
|
||||
txt = p.read_text()
|
||||
themes = ["auto", "gitea", "arc-green", "gitea-gruvbox",
|
||||
"github-auto", "github-light", "github-dark", "github-soft-dark",
|
||||
"qq-auto", "qq-light", "qq-dark"]
|
||||
lines = txt.splitlines()
|
||||
out, in_ui = [], False
|
||||
seen = set()
|
||||
for line in lines:
|
||||
stripped = line.strip()
|
||||
if stripped.startswith("[") and stripped.endswith("]"):
|
||||
in_ui = stripped == "[ui]"
|
||||
for ln in lines:
|
||||
s = ln.strip()
|
||||
if s.startswith("[") and s.endswith("]"):
|
||||
in_ui = (s == "[ui]")
|
||||
if in_ui:
|
||||
if stripped.lower().startswith("default_theme"):
|
||||
out.append("DEFAULT_THEME = qq-auto")
|
||||
seen.add("default")
|
||||
continue
|
||||
if stripped.lower().startswith("themes"):
|
||||
out.append("THEMES = " + ",".join(themes))
|
||||
seen.add("themes")
|
||||
continue
|
||||
out.append(line)
|
||||
if s.lower().startswith("default_theme"):
|
||||
out.append("DEFAULT_THEME = qq-auto"); seen.add("default"); continue
|
||||
if s.lower().startswith("themes"):
|
||||
out.append("THEMES = " + ",".join(themes)); seen.add("themes"); continue
|
||||
out.append(ln)
|
||||
if "default" not in seen or "themes" not in seen:
|
||||
updated = []
|
||||
for line in out:
|
||||
updated.append(line)
|
||||
if line.strip() == "[ui]":
|
||||
if "default" not in seen:
|
||||
updated.append("DEFAULT_THEME = qq-auto")
|
||||
if "themes" not in seen:
|
||||
updated.append("THEMES = " + ",".join(themes))
|
||||
out = updated
|
||||
p.write_text("\n".join(out) + "\n", encoding="utf-8")
|
||||
# [ui] 段里缺字段:插到段首
|
||||
res = []
|
||||
for ln in out:
|
||||
res.append(ln)
|
||||
if ln.strip() == "[ui]":
|
||||
if "default" not in seen: res.append("DEFAULT_THEME = qq-auto")
|
||||
if "themes" not in seen: res.append("THEMES = " + ",".join(themes))
|
||||
out = res
|
||||
p.write_text("\n".join(out) + "\n")
|
||||
print("app.ini [ui] 已更新")
|
||||
PY
|
||||
then
|
||||
rollback_on_failure
|
||||
fi
|
||||
say "app.ini 已更新(原文件备份为 $APP_INI.bak-$STAMP)"
|
||||
fi
|
||||
|
||||
say "重启 Gitea"
|
||||
if ! sudo systemctl restart gitea; then
|
||||
rollback_on_failure
|
||||
fi
|
||||
# ---------------------------------------------------------------- 5. 重启
|
||||
say "重启 gitea"
|
||||
sudo systemctl restart gitea
|
||||
sleep 2
|
||||
systemctl is-active gitea && say "gitea 运行中"
|
||||
command -v curl >/dev/null && curl -s -o /dev/null -w "HTTP %{http_code}\n" https://git.qyhhh.top/ || true
|
||||
|
||||
healthy=0
|
||||
for _ in 1 2 3 4 5; do
|
||||
if systemctl is-active --quiet gitea && \
|
||||
(! command -v curl >/dev/null || curl -fsS -o /dev/null https://git.qyhhh.top/); then
|
||||
healthy=1
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
[ "$healthy" -eq 1 ] || rollback_on_failure
|
||||
cat <<EOF
|
||||
|
||||
say "部署完成,Gitea 运行正常"
|
||||
echo "回滚命令:./scripts/rollback.sh $BACKUP"
|
||||
部署完成。回滚方式:
|
||||
sudo tar xzf $BACKUP -C /
|
||||
sudo chown -R git:git $DST_CUSTOM
|
||||
sudo systemctl restart gitea
|
||||
|
||||
EOF
|
||||
|
|
|
|||
|
|
@ -1,44 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
# =============================================================================
|
||||
# rollback.sh —— 从 /var/backups 的完整快照精确还原线上 custom/ 与 app.ini
|
||||
# rollback.sh —— 从 /var/backups 的 tar 包还原线上 custom/ 与 app.ini
|
||||
#
|
||||
# ./scripts/rollback.sh --list
|
||||
# ./scripts/rollback.sh <备份文件> # 交互确认
|
||||
# ./scripts/rollback.sh --yes <备份文件> # 自动确认(供 deploy.sh 失败回滚)
|
||||
# ./scripts/rollback.sh --allow-incomplete <旧备份> # 允许缺少 QQ 主题的历史备份
|
||||
# ./scripts/rollback.sh # 列出可用备份
|
||||
# ./scripts/rollback.sh <备份文件> # 还原指定备份(会再问一次 y/N)
|
||||
# ./scripts/rollback.sh --list # 同上,列出
|
||||
# =============================================================================
|
||||
set -euo pipefail
|
||||
|
||||
BACKUP_DIR="/var/backups"
|
||||
DST_CUSTOM="/var/lib/gitea/custom"
|
||||
APP_INI="/etc/gitea/app.ini"
|
||||
STAMP="$(date +%Y%m%d-%H%M%S)"
|
||||
DO_IT=0
|
||||
ALLOW_INCOMPLETE=0
|
||||
BACKUP=""
|
||||
|
||||
say() { printf '\033[36m==>\033[0m %s\n' "$*"; }
|
||||
warn() { printf '\033[33m[!]\033[0m %s\n' "$*"; }
|
||||
fail() { printf '\033[31m[错误]\033[0m %s\n' "$*" >&2; exit 1; }
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--yes) DO_IT=1 ;;
|
||||
--allow-incomplete) ALLOW_INCOMPLETE=1 ;;
|
||||
--list) ;;
|
||||
-h|--help)
|
||||
sed -n '2,9p' "$0"
|
||||
exit 0
|
||||
;;
|
||||
-*) fail "未知参数:$arg" ;;
|
||||
*)
|
||||
[ -z "$BACKUP" ] || fail "只能指定一个备份文件"
|
||||
BACKUP="$arg"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$BACKUP" ]; then
|
||||
if [ "${1:-}" = "" ] || [ "${1:-}" = "--list" ]; then
|
||||
echo "可用备份(新的在上):"
|
||||
ls -1t "$BACKUP_DIR"/gitea-custom-*.tar.gz 2>/dev/null || echo " (没有找到备份)"
|
||||
echo
|
||||
|
|
@ -46,69 +19,15 @@ if [ -z "$BACKUP" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
[ -f "$BACKUP" ] || fail "备份不存在:$BACKUP"
|
||||
BACKUP="$1"
|
||||
[ -f "$BACKUP" ] || { echo "备份不存在:$BACKUP" >&2; exit 1; }
|
||||
|
||||
say "校验备份完整性"
|
||||
sudo tar tzf "$BACKUP" >/dev/null
|
||||
if sudo tar tzf "$BACKUP" | grep -E '(^/|(^|/)\.\.(/|$))' >/dev/null; then
|
||||
fail "备份包含不安全路径,拒绝解包"
|
||||
fi
|
||||
for required in \
|
||||
var/lib/gitea/custom/templates/base/footer_content.tmpl \
|
||||
var/lib/gitea/custom/public/assets/css/qq-pages.css \
|
||||
etc/gitea/app.ini; do
|
||||
sudo tar tzf "$BACKUP" | grep -Fx "$required" >/dev/null || fail "备份缺少关键文件:$required"
|
||||
done
|
||||
echo "将把 $BACKUP 解包覆盖 /var/lib/gitea/custom 与 /etc/gitea/app.ini"
|
||||
read -r -p "确认还原?(y/N) " ans
|
||||
[ "$ans" = "y" ] || [ "$ans" = "Y" ] || { echo "已取消"; exit 0; }
|
||||
|
||||
missing_themes=0
|
||||
for theme in theme-qq-auto.css theme-qq-light.css theme-qq-dark.css; do
|
||||
if ! sudo tar tzf "$BACKUP" | grep -Fx "var/lib/gitea/custom/public/assets/css/$theme" >/dev/null; then
|
||||
warn "备份缺少 $theme"
|
||||
missing_themes=1
|
||||
fi
|
||||
done
|
||||
if [ "$missing_themes" -eq 1 ] && [ "$ALLOW_INCOMPLETE" -ne 1 ]; then
|
||||
fail "这是历史不完整备份。默认拒绝精确回滚;确认承担主题文件缺失风险后才可加 --allow-incomplete"
|
||||
fi
|
||||
|
||||
if [ "$DO_IT" -ne 1 ]; then
|
||||
echo "将精确还原 $BACKUP:"
|
||||
echo " 1) 先完整备份当前 custom/ 与 app.ini"
|
||||
echo " 2) 解包到临时目录并再次校验"
|
||||
echo " 3) 停止 Gitea,以 rsync --delete 精确还原 custom/"
|
||||
echo " 4) 还原 app.ini、权限并启动 Gitea"
|
||||
read -r -p "确认还原?(y/N) " ans
|
||||
[ "$ans" = "y" ] || [ "$ans" = "Y" ] || { echo "已取消"; exit 0; }
|
||||
fi
|
||||
|
||||
TMP_DIR="$(mktemp -d)"
|
||||
trap 'sudo rm -rf "$TMP_DIR"' EXIT
|
||||
sudo tar xzf "$BACKUP" -C "$TMP_DIR"
|
||||
SRC_CUSTOM="$TMP_DIR/var/lib/gitea/custom"
|
||||
SRC_APP_INI="$TMP_DIR/etc/gitea/app.ini"
|
||||
[ -d "$SRC_CUSTOM" ] || fail "解包后找不到 custom/"
|
||||
[ -f "$SRC_APP_INI" ] || fail "解包后找不到 app.ini"
|
||||
|
||||
SAFETY_BACKUP="$BACKUP_DIR/gitea-pre-rollback-$STAMP.tar.gz"
|
||||
say "回滚前保护当前状态:$SAFETY_BACKUP"
|
||||
sudo tar czf "$SAFETY_BACKUP" -C / var/lib/gitea/custom etc/gitea/app.ini
|
||||
sudo chmod 600 "$SAFETY_BACKUP"
|
||||
|
||||
say "停止 Gitea 并精确还原"
|
||||
sudo systemctl stop gitea
|
||||
sudo mkdir -p "$DST_CUSTOM"
|
||||
sudo rsync -a --delete "$SRC_CUSTOM/" "$DST_CUSTOM/"
|
||||
sudo cp -a "$SRC_APP_INI" "$APP_INI"
|
||||
sudo tar xzf "$BACKUP" -C /
|
||||
sudo chown -R git:git "$DST_CUSTOM"
|
||||
sudo systemctl start gitea
|
||||
sudo systemctl restart gitea
|
||||
sleep 2
|
||||
|
||||
if ! systemctl is-active --quiet gitea; then
|
||||
fail "Gitea 未能启动;回滚前状态保存在 $SAFETY_BACKUP"
|
||||
fi
|
||||
if command -v curl >/dev/null && ! curl -fsS -o /dev/null https://git.qyhhh.top/; then
|
||||
fail "Gitea 已启动但站点健康检查失败;回滚前状态保存在 $SAFETY_BACKUP"
|
||||
fi
|
||||
|
||||
say "还原完成,Gitea 运行正常"
|
||||
echo "回滚前状态备份:$SAFETY_BACKUP"
|
||||
systemctl is-active gitea && echo "还原完成,gitea 运行中"
|
||||
|
|
|
|||
Loading…
Reference in New Issue