mirror of
https://git.ari.lt/ari.lt/ari.lt.git
synced 2025-02-05 01:59:25 +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")
|
@views.get("/counter.svg")
|
||||||
def counter() -> flask.Response:
|
def counter() -> flask.Response:
|
||||||
"""counter"""
|
"""counter"""
|
||||||
return flask.Response(
|
|
||||||
|
r = flask.Response(
|
||||||
util.text2svg(
|
util.text2svg(
|
||||||
text=str(models.Counter.first().inc().count),
|
text=str(models.Counter.first().inc().count),
|
||||||
fill=flask.request.args.get("fill", "#fff"),
|
fill=flask.request.args.get("fill", "#fff"),
|
||||||
|
@ -273,6 +274,15 @@ def counter() -> flask.Response:
|
||||||
mimetype="image/svg+xml",
|
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")
|
@views.get("/badge.png")
|
||||||
def badge() -> Response:
|
def badge() -> Response:
|
||||||
|
|
Loading…
Add table
Reference in a new issue