This commit is contained in:
hexlocation 2024-12-28 21:51:06 +01:00
parent 2b69254416
commit 9b2db30a82
Signed by: hex
GPG key ID: A19EFFAAF8C00FCF
6 changed files with 13 additions and 8 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@
gw gw
gw.exe gw.exe
gw_linkerArgs.txt gw_linkerArgs.txt
web/node_modules

6
package-lock.json generated Normal file
View file

@ -0,0 +1,6 @@
{
"name": "gw",
"lockfileVersion": 3,
"requires": true,
"packages": {}
}

File diff suppressed because one or more lines are too long

View file

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="color-scheme" content="light dark" /> <meta name="color-scheme" content="light dark" />
<title>Vite + Preact</title> <title>Vite + Preact</title>
<script type="module" crossorigin src="/public/assets/index-Ccw9dgTj.js"></script> <script type="module" crossorigin src="/public/assets/index-CnOGj8CL.js"></script>
<link rel="stylesheet" crossorigin href="/public/assets/index-CHOkfbIW.css"> <link rel="stylesheet" crossorigin href="/public/assets/index-CHOkfbIW.css">
</head> </head>
<body> <body>

View file

@ -15,8 +15,6 @@ sql"""CREATE TABLE IF NOT EXISTS keys(
)""") )""")
proc index*(ctx: Context) {.async.} = proc index*(ctx: Context) {.async.} =
for x in db.fastRows(sql"SELECT * FROM keys"):
echo x
await ctx.staticFileResponse("public/index.html", "") await ctx.staticFileResponse("public/index.html", "")
proc ip_exists*(ip: string): bool = proc ip_exists*(ip: string): bool =
@ -46,7 +44,7 @@ proc gentry*(ctx: Context) {.async.} =
ip_exists(ctx.request.hostName)) and not table_empty()) and not debug: ip_exists(ctx.request.hostName)) and not table_empty()) and not debug:
err = true err = true
else: else:
generate_referral(key,referral, ctx.request.hostName, $ctx.request.getHeader("header")) generate_referral(key,referral, ctx.request.hostName, $ctx.request.getHeader("referral"))
err = false err = false
var info = %* var info = %*

View file

@ -21,7 +21,7 @@ export const Home = () => {
}, [referral]); }, [referral]);
const entry = async () => { const entry = async () => {
let res = await fetch("http://localhost:8080/entry", { let res = await fetch("/entry", {
method: 'GET', method: 'GET',
headers: { referral } headers: { referral }
}) })