mirror of
https://git.ari.lt/ari.lt/ari.lt.git
synced 2025-02-04 17:49:24 +01:00
fix cors and caching of counter
Signed-off-by: Ari Archer <ari@ari.lt>
This commit is contained in:
parent
741bc64237
commit
546b3bc1d9
1 changed files with 11 additions and 1 deletions
|
@ -260,7 +260,8 @@ def favicon() -> Response:
|
|||
@views.get("/counter.svg")
|
||||
def counter() -> flask.Response:
|
||||
"""counter"""
|
||||
return flask.Response(
|
||||
|
||||
r = flask.Response(
|
||||
util.text2svg(
|
||||
text=str(models.Counter.first().inc().count),
|
||||
fill=flask.request.args.get("fill", "#fff"),
|
||||
|
@ -273,6 +274,15 @@ def counter() -> flask.Response:
|
|||
mimetype="image/svg+xml",
|
||||
)
|
||||
|
||||
r.headers["Access-Control-Allow-Origin"] = "*"
|
||||
r.headers["Access-Control-Allow-Methods"] = "GET, POST, OPTIONS, HEAD"
|
||||
r.headers["Expires"] = "Thu, 01 Jan 1970 00:00:00 GMT"
|
||||
r.headers["Cache-Control"] = (
|
||||
"max-age=0, no-cache, must-revalidate, proxy-revalidate"
|
||||
)
|
||||
|
||||
return r
|
||||
|
||||
|
||||
@views.get("/badge.png")
|
||||
def badge() -> Response:
|
||||
|
|
Loading…
Add table
Reference in a new issue