修复link_lite.json bug
This commit is contained in:
1 parent
8dec5359bd
commit
68e3cf372f
7 files changed
+67
-57
No files matched your search
@@ -1,33 +0,0 @@
|
|||||||
name: Refresh CDN
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
schedule:
|
|
||||||
- cron: '0 */12 * * *' # 每 12 小时执行一次
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
refresh-cdn:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: 检出代码
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: 安装 Python
|
|
||||||
uses: actions/setup-python@v2
|
|
||||||
with:
|
|
||||||
python-version: '3.x'
|
|
||||||
|
|
||||||
- name: 安装依赖
|
|
||||||
run: pip install requests
|
|
||||||
|
|
||||||
- name: 等待源站部署
|
|
||||||
run: sleep 1m # 这里用了个笨办法,等待 1 分钟后进行刷新
|
|
||||||
|
|
||||||
- name: 刷新 CDN
|
|
||||||
run: python RefreshCDN.py
|
|
||||||
env:
|
|
||||||
DOGECLOUD_ACCESS_KEY: ${{ secrets.DOGECLOUD_ACCESS_KEY }}
|
|
||||||
DOGECLOUD_SECRET_KEY: ${{ secrets.DOGECLOUD_SECRET_KEY }}
|
|
||||||
CDN_URL_LIST: ${{ secrets.CDN_URL_LIST }}
|
|
||||||
@@ -21,6 +21,15 @@ jobs:
|
|||||||
hugo-version: '0.128.2'
|
hugo-version: '0.128.2'
|
||||||
extended: true
|
extended: true
|
||||||
|
|
||||||
|
- name: Run Pre-Build Scripts
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
# 1. 自动生成友链 JSON (即使本地漏提交也能保证是最新的)
|
||||||
|
./scripts/update_link_lite_json.ps1
|
||||||
|
|
||||||
|
# 2. 自动处理隐藏文章 (防止 status: hidden 的文章意外泄露)
|
||||||
|
./scripts/add_draft_to_hidden.ps1
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: rm -rf public && hugo --minify
|
run: rm -rf public && hugo --minify
|
||||||
|
|
||||||
@@ -43,3 +52,18 @@ jobs:
|
|||||||
password: ${{ secrets.UPYUN_PASSWORD }}
|
password: ${{ secrets.UPYUN_PASSWORD }}
|
||||||
dir: 'public' # 确认这个目录是您的构建输出目录
|
dir: 'public' # 确认这个目录是您的构建输出目录
|
||||||
publish_dir: '/' # 发布到 UpYun 的根目录
|
publish_dir: '/' # 发布到 UpYun 的根目录
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.x'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pip install requests
|
||||||
|
|
||||||
|
- name: Refresh DogeCloud CDN
|
||||||
|
env:
|
||||||
|
DOGECLOUD_ACCESS_KEY: ${{ secrets.DOGECLOUD_ACCESS_KEY }}
|
||||||
|
DOGECLOUD_SECRET_KEY: ${{ secrets.DOGECLOUD_SECRET_KEY }}
|
||||||
|
CDN_URL_LIST: ${{ secrets.CDN_URL_LIST }}
|
||||||
|
run: python scripts/RefreshCDN.py
|
||||||
File renamed without changes.
@@ -84,8 +84,9 @@ foreach ($file in $files) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
# Save file using .NET method to ensure UTF8
|
# Save file using .NET method to ensure UTF8 without BOM
|
||||||
[System.IO.File]::WriteAllText($file.FullName, $newContent, [System.Text.Encoding]::UTF8)
|
$utf8NoBom = New-Object System.Text.UTF8Encoding $false
|
||||||
|
[System.IO.File]::WriteAllText($file.FullName, $newContent, $utf8NoBom)
|
||||||
Write-Host " -> Saved changes to $($file.Name)" -ForegroundColor Green
|
Write-Host " -> Saved changes to $($file.Name)" -ForegroundColor Green
|
||||||
$count++
|
$count++
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-1
@@ -87,10 +87,27 @@ async function main() {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let linksData;
|
||||||
let links;
|
let links;
|
||||||
try {
|
try {
|
||||||
const fileContent = fs.readFileSync(LINKS_FILE, 'utf8');
|
const fileContent = fs.readFileSync(LINKS_FILE, 'utf8');
|
||||||
links = JSON.parse(fileContent);
|
linksData = JSON.parse(fileContent);
|
||||||
|
// Adapt to both array (old) and object with friends key (new)
|
||||||
|
if (Array.isArray(linksData)) {
|
||||||
|
links = linksData;
|
||||||
|
} else if (linksData.friends && Array.isArray(linksData.friends)) {
|
||||||
|
// The new format has [name, url, avatar] arrays inside friends array
|
||||||
|
// We need to convert them to objects {name, url} for the checker
|
||||||
|
links = linksData.friends.map(item => {
|
||||||
|
if (Array.isArray(item)) {
|
||||||
|
return { name: item[0], url: item[1] };
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.error('Error: Unknown JSON format');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Error parsing JSON:', e.message);
|
console.error('Error parsing JSON:', e.message);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|||||||
@@ -94,7 +94,8 @@ if (-not (Test-Path $jsonDir)) {
|
|||||||
New-Item -ItemType Directory -Path $jsonDir | Out-Null
|
New-Item -ItemType Directory -Path $jsonDir | Out-Null
|
||||||
}
|
}
|
||||||
|
|
||||||
# Write to file
|
# Write to file without BOM
|
||||||
[System.IO.File]::WriteAllText($jsonPath, $json, [System.Text.Encoding]::UTF8)
|
$utf8NoBom = New-Object System.Text.UTF8Encoding $false
|
||||||
|
[System.IO.File]::WriteAllText($jsonPath, $json, $utf8NoBom)
|
||||||
|
|
||||||
Write-Host "Successfully generated $jsonPath" -ForegroundColor Green
|
Write-Host "Successfully generated $jsonPath" -ForegroundColor Green
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"friends": [
|
"friends": [
|
||||||
[
|
[
|
||||||
"吾柯",
|
"吾柯",
|
||||||
@@ -8,12 +8,12 @@
|
|||||||
[
|
[
|
||||||
"叶开",
|
"叶开",
|
||||||
"https://qq.md",
|
"https://qq.md",
|
||||||
"https://cravatar.cn/avatar/4741124456fb02fa4da30494dbc6c99e?d=monsterid\u0026s=80"
|
"https://cravatar.cn/avatar/4741124456fb02fa4da30494dbc6c99e?d=monsterid&s=80"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"一泽",
|
"一泽",
|
||||||
"https://yang99.fun",
|
"https://yang99.fun",
|
||||||
"https://q.qlogo.cn/g?b=qq\u0026nk=3369963811@qq.com\u0026s=100"
|
"https://q.qlogo.cn/g?b=qq&nk=3369963811@qq.com&s=100"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"七栀",
|
"七栀",
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
[
|
[
|
||||||
"若志随笔",
|
"若志随笔",
|
||||||
"https://www.rz.sb",
|
"https://www.rz.sb",
|
||||||
"https://q1.qlogo.cn/g?b=qq\u0026nk=80360650\u0026s=640"
|
"https://q1.qlogo.cn/g?b=qq&nk=80360650&s=640"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"黑桃三",
|
"黑桃三",
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
[
|
[
|
||||||
"十七的小栈",
|
"十七的小栈",
|
||||||
"https://blog.allnull.cn",
|
"https://blog.allnull.cn",
|
||||||
"https://cravatar.cn/avatar/56238a7f177c534928fd3cf4161ab59e?s=65\u0026r=G\u0026d=mm"
|
"https://cravatar.cn/avatar/56238a7f177c534928fd3cf4161ab59e?s=65&r=G&d=mm"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"Vian",
|
"Vian",
|
||||||
@@ -43,17 +43,17 @@
|
|||||||
[
|
[
|
||||||
"油油",
|
"油油",
|
||||||
"https://blog.200011.net",
|
"https://blog.200011.net",
|
||||||
"https://q1.qlogo.cn/g?b=qq\u0026nk=1376652515\u0026s=640"
|
"https://q1.qlogo.cn/g?b=qq&nk=1376652515&s=640"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"段先森",
|
"段先森",
|
||||||
"https://duanxiansen.com",
|
"https://duanxiansen.com",
|
||||||
"https://q.qlogo.cn/g?b=qq\u0026nk=2443266417@qq.com\u0026s=100"
|
"https://q.qlogo.cn/g?b=qq&nk=2443266417@qq.com&s=100"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"Fivk博客",
|
"Fivk博客",
|
||||||
"https://blog.fivk.cn",
|
"https://blog.fivk.cn",
|
||||||
"https://q1.qlogo.cn/g?b=qq\u0026nk=11470226\u0026s=640"
|
"https://q1.qlogo.cn/g?b=qq&nk=11470226&s=640"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"百品博客",
|
"百品博客",
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
[
|
[
|
||||||
"北枫",
|
"北枫",
|
||||||
"https://beifeng.me",
|
"https://beifeng.me",
|
||||||
"https://q1.qlogo.cn/g?b=qq\u0026nk=41777657\u0026s=640"
|
"https://q1.qlogo.cn/g?b=qq&nk=41777657&s=640"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"团团生活志",
|
"团团生活志",
|
||||||
@@ -83,12 +83,12 @@
|
|||||||
[
|
[
|
||||||
"岳泽以",
|
"岳泽以",
|
||||||
"https://www.yuezeyi.com",
|
"https://www.yuezeyi.com",
|
||||||
"https://q2.qlogo.cn/g?b=qq\u0026nk=2780008080\u0026s=100"
|
"https://q2.qlogo.cn/g?b=qq&nk=2780008080&s=100"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"三石的记录",
|
"三石的记录",
|
||||||
"https://www.fllv.cn",
|
"https://www.fllv.cn",
|
||||||
"https://cdn.helingqi.com/wavatar/a25a7640aa68e6d26e32afee8120f7e5?s=65\u0026r=G\u0026d="
|
"https://cdn.helingqi.com/wavatar/a25a7640aa68e6d26e32afee8120f7e5?s=65&r=G&d="
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"竹春廿柒",
|
"竹春廿柒",
|
||||||
@@ -103,17 +103,17 @@
|
|||||||
[
|
[
|
||||||
"半截の诗",
|
"半截の诗",
|
||||||
"https://sweetjing.cc/",
|
"https://sweetjing.cc/",
|
||||||
"https://q1.qlogo.cn/g?b=qq\u0026nk=1486823198\u0026s=640"
|
"https://q1.qlogo.cn/g?b=qq&nk=1486823198&s=640"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"XIAOMING\u0027S BLOG",
|
"XIAOMING'S BLOG",
|
||||||
"https://vimin.cc",
|
"https://vimin.cc",
|
||||||
"https://cravatar.cn/avatar/6eb95597489dd26f15a973e667d71aef?s=100\u0026amp;r=G\u0026amp;d="
|
"https://cravatar.cn/avatar/6eb95597489dd26f15a973e667d71aef?s=100&r=G&d="
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"网友小宋",
|
"网友小宋",
|
||||||
"https://xyzbz.cn",
|
"https://xyzbz.cn",
|
||||||
"https://cravatar.cn/avatar/120340d1df519f4e28613fe5d404b286?s=65\u0026r=G\u0026d="
|
"https://cravatar.cn/avatar/120340d1df519f4e28613fe5d404b286?s=65&r=G&d="
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"微风忆夏",
|
"微风忆夏",
|
||||||
@@ -133,7 +133,7 @@
|
|||||||
[
|
[
|
||||||
"Kris Yan",
|
"Kris Yan",
|
||||||
"https://blog.krisyan.dev",
|
"https://blog.krisyan.dev",
|
||||||
"https://cravatar.cn/avatar/05729ab2ca3b99203a674859f77d592b?\u0026d=mp"
|
"https://cravatar.cn/avatar/05729ab2ca3b99203a674859f77d592b?&d=mp"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"Echo 的小窝",
|
"Echo 的小窝",
|
||||||
@@ -143,7 +143,7 @@
|
|||||||
[
|
[
|
||||||
"未来往事",
|
"未来往事",
|
||||||
"https://felixway.cn",
|
"https://felixway.cn",
|
||||||
"https://cravatar.cn/avatar/2ee35215cbea58cd8b2605e7f517d689?\u0026d=mp"
|
"https://cravatar.cn/avatar/2ee35215cbea58cd8b2605e7f517d689?&d=mp"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"小稚生活志",
|
"小稚生活志",
|
||||||
@@ -163,7 +163,7 @@
|
|||||||
[
|
[
|
||||||
"永恒末匕",
|
"永恒末匕",
|
||||||
"https://likaijian.com",
|
"https://likaijian.com",
|
||||||
"https://q.qlogo.cn/headimg_dl?dst_uin=1527335101\u0026spec=640"
|
"https://q.qlogo.cn/headimg_dl?dst_uin=1527335101&spec=640"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"刘郎阁",
|
"刘郎阁",
|
||||||
@@ -173,7 +173,7 @@
|
|||||||
[
|
[
|
||||||
"浮沉流年",
|
"浮沉流年",
|
||||||
"https://www.fcln.net",
|
"https://www.fcln.net",
|
||||||
"https://cravatar.cn/avatar//4355eea603309a0c159ca27f54e27c89?s=65\u0026r=G\u0026d="
|
"https://cravatar.cn/avatar//4355eea603309a0c159ca27f54e27c89?s=65&r=G&d="
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"二十六",
|
"二十六",
|
||||||
|
|||||||
Reference in new issue
Block a user