Update server.py
This commit is contained in:
parent
d4dc2f603b
commit
e7a5ccf74f
1 changed files with 2 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
import asyncio, traceback, socket, ssl
|
import asyncio, traceback, socket, ssl
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse, quote
|
||||||
from flask import Flask, request, redirect, send_file, Response
|
from flask import Flask, request, redirect, send_file, Response
|
||||||
from hypercorn.config import Config
|
from hypercorn.config import Config
|
||||||
from hypercorn.asyncio import serve
|
from hypercorn.asyncio import serve
|
||||||
|
@ -70,7 +70,7 @@ def relay():
|
||||||
i = i.replace("<", "<")
|
i = i.replace("<", "<")
|
||||||
if firstline:
|
if firstline:
|
||||||
if i.split(" ")[0][0] == "3":
|
if i.split(" ")[0][0] == "3":
|
||||||
return redirect("/gem?gemini=" + i.split(" ")[1][9:])
|
return redirect("/gem?gemini=" + quote(i.split(" ")[1][9:], safe=''))
|
||||||
elif i.split(" ")[0][0] == "1":
|
elif i.split(" ")[0][0] == "1":
|
||||||
return f'<!DOCTYPE html>\n<html><head><meta charset="UTF-8"><link rel="stylesheet" href="/style.css"><title>Input required</title></head><body><h1>Input required</h1><p>The specified Gemini server wants more data: "<pre>{i}</pre>"</p><br><form action="/gem"><input hidden class="input" value="{url}" type="text" name="gemini"><input hidden class="input" type="text" name="query"><br><input type="submit" class="go" value="Go!"><br></form></body></html>'
|
return f'<!DOCTYPE html>\n<html><head><meta charset="UTF-8"><link rel="stylesheet" href="/style.css"><title>Input required</title></head><body><h1>Input required</h1><p>The specified Gemini server wants more data: "<pre>{i}</pre>"</p><br><form action="/gem"><input hidden class="input" value="{url}" type="text" name="gemini"><input hidden class="input" type="text" name="query"><br><input type="submit" class="go" value="Go!"><br></form></body></html>'
|
||||||
elif i.split(" ")[0][0] != "2":
|
elif i.split(" ")[0][0] != "2":
|
||||||
|
|
Loading…
Add table
Reference in a new issue