mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-02 17:32:50 +08:00
Add news ticker at the bottom of the client
Central feed (/api/store/news on the store server: manual items via STORE_ADMIN_TOKEN, plus the latest release and newest store design for 30 days) and a per-gateway /api/news with NEWS_TICKER, NEWS_TICKER_CENTRAL and NEWS_TICKER_MESSAGES so self-hosters can turn it off or add their own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
1 parent
aa324274a4
commit
632e77ccc8
12 files changed
+359
No files matched your search
@@ -7,6 +7,7 @@
|
||||
import { createServer } from "node:http";
|
||||
import { handleStore } from "./store.js";
|
||||
import { handlePing } from "./ping.js";
|
||||
import { handleNewsFeed } from "./news.js";
|
||||
|
||||
const PORT = Number(process.env.PORT ?? 8080);
|
||||
|
||||
@@ -28,6 +29,16 @@ createServer((req, res) => {
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (pathname === "/api/store/news" || pathname === "/api/store/news/admin") {
|
||||
handleNewsFeed(req, res, pathname).catch((err) => {
|
||||
console.error("[news] Request failed:", err);
|
||||
if (!res.headersSent) {
|
||||
res.writeHead(500, { "Content-Type": "application/json" });
|
||||
res.end(JSON.stringify({ error: "internal" }));
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (pathname === "/api/ping" || pathname === "/api/ping/stats") {
|
||||
handlePing(req, res, pathname).catch((err) => {
|
||||
console.error("[ping] Request failed:", err);
|
||||
|
||||
Reference in new issue
Block a user