Skip to content

Commit 3a37b76

Browse files
cursoragentflymysql
andcommitted
merge(main): 解决 PR #93 与 main 的构建产物冲突
合并 main 的置顶排序修复,保留分支上的微信农场种子数据更新; 统一 VERSION 后重新 build 生成 index/sw/tools 等文件。 Co-authored-by: 兰州小红鸡 <flyphp@outlook.com>
2 parents f51cf67 + 414157c commit 3a37b76

21 files changed

Lines changed: 141 additions & 117 deletions

‎assets/dist/home.min.js‎

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎assets/js/config.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// 这里都是公开信息,不要把 token 等密钥放进来
44
// ============================================================================
55

6-
export const VERSION = '20260617160000';
6+
export const VERSION = '20260618140000';
77

88
export const CONFIG = {
99
repo: {

‎assets/js/home.js‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ function postItemHtml(p, author, avatar) {
366366
// 懒加载状态:每次切 tab/筛选都会被替换
367367
let listState = null;
368368
let mobileHomeStickySync = null;
369+
/** 首屏预渲染列表仅允许复用一次(切 tab 后必须重绘) */
370+
let homePrerenderConsumed = false;
369371

370372
function renderList(posts, tab = 'latest') {
371373
const ul = $('#postList');
@@ -433,6 +435,14 @@ function renderList(posts, tab = 'latest') {
433435
mobileHomeStickySync?.();
434436
}
435437

438+
function prerenderListMatches(ul, posts) {
439+
const items = [...ul.querySelectorAll('li.post-item')];
440+
if (!items.length) return false;
441+
const slugs = items.map(li => li.dataset.slug);
442+
const expected = posts.slice(0, slugs.length).map(p => p.slug);
443+
return slugs.length === expected.length && slugs.every((s, i) => s === expected[i]);
444+
}
445+
436446
/** 保留 build 预渲染的首页列表 DOM,只绑定懒加载与无限滚动 */
437447
function bindPrerenderedPostList(posts) {
438448
const ul = $('#postList');
@@ -441,6 +451,7 @@ function bindPrerenderedPostList(posts) {
441451

442452
const existing = ul.querySelectorAll('li.post-item');
443453
if (!existing.length) return false;
454+
if (!prerenderListMatches(ul, posts)) return false;
444455

445456
const author = CONFIG.site.author;
446457
const avatar = CONFIG.site.avatar;
@@ -768,7 +779,9 @@ function bindMobileHomeSticky() {
768779
} else {
769780
ul.classList.remove('post-list--giscus');
770781
const filtered = buildHomeList({ allPosts, tab, q: '', tag: activeTag });
771-
const reused = tab === 'latest' && !activeTag && bindPrerenderedPostList(filtered);
782+
const canReusePrerender = tab === 'latest' && !activeTag && !homePrerenderConsumed;
783+
const reused = canReusePrerender && bindPrerenderedPostList(filtered);
784+
if (reused) homePrerenderConsumed = true;
772785
if (!reused) renderList(filtered, tab);
773786
}
774787

‎data/search.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"generated": "2026-06-23T09:35:55.220Z",
2+
"generated": "2026-06-23T09:53:03.306Z",
33
"count": 67,
44
"docs": [
55
{

‎index.html‎

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<title>小红鸡 · 记录想法与代码</title>
88
<meta name="description" content="桃李春风一杯酒,江湖夜雨十年灯。">
99
<link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml">
10-
<link rel="stylesheet" href="assets/dist/common.min.css?v=20260617160000">
11-
<link rel="stylesheet" href="assets/dist/home.min.css?v=20260617160000">
10+
<link rel="stylesheet" href="assets/dist/common.min.css?v=20260618140000">
11+
<link rel="stylesheet" href="assets/dist/home.min.css?v=20260618140000">
1212
<script>(function(){var s=localStorage;var t=s.getItem('blog_theme')||'auto';var d=t==='auto'?(window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light'):t;var p=s.getItem('blog_preset')||'jianshu';var h=document.documentElement;h.setAttribute('data-preset',p);h.setAttribute('data-mode',d);h.setAttribute('data-theme',d);h.dataset.themeChoice=t;})();</script>
1313
<style id="critical-home">
1414
:root{--nav-height:60px;--content-max:980px;--radius:6px;--radius-lg:10px;--primary:#EA6F5A;--text-main:#2F2F2F;--text-secondary:#6B6B6B;--text-tertiary:#9C9C9C;--border:#ECECEC;--bg:#FFF;--bg-soft:#F8F8F8;--nav-bg:rgba(255,255,255,.85);--shadow:0 1px 3px rgba(0,0,0,.04)}
@@ -274,6 +274,23 @@
274274
<div class="tab" data-tab="notes">随笔</div>
275275
</div>
276276
<ul id="postList" class="post-list">
277+
<li class="post-item" data-slug="welcome">
278+
<a class="post-content" href="/post/welcome/">
279+
<div class="post-author-row">
280+
<div class="avatar" style="background-image:url(https://gitpull.cn/assets/uploads/2026/05/touxiang.webp)"></div>
281+
<span class="name">Jimmy</span>
282+
<span>·</span>
283+
<span>1 个月前</span>
284+
<span class="post-pin">置顶</span>
285+
</div>
286+
<h3 class="post-title">GitBlog:一个带伪后台的博客站点</h3>
287+
<p class="post-summary">一个完全静态、托管在 GitHub Pages 上的博客,但带有可以在浏览器里直接写、直接发的&#39;伪后台&#39;。这篇文章记录它能做什么,相比传统方案为什么这样设计,以及如果你也想搭一个,要怎么开始。</p>
288+
<div class="post-meta">
289+
<span class="tag tag-colored" style="--tag-bg:#EEF0F3;--tag-text:#4B5563;--tag-border:#D5DAE1;--tag-dark-bg:#252A33;--tag-dark-text:#CBD5E1;--tag-dark-border:#47515F;">博客建站</span><span class="tag tag-colored" style="--tag-bg:#E8F8EE;--tag-text:#1E7A43;--tag-border:#BDE8CC;--tag-dark-bg:#153321;--tag-dark-text:#91E4AE;--tag-dark-border:#2F6A43;">教程</span><span class="tag tag-colored" style="--tag-bg:#EEF0F3;--tag-text:#4B5563;--tag-border:#D5DAE1;--tag-dark-bg:#252A33;--tag-dark-text:#CBD5E1;--tag-dark-border:#47515F;">项目介绍</span>
290+
</div>
291+
</a>
292+
<a href="/post/welcome/" class="post-thumbnail"><img src="data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%204%203%22%2F%3E" data-src="assets/uploads/2026/05/1778490605877-blwjij-image.webp" alt="GitBlog:一个带伪后台的博客站点" loading="lazy" decoding="async" fetchpriority="low" class="lazy-pending"></a>
293+
</li>
277294
<li class="post-item" data-slug="海门回声-黑鬼">
278295
<a class="post-content" href="/post/20260618/">
279296
<div class="post-author-row">
@@ -393,23 +410,6 @@ <h3 class="post-title">CPTI:手机上就能玩的恋爱人格小测验</h3>
393410
</a>
394411
<a href="/post/20260514/" class="post-thumbnail"><img src="data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%204%203%22%2F%3E" data-src="assets/uploads/2026/05/cptijietu1.webp" alt="CPTI:手机上就能玩的恋爱人格小测验" loading="lazy" decoding="async" fetchpriority="low" class="lazy-pending"></a>
395412
</li>
396-
<li class="post-item" data-slug="welcome">
397-
<a class="post-content" href="/post/welcome/">
398-
<div class="post-author-row">
399-
<div class="avatar" style="background-image:url(https://gitpull.cn/assets/uploads/2026/05/touxiang.webp)"></div>
400-
<span class="name">Jimmy</span>
401-
<span>·</span>
402-
<span>1 个月前</span>
403-
<span class="post-pin">置顶</span>
404-
</div>
405-
<h3 class="post-title">GitBlog:一个带伪后台的博客站点</h3>
406-
<p class="post-summary">一个完全静态、托管在 GitHub Pages 上的博客,但带有可以在浏览器里直接写、直接发的&#39;伪后台&#39;。这篇文章记录它能做什么,相比传统方案为什么这样设计,以及如果你也想搭一个,要怎么开始。</p>
407-
<div class="post-meta">
408-
<span class="tag tag-colored" style="--tag-bg:#EEF0F3;--tag-text:#4B5563;--tag-border:#D5DAE1;--tag-dark-bg:#252A33;--tag-dark-text:#CBD5E1;--tag-dark-border:#47515F;">博客建站</span><span class="tag tag-colored" style="--tag-bg:#E8F8EE;--tag-text:#1E7A43;--tag-border:#BDE8CC;--tag-dark-bg:#153321;--tag-dark-text:#91E4AE;--tag-dark-border:#2F6A43;">教程</span><span class="tag tag-colored" style="--tag-bg:#EEF0F3;--tag-text:#4B5563;--tag-border:#D5DAE1;--tag-dark-bg:#252A33;--tag-dark-text:#CBD5E1;--tag-dark-border:#47515F;">项目介绍</span>
409-
</div>
410-
</a>
411-
<a href="/post/welcome/" class="post-thumbnail"><img src="data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%204%203%22%2F%3E" data-src="assets/uploads/2026/05/1778490605877-blwjij-image.webp" alt="GitBlog:一个带伪后台的博客站点" loading="lazy" decoding="async" fetchpriority="low" class="lazy-pending"></a>
412-
</li>
413413
<li class="post-item" data-slug="about">
414414
<a class="post-content" href="/post/about/">
415415
<div class="post-author-row">
@@ -550,6 +550,6 @@ <h3>最近更新</h3>
550550
<div id="site-footer"></div>
551551
<div id="site-overlays"></div>
552552

553-
<script type="module" src="assets/dist/home.min.js?v=20260617160000"></script>
553+
<script type="module" src="assets/dist/home.min.js?v=20260618140000"></script>
554554
</body>
555555
</html>

‎rss.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<link>https://gitpull.cn/</link>
66
<description>桃李春风一杯酒,江湖夜雨十年灯。</description>
77
<language>zh-CN</language>
8-
<lastBuildDate>Tue, 23 Jun 2026 09:35:55 GMT</lastBuildDate>
8+
<lastBuildDate>Tue, 23 Jun 2026 09:53:03 GMT</lastBuildDate>
99
<atom:link href="https://gitpull.cn/rss.xml" rel="self" type="application/rss+xml" />
1010
<item>
1111
<title>海门回声 | 黑鬼</title>

‎scripts/build.mjs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
buildCarouselShell,
1414
buildCriticalHomeCss,
1515
postHrefFromEntry,
16+
sortPostsForHomeList,
1617
} from './home-shell-html.mjs';
1718
import { bundleAssets } from './bundle-assets.mjs';
1819
import {
@@ -775,7 +776,7 @@ function injectHomeSeo() {
775776
}
776777

777778
const hrefFn = p => postHrefFromEntry(p, postPublicAbsUrl);
778-
const latestForHome = visiblePosts.slice(0, 15);
779+
const latestForHome = sortPostsForHomeList(visiblePosts).slice(0, 15);
779780
let listHtml = '';
780781
if (latestForHome.length) {
781782
listHtml = latestForHome.map(p => buildPostItemShell(p, {

‎scripts/home-shell-html.mjs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,16 @@ export function buildPostItemShell(p, { author, avatar, postHrefFromEntry: hrefF
207207
</li>`;
208208
}
209209

210+
export function sortPostsForHomeList(posts) {
211+
return [...posts].sort((a, b) => {
212+
if ((b.pinned ? 1 : 0) !== (a.pinned ? 1 : 0)) return (b.pinned ? 1 : 0) - (a.pinned ? 1 : 0);
213+
if (a.pinned && b.pinned && Number(a.pinnedOrder || 0) !== Number(b.pinnedOrder || 0)) {
214+
return Number(a.pinnedOrder || 9999) - Number(b.pinnedOrder || 9999);
215+
}
216+
return new Date(b.date || 0) - new Date(a.date || 0);
217+
});
218+
}
219+
210220
export function pickCarouselItems(posts) {
211221
const sortFn = (a, b) => {
212222
if ((b.pinned ? 1 : 0) !== (a.pinned ? 1 : 0)) return (b.pinned ? 1 : 0) - (a.pinned ? 1 : 0);

‎sitemap.xml‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,91 +8,91 @@
88
</url>
99
<url>
1010
<loc>https://gitpull.cn/tags.html</loc>
11-
<lastmod>2026-06-23T09:35:55.222Z</lastmod>
11+
<lastmod>2026-06-23T09:53:03.309Z</lastmod>
1212
<changefreq>weekly</changefreq>
1313
<priority>0.8</priority>
1414
</url>
1515
<url>
1616
<loc>https://gitpull.cn/archives.html</loc>
17-
<lastmod>2026-06-23T09:35:55.222Z</lastmod>
17+
<lastmod>2026-06-23T09:53:03.309Z</lastmod>
1818
<changefreq>weekly</changefreq>
1919
<priority>0.7</priority>
2020
</url>
2121
<url>
2222
<loc>https://gitpull.cn/series.html</loc>
23-
<lastmod>2026-06-23T09:35:55.222Z</lastmod>
23+
<lastmod>2026-06-23T09:53:03.309Z</lastmod>
2424
<changefreq>weekly</changefreq>
2525
<priority>0.7</priority>
2626
</url>
2727
<url>
2828
<loc>https://gitpull.cn/tools/</loc>
29-
<lastmod>2026-06-23T09:35:55.222Z</lastmod>
29+
<lastmod>2026-06-23T09:53:03.309Z</lastmod>
3030
<changefreq>monthly</changefreq>
3131
<priority>0.7</priority>
3232
</url>
3333
<url>
3434
<loc>https://gitpull.cn/tools/tool-age.html</loc>
35-
<lastmod>2026-06-23T09:35:55.222Z</lastmod>
35+
<lastmod>2026-06-23T09:53:03.309Z</lastmod>
3636
<changefreq>monthly</changefreq>
3737
<priority>0.6</priority>
3838
</url>
3939
<url>
4040
<loc>https://gitpull.cn/tools/tool-fortune.html</loc>
41-
<lastmod>2026-06-23T09:35:55.222Z</lastmod>
41+
<lastmod>2026-06-23T09:53:03.309Z</lastmod>
4242
<changefreq>monthly</changefreq>
4343
<priority>0.6</priority>
4444
</url>
4545
<url>
4646
<loc>https://gitpull.cn/tools/tool-json.html</loc>
47-
<lastmod>2026-06-23T09:35:55.222Z</lastmod>
47+
<lastmod>2026-06-23T09:53:03.309Z</lastmod>
4848
<changefreq>monthly</changefreq>
4949
<priority>0.6</priority>
5050
</url>
5151
<url>
5252
<loc>https://gitpull.cn/tools/tool-codec.html</loc>
53-
<lastmod>2026-06-23T09:35:55.222Z</lastmod>
53+
<lastmod>2026-06-23T09:53:03.309Z</lastmod>
5454
<changefreq>monthly</changefreq>
5555
<priority>0.6</priority>
5656
</url>
5757
<url>
5858
<loc>https://gitpull.cn/tools/tool-timestamp.html</loc>
59-
<lastmod>2026-06-23T09:35:55.222Z</lastmod>
59+
<lastmod>2026-06-23T09:53:03.309Z</lastmod>
6060
<changefreq>monthly</changefreq>
6161
<priority>0.6</priority>
6262
</url>
6363
<url>
6464
<loc>https://gitpull.cn/tools/tool-regex.html</loc>
65-
<lastmod>2026-06-23T09:35:55.222Z</lastmod>
65+
<lastmod>2026-06-23T09:53:03.309Z</lastmod>
6666
<changefreq>monthly</changefreq>
6767
<priority>0.6</priority>
6868
</url>
6969
<url>
7070
<loc>https://gitpull.cn/tools/tool-qrcode.html</loc>
71-
<lastmod>2026-06-23T09:35:55.222Z</lastmod>
71+
<lastmod>2026-06-23T09:53:03.309Z</lastmod>
7272
<changefreq>monthly</changefreq>
7373
<priority>0.6</priority>
7474
</url>
7575
<url>
7676
<loc>https://gitpull.cn/tools/tool-image.html</loc>
77-
<lastmod>2026-06-23T09:35:55.222Z</lastmod>
77+
<lastmod>2026-06-23T09:53:03.309Z</lastmod>
7878
<changefreq>monthly</changefreq>
7979
<priority>0.6</priority>
8080
</url>
8181
<url>
8282
<loc>https://gitpull.cn/tools/tool-network.html</loc>
83-
<lastmod>2026-06-23T09:35:55.222Z</lastmod>
83+
<lastmod>2026-06-23T09:53:03.309Z</lastmod>
8484
<changefreq>monthly</changefreq>
8585
<priority>0.6</priority>
8686
</url>
8787
<url>
8888
<loc>https://gitpull.cn/tools/tool-air-conditioner.html</loc>
89-
<lastmod>2026-06-23T09:35:55.222Z</lastmod>
89+
<lastmod>2026-06-23T09:53:03.309Z</lastmod>
9090
<changefreq>monthly</changefreq>
9191
<priority>0.6</priority>
9292
</url>
9393
<url>
9494
<loc>https://gitpull.cn/tools/tool-farm-seed.html</loc>
95-
<lastmod>2026-06-23T09:35:55.222Z</lastmod>
95+
<lastmod>2026-06-23T09:53:03.309Z</lastmod>
9696
<changefreq>monthly</changefreq>
9797
<priority>0.6</priority>
9898
</url>

‎sw.js‎

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// 与 ?v=VERSION 的 cache-busting 协同:CACHE_NAME 用 release VERSION 区分批次
44
// ============================================================================
55

6-
const SW_VERSION = '20260617160000';
6+
const SW_VERSION = '20260618140000';
77
const STATIC_CACHE = `static-${SW_VERSION}`;
88
const PAGE_CACHE = `pages-${SW_VERSION}`;
99
const RUNTIME_CACHE = `runtime-${SW_VERSION}`;
@@ -12,28 +12,28 @@ const RUNTIME_CACHE = `runtime-${SW_VERSION}`;
1212
const OFFLINE_URL = 'offline.html';
1313

1414
const PRECACHE_ASSETS = [
15-
'assets/dist/common.min.css?v=20260617160000',
16-
'assets/dist/home.min.css?v=20260617160000',
17-
'assets/dist/post.min.css?v=20260617160000',
18-
'assets/dist/tools.min.css?v=20260617160000',
19-
'assets/dist/admin.min.css?v=20260617160000',
20-
'assets/dist/home.min.js?v=20260617160000',
21-
'assets/dist/post.min.js?v=20260617160000',
22-
'assets/dist/tags.min.js?v=20260617160000',
23-
'assets/dist/archives.min.js?v=20260617160000',
24-
'assets/dist/series.min.js?v=20260617160000',
25-
'assets/dist/notes.min.js?v=20260617160000',
26-
'assets/dist/tools.min.js?v=20260617160000',
27-
'assets/dist/tool-age.min.js?v=20260617160000',
28-
'assets/dist/tool-fortune.min.js?v=20260617160000',
29-
'assets/dist/tool-json.min.js?v=20260617160000',
30-
'assets/dist/tool-codec.min.js?v=20260617160000',
31-
'assets/dist/tool-timestamp.min.js?v=20260617160000',
32-
'assets/dist/tool-regex.min.js?v=20260617160000',
33-
'assets/dist/tool-qrcode.min.js?v=20260617160000',
34-
'assets/dist/tool-image.min.js?v=20260617160000',
35-
'assets/dist/tool-network.min.js?v=20260617160000',
36-
'assets/dist/tool-farm-seed.min.js?v=20260617160000',
15+
'assets/dist/common.min.css?v=20260618140000',
16+
'assets/dist/home.min.css?v=20260618140000',
17+
'assets/dist/post.min.css?v=20260618140000',
18+
'assets/dist/tools.min.css?v=20260618140000',
19+
'assets/dist/admin.min.css?v=20260618140000',
20+
'assets/dist/home.min.js?v=20260618140000',
21+
'assets/dist/post.min.js?v=20260618140000',
22+
'assets/dist/tags.min.js?v=20260618140000',
23+
'assets/dist/archives.min.js?v=20260618140000',
24+
'assets/dist/series.min.js?v=20260618140000',
25+
'assets/dist/notes.min.js?v=20260618140000',
26+
'assets/dist/tools.min.js?v=20260618140000',
27+
'assets/dist/tool-age.min.js?v=20260618140000',
28+
'assets/dist/tool-fortune.min.js?v=20260618140000',
29+
'assets/dist/tool-json.min.js?v=20260618140000',
30+
'assets/dist/tool-codec.min.js?v=20260618140000',
31+
'assets/dist/tool-timestamp.min.js?v=20260618140000',
32+
'assets/dist/tool-regex.min.js?v=20260618140000',
33+
'assets/dist/tool-qrcode.min.js?v=20260618140000',
34+
'assets/dist/tool-image.min.js?v=20260618140000',
35+
'assets/dist/tool-network.min.js?v=20260618140000',
36+
'assets/dist/tool-farm-seed.min.js?v=20260618140000',
3737
];
3838

3939
// 安装阶段预缓存关键文件,确保彻底离线也能至少打开首页和 offline.html

0 commit comments

Comments
 (0)