mirror of
https://git.ari.lt/ari.lt/ari.lt.git
synced 2025-02-05 01:59:25 +01:00
improve badges, js, and metadata
Signed-off-by: Ari Archer <ari@ari.lt>
This commit is contained in:
parent
7eed157a33
commit
f05a6a962f
6 changed files with 119 additions and 25 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
import datetime
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from base64 import b64encode
|
||||
from functools import lru_cache
|
||||
|
@ -22,6 +23,56 @@ def min_css(css: str) -> str:
|
|||
return web_mini.css.minify_css(css)
|
||||
|
||||
|
||||
def assign_http(app: flask.Flask) -> flask.Flask:
|
||||
"""assign http file stuff"""
|
||||
|
||||
# robots
|
||||
|
||||
@app.route("/robots.txt", methods=["GET", "POST"])
|
||||
def __robots__() -> flask.Response:
|
||||
"""favicon"""
|
||||
|
||||
robots: str = (
|
||||
f"User-agent: *\nSitemap: {app.config['PREFERRED_URL_SCHEME']}://{app.config['DOMAIN']}/sitemap.xml\n"
|
||||
)
|
||||
|
||||
return flask.Response(robots, mimetype="text/plain")
|
||||
|
||||
# sitemap
|
||||
|
||||
rule: flask.Rule
|
||||
|
||||
pat: re.Pattern[str] = re.compile(r"<.+?:(.+?)>")
|
||||
|
||||
sitemap: str = (
|
||||
'<?xml version="1.0" encoding="UTF-8"?>\
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'
|
||||
)
|
||||
|
||||
def surl(loc: str) -> str:
|
||||
"""sitemap url"""
|
||||
|
||||
u: str = "<url>"
|
||||
|
||||
u += f'<loc>{app.config["PREFERRED_URL_SCHEME"]}://{app.config["DOMAIN"]}{loc}</loc>'
|
||||
u += "<priority>1.0</priority>"
|
||||
|
||||
return u + "</url>"
|
||||
|
||||
sitemap += surl("/robots.txt")
|
||||
|
||||
for rule in app.url_map.iter_rules():
|
||||
url: str = pat.sub(r"\1", rule.rule)
|
||||
sitemap += surl(url)
|
||||
|
||||
@app.route("/sitemap.xml", methods=["GET", "POST"])
|
||||
def __sitemap__() -> flask.Response:
|
||||
"""sitemap"""
|
||||
return flask.Response(sitemap + "</urlset>", mimetype="application/xml")
|
||||
|
||||
return app
|
||||
|
||||
|
||||
def create_app(name: str) -> flask.Flask:
|
||||
"""create ari.lt app"""
|
||||
|
||||
|
@ -125,4 +176,4 @@ def create_app(name: str) -> flask.Flask:
|
|||
"b64encode": b64encode,
|
||||
}
|
||||
|
||||
return app
|
||||
return assign_http(app)
|
||||
|
|
|
@ -312,6 +312,23 @@ def badge_yellow() -> Response:
|
|||
return r
|
||||
|
||||
|
||||
@views.get("/badge.txt")
|
||||
def badge_txt() -> Response:
|
||||
"""Website badge"""
|
||||
|
||||
r: Response = flask.redirect(
|
||||
flask.url_for(
|
||||
"static",
|
||||
filename="badges/badge.txt",
|
||||
)
|
||||
)
|
||||
|
||||
r.headers["Access-Control-Allow-Origin"] = "*"
|
||||
r.headers["Access-Control-Allow-Methods"] = "GET, POST, OPTIONS, HEAD"
|
||||
|
||||
return r
|
||||
|
||||
|
||||
@views.get("/captcha.png")
|
||||
def captcha() -> Response:
|
||||
"""CAPTCHA"""
|
||||
|
|
12
src/static/badges/badge.txt
Normal file
12
src/static/badges/badge.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
.;l.
|
||||
';..,lxOx'
|
||||
.:dxl.lxOOOx,..... b. .o
|
||||
'dkOkxdxkOOOkxxxxxddl; ok
|
||||
.:loxOOOxlcoOOOOkxxxxxdc. .::c. ,c:c c: :, l. ': ;::. xX;:c,
|
||||
.,,'.cOOO: ;OOOkd'..... co cO xM'' 0k.==.lK .Nd Kl k0..K kM,.,X.
|
||||
dOOO;..dOOOkxlccc:;'. kc :K xX 0k.==. Od0,ooO NO; kM 0,
|
||||
.,;lOOOOxxkOOOOkxc:;,.. o::\ :o lc .k: .k. 'o-:/ cd:;lo
|
||||
.;cccxOOOk',dkOOOx:
|
||||
dOOOo .dxOOko. https://ari.lt/
|
||||
dkdc. .ooo:'.
|
||||
''. ..
|
|
@ -108,6 +108,15 @@ a {
|
|||
text-decoration: none;
|
||||
}
|
||||
|
||||
input[type=checkbox] {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
textarea {
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||
const connection_radius = 192;
|
||||
|
||||
let mouse = {
|
||||
x: null,
|
||||
y: null,
|
||||
x: -1,
|
||||
y: -1,
|
||||
};
|
||||
|
||||
let animation_frame_id = null;
|
||||
|
@ -57,9 +57,6 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||
}
|
||||
}
|
||||
|
||||
window.addEventListener("mousemove", update_pointer);
|
||||
window.addEventListener("touchmove", update_pointer);
|
||||
|
||||
function debounce(func, wait, immediate) {
|
||||
let timeout;
|
||||
return function () {
|
||||
|
@ -76,16 +73,20 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||
};
|
||||
}
|
||||
|
||||
function handle_resize() {
|
||||
window.addEventListener("mousemove", update_pointer);
|
||||
window.addEventListener("touchmove", update_pointer);
|
||||
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
debounce(() => {
|
||||
canvas.width = window.innerWidth;
|
||||
canvas.height = window.innerHeight;
|
||||
|
||||
cancelAnimationFrame(animation_frame_id);
|
||||
init();
|
||||
animate();
|
||||
}
|
||||
|
||||
window.addEventListener("resize", debounce(handle_resize, 250));
|
||||
}, 250),
|
||||
);
|
||||
|
||||
class Particle {
|
||||
constructor() {
|
||||
|
|
|
@ -131,7 +131,7 @@
|
|||
|
||||
<div>
|
||||
<div align="center">
|
||||
<img src="{{ url_for("static", filename="svg/ari.svg") }}" alt="A illustration (sketch) of Ari Archer with medium length red-black split dyed hair" width="196px" />
|
||||
<img src="{{ url_for("static", filename="svg/ari.svg") }}" alt="A illustration (sketch) of Ari Archer with medium length red-black split dyed hair" width="196" />
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
|
@ -234,31 +234,35 @@
|
|||
|
||||
<ul>
|
||||
<li>
|
||||
Normal: <a href="https://ari.lt/"> <img src="{{ url_for("views.badge") }}" loading="lazy" alt="ari-web badge" height="31px" width="88px" /> </a>
|
||||
Normal: <a href="https://ari.lt/" title="ari-web badge" aria-label="Visit ari-web" rel="noopener noreferrer"> <img src="{{ url_for("views.badge") }}" loading="lazy" alt="ari-web badge" height="31" width="88" role="presentation" /> </a>
|
||||
<ul>
|
||||
<li>
|
||||
<b>Embed:</b> <textarea style="width:50%;min-height:3rem;resize:vertical" disabled><a href="https://ari.lt/"> <img src="https://ari.lt{{ url_for("views.badge") }}" loading="lazy" alt="ari-web badge" height="31px" width="88px" /> </a></textarea>
|
||||
<b>Embed:</b> <textarea style="width:50%;min-height:3rem;resize:vertical" disabled><a href="https://ari.lt/" title="ari-web badge" aria-label="Visit ari-web" rel="noopener noreferrer"> <img src="https://ari.lt{{ url_for("views.badge") }}" loading="lazy" alt="ari-web badge" height="31" width="88" role="presentation" /> </a></textarea>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
Yellow: <a href="https://ari.lt/"> <img src="{{ url_for("views.badge_yellow") }}" loading="lazy" alt="ari-web badge" height="31px" width="88px" /> </a>
|
||||
Yellow: <a href="https://ari.lt/" title="ari-web badge" aria-label="Visit ari-web" rel="noopener noreferrer"> <img src="{{ url_for("views.badge_yellow") }}" loading="lazy" alt="ari-web badge" height="31" width="88" role="presentation" /> </a>
|
||||
<ul>
|
||||
<li>
|
||||
<b>Embed:</b> <textarea style="width:50%;min-height:3rem;resize:vertical" disabled><a href="https://ari.lt/"> <img src="https://ari.lt{{ url_for("views.badge_yellow") }}" loading="lazy" alt="ari-web badge" height="31px" width="88px" /> </a></textarea>
|
||||
<b>Embed:</b> <textarea style="width:50%;min-height:3rem;resize:vertical" disabled><a href="https://ari.lt/" title="ari-web badge" aria-label="Visit ari-web" rel="noopener noreferrer"> <img src="https://ari.lt{{ url_for("views.badge_yellow") }}" loading="lazy" alt="ari-web badge" height="31" width="88" role="presentation" /> </a></textarea>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
Text: <a href="{{ url_for("views.badge_txt") }}">badge.txt</a>.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Also, friends:</p>
|
||||
|
||||
<ul>
|
||||
<li>FSKY: <a href="https://fsky.io/"> <img src="https://fsky.io/badge.png" loading="lazy" alt="FSKY badge" height="31px" width="88px" /> </a></li>
|
||||
<li>LDA: <a href="https://freetards.xyz/"> <img src="https://freetards.xyz/88x31.png" loading="lazy" alt="Freetards badge" height="31px" width="88px" /> </a></li>
|
||||
<li>Hydrogen: <a href="https://h2.gay/"> <img src="https://h2.gay/images/88x31.gif" loading="lazy" alt="H2.gay's badge" height="31px" width="88px" /> </a></li>
|
||||
<li>DOSKEL: <a href="https://doskel.net/"> <img src="https://doskel.net/img/logo.png" loading="lazy" alt="Doskel.net's badge" height="31px" width="88px" /> </a></li>
|
||||
<li>FSKY: <a href="https://fsky.io/" title="FSKY badge" aria-label="Visit FSKY" rel="noopener noreferrer"> <img src="https://fsky.io/badge.png" loading="lazy" alt="FSKY badge" height="31" width="88" role="presentation" /> </a></li>
|
||||
<li>LDA: <a href="https://freetards.xyz/" title="LDA's badge" aria-label="Visit LDA's website" rel="noopener noreferrer"> <img src="https://freetards.xyz/88x31.png" loading="lazy" alt="Freetards badge" height="31" width="88" role="presentation" /> </a></li>
|
||||
<li>Hydrogen: <a href="https://h2.gay/" title="Hydrogen's badge" aria-label="Visit Hydrogen's website" rel="noopener noreferrer"> <img src="https://h2.gay/images/88x31.gif" loading="lazy" alt="H2.gay's badge" height="31" width="88" role="presentation" /> </a></li>
|
||||
<li>DOSKEL: <a href="https://doskel.net/" title="DOSKEL's badge" aria-label="Visit DOSKEL's website" rel="noopener noreferrer"> <img src="https://doskel.net/img/logo.png" loading="lazy" alt="Doskel.net's badge" height="31" width="88" role="presentation" /> </a></li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
|
@ -468,7 +472,7 @@
|
|||
</div>
|
||||
|
||||
<div class="captcha">
|
||||
<img loading="lazy" width="240px" height="90" src="{{ url_for("views.captcha") }}?new" onclick="this.src=this.src+Math.floor(1000*Math.random())" alt="An image CAPTCHA" />
|
||||
<img loading="lazy" width="240" height="90" src="{{ url_for("views.captcha") }}?new" onclick="this.src=this.src+Math.floor(1000*Math.random())" alt="An image CAPTCHA" />
|
||||
<i>Click the image above to reload and get a new CAPTCHA.</i>
|
||||
</div>
|
||||
|
||||
|
@ -492,7 +496,7 @@
|
|||
<div id="comments">
|
||||
{% for comment in comments %}
|
||||
<div id="gb-{{ comment.id }}">
|
||||
<p><a href="#gb-{{ comment.id }}">#{{ comment.id }}:</a> <span>{{ comment.name | escape }}</span> {% if comment.website %}(<a href="{{ comment.website }}" target="_blank">{{ comment.website | escape }}</a>){% endif %} <<i><a href="mailto:" style="color:#aaa" onclick="this.innerText=rc4('{{ b64encode(comment.email_ct).decode() }}','{{ b64encode(comment.key).decode() }}');this.href+=this.innerText;this.onclick=null;this.style='';return!!0">show email</a></i>> at <time>{{ comment.posted }} UTC</time> says...</p>
|
||||
<p><a href="#gb-{{ comment.id }}">#{{ comment.id }}:</a> <span>{{ comment.name | escape }}</span> {% if comment.website %}(<a href="{{ comment.website }}" rel="noopener noreferrer" target="_blank">{{ comment.website | escape }}</a>){% endif %} <<i><a href="mailto:" style="color:#aaa" onclick="this.innerText=rc4('{{ b64encode(comment.email_ct).decode() }}','{{ b64encode(comment.key).decode() }}');this.href+=this.innerText;this.onclick=null;this.style='';return!!0">show email</a></i>> at <time>{{ comment.posted }} UTC</time> says...</p>
|
||||
<div>{{ comment.comment | markdown }}</div>
|
||||
</div>{% endfor %}
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue