mirror of
https://github.com/Galax028/startpage.git
synced 2025-02-16 10:59:25 +01:00
Fix more things since Vercel is bruh
This commit is contained in:
parent
f1f345b5da
commit
d8b1fd87af
10
proxy.py
10
proxy.py
@ -1,11 +1,11 @@
|
||||
import requests
|
||||
from flask import Flask, send_from_directory
|
||||
|
||||
server = Flask(__name__)
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@server.get("/")
|
||||
@server.get("/<string:file>")
|
||||
@app.get("/")
|
||||
@app.get("/<string:file>")
|
||||
def startpage(file = None):
|
||||
if not file:
|
||||
return send_from_directory("./", "startpage.html")
|
||||
@ -13,12 +13,12 @@ def startpage(file = None):
|
||||
return send_from_directory("./", file)
|
||||
|
||||
|
||||
@server.get("/ac/<string:query>")
|
||||
@app.get("/ac/<string:query>")
|
||||
def deal_with_cors(query):
|
||||
return {"data": requests.get(f"https://ac.duckduckgo.com/ac/?q={query}&type=list").json()[1]}
|
||||
|
||||
|
||||
@server.after_request
|
||||
@app.after_request
|
||||
def actually_deal_with_cors(res):
|
||||
res.headers["Access-Control-Allow-Origin"] = "startpage.galax.tech"
|
||||
return res
|
||||
|
Loading…
Reference in New Issue
Block a user