2024-09-07 18:12:58 -04:00
|
|
|
import main from "./client/main.js";
|
|
|
|
import login from "./client/login.js";
|
|
|
|
import register from "./client/register.js";
|
2024-09-19 05:44:24 -04:00
|
|
|
import upload from "./client/upload.js";
|
|
|
|
import player from "./client/player.js";
|
2024-09-20 16:59:12 -04:00
|
|
|
import user from "./client/user.js";
|
2024-09-27 03:59:23 -04:00
|
|
|
import settings from "./client/settings.js";
|
2024-10-24 22:41:21 -04:00
|
|
|
import e404 from "./client/e404.js";
|
2024-10-27 00:26:02 -04:00
|
|
|
import tou from "./client/tou.js";
|
2024-10-28 04:54:58 -04:00
|
|
|
import captcha from './client/captcha.js';
|
2024-11-04 04:21:47 -05:00
|
|
|
import messages from './client/messages.js';
|
2024-09-20 16:59:12 -04:00
|
|
|
|
2024-09-07 18:12:58 -04:00
|
|
|
import loginB from "./form/login.js";
|
|
|
|
import registerB from "./form/register.js";
|
2024-09-19 05:44:24 -04:00
|
|
|
import uploadB from "./form/upload.js";
|
2024-09-22 03:49:36 -04:00
|
|
|
import commentB from "./form/comment.js";
|
2024-09-27 03:59:23 -04:00
|
|
|
import settingsB from "./form/settings.js";
|
|
|
|
import auth from "./form/auth.js";
|
2024-10-19 16:00:03 -04:00
|
|
|
import auth_api from "./form/auth_api.js";
|
2024-10-24 22:41:21 -04:00
|
|
|
import delete_video from "./form/delete_video.js";
|
2024-09-22 10:49:47 -04:00
|
|
|
import follow from './form/follow.js';
|
2024-09-07 18:12:58 -04:00
|
|
|
|
|
|
|
const routes = {
|
|
|
|
get: {},
|
|
|
|
form: {},
|
2024-09-19 05:44:24 -04:00
|
|
|
client: {},
|
2024-09-07 18:12:58 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
routes.client = {
|
|
|
|
main,
|
|
|
|
login,
|
2024-09-19 05:44:24 -04:00
|
|
|
register,
|
|
|
|
upload,
|
2024-09-20 16:59:12 -04:00
|
|
|
video: player,
|
2024-09-27 03:59:23 -04:00
|
|
|
user,
|
2024-10-24 22:41:21 -04:00
|
|
|
settings,
|
2024-10-27 00:26:02 -04:00
|
|
|
e404,
|
2024-10-28 04:54:58 -04:00
|
|
|
tou,
|
2024-11-04 04:21:47 -05:00
|
|
|
captcha,
|
|
|
|
messages
|
2024-09-07 18:12:58 -04:00
|
|
|
}
|
2024-09-27 03:59:23 -04:00
|
|
|
|
2024-09-07 18:12:58 -04:00
|
|
|
routes.get = {
|
|
|
|
};
|
2024-09-27 03:59:23 -04:00
|
|
|
|
2024-09-07 18:12:58 -04:00
|
|
|
routes.form = {
|
|
|
|
login: loginB,
|
|
|
|
register: registerB,
|
2024-09-19 05:44:24 -04:00
|
|
|
upload: uploadB,
|
2024-09-22 03:49:36 -04:00
|
|
|
auth,
|
2024-09-22 10:49:47 -04:00
|
|
|
comment: commentB,
|
2024-09-27 03:59:23 -04:00
|
|
|
follow,
|
2024-10-19 16:00:03 -04:00
|
|
|
settings: settingsB,
|
2024-10-24 22:41:21 -04:00
|
|
|
auth_api,
|
|
|
|
delete_video
|
2024-09-07 18:12:58 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
async function iterate(req, res, index) {
|
|
|
|
let routesI = routes[index];
|
|
|
|
let keys = Object.keys(routesI);
|
|
|
|
|
|
|
|
let cmd = req.params.route;
|
2024-09-19 05:04:03 -04:00
|
|
|
if (keys.indexOf(cmd) == -1) {
|
2024-10-25 17:02:39 -04:00
|
|
|
return await routes.client['e404'].run(req, res, {});
|
2024-09-19 05:04:03 -04:00
|
|
|
}
|
2024-09-07 18:12:58 -04:00
|
|
|
|
2024-10-25 17:02:39 -04:00
|
|
|
let dat = await routesI[cmd].run(req, res, {});
|
2024-10-29 04:13:08 -04:00
|
|
|
if (!dat && !res.headersSent) {
|
2024-11-25 08:24:18 -05:00
|
|
|
console.log(res)
|
2024-10-25 17:02:39 -04:00
|
|
|
return await routes.client['e404'].run(req, res, {});
|
2024-10-24 22:41:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return dat;
|
2024-09-07 18:12:58 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export default iterate;
|