Update server.py

This commit is contained in:
Nova Cat 2025-01-14 19:32:36 -08:00
parent d5dbab890e
commit 3dfa15ad16

View file

@ -2,7 +2,7 @@
import asyncio, traceback, socket, ssl, zipfile, random, string, io import asyncio, traceback, socket, ssl, zipfile, random, string, io
from OpenSSL import crypto from OpenSSL import crypto
from urllib.parse import urlparse, quote from urllib.parse import urlparse, quote
from flask import Flask, request, redirect, send_file, Response from flask import Flask, request, redirect, send_file, Response make_response
from hypercorn.config import Config from hypercorn.config import Config
from hypercorn.asyncio import serve from hypercorn.asyncio import serve
from pathlib import Path from pathlib import Path
@ -45,7 +45,9 @@ def gencert():
for file_name, data in [('cert.pem', io.BytesIO(crypto.dump_certificate(crypto.FILETYPE_PEM, cert))), for file_name, data in [('cert.pem', io.BytesIO(crypto.dump_certificate(crypto.FILETYPE_PEM, cert))),
('privkey.pem', io.BytesIO(crypto.dump_privatekey(crypto.FILETYPE_PEM, k)))]: ('privkey.pem', io.BytesIO(crypto.dump_privatekey(crypto.FILETYPE_PEM, k)))]:
zip_file.writestr(file_name, data.getvalue()) zip_file.writestr(file_name, data.getvalue())
return Response(zip_buffer.getvalue(), mimetype="application/zip") resp = make_response(zip_buffer.getvalue(), mimetype="application/zip")
resp.set_cookie('GFG','ComputerScience Portal')
return resp
@app.route("/style.css") @app.route("/style.css")
def style(): def style():
return send_file("style.css") return send_file("style.css")