redesign
This commit is contained in:
1 parent
ad620c976a
commit
0973129c17
26 files changed
+2255
-2245
No files matched your search
@@ -0,0 +1,27 @@
|
||||
"""Public page and consistent HTTP error rendering."""
|
||||
from datetime import datetime
|
||||
from flask import request, render_template, Response, jsonify, current_app
|
||||
from adlist import services
|
||||
import config
|
||||
|
||||
|
||||
def favicon():
|
||||
return current_app.send_static_file("favicon.svg")
|
||||
|
||||
|
||||
def index():
|
||||
recent_links = services.get_recent_links()
|
||||
return render_template(
|
||||
"form.html",
|
||||
recent_links=recent_links,
|
||||
client_ip=services.get_client_ip(),
|
||||
cache_days=config.CACHE_S_MAXAGE // 86400,
|
||||
)
|
||||
|
||||
|
||||
def handle_errors(error):
|
||||
status = getattr(error, "code", 500)
|
||||
try:
|
||||
return render_template("error.html", error=error, code=status), status
|
||||
except Exception:
|
||||
return jsonify({"error": getattr(error, "description", "Unexpected error"), "code": status}), status
|
||||
Reference in new issue
Block a user