This commit is contained in:
2025-08-08 21:29:19 +09:00
parent 2b53b8cd3d
commit db5e174dd4
29 changed files with 235 additions and 208 deletions
+1 -1
View File
@@ -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),
});
+24
View File
@@ -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;
+25
View File
@@ -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;
-3
View File
@@ -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");
+7 -3
View File
@@ -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");