2021-07-12 08:43:46 +02:00
|
|
|
import express from "express";
|
2021-09-23 00:52:35 +02:00
|
|
|
import { config } from "../src/config";
|
2021-07-12 08:43:46 +02:00
|
|
|
import { Server } from "http";
|
2022-09-21 07:14:22 +02:00
|
|
|
import { UserCounter } from "./mocks/UserCounter";
|
2020-10-17 20:56:54 +02:00
|
|
|
|
|
|
|
const app = express();
|
|
|
|
|
2022-09-21 07:14:22 +02:00
|
|
|
app.post("/webhook/ReportChannel", (req, res) => {
|
2020-10-17 20:56:54 +02:00
|
|
|
res.sendStatus(200);
|
|
|
|
});
|
|
|
|
|
2022-09-21 07:14:22 +02:00
|
|
|
app.post("/webhook/FirstTimeSubmissions", (req, res) => {
|
2020-10-17 20:56:54 +02:00
|
|
|
res.sendStatus(200);
|
|
|
|
});
|
|
|
|
|
2022-09-21 07:14:22 +02:00
|
|
|
app.post("/webhook/CompletelyIncorrectReport", (req, res) => {
|
2020-10-17 20:56:54 +02:00
|
|
|
res.sendStatus(200);
|
|
|
|
});
|
|
|
|
|
|
|
|
// Testing NeuralBlock
|
2022-09-21 07:14:22 +02:00
|
|
|
app.post("/webhook/NeuralBlockReject", (req, res) => {
|
2020-10-17 20:56:54 +02:00
|
|
|
res.sendStatus(200);
|
|
|
|
});
|
|
|
|
|
2021-07-12 08:43:46 +02:00
|
|
|
app.get("/NeuralBlock/api/checkSponsorSegments", (req, res) => {
|
2020-10-17 20:56:54 +02:00
|
|
|
if (req.query.vid === "LevkAjUE6d4") {
|
|
|
|
res.json({
|
|
|
|
probabilities: [0.69],
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
res.sendStatus(500);
|
|
|
|
});
|
|
|
|
|
|
|
|
//getSponsorSegments is no longer being used for automod
|
2021-07-12 08:43:46 +02:00
|
|
|
app.get("/NeuralBlock/api/getSponsorSegments", (req, res) => {
|
2020-10-17 20:56:54 +02:00
|
|
|
if (req.query.vid === "LevkAjUE6d4") {
|
|
|
|
res.json({
|
|
|
|
sponsorSegments: [[0.47, 7.549], [264.023, 317.293]],
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
res.sendStatus(500);
|
|
|
|
});
|
|
|
|
|
|
|
|
// Testing webhooks
|
2021-07-12 08:43:46 +02:00
|
|
|
app.post("/CustomWebhook", (req, res) => {
|
2020-10-17 20:56:54 +02:00
|
|
|
res.sendStatus(200);
|
|
|
|
});
|
|
|
|
|
2022-09-21 07:14:22 +02:00
|
|
|
// mocks
|
|
|
|
app.use("/UserCounter", UserCounter);
|
|
|
|
|
2021-07-05 09:14:05 +02:00
|
|
|
export function createMockServer(callback: () => void): Server {
|
2020-10-17 20:56:54 +02:00
|
|
|
return app.listen(config.mockPort, callback);
|
|
|
|
}
|