mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-04 10:05:53 +02:00
Add scripts and fix routes
This commit is contained in:
parent
ac6a6d7616
commit
77d71de990
6 changed files with 91 additions and 13 deletions
|
@ -2,15 +2,11 @@ import { Request, Response, NextFunction } from 'express';
|
|||
import { DrizzleError } from 'drizzle-orm';
|
||||
import { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
|
||||
import { sites, Site } from '../../db/schema';
|
||||
|
||||
interface CustomRequest extends Request {
|
||||
db?: BetterSQLite3Database;
|
||||
}
|
||||
import db from '../../db';
|
||||
|
||||
export const getConfig = async (req: Request, res: Response, next: NextFunction): Promise<void> => {
|
||||
try {
|
||||
const customReq = req as CustomRequest;
|
||||
const db = customReq.db;
|
||||
const exitNodeId = req.query.exitNodeId as string;
|
||||
|
||||
if (!db) {
|
||||
throw new Error('Database is not attached to the request');
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { Router } from "express";
|
||||
import badger from "./badger/badger";
|
||||
import gerbil from "./gerbil/gerbil";
|
||||
import newt from "./newt/newt";
|
||||
import pangolin from "./pangolin/pangolin";
|
||||
|
||||
const unauth = Router();
|
||||
|
@ -11,6 +9,6 @@ unauth.get("/", (_, res) => {
|
|||
});
|
||||
|
||||
unauth.use("/newt", badger);
|
||||
unauth.use("/pangolin", badger);
|
||||
unauth.use("/pangolin", pangolin);
|
||||
|
||||
export default unauth;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import { Router } from "express";
|
||||
import badger from "./badger/badger";
|
||||
import gerbil from "./gerbil/gerbil";
|
||||
import newt from "./newt/newt";
|
||||
import pangolin from "./pangolin/pangolin";
|
||||
|
||||
const unauth = Router();
|
||||
|
||||
|
@ -11,6 +9,6 @@ unauth.get("/", (_, res) => {
|
|||
});
|
||||
|
||||
unauth.use("/badger", badger);
|
||||
unauth.use("/gerbil", badger);
|
||||
unauth.use("/gerbil", gerbil);
|
||||
|
||||
export default unauth;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue