Added routes rough draft finished

This commit is contained in:
brian 2023-11-20 02:19:13 -05:00
parent 879964487c
commit 6149c3a1b9
2 changed files with 8 additions and 4 deletions

View file

@ -58,6 +58,9 @@ export async function PUT(request: Request, { params }: { params: { route: numbe
body: JSON.stringify(route) body: JSON.stringify(route)
}) })
//console.log(JSON.stringify(route));
if (!res.ok) return new NextResponse(JSON.stringify({ error: true, message: "Could not save route" }), { if (!res.ok) return new NextResponse(JSON.stringify({ error: true, message: "Could not save route" }), {
status: 500, status: 500,
headers: { headers: {

View file

@ -31,8 +31,8 @@ export function RouteDialog({ route, routesMap }: { route: Route, routesMap: Rou
} }
}); });
let validHosts: any[] = ["google.com"]; let validHosts: any[] = ["google.com", "test.com"];
let validUpstreams: any[] = ["1.1.1.1"]; let validUpstreams: any[] = ["1.1.1.1", "69.126.24.175"];
let handler: string = "reverse_proxy"; let handler: string = "reverse_proxy";
if (index != -1) { if (index != -1) {
@ -90,6 +90,8 @@ export function RouteDialog({ route, routesMap }: { route: Route, routesMap: Rou
"terminal": true "terminal": true
} }
console.log(JSON.stringify(update.route))
if (index == -1) update.index = routesMap.length - 1; if (index == -1) update.index = routesMap.length - 1;
console.log(update.index) console.log(update.index)
pushUpdate(update); pushUpdate(update);
@ -153,8 +155,7 @@ export function RouteDialog({ route, routesMap }: { route: Route, routesMap: Rou
/> />
))} ))}
<Button type="submit">Save</Button> <Button type="submit">Save</Button>
<Button type='button' onClick={() => { appendUpstreams('') }}>Add Host</Button> <Button type='button' onClick={() => { appendHosts('') }}>Add Host</Button>
<Button type='button' onClick={() => { appendHosts('') }}>Add Upstream</Button>
</form> </form>
</Form> </Form>
</DialogContent> </DialogContent>