From db5e174dd4f1c3530a4b39bffda44f733fab8b89 Mon Sep 17 00:00:00 2001 From: Last2014 Date: Fri, 8 Aug 2025 21:29:19 +0900 Subject: [PATCH] v8.1 --- checks/api.ts | 2 +- checks/legal.ts | 12 +++++ checks/main.ts | 5 ++ checks/version.ts | 2 +- examples/config.ts | 13 +++--- main.ts | 15 ++++-- package.json | 5 +- panel/main.ts | 2 + panel/public/index.html | 4 ++ panel/public/script.js | 14 ++++++ panel/route/api.ts | 2 +- panel/route/debug.ts | 24 ++++++++++ panel/route/eventday.ts | 25 ++++++++++ panel/route/token.ts | 3 -- panel/route/ueuse.ts | 10 ++-- scripts/birthdayDataSet.ts | 14 ------ scripts/birthdayNotice.ts | 56 ----------------------- scripts/commands/birthday.ts | 88 ------------------------------------ scripts/commands/follow.ts | 2 +- scripts/commands/help.ts | 7 --- scripts/commands/main.ts | 12 ++--- scripts/commands/report.ts | 2 +- scripts/commands/unfollow.ts | 2 +- scripts/earthquakeNotice.ts | 2 +- scripts/eventday.ts | 30 ++++++++++++ scripts/eventdayData.ts | 70 ++++++++++++++++++++++++++++ scripts/timeNotice.ts | 2 +- scripts/weatherNotice.ts | 4 +- types/config.d.ts | 14 +++--- 29 files changed, 235 insertions(+), 208 deletions(-) create mode 100644 checks/legal.ts create mode 100644 panel/route/debug.ts create mode 100644 panel/route/eventday.ts delete mode 100644 scripts/birthdayDataSet.ts delete mode 100644 scripts/birthdayNotice.ts delete mode 100644 scripts/commands/birthday.ts create mode 100644 scripts/eventday.ts create mode 100644 scripts/eventdayData.ts diff --git a/checks/api.ts b/checks/api.ts index 0990a43..3111cfe 100644 --- a/checks/api.ts +++ b/checks/api.ts @@ -3,7 +3,7 @@ import config from "../config.js"; export default async function APICheck() { try { - const req = await fetch(`https://${config.uwuzu.host}/api/me/`, { + const req = await fetch(`${config.uwuzu.host}/api/me/`, { method: "POST", body: JSON.stringify({ token: config.uwuzu.apiToken, diff --git a/checks/legal.ts b/checks/legal.ts new file mode 100644 index 0000000..f9585c9 --- /dev/null +++ b/checks/legal.ts @@ -0,0 +1,12 @@ +import config from "../config.js"; +import { styleText } from "util"; + +export default function LegalCheck() { + if ( + config.legal.terms.length <= 50 || + config.legal.terms.length <= 50 + ) { + console.log(styleText("red", "利用規約とプライバシーポリシーは50文字以上にしてください。")); + process.exit(); + } +} diff --git a/checks/main.ts b/checks/main.ts index 35cc316..ab40c98 100644 --- a/checks/main.ts +++ b/checks/main.ts @@ -3,11 +3,16 @@ import PackagesCheck from "./packages.js"; import ConfigCheck from "./config.js"; import APICheck from "./api.js"; import VersionCheck from "./version.js"; +import LegalCheck from "./legal.js"; +import config from "../config.js"; export default async function Check() { PackagesIsExist(); PackagesCheck(); ConfigCheck(); + if (config.debug === undefined) { + LegalCheck() + } await APICheck(); await VersionCheck(); } diff --git a/checks/version.ts b/checks/version.ts index 11b3130..d5027c9 100644 --- a/checks/version.ts +++ b/checks/version.ts @@ -26,7 +26,7 @@ export default async function VersionCheck() { const releaseUrl = `${packageJson.repository.url}/releases/tag/${packageJson.tag}`; - await fetch(`https://${config.uwuzu.host}/api/ueuse/create`, { + await fetch(`${config.uwuzu.host}/api/ueuse/create`, { method: "POST", body: JSON.stringify({ token: config.uwuzu.apiToken, diff --git a/examples/config.ts b/examples/config.ts index 3d08cc9..2fad399 100644 --- a/examples/config.ts +++ b/examples/config.ts @@ -35,6 +35,11 @@ const config: configTypes = { to: "admin@noticeuwuzu.example.com", // 緊急時メール送信先(配列可) }, }, + // /report設定 + report: { + isEnabled: true, // 有効/無効 + message: "", // 報告者へのメッセージ + }, // 規約等 legal: { terms: ` @@ -51,16 +56,10 @@ const config: configTypes = { port: 74919, // 配信ポート }, }, - // /report設定 - report: { - isEnabled: true, // 有効/無効 - message: "", // 報告者へのメッセージ - }, // uwuzuサーバー設定 uwuzu: { apiToken: "TOKEN_EXAMPLE", // APIトークン - clientToken: "TOKEN_EXAMPLE", // クライアントトークン(任意) - host: "uwuzu.example.com", // サーバーホスト(HTTPSである必要があります) + host: "https://uwuzu.example.com", // サーバーホスト }, }; diff --git a/main.ts b/main.ts index 7f99c64..d54a4e0 100644 --- a/main.ts +++ b/main.ts @@ -11,16 +11,14 @@ import * as cron from "node-cron"; import timeNotice from "./scripts/timeNotice.js"; import { weatherNotice } from "./scripts/weatherNotice.js"; import earthquakeNotice from "./scripts/earthquakeNotice.js"; -import birthdayNotice from "./scripts/birthdayNotice.js"; +import EventDays from "scripts/eventday.js"; import Commands from "./scripts/commands/main.js"; -import BirthdayDataSet from "./scripts/birthdayDataSet.js"; // その他機能 import asciiArt from "./scripts/asciiart.js"; asciiArt(); import successExit from "./scripts/successExit.js"; successExit(); -BirthdayDataSet(); // 地震情報観測開始 earthquakeNotice(); @@ -31,23 +29,30 @@ cron.schedule("0 * * * *", () => { }); // コマンド(10分/1回) -cron.schedule('*/10 * * * *', () => { +cron.schedule("*/10 * * * *", () => { Commands(); }); +// 祝日などお知らせ(毎日0:00) +cron.schedule("0 0 * * *", () => { + EventDays(); +}); + // 天気お知らせ(毎日7:00) +import { setTimeout } from "timers"; cron.schedule("0 7 * * *", () => { setTimeout(() => { weatherNotice(); - birthdayNotice(); }, 100); }); // 管理パネル import AdminPanel from "./panel/main.js"; +import { styleText } from "util"; (async () => { await AdminPanel(); })(); // 起動表示 console.log("BOTサーバーが起動しました"); +console.log(styleText(["bgRed", "cyan", "bold"], "デバッグモードで起動中")); diff --git a/package.json b/package.json index cec7ed2..7463872 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "notice-uwuzu", - "version": "v8.0.2@uwuzu1.6.1", - "tag": "v8.0.2", + "version": "v8.1@uwuzu1.6.1", + "tag": "v8.1", "description": "Notice Bot for uwuzu", "main": "dist/main.js", "scripts": { @@ -49,6 +49,7 @@ "fs": "^0.0.1-security", "node-cron": "^4.1.1", "nodemailer": "^7.0.4", + "timers": "^0.1.1", "typescript": "^5.9.2", "ws": "^8.18.3" }, diff --git a/panel/main.ts b/panel/main.ts index 479c483..2cc31f1 100644 --- a/panel/main.ts +++ b/panel/main.ts @@ -9,6 +9,7 @@ import ueusePost from "./route/ueuse.js"; import WeatherUeuse from "./route/weather.js"; import API from "./route/api.js"; import Token from "./route/token.js"; +import Debug from "./route/debug.js"; export default async function AdminPanel() { // 無効 @@ -26,6 +27,7 @@ export default async function AdminPanel() { app.use(WeatherUeuse); app.use(API); app.use(Token); + app.use(Debug); app.use(express.static("panel/public")); app.listen(port, () => { diff --git a/panel/public/index.html b/panel/public/index.html index e9d9a4e..64a9773 100644 --- a/panel/public/index.html +++ b/panel/public/index.html @@ -23,6 +23,10 @@ 天気お知らせ + + diff --git a/panel/public/script.js b/panel/public/script.js index d0446cf..66db087 100644 --- a/panel/public/script.js +++ b/panel/public/script.js @@ -26,6 +26,20 @@ document.getElementById("weatherUeuse").addEventListener("click", async () => { } }); +document.getElementById("eventdayUeuse").addEventListener("click", async () => { + const req = await fetch("/actions/eventday", { + method: "POST", + }); + + const res = await req.text(); + + if (res === "Accepted") { + alert("祝日等お知らせを受け付けました"); + } else { + alert(`祝日等お知らせの要求にエラーが発生しました:${res}`); + } +}); + document.getElementById("ueuse").addEventListener("click", async () => { const text = prompt("ユーズ内容").toLowerCase(); diff --git a/panel/route/api.ts b/panel/route/api.ts index 53a5f8a..5914aeb 100644 --- a/panel/route/api.ts +++ b/panel/route/api.ts @@ -11,7 +11,7 @@ API.post("/actions/api", async (req, res, next) => { const body = req.body.body; try { - const apiReq = await fetch(`https://${config.uwuzu.host}/api${endpoint}`, { + const apiReq = await fetch(`${config.uwuzu.host}/api${endpoint}`, { method: "POST", body: JSON.stringify(body), }); diff --git a/panel/route/debug.ts b/panel/route/debug.ts new file mode 100644 index 0000000..57109dc --- /dev/null +++ b/panel/route/debug.ts @@ -0,0 +1,24 @@ +import express from "express"; +const Debug = express.Router(); + +import config from "../../config.js"; + +Debug.post("/actions/debug", (req, res, next) => { + res.status(501) + .send("GET Only"); +}); + +Debug.get("/actions/debug", (req, res) => { + let debug; + + if (config.debug === undefined) { + debug = false; + } else { + debug = true; + } + + res.status(200) + .send(debug); +}); + +export default Debug; diff --git a/panel/route/eventday.ts b/panel/route/eventday.ts new file mode 100644 index 0000000..0b1a0ae --- /dev/null +++ b/panel/route/eventday.ts @@ -0,0 +1,25 @@ +import express from "express"; +const EventdayUeuse = express.Router(); + +import EventDays from "../../scripts/eventday.js"; + +EventdayUeuse.post("/actions/eventday", (req, res) => { + try { + (async () => { + await EventDays(); + })(); + + res.status(202) + .send("Accepted"); + } catch(err) { + res.status(500) + .send(`Error: ${err}`); + } +}); + +EventdayUeuse.get("/actions/eventday", (req, res) => { + res.status(501) + .send("POST Only"); +}); + +export default EventdayUeuse; diff --git a/panel/route/token.ts b/panel/route/token.ts index 2563718..2ad2a80 100644 --- a/panel/route/token.ts +++ b/panel/route/token.ts @@ -3,9 +3,6 @@ const Token = express.Router(); import config from "../../config.js"; -Token.use(express.json()); -Token.use(express.urlencoded({ extended: true })); - Token.post("/actions/token", (req, res, next) => { res.status(501) .send("GET Only"); diff --git a/panel/route/ueuse.ts b/panel/route/ueuse.ts index 1bc0424..50cec6b 100644 --- a/panel/route/ueuse.ts +++ b/panel/route/ueuse.ts @@ -11,18 +11,22 @@ ueusePost.post("/actions/ueuse", async (req, res, next) => { const nsfw = req.body.nsfw; try { - const ueuseReq = await fetch(`https://${config.uwuzu.host}/api/ueuse/create`, { + const ueuseReq = await fetch(`${config.uwuzu.host}/api/ueuse/create`, { method: "POST", body: JSON.stringify({ token: config.uwuzu.apiToken, - text: text, + text: ` + ${text} + + このユーズはnoticeUwuzuの管理パネルから投稿されました + `, nsfw: nsfw, }), }); const ueuseRes = await ueuseReq.json(); - console.log(`ユーズ(管理パネル):${ueuseRes}`); + console.log(`ユーズ(管理パネル):${JSON.stringify(ueuseRes)}`); res.status(200) .send("Success"); diff --git a/scripts/birthdayDataSet.ts b/scripts/birthdayDataSet.ts deleted file mode 100644 index 5f083a4..0000000 --- a/scripts/birthdayDataSet.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { existsSync, writeFileSync } from "fs"; - -const initialData = {} as -{ [key: string]: string | undefined }; - -export default function BirthdayDataSet() { - if (!existsSync("data/birthdays.json")) { - writeFileSync( - "data/birthdays.json", - JSON.stringify(initialData), - "utf-8", - ); - } -} diff --git a/scripts/birthdayNotice.ts b/scripts/birthdayNotice.ts deleted file mode 100644 index 3a4d765..0000000 --- a/scripts/birthdayNotice.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { readFileSync } from "fs"; -import { isSameDay, format, differenceInYears } from "date-fns/fp"; -import config from "../config.js"; - -export default async function birthdayNotice() { - // 読み込み - const birthdays: { [key: string]: string | undefined } = - JSON.parse(readFileSync("data/birthdays.json", "utf-8")); - - // 配列化 - const birthdaysIndex: string[] = Object.entries(birthdays) - .map(([key, value]) => value) - .filter(value => value !== undefined) as string[]; - - // 初期値 - const resultInitial: string = ` - 【今日誕生日の人】\n`; - - let result = resultInitial; - - for (let i = 0; i < Object.keys(birthdays).length; i++) { - const birthday = format(birthdaysIndex[i], "yyyy/MM/dd") - - if (isSameDay(birthday, new Date())) { - const age = differenceInYears(new Date(), birthday); - - const req = await fetch(`https://${config.uwuzu.host}/api/users/`, { - method: "POST", - body: JSON.stringify({ - token: config.uwuzu.apiToken, - userid: Object.keys(birthdays)[i], - }), - }); - - const res = await req.json(); - - result+= `${res.username}さん(${age}歳)\n` - } - } - - if (result === resultInitial) { - return; - } - - const req = await fetch(`https://${config.uwuzu.host}/api/ueuse/create`, { - method: "POST", - body: JSON.stringify({ - token: config.uwuzu.apiToken, - text: result, - }), - }); - - const res = await req.json(); - - console.log("誕生日お知らせ:", res); -} diff --git a/scripts/commands/birthday.ts b/scripts/commands/birthday.ts deleted file mode 100644 index c8befb2..0000000 --- a/scripts/commands/birthday.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { ueuse } from "types/types"; -import { readFileSync, writeFileSync, existsSync } from "fs"; -import { parse, isValid } from 'date-fns/fp'; -import { Reply } from "./main.js"; - -function normalizedString(Str: string) { - return Str.replace(/[\u3000-\u303F]+/g, ' ') - .replace(/[\uFF01-\uFF0F]+/g, '0-9') - .replace(/[\u3001-\u3002]+/g, '/'); -} - -function isValidDateString(dateString: string) { - const normalizedStr = normalizedString(dateString); - - const regex = /^\d{4}\/\d{2}\/\d{2}$/; - if (!regex.test(normalizedStr)) { - return false; - } - - const parseString = parse(new Date(), 'yyyy/MM/dd'); - return isValid(parseString(normalizedStr)); -} - -export default function Birthday(data: ueuse) { - // 読み込み - const birthdays: { [key: string]: string | undefined } = - JSON.parse(readFileSync("data/birthdays.json", "utf-8")); - - if ( - (data.abi === "none" || - data.abi === "") && - birthdays[data.account.userid] === undefined - ) { - Reply(` - 追記に誕生日を入力してください - (このユーズはもう利用できません。他のユーズで\`/birthday\`をまたご利用ください。) - `, data.uniqid); - return; - } - - if ( - data.abi === "delete" && - birthdays[data.account.userid] !== undefined - ) { - birthdays[data.account.userid] = undefined; - writeFileSync( - "data/birthdays.json", - JSON.stringify(birthdays), - "utf-8", - ); - - Reply(` - 誕生日のデータを削除しました - `, data.uniqid); - return; - } - - if ( - data.abi === "delete" && - birthdays[data.account.userid] === undefined - ) { - Reply(` - 誕生日のデータが存在しないため削除できません - `, data.uniqid); - return; - } - - if (!isValidDateString(data.abi)) { - Reply(` - 誕生日の形式が違います。 - yyyy/MM/ddの形式で入力してください。 - スラッシュ・数字は全角での使用が可能です。 - (このユーズはもう利用できません。他のユーズで\`/birthday\`をまたご利用ください。) - `, data.uniqid); - return; - } - - birthdays[data.account.userid] = normalizedString(data.abi); - writeFileSync( - "data/birthdays.json", - JSON.stringify(birthdays), - "utf-8", - ); - - Reply(` - ${data.account.username}さんの誕生日を${normalizedString(data.abi)}に設定しました - `, data.uniqid); -} diff --git a/scripts/commands/follow.ts b/scripts/commands/follow.ts index c9d9626..785bb9e 100644 --- a/scripts/commands/follow.ts +++ b/scripts/commands/follow.ts @@ -3,7 +3,7 @@ import config from "../../config.js"; import { Reply } from "./main.js"; export default async function Follow(data: ueuse) { - const followReq = await fetch(`https://${config.uwuzu.host}/api/users/follow`, { + const followReq = await fetch(`${config.uwuzu.host}/api/users/follow`, { method: "POST", body: JSON.stringify({ token: config.uwuzu.apiToken, diff --git a/scripts/commands/help.ts b/scripts/commands/help.ts index 321be1e..ff784f1 100644 --- a/scripts/commands/help.ts +++ b/scripts/commands/help.ts @@ -9,7 +9,6 @@ const helpsMin = { "unfollow": "コマンド送信者をフォロー解除します。", "weather": "天気を返信します。", "report": "運営者に不具合などを報告します。", - "birthday": "誕生日を設定・削除できます。", "legal terms": "利用規約を返信します。", "legal privacy": "プライバシーポリシーを返信します。", } as { [key: string]: string }; @@ -41,12 +40,6 @@ const helpsFull = { 運営者によって有効化されていないと使用できません。 \`/report\`を使用してそのユーズの追記に内容を入力することで使用できます。 `, - "birthday": ` - 誕生日を設定できます。 - 設定された誕生日の7:00に祝われます。 - 追記にyyyy/MM/ddの形式で誕生日を入力することで誕生日を設定できます。 - また、追記に\`delete\`と入力することで誕生日のデータを削除できます。 - `, "legal terms": ` 利用規約を返信します。 `, diff --git a/scripts/commands/main.ts b/scripts/commands/main.ts index 1186ef8..0c68db4 100644 --- a/scripts/commands/main.ts +++ b/scripts/commands/main.ts @@ -11,7 +11,6 @@ import UnFollow from "./unfollow.js"; import Weather from "./weather.js"; import Help from "./help.js"; import Report from "./report.js"; -import Birthday from "./birthday.js"; import Terms from "./legal/terms.js" import PrivacyPolicy from "./legal/privacy.js"; @@ -38,7 +37,7 @@ function cutAfterChar(str: string, char: string) { } export async function Reply(text: string, reply: string) { - const req = await fetch(`https://${config.uwuzu.host}/api/ueuse/create`, { + const req = await fetch(`${config.uwuzu.host}/api/ueuse/create`, { method: "POST", body: JSON.stringify({ token: config.uwuzu.apiToken, @@ -65,7 +64,7 @@ function alreadyAdd(data: string) { export default async function Commands() { const mentionsReq = await fetch( - `https://${config.uwuzu.host}/api/ueuse/mentions`, { + `${config.uwuzu.host}/api/ueuse/mentions`, { method: "POST", body: JSON.stringify({ token: config.uwuzu.apiToken, @@ -84,6 +83,10 @@ export default async function Commands() { const data = mentions[key]; // 除外ユーズ + if (data.text === undefined) { + break; + } + if (alreadyCommands.indexOf(data.uniqid) !== -1) { break; } @@ -130,9 +133,6 @@ export default async function Commands() { case "weather": Weather(data); break; - case "birthday": - Birthday(data); - break; default: const reply = await Reply(` 不明なコマンドです。 diff --git a/scripts/commands/report.ts b/scripts/commands/report.ts index 4c0735c..ed5ab92 100644 --- a/scripts/commands/report.ts +++ b/scripts/commands/report.ts @@ -48,7 +48,7 @@ export default async function Report(data: ueuse) { 【報告】 BOT管理者さん、noticeUwuzu自動送信メールです。 @${data.account.userid}@${config.uwuzu.host}から/reportコマンドを利用した報告がありました。 - 報告元ユーズ:https://${config.uwuzu.host}/!${data.uniqid} + 報告元ユーズ:${config.uwuzu.host}/!${data.uniqid} 下記が内容となります。 ${data.abi} `, diff --git a/scripts/commands/unfollow.ts b/scripts/commands/unfollow.ts index 65c68c5..0407ad9 100644 --- a/scripts/commands/unfollow.ts +++ b/scripts/commands/unfollow.ts @@ -3,7 +3,7 @@ import config from "../../config.js"; import { Reply } from "./main.js"; export default async function UnFollow(data: ueuse) { - const unfollowReq = await fetch(`https://${config.uwuzu.host}/api/users/unfollow`, { + const unfollowReq = await fetch(`${config.uwuzu.host}/api/users/unfollow`, { method: "POST", body: JSON.stringify({ token: config.uwuzu.apiToken, diff --git a/scripts/earthquakeNotice.ts b/scripts/earthquakeNotice.ts index 7d13d4f..ecdc6bb 100644 --- a/scripts/earthquakeNotice.ts +++ b/scripts/earthquakeNotice.ts @@ -485,7 +485,7 @@ async function event(earthquakeInfo: any): Promise { } async function ueuse(text: string) { - const res = await fetch(`https://${config.uwuzu.host}/api/ueuse/create`, { + const res = await fetch(`${config.uwuzu.host}/api/ueuse/create`, { method: "POST", body: JSON.stringify({ token: config.uwuzu.apiToken, diff --git a/scripts/eventday.ts b/scripts/eventday.ts new file mode 100644 index 0000000..17f55c3 --- /dev/null +++ b/scripts/eventday.ts @@ -0,0 +1,30 @@ +import { format } from "date-fns"; +import eventdays from "./eventdayData.js"; +import config from "../config.js"; + +export default async function EventDays() { + const now = format(new Date(), "MM/dd"); + + for (let i = 0; i < Object.keys(eventdays).length; i++) { + const day = Object.keys(eventdays)[i]; + const value = Object.values(eventdays)[i]; + const name = value.name; + const message = value.message; + + if (day === now) { + const req = await fetch(`${config.uwuzu.host}/api/ueuse/create`, { + method: "POST", + body: JSON.stringify({ + token: config.uwuzu.apiToken, + text: + `今日は${name}です + ${message}`, + }), + }); + + const res = await req.json(); + + console.log("祝日等ユーズ:", res); + } + } +} diff --git a/scripts/eventdayData.ts b/scripts/eventdayData.ts new file mode 100644 index 0000000..510f782 --- /dev/null +++ b/scripts/eventdayData.ts @@ -0,0 +1,70 @@ +interface eventdaysValue { + name: string; + message: string; +} + +const eventdays = { + "01/01": { + name: "元日", + message: "はい年越した瞬間地球にいなかった~", + }, + "02/11": { + name: "建国記念日", + message: "建国記念日とかいう強制休暇", + }, + "04/29": { + name: "昭和の日", + message: "平成の日は???", + }, + "05/03": { + name: "憲法記念日", + message: "憲法決めた日とか祝日じゃなくていいだろ", + }, + "05/04": { + name: "みどりの日", + message: + `なんだよみどりの日って + 単色全部作れよ`, + }, + "05/05": { + name: "こどもの日", + message: "こどもの日あるならおとなの日もあっていいだろ", + }, + "07/07": { + name: "七夕", + message: + `祭りでも行っとけ + どーせ開発者のLast2014は家でサーバーいじってるから`, + }, + "08/11": { + name: "山の日", + message: + `空の日と山の日も作れよ + 水の循環に重要な3つ`, + }, + "11/03": { + name: "文化の日", + message: "ネットミームできるたびに休みになればいいのになぁ...", + }, + "11/23": { + name: "勤労感謝の日", + message: "学生は神!!", + }, + "12/24": { + name: "クリスマスイブ", + message: + `リア充爆破します + by 開発者`, + }, + "12/25": { + name: "クリスマス", + message: `リア充爆破します(2回目) + by 開発者`, + }, + "12/31": { + name: "大晦日", + message: "大掃除!!大掃除!!", + }, +} as { [key: string]: eventdaysValue }; + +export default eventdays; diff --git a/scripts/timeNotice.ts b/scripts/timeNotice.ts index 9e91613..980eaa7 100644 --- a/scripts/timeNotice.ts +++ b/scripts/timeNotice.ts @@ -28,7 +28,7 @@ export default async function timeNotice() { } else { // 投稿 const resUeuse = await fetch( - `https://${config.uwuzu.host}/api/ueuse/create`, + `${config.uwuzu.host}/api/ueuse/create`, { method: "POST", body: JSON.stringify({ diff --git a/scripts/weatherNotice.ts b/scripts/weatherNotice.ts index 6431635..47cd378 100644 --- a/scripts/weatherNotice.ts +++ b/scripts/weatherNotice.ts @@ -9,7 +9,7 @@ export async function weatherNotice() { // 仮投稿 const resUeuse = await fetch( - `https://${config.uwuzu.host}/api/ueuse/create`, + `${config.uwuzu.host}/api/ueuse/create`, { method: "POST", body: JSON.stringify({ @@ -107,7 +107,7 @@ export async function weatherReply(uniqid: string) { // 分割投稿 for (let i = 0; i < splitCount; i++) { const resReply = await fetch( - `https://${config.uwuzu.host}/api/ueuse/create`, + `${config.uwuzu.host}/api/ueuse/create`, { method: "POST", body: JSON.stringify({ diff --git a/types/config.d.ts b/types/config.d.ts index 20b2c39..11d8fa4 100644 --- a/types/config.d.ts +++ b/types/config.d.ts @@ -42,6 +42,11 @@ interface emergencyMinTypes { isEnabled: false; } +interface reportTypes { + isEnabled: boolean; + message: string; +} + interface legalTypes { terms: string; privacy: string; @@ -62,14 +67,8 @@ interface adminTypes { panel: PanelFullTypes | PanelMinTypes; } -interface reportTypes { - isEnabled: boolean; - message: string; -} - interface uwuzuTypes { apiToken: string; - clientToken?: string; host: string; } @@ -79,8 +78,9 @@ export interface configTypes { weather: weatherTypes; emergency: emergencyFullTypes | emergencyMinTypes; + report: reportTypes; legal: legalTypes; admin: adminTypes; - report: reportTypes; uwuzu: uwuzuTypes; + debug?: true; }