diff --git a/hugo.toml b/hugo.toml index 055b2c4e..8b8d7a7f 100644 --- a/hugo.toml +++ b/hugo.toml @@ -190,6 +190,13 @@ hasCJKLanguage = true emoticons = "/emotion/OwO.json" gravatar = "https://cravatar.cn/avatar/" + # ---------------------------------------------------------------------------- + # RSS 聚合服务 (rss-robot-cf:订阅/友链/文章/图标) + # ---------------------------------------------------------------------------- + [params.rssapi] + # 2026-10-02 从 EdgeOne (https://api.usj.cc) 迁到 Cloudflare Workers + base = "https://api.200181.xyz" + # ---------------------------------------------------------------------------- # 弹幕配置 (Barrage Configuration) # ---------------------------------------------------------------------------- diff --git a/scripts/fetch_greetings.js b/scripts/fetch_greetings.js index 286c6e99..28af4775 100644 --- a/scripts/fetch_greetings.js +++ b/scripts/fetch_greetings.js @@ -7,7 +7,7 @@ const fs = require("fs"); const path = require("path"); -const API_BASE = "https://api.usj.cc/api/ai/greeting"; +const API_BASE = (process.env.RSS_API_BASE || "https://api.200181.xyz") + "/api/ai/greeting"; let TOKEN = process.env.RSS_API_TOKEN; // Fallback: read from write/.env diff --git a/themes/Ying/assets/js/modules/linkify.js b/themes/Ying/assets/js/modules/linkify.js index 6a34dcfb..941772f2 100644 --- a/themes/Ying/assets/js/modules/linkify.js +++ b/themes/Ying/assets/js/modules/linkify.js @@ -2,7 +2,7 @@ (function() { var URL_RE = /(https?:\/\/[^\s一-鿿 -〿＀-￯<>"')\]]+)/g; var VIDEO_RE = /\.(mp4|webm|ogg|mov)(\?|$)/i; - var FAVICON_API = 'https://api.usj.cc/api/favicon?url='; + var FAVICON_API = (window.rssApiBase || 'https://api.200181.xyz') + '/api/favicon?url='; function getDomain(url) { try { return new URL(url).hostname; } catch (e) { return url; } diff --git a/themes/Ying/layouts/_default/_markup/render-link.html b/themes/Ying/layouts/_default/_markup/render-link.html index 0461c62c..2a719ce4 100644 --- a/themes/Ying/layouts/_default/_markup/render-link.html +++ b/themes/Ying/layouts/_default/_markup/render-link.html @@ -10,7 +10,7 @@ {{- else if $isExternal -}} {{- $domain := urls.Parse $url -}} -{{- $faviconUrl := printf "https://api.usj.cc/api/favicon?url=%s" $domain.Host -}} +{{- $faviconUrl := printf "%s/api/favicon?url=%s" (site.Params.rssapi.base | default "https://api.200181.xyz") $domain.Host -}} {{- if $isBareUrl -}} diff --git a/themes/Ying/layouts/page/circles.html b/themes/Ying/layouts/page/circles.html index bd8c0408..ab49b4c0 100644 --- a/themes/Ying/layouts/page/circles.html +++ b/themes/Ying/layouts/page/circles.html @@ -448,7 +448,7 @@ hardTtl: window.BrowserCache ? window.BrowserCache.formatDuration(window.FriendCircle.CACHE_OPTIONS.hardTtl) : window.FriendCircle.CACHE_OPTIONS.hardTtl }); } - return fetch("https://api.usj.cc/api/articles?limit=50") + return fetch("{{ site.Params.rssapi.base | default "https://api.200181.xyz" }}/api/articles?limit=50") .then(function(res) { if (!res.ok) throw new Error("Network response was not ok"); return res.json(); diff --git a/themes/Ying/layouts/page/links.html b/themes/Ying/layouts/page/links.html index a95a63f0..d71895ec 100644 --- a/themes/Ying/layouts/page/links.html +++ b/themes/Ying/layouts/page/links.html @@ -220,7 +220,7 @@ softTtl: window.BrowserCache ? window.BrowserCache.formatDuration(CACHE_OPTIONS.softTtl) : CACHE_OPTIONS.softTtl, hardTtl: window.BrowserCache ? window.BrowserCache.formatDuration(CACHE_OPTIONS.hardTtl) : CACHE_OPTIONS.hardTtl }); - return fetch('https://api.usj.cc/api/links') + return fetch('{{ site.Params.rssapi.base | default "https://api.200181.xyz" }}/api/links') .then(function(res) { if (!res.ok) throw new Error('Failed to fetch links'); return res.json(); diff --git a/themes/Ying/layouts/partials/footer.html b/themes/Ying/layouts/partials/footer.html index cc82ffa4..c132f68a 100644 --- a/themes/Ying/layouts/partials/footer.html +++ b/themes/Ying/layouts/partials/footer.html @@ -80,7 +80,7 @@ {{/* Fetch friend data at build time — no runtime network requests */}} {{ $linkHosts := slice }} {{ $linkNames := slice }} -{{ with resources.GetRemote "https://api.usj.cc/api/links?all=1" }} +{{ with resources.GetRemote (printf "%s/api/links?all=1" (site.Params.rssapi.base | default "https://api.200181.xyz")) }} {{ with .Err }} {{ warnf "Links API fetch failed: %s" . }} {{ else }} @@ -107,7 +107,7 @@ {{ $feedHosts := slice }} {{ $feedNames := slice }} -{{ with resources.GetRemote "https://api.usj.cc/api/feeds" }} +{{ with resources.GetRemote (printf "%s/api/feeds" (site.Params.rssapi.base | default "https://api.200181.xyz")) }} {{ with .Err }} {{ warnf "Feeds API fetch failed: %s" . }} {{ else }} diff --git a/themes/Ying/layouts/partials/head.html b/themes/Ying/layouts/partials/head.html index 07002fd6..81eb180c 100644 --- a/themes/Ying/layouts/partials/head.html +++ b/themes/Ying/layouts/partials/head.html @@ -42,7 +42,8 @@ - + {{ with site.Params.rssapi.base }}{{ end }} + {{ with site.Params.rssapi.base }}{{ end }}