25.12.0-alpha.0 #3

Merged
last2014 merged 1 commits from alias-import-20251130 into main 2025-11-30 08:45:11 +00:00
45 changed files with 220 additions and 280 deletions
+22
View File
@@ -0,0 +1,22 @@
# 25.12.0-alpha.0
- New: リリースノートを記録する方針を取り始めました
- Change: tsc-aliasによるエイリアスインポートを導入しました
- New: resolveFullPathsが有効です
- Del: それに伴いインポートから末尾の.jsを削除しました
- New: エイリアスに`@/`(`./src`)が追加されました
- Change: config.d.tsの名称をconfigTypeからConfigへ変更しました
- Change: config.d.tsの余分なinterface定義を1つのConfigとして再定義しました
- Change: moduleResolutionをnodeからbundlerへ変更しました
- Change: typeRootのsrc/typesを./src/typesへ変更しました
- Change: 同一ファイルでの使用数が1つのみのインポートを静的インポートから動的インポートへ変更しました
- Change: ディレクトリ構造を大幅に変更しました
- Migrate: /src/wiatherId.tsを/src/constantsへ移動しました
- Migrate: /scriptを/srcへ移動しました
- Migrate: /typesを/src/typesへ移動しました
- Migrate: /src/mailer.tsを/src/libへ移動しました
- Migrate: /checksを/src/scriptsへ移動しました
- Change: eventdayData.tsを単一のexport文のみに短縮しました
- Delete: asciiart.txtの末尾に含まれている改行を削除しました
- Delete: それに伴いasciiart.tsの改行を削除する正規表現を削除しました
- Delete: package.jsonのscriptsからmainを削除しました
- Delete: successExit.tsに含まれていたデバッグ用の関数を即時実行するコードを削除しました
+2 -2
View File
@@ -1,7 +1,7 @@
import type { configTypes } from "types/config"; import type Config from "src/types/config";
// READMEの設定項目を参照 // READMEの設定項目を参照
const config: configTypes = { const config: Config = {
// 時報設定 // 時報設定
time: { time: {
// 時報休止期間 // 時報休止期間
+27 -42
View File
@@ -1,63 +1,48 @@
// 起動チェック // 起動チェック
import Check from "./checks/main.js"; (await import("@/scripts/checks/main")).default();
(async () => { (await import("@/scripts/successExit")).default();
await Check();
})();
// 定期実行読み込み // アスキーアート
import * as cron from "node-cron"; (await import("@/scripts/asciiart")).default();
// 機能読み込み
import timeNotice from "./scripts/timeNotice.js";
import { weatherNotice } from "./scripts/weatherNotice.js";
import earthquakeNotice from "./scripts/earthquakeNotice.js";
import EventDays from "./scripts/eventday.js";
import Commands from "./scripts/commands/main.js";
// その他機能
import asciiArt from "./scripts/asciiart.js";
asciiArt();
import successExit from "./scripts/successExit.js";
successExit();
// 地震情報観測開始 // 地震情報観測開始
earthquakeNotice(); (await import("@/scripts/earthquakeNotice")).default();
// 時報(1時間/1回) // 定期実行
cron.schedule("0 * * * *", () => { import * as cron from "node-cron";
timeNotice();
/// 時報(1時間毎)
cron.schedule("0 * * * *", async () => {
(await import("@/scripts/timeNotice")).default();
}); });
// コマンド(10分/1回) // コマンド(10分)
cron.schedule("*/10 * * * *", () => { cron.schedule("*/10 * * * *", async () => {
Commands(); (await import("@/scripts/commands/main")).default();
}); });
// 祝日などお知らせ(毎日0:00) // 祝日など(毎日0:00)
cron.schedule("0 0 * * *", () => { cron.schedule("0 0 * * *", async () => {
EventDays(); (await import("@/scripts/eventday")).default();
}); });
// 天気お知らせ(毎日7:00) // 天気お知らせ(毎日7:00)
import { setTimeout } from "timers"; cron.schedule("0 7 * * *", async () => {
cron.schedule("0 7 * * *", () => { (await import("@/scripts/weatherNotice")).weatherNotice();
setTimeout(() => {
weatherNotice();
}, 100);
}); });
// 管理パネル // 管理パネル
import AdminPanel from "./panel/main.js"; await (await import("./panel/main")).default()
(async () => {
await AdminPanel();
})();
// 起動表示 // 起動表示
console.log("BOTサーバーが起動しました"); console.log("BOTサーバーが起動しました");
import config from "./config.js"; if ((await import("./config")).default.debug) {
import { styleText } from "util"; // TLSを任意に設定
if (config.debug !== undefined) {
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
console.log(styleText(["bgRed", "cyan", "bold"], "デバッグモードで起動中"));
console.log((await import("node:util")).styleText(
["bgRed", "cyan", "bold"],
"デバッグモードで起動中"
));
} }
+3 -4
View File
@@ -6,10 +6,9 @@
"main": "dist/main.js", "main": "dist/main.js",
"scripts": { "scripts": {
"start": "node .", "start": "node .",
"build": "tsc", "build": "tsc && tsc-alias",
"main": "tsc && node .",
"dev": "tsx main.ts", "dev": "tsx main.ts",
"clean": "tsc && node dist/scripts/clean/main.js" "clean": "npm run build && node dist/scripts/clean/main.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@@ -52,7 +51,7 @@
"node-cron": "^4.1.1", "node-cron": "^4.1.1",
"nodemailer": "^7.0.4", "nodemailer": "^7.0.4",
"sharp": "^0.34.3", "sharp": "^0.34.3",
"timers": "^0.1.1", "tsc-alias": "^1.8.16",
"typescript": "^5.9.2", "typescript": "^5.9.2",
"ws": "^8.18.3" "ws": "^8.18.3"
}, },
+8 -16
View File
@@ -1,15 +1,7 @@
import express from "express"; import express from "express";
import * as os from "os"; import * as os from "os";
import config from "../config.js"; import config from "../config";
import { NetworkInterfaceDetails } from "types/types"; import { NetworkInterfaceDetails } from "@/types/types";
// バックエンドルーティング
import CommandExecute from "./route/command.js";
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() { export default async function AdminPanel() {
// 無効 // 無効
@@ -22,12 +14,12 @@ export default async function AdminPanel() {
const port = config.admin.panel.port; const port = config.admin.panel.port;
// ルーティング // ルーティング
app.use(ueusePost); app.use((await import("./route/ueuse")).default);
app.use(CommandExecute); app.use((await import("./route/command")).default);
app.use(WeatherUeuse); app.use((await import("./route/weather")).default);
app.use(API); app.use((await import("./route/api")).default);
app.use(Token); app.use((await import("./route/token")).default);
app.use(Debug); app.use((await import("./route/debug")).default);
app.use(express.static("panel/public")); app.use(express.static("panel/public"));
app.listen(port, () => { app.listen(port, () => {
+1 -1
View File
@@ -1,7 +1,7 @@
import express from "express"; import express from "express";
const API = express.Router(); const API = express.Router();
import config from "../../config.js"; import config from "../../config";
API.use(express.json()); API.use(express.json());
API.use(express.urlencoded({ extended: true })); API.use(express.urlencoded({ extended: true }));
+1 -1
View File
@@ -1,7 +1,7 @@
import express from "express"; import express from "express";
const CommandExecute = express.Router(); const CommandExecute = express.Router();
import Commands from "../../scripts/commands/main.js"; import Commands from "@/scripts/commands/main";
CommandExecute.post("/actions/command-execute", (req, res) => { CommandExecute.post("/actions/command-execute", (req, res) => {
try { try {
+1 -1
View File
@@ -1,7 +1,7 @@
import express from "express"; import express from "express";
const Debug = express.Router(); const Debug = express.Router();
import config from "../../config.js"; import config from "../../config";
Debug.post("/actions/debug", (req, res, next) => { Debug.post("/actions/debug", (req, res, next) => {
res.status(501) res.status(501)
+1 -1
View File
@@ -1,7 +1,7 @@
import express from "express"; import express from "express";
const EventdayUeuse = express.Router(); const EventdayUeuse = express.Router();
import EventDays from "../../scripts/eventday.js"; import EventDays from "@/scripts/eventday";
EventdayUeuse.post("/actions/eventday", (req, res) => { EventdayUeuse.post("/actions/eventday", (req, res) => {
try { try {
+1 -1
View File
@@ -1,7 +1,7 @@
import express from "express"; import express from "express";
const Token = express.Router(); const Token = express.Router();
import config from "../../config.js"; import config from "../../config";
Token.post("/actions/token", (req, res, next) => { Token.post("/actions/token", (req, res, next) => {
res.status(501) res.status(501)
+1 -1
View File
@@ -1,7 +1,7 @@
import express from "express"; import express from "express";
const ueusePost = express.Router(); const ueusePost = express.Router();
import config from "../../config.js"; import config from "../../config";
ueusePost.use(express.json()); ueusePost.use(express.json());
ueusePost.use(express.urlencoded({ extended: true })); ueusePost.use(express.urlencoded({ extended: true }));
+1 -1
View File
@@ -1,7 +1,7 @@
import express from "express"; import express from "express";
const WeatherUeuse = express.Router(); const WeatherUeuse = express.Router();
import { weatherNotice } from "../../scripts/weatherNotice.js"; import { weatherNotice } from "@/scripts/weatherNotice";
WeatherUeuse.post("/actions/weather", (req, res) => { WeatherUeuse.post("/actions/weather", (req, res) => {
try { try {
@@ -1,9 +1,4 @@
interface eventdaysValue { export default {
name: string;
message: string;
}
const eventdays = {
"01/01": { "01/01": {
name: "元日", name: "元日",
message: "はい年越した瞬間地球にいなかった~", message: "はい年越した瞬間地球にいなかった~",
@@ -65,6 +60,7 @@ const eventdays = {
name: "大晦日", name: "大晦日",
message: "大掃除!!大掃除!!", message: "大掃除!!大掃除!!",
}, },
} as { [key: string]: eventdaysValue }; } as { [key: string]: {
name: string;
export default eventdays; message: string;
} };
+1 -1
View File
@@ -1,4 +1,4 @@
import config from "../../config.js"; import config from "../../config";
import * as nodemailer from "nodemailer"; import * as nodemailer from "nodemailer";
import type SMTPTransport from "nodemailer/lib/smtp-transport"; import type SMTPTransport from "nodemailer/lib/smtp-transport";
+1 -1
View File
@@ -3,6 +3,6 @@ import * as fs from "fs";
const version = JSON.parse(fs.readFileSync("package.json", "utf-8")).version; const version = JSON.parse(fs.readFileSync("package.json", "utf-8")).version;
export default function asciiArt() { export default function asciiArt() {
console.log(fs.readFileSync("asciiart.txt", "utf-8").replace(/(\r?\n)$/, '')); console.log(fs.readFileSync("asciiart.txt", "utf-8"));
console.log(`${version}\n`); console.log(`${version}\n`);
} }
+4 -6
View File
@@ -1,7 +1,5 @@
import logsDelete from "./logsDel.js"; (await import("@/scripts/clean/logsDel")).default();
import packageLockJsonDelete from "./packageLockDel.js"; (await import("@/scripts/clean/packageLockDel")).default();
import npmInstall from "./npmInstall.js"; (await import("@/scripts/clean/npmInstall")).default();
logsDelete(); export {};
packageLockJsonDelete();
npmInstall();
+3 -3
View File
@@ -1,6 +1,6 @@
import { meApi, ueuse } from "../../src/types/types"; import { meApi, ueuse } from "@/types/types";
import config from "../../config.js"; import config from "../../../config";
import { Reply } from "./main.js"; import { Reply } from "@/scripts/commands/main";
export default async function Delete(data: ueuse) { export default async function Delete(data: ueuse) {
const meReq = await fetch(`${config.uwuzu.host}/api/me/`, { const meReq = await fetch(`${config.uwuzu.host}/api/me/`, {
+3 -3
View File
@@ -1,6 +1,6 @@
import { ueuse } from "src/types/types.js"; import { ueuse } from "@/types/types";
import config from "../../config.js"; import config from "../../../config";
import { Reply } from "./main.js"; import { Reply } from "@/scripts/commands/main";
export default async function Follow(data: ueuse) { export default async function Follow(data: ueuse) {
const followReq = await fetch(`${config.uwuzu.host}/api/users/follow`, { const followReq = await fetch(`${config.uwuzu.host}/api/users/follow`, {
+2 -2
View File
@@ -1,6 +1,6 @@
import { ueuse } from "src/types/types.js"; import { ueuse } from "@/types/types";
import { readFileSync } from "fs"; import { readFileSync } from "fs";
import { Reply } from "./main.js"; import { Reply } from "@/scripts/commands/main";
const helpsMin = { const helpsMin = {
"info": "このBOTについての概要を返信するコマンドです。", "info": "このBOTについての概要を返信するコマンドです。",
+4 -6
View File
@@ -1,10 +1,8 @@
import { ueuse } from "src/types/types.js"; import { ueuse } from "@/types/types";
import { readFileSync } from "fs"; import config from "../../../config";
import { Reply } from "./main.js";
import config from "../../config.js";
export default async function Info(data: ueuse) { export default async function Info(data: ueuse) {
const packageJson = JSON.parse(readFileSync("package.json", "utf-8")); const packageJson = JSON.parse((await import("fs")).readFileSync("package.json", "utf-8"));
const releaseUrl = `${packageJson.repository.url}/releases/tag/${packageJson.tag}`; const releaseUrl = `${packageJson.repository.url}/releases/tag/${packageJson.tag}`;
let editor = ""; let editor = "";
@@ -29,7 +27,7 @@ export default async function Info(data: ueuse) {
isReport = "無効"; isReport = "無効";
} }
const ueuse = await Reply(` const ueuse = await (await import("@/scripts/commands/main")).Reply(`
【BOTについて】 【BOTについて】
このBOTはオープンソースソフトウェアであるnoticeUwuzuを利用して運営されています。 このBOTはオープンソースソフトウェアであるnoticeUwuzuを利用して運営されています。
noticeUwuzuはApache License 2.0によって保護されています。 noticeUwuzuはApache License 2.0によって保護されています。
+6 -5
View File
@@ -1,7 +1,8 @@
import { ueuse } from "src/types/types.js"; import { ueuse } from "@/types/types";
import { Reply } from "../main.js";
import config from "../../../config.js";
export default function PrivacyPolicy(data: ueuse) { export default async function PrivacyPolicy(data: ueuse) {
Reply(config.legal.privacy, data.uniqid); (await import("@/scripts/commands/main")).Reply(
(await import("../../../../config")).default.legal.privacy,
data.uniqid
);
} }
+6 -5
View File
@@ -1,7 +1,8 @@
import { ueuse } from "src/types/types.js"; import { ueuse } from "@/types/types";
import { Reply } from "../main.js";
import config from "../../../config.js";
export default function Terms(data: ueuse) { export default async function Terms(data: ueuse) {
Reply(config.legal.terms, data.uniqid); (await import("@/scripts/commands/main")).Reply(
(await import("../../../../config")).default.legal.terms,
data.uniqid
);
} }
+15 -31
View File
@@ -1,28 +1,12 @@
import * as fs from "fs"; import * as fs from "fs";
import config from "../../config.js"; import config from "../../../config";
import type { ueuse } from "src/types/types.js"; import type { ueuse } from "@/types/types";
const initialFile: Array<string> = [];
// コマンド読み込み
import Info from "./info.js";
import Help from "./help.js";
import Follow from "./follow.js";
import UnFollow from "./unfollow.js";
import Weather from "./weather.js";
import Report from "./report.js";
import Terms from "./legal/terms.js"
import PrivacyPolicy from "./legal/privacy.js";
import Delete from "./delete.js";
import MakeItAQuote from "./miq/main.js";
import MiQPermission from "./miq/permission.js";
import MiQAllow from "./miq/allow.js";
// 初期化 // 初期化
if (!fs.existsSync("data/alreadyCommands.json")) { if (!fs.existsSync("data/alreadyCommands.json")) {
fs.writeFileSync( fs.writeFileSync(
"data/alreadyCommands.json", "data/alreadyCommands.json",
JSON.stringify(initialFile), JSON.stringify([]),
"utf-8", "utf-8",
); );
} }
@@ -162,40 +146,40 @@ export default async function Commands() {
switch (commandName) { switch (commandName) {
case "info": case "info":
Info(data); (await import("@/scripts/commands/info")).default(data);
break; break;
case "help": case "help":
Help(data); (await import("@/scripts/commands/help")).default(data);
break; break;
case "legal terms": case "legal terms":
Terms(data); (await import("@/scripts/commands/legal/terms")).default(data);
break; break;
case "legal privacy": case "legal privacy":
PrivacyPolicy(data); (await import("@/scripts/commands/legal/privacy")).default(data);
break; break;
case "report": case "report":
Report(data); (await import("@/scripts/commands/report")).default(data);
break; break;
case "follow": case "follow":
Follow(data); (await import("@/scripts/commands/follow")).default(data);
break; break;
case "unfollow": case "unfollow":
UnFollow(data); (await import("@/scripts/commands/unfollow")).default(data);
break; break;
case "weather": case "weather":
Weather(data); (await import("@/scripts/commands/weather")).default(data);
break; break;
case "miq": case "miq":
MakeItAQuote(data); (await import("@/scripts/commands/miq/main")).default(data);
break; break;
case "miq permission": case "miq permission":
MiQPermission(data); (await import("@/scripts/commands/miq/permission")).default(data);
break; break;
case "miq allow": case "miq allow":
MiQAllow(data); (await import("@/scripts/commands/miq/allow")).default(data);
break; break;
case "delete": case "delete":
Delete(data); (await import("@/scripts/commands/delete")).default(data);
break; break;
default: default:
const reply = await Reply(` const reply = await Reply(`
+6 -7
View File
@@ -1,9 +1,8 @@
import { meApi, ueuse } from "../../../src/types/types"; import { meApi, ueuse } from "@/types/types";
import { readFileSync } from "fs"; import config from "../../../../config";
import config from "../../../config.js"; import { Reply } from "@/scripts/commands/main";
import { Reply } from "../main.js"; import { Permission } from "@/scripts/commands/miq/permission";
import { Permission } from "./permission"; import MiQ from "../../../../miq/main";
import MiQ from "../../../miq/main.js";
export default async function MiQAllow(data: ueuse) { export default async function MiQAllow(data: ueuse) {
if (!config.miq) { if (!config.miq) {
@@ -22,7 +21,7 @@ export default async function MiQAllow(data: ueuse) {
// 権限一覧取得 // 権限一覧取得
const permissions: { [user: string]: Permission } = const permissions: { [user: string]: Permission } =
JSON.parse(readFileSync("data/miqPermissions.json", "utf-8")); JSON.parse((await import("fs")).readFileSync("data/miqPermissions.json", "utf-8"));
if (permissions[data.account.userid] !== "consent") { if (permissions[data.account.userid] !== "consent") {
console.log("MiQ許可制(許可制以外)", await Reply(` console.log("MiQ許可制(許可制以外)", await Reply(`
+7 -9
View File
@@ -1,9 +1,7 @@
import { ueuse } from "../../../src/types/types"; import { ueuse } from "@/types/types";
import MiQ from "../../../miq/main.js"; import config from "../../../../config";
import config from "../../../config.js"; import { Reply } from "@/scripts/commands/main";
import { Reply } from "../main.js"; import type { Permission } from "@/scripts/commands/miq/permission";
import { readFileSync, writeFileSync } from "fs";
import { Permission } from "./permission";
export default async function MakeItAQuote(data: ueuse) { export default async function MakeItAQuote(data: ueuse) {
if (!config.miq) { if (!config.miq) {
@@ -47,12 +45,12 @@ export default async function MakeItAQuote(data: ueuse) {
// 権限一覧取得 // 権限一覧取得
const permissions: { [user: string]: Permission } = const permissions: { [user: string]: Permission } =
JSON.parse(readFileSync("data/miqPermissions.json", "utf-8")); JSON.parse((await import("fs")).readFileSync("data/miqPermissions.json", "utf-8"));
// 初期化 // 初期化
if (permissions[ueuseData.account.userid] === undefined) { if (permissions[ueuseData.account.userid] === undefined) {
permissions[ueuseData.account.userid] = "consent"; permissions[ueuseData.account.userid] = "consent";
writeFileSync( (await import("fs")).writeFileSync(
"data/miqPermissions.json", "data/miqPermissions.json",
JSON.stringify(permissions), JSON.stringify(permissions),
"utf-8" "utf-8"
@@ -82,7 +80,7 @@ export default async function MakeItAQuote(data: ueuse) {
return; return;
} }
const img = await MiQ({ const img = await (await import("../../../../miq/main")).default({
type: "Base64Data", type: "Base64Data",
color: color, color: color,
text: ueuseData.text, text: ueuseData.text,
+6 -7
View File
@@ -1,11 +1,10 @@
import { ueuse } from "../../../src/types/types"; import { ueuse } from "@/types/types";
import { Reply } from "../main.js"; import { Reply } from "@/scripts/commands/main";
import config from "../../../config.js"; import { writeFileSync } from "fs";
import { readFileSync, writeFileSync, existsSync } from "fs";
// 初期化 // 初期化
const initialFile = {}; const initialFile = {};
if (!existsSync("data/miqPermissions.json")) { if (!(await import("fs")).existsSync("data/miqPermissions.json")) {
writeFileSync( writeFileSync(
"data/miqPermissions.json", "data/miqPermissions.json",
JSON.stringify(initialFile), JSON.stringify(initialFile),
@@ -25,7 +24,7 @@ const PermissionsNames: { [name: string]: string } = {
} }
export default async function MiQPermission(data: ueuse) { export default async function MiQPermission(data: ueuse) {
if (!config.miq) { if (!(await import("../../../../config")).default.miq) {
await Reply(` await Reply(`
BOT管理者によってMake it a quoteが無効化されています BOT管理者によってMake it a quoteが無効化されています
\`/miq\`はご利用いただけません。 \`/miq\`はご利用いただけません。
@@ -34,7 +33,7 @@ export default async function MiQPermission(data: ueuse) {
} }
const permissions: { [user: string]: string } = const permissions: { [user: string]: string } =
JSON.parse(readFileSync("data/miqPermissions.json", "utf-8")); JSON.parse((await import("fs")).readFileSync("data/miqPermissions.json", "utf-8"));
// 初期化 // 初期化
if (permissions[data.account.userid] === undefined) { if (permissions[data.account.userid] === undefined) {
+4 -5
View File
@@ -1,7 +1,6 @@
import { ueuse } from "src/types/types.js"; import { ueuse } from "@/types/types";
import { Reply } from "./main.js"; import { Reply } from "./main";
import config from "../../config.js"; import config from "../../../config";
import sendMail from "../../src/lib/mailer.js";
export default async function Report(data: ueuse) { export default async function Report(data: ueuse) {
if ( if (
@@ -40,7 +39,7 @@ export default async function Report(data: ueuse) {
} }
try { try {
sendMail({ (await import("@/lib/mailer")).default({
to: config.emergency.mail.to, to: config.emergency.mail.to,
subject: "【報告】BOT利用者からの報告", subject: "【報告】BOT利用者からの報告",
text: ` text: `
+3 -3
View File
@@ -1,6 +1,6 @@
import { ueuse } from "src/types/types.js"; import { ueuse } from "@/types/types";
import config from "../../config.js"; import config from "../../../config";
import { Reply } from "./main.js"; import { Reply } from "./main";
export default async function UnFollow(data: ueuse) { export default async function UnFollow(data: ueuse) {
const unfollowReq = await fetch(`${config.uwuzu.host}/api/users/unfollow`, { const unfollowReq = await fetch(`${config.uwuzu.host}/api/users/unfollow`, {
+2 -2
View File
@@ -1,5 +1,5 @@
import { weatherReply } from "../weatherNotice.js"; import { weatherReply } from "@/scripts/weatherNotice";
import { ueuse } from "src/types/types.js"; import { ueuse } from "@/types/types.js";
export default function Weather(data: ueuse) { export default function Weather(data: ueuse) {
weatherReply(data.uniqid); weatherReply(data.uniqid);
+2 -3
View File
@@ -1,7 +1,6 @@
import WebSocket from "ws"; import WebSocket from "ws";
import sendMail from "../src/lib/mailer.js"; import sendMail from "@/lib/mailer";
import config from "../../config.js";
import config from "../config.js";
class P2PEarthquakeClient { class P2PEarthquakeClient {
private ws: WebSocket | null = null; private ws: WebSocket | null = null;
+2 -2
View File
@@ -1,6 +1,6 @@
import { format } from "date-fns"; import { format } from "date-fns";
import eventdays from "./eventdayData.js"; import eventdays from "@/constants/eventday";
import config from "../config.js"; import config from "../../config";
export default async function EventDays() { export default async function EventDays() {
const now = format(new Date(), "MM/dd"); const now = format(new Date(), "MM/dd");
+2 -5
View File
@@ -1,8 +1,7 @@
import * as fs from "fs"; import * as fs from "fs";
import { isAfter } from "date-fns"; import { isAfter } from "date-fns";
import config from "../../config";
import config from "../config.js"; import sendMail from "@/lib/mailer";
import sendMail from "../src/lib/mailer.js";
export default function successExit() { export default function successExit() {
// 初期化 // 初期化
@@ -56,5 +55,3 @@ export default function successExit() {
fs.writeFileSync("logs/boot.json", JSON.stringify(iolog), "utf-8"); fs.writeFileSync("logs/boot.json", JSON.stringify(iolog), "utf-8");
}); });
} }
successExit();
+2 -3
View File
@@ -1,7 +1,6 @@
import { format } from "date-fns"; import { format } from "date-fns";
import type * as types from "@/types/types";
import type * as types from "src/types/types.js"; import config from "../../config";
import config from "../config.js";
export default async function timeNotice() { export default async function timeNotice() {
// 停止時間 // 停止時間
+3 -5
View File
@@ -1,8 +1,6 @@
import { cityList } from "../src/constants/weatherId.js"; import { cityList } from "@/constants/weather";
import type * as types from "@/types/types";
import type * as types from "src/types/types.js"; import config from "../../config";
import config from "../config.js";
export async function weatherNotice() { export async function weatherNotice() {
console.log("----------------"); console.log("----------------");
+33 -61
View File
@@ -1,24 +1,24 @@
interface earthquakeTypes { export default interface Config {
time: {
stopTimes: {
start: number;
stop: number;
};
};
earthquake: {
reconnectTimes: number; reconnectTimes: number;
websocketUrl: string; websocketUrl: string;
areasCsvUrl: string; areasCsvUrl: string;
maxScaleMin: number; maxScaleMin: number;
} };
weather: {
interface weatherTypes {
splitCount: number; splitCount: number;
} };
miq: boolean;
interface stopsTypes { emergency: {
start: number; isEnabled: true;
stop: number; mail: {
}
interface timeTypes {
stopTimes: stopsTypes;
}
interface emergencyMailFullTypes {
isEnabled: true; isEnabled: true;
host: string; host: string;
port: number; port: number;
@@ -26,62 +26,34 @@ interface emergencyMailFullTypes {
password: string; password: string;
secure: boolean; secure: boolean;
to: string | string[]; to: string | string[];
} } | {
interface emergencyMailMinTypes {
isEnabled: false; isEnabled: false;
mail: undefined; mail: undefined;
} };
} | {
interface emergencyFullTypes {
isEnabled: true;
mail: emergencyMailFullTypes | emergemcyMailMinTypes;
}
interface emergencyMinTypes {
isEnabled: false; isEnabled: false;
} };
report: {
interface reportTypes {
isEnabled: boolean; isEnabled: boolean;
message: string; message: string;
} };
legal: {
interface legalTypes {
terms: string; terms: string;
privacy: string; privacy: string;
} };
admin: {
interface PanelFullTypes {
isEnabled: true;
port: number;
}
interface PanelMinTypes {
isEnabled: false;
}
interface adminTypes {
name: string; name: string;
showMail: string | false; showMail: string | false;
panel: PanelFullTypes | PanelMinTypes; panel: {
} isEnabled: true;
port: number;
interface uwuzuTypes { } | {
isEnabled: false;
};
};
uwuzu: {
apiToken: string; apiToken: string;
host: string; host: string;
} };
export interface configTypes {
time: timeTypes,
earthquake: earthquakeTypes;
weather: weatherTypes;
miq: boolean;
emergency: emergencyFullTypes | emergencyMinTypes;
report: reportTypes;
legal: legalTypes;
admin: adminTypes;
uwuzu: uwuzuTypes;
debug?: true; debug?: true;
} }
+6 -2
View File
@@ -2,7 +2,7 @@
"compilerOptions": { "compilerOptions": {
"target": "ES2024", "target": "ES2024",
"module": "ESNext", "module": "ESNext",
"moduleResolution": "node", "moduleResolution": "bundler",
"outDir": "./dist", "outDir": "./dist",
"esModuleInterop": true, "esModuleInterop": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
@@ -12,12 +12,16 @@
"baseUrl": "./", "baseUrl": "./",
"typeRoots": [ "typeRoots": [
"./node_modules/@types", "./node_modules/@types",
"./types" "./src/types"
], ],
"paths": { "paths": {
"@/*": ["./src/*"],
"ws": ["./node_modules/ws/index.js"], "ws": ["./node_modules/ws/index.js"],
"@types/ws": ["./node_modules/@types/ws/index.d.ts"] "@types/ws": ["./node_modules/@types/ws/index.d.ts"]
}, },
"removeComments": true, "removeComments": true,
}, },
"tsc-alias": {
"resolveFullPaths": true,
},
} }