Remove & made the words system based on github NOT nuking this repo :)

This commit is contained in:
yuanhau 2025-06-09 14:33:20 +08:00
parent 5f3a721339
commit e2adcf71b8
3 changed files with 22 additions and 28 deletions

View file

@ -1 +0,0 @@
# 資料庫資訊 Database info

View file

@ -1,29 +1,24 @@
import sql from "~/server/components/postgres";
let cachedWords: content | null = null;
let lastFetchTime: number | null = null;
const CACHE_DURATION = 1000 * 60 * 60 * 3; // Updates every 3 hours.
interface content {
data: string[];
}
export default defineEventHandler(async (event) => {
return {
words: [
"尺度太小",
"比基尼",
"無罩",
"脫褲",
"裸露",
"露豐",
"V辣",
"激露",
"E級曲線",
"放0肩",
"透視裝",
"性侵",
"裸照",
"性感",
"找妹",
"肉蹼",
"超兇北半球",
"大露",
"色誘",
"死亡",
"撩妹",
"裸上身",
],
};
const currentTime = Date.now();
if (
cachedWords &&
lastFetchTime &&
currentTime - lastFetchTime < CACHE_DURATION
) {
return cachedWords;
}
const fetchWordsFromGitHub = await fetch(
"https://raw.githubusercontent.com/hpware/news-analyze/refs/heads/master/words.json",
);
cachedWords = await fetchWordsFromGitHub.json();
lastFetchTime = currentTime;
return cachedWords;
});