Spaces:
Running
Running
cutycat2000x
commited on
Commit
•
3c2a81d
1
Parent(s):
b8cf750
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from flask import Flask, request, Response
|
2 |
+
|
3 |
+
app = Flask("DiscordRocks Instant Chat Proxy")
|
4 |
+
|
5 |
+
DISCORD_ROCKS_HOST = 'chat.discord.rocks'
|
6 |
+
CHAT_UI_HOST = 'cutycat2000x-instantchat.static.hf.space'
|
7 |
+
|
8 |
+
@app.route("/<path:path>", methods=['GET', 'POST'])
|
9 |
+
def handle_request(path):
|
10 |
+
chat_ui_url = f'https://{DISCORD_ROCKS_HOST}/{path}'
|
11 |
+
response = Response()
|
12 |
+
response.status_code = 200
|
13 |
+
response.content_type = "text/html"
|
14 |
+
response.data = requests.get(chat_ui_url).content
|
15 |
+
return response
|
16 |
+
|
17 |
+
if __name__ == "__main__":
|
18 |
+
app.run(debug=True, host="0.0.0.0", port=7860)
|