From 8e27eea6b019aceb97a82e73298069408ae4ac02 Mon Sep 17 00:00:00 2001 From: MrMelon54 Date: Wed, 25 Oct 2023 20:02:48 +0100 Subject: [PATCH] Add route and redirect creators --- src/components/RedirectCreator.svelte | 25 ++++++++++++++++ src/components/RedirectRow.svelte | 6 ++-- src/components/RouteCreator.svelte | 25 ++++++++++++++++ src/components/RouteRow.svelte | 22 ++++++++++++-- src/views/VioletView.svelte | 29 +++++++++++++++---- test-server/main.go | 41 +++++++++++++++++++++++++-- 6 files changed, 134 insertions(+), 14 deletions(-) create mode 100644 src/components/RedirectCreator.svelte create mode 100644 src/components/RouteCreator.svelte diff --git a/src/components/RedirectCreator.svelte b/src/components/RedirectCreator.svelte new file mode 100644 index 0000000..5a73d64 --- /dev/null +++ b/src/components/RedirectCreator.svelte @@ -0,0 +1,25 @@ + + + + + + + + + + + diff --git a/src/components/RedirectRow.svelte b/src/components/RedirectRow.svelte index 72e2f97..740748c 100644 --- a/src/components/RedirectRow.svelte +++ b/src/components/RedirectRow.svelte @@ -12,15 +12,15 @@ {#if noCPair(redirect)} - {redirect.server.src} + {redirect.server.src} {:else} - - {redirect.client.src} + + {redirect.client.src} diff --git a/src/components/RouteCreator.svelte b/src/components/RouteCreator.svelte new file mode 100644 index 0000000..59987be --- /dev/null +++ b/src/components/RouteCreator.svelte @@ -0,0 +1,25 @@ + + + + + + + + + + + diff --git a/src/components/RouteRow.svelte b/src/components/RouteRow.svelte index 6e8c032..6eb093d 100644 --- a/src/components/RouteRow.svelte +++ b/src/components/RouteRow.svelte @@ -12,15 +12,15 @@ {#if noCPair(route)} - {route.server.src} + {route.server.src} {:else} - - {route.client.src} + + {route.client.src} @@ -34,16 +34,32 @@ {/if} diff --git a/test-server/main.go b/test-server/main.go index 35c71b1..1d46b62 100644 --- a/test-server/main.go +++ b/test-server/main.go @@ -110,16 +110,53 @@ func apiServer(verify mjwt.Verifier) { "flags": 181, "active": true, }, + { + "src": "b.example.test", + "dst": "127.0.0.1:8081", + "flags": 17, + "active": true, + }, + { + "src": "c.example.test", + "dst": "127.0.0.1:8082", + "flags": 16, + "active": true, + }, + { + "src": "d.example.test", + "dst": "127.0.0.1:8083", + "flags": 15, + "active": true, + }, + }) })) r.Handle("/v1/violet/redirect", hasPerm(verify, "violet:redirect", func(rw http.ResponseWriter, req *http.Request) { json.NewEncoder(rw).Encode([]map[string]any{ { - "src": "b.example.test", - "dst": "127.0.0.1:8080", + "src": "e.example.test", + "dst": "127.0.0.1:8084", "flags": 181, "active": true, }, + { + "src": "f.example.test", + "dst": "127.0.0.1:8085", + "flags": 17, + "active": true, + }, + { + "src": "g.example.test", + "dst": "127.0.0.1:8086", + "flags": 16, + "active": true, + }, + { + "src": "h.example.test", + "dst": "127.0.0.1:8087", + "flags": 15, + "active": true, + }, }) }))