From 3f67d21fc9014899eb6edbbc96a44826ffc85c73 Mon Sep 17 00:00:00 2001 From: Sweetbread Date: Fri, 3 Apr 2026 00:34:08 +0300 Subject: [PATCH] tmp --- app.py | 7 +- blueprints/risdeveau/__init__.py | 2 +- blueprints/risdeveau/templates/index.html | 57 --------------- blueprints/risdeveau/templates/index.pug | 50 +++++++++++++ .../risdeveau/templates/listenbrainz.pug | 7 +- blueprints/risdeveau/templates/steam.pug | 4 +- blueprints/root/__init__.py | 2 +- blueprints/root/templates/base.pug | 33 +++++++++ blueprints/root/templates/base.tmpl | 35 ---------- blueprints/root/templates/footer.pug | 9 +++ blueprints/root/templates/footer.tmpl | 5 -- blueprints/root/templates/header.pug | 17 +++++ blueprints/root/templates/header.tmpl | 20 ------ blueprints/root/templates/host.pug | 2 +- blueprints/root/templates/index.html | 52 -------------- blueprints/root/templates/index.pug | 70 +++++++++++++++++++ blueprints/root/templates/us.pug | 4 +- requirements.txt | 2 +- shell.nix | 2 +- 19 files changed, 198 insertions(+), 182 deletions(-) delete mode 100644 blueprints/risdeveau/templates/index.html create mode 100644 blueprints/risdeveau/templates/index.pug create mode 100644 blueprints/root/templates/base.pug delete mode 100644 blueprints/root/templates/base.tmpl create mode 100644 blueprints/root/templates/footer.pug delete mode 100644 blueprints/root/templates/footer.tmpl create mode 100644 blueprints/root/templates/header.pug delete mode 100644 blueprints/root/templates/header.tmpl delete mode 100644 blueprints/root/templates/index.html create mode 100644 blueprints/root/templates/index.pug diff --git a/app.py b/app.py index f683af4..66d8ff0 100644 --- a/app.py +++ b/app.py @@ -9,7 +9,12 @@ import blueprints.risdeveau.modules.style from flask import Flask -app = Flask(__name__, static_folder=None, subdomain_matching=True) +app = Flask( + __name__, + static_folder=None, + subdomain_matching=True, + template_folder="blueprints" +) app.jinja_env.add_extension('pypugjs.ext.jinja.PyPugJSExtension') diff --git a/blueprints/risdeveau/__init__.py b/blueprints/risdeveau/__init__.py index dcf100c..c6997f8 100644 --- a/blueprints/risdeveau/__init__.py +++ b/blueprints/risdeveau/__init__.py @@ -83,7 +83,7 @@ args = { @bp.route("/") def index(): - return render_tmpl('index.html', **args) + return render_tmpl('index.pug', **args) @bp.route("/m/") def module(module): diff --git a/blueprints/risdeveau/templates/index.html b/blueprints/risdeveau/templates/index.html deleted file mode 100644 index 4f4487b..0000000 --- a/blueprints/risdeveau/templates/index.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - Sweet Bread - - - - - - - - - - - - - - - -
- Lair -
- -
- {% for m in ( - 'info', - 'contacts', - 'listenbrainz', - 'steam', - 'donate', - '88x31' - ) %} - {% include 'risdeveau/templates/%s.pug' % m %} - {% endfor %} -
- - diff --git a/blueprints/risdeveau/templates/index.pug b/blueprints/risdeveau/templates/index.pug new file mode 100644 index 0000000..805e487 --- /dev/null +++ b/blueprints/risdeveau/templates/index.pug @@ -0,0 +1,50 @@ +doctype html + +html(lang="en") + head + title Sweet Bread + + each f in ('tw', 'main', 'risdeveau') + link(rel="stylesheet", href="/static/style/#{f}.css") + + link(rel="icon" type="image/webp" href="/static/icon/us/risdeveau.webp") + + script(src="/static/script/rtime.js") + script( + src="https://track.lair.moe/api/script.js" + data-site-id="1" + defer + ) + script( + src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.8/dist/htmx.min.js" + integrity="sha384-/TgkGk7p307TH7EXJDuUlgG3Ce1UVolAOFopFekQkkXihi5u/6OCvVKyz1W+idaz" + crossorigin="anonymous" + ) + script(defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js") + + meta(name="viewport" content="width=device-width, initial-scale=1.0") + meta( + name="htmx-config" + content='{ + "responseHandling":[ + {"code":"204", "swap": false}, + {"code":"304", "swap": false}, + {"code":"[23]..", "swap": true}, + {"code":"422", "swap": true}, + {"code":"[45]..", "swap": false, "error":true}, + {"code":"...", "swap": true} + ] + }' + ) + + body + header + a(href=url_for('root.index')) Lair + + main + include risdeveau/templates/info.pug + include risdeveau/templates/contacts.pug + include risdeveau/templates/listenbrainz.pug + include risdeveau/templates/steam.pug + include risdeveau/templates/donate.pug + include risdeveau/templates/88x31.pug diff --git a/blueprints/risdeveau/templates/listenbrainz.pug b/blueprints/risdeveau/templates/listenbrainz.pug index 021094a..9d89a40 100644 --- a/blueprints/risdeveau/templates/listenbrainz.pug +++ b/blueprints/risdeveau/templates/listenbrainz.pug @@ -1,5 +1,6 @@ mixin track_block(track, is_active=false) - .block.track + - set act_cls = "active" if is_active else "" + .block.track(class=act_cls) if track.cover_url img(src=track.cover_url) div @@ -18,13 +19,13 @@ mixin track_block(track, is_active=false) hx-get="/m/listenbrainz", hx-trigger="every 15s", hx-swap="outerHTML", - hx-headers='{ "If-None-Match": "#{lb.etag}" }' + hx-headers='{"If-None-Match": "#{lb.etag}"}' ) h2 a(href="https://listenbrainz.org/user/risdeveau/") Listenbrainz if lb.caches.now.data and lb.caches.now.data.listens[0] - +track_block.active(lb.caches.now.data.listens[0]) + +track_block(lb.caches.now.data.listens[0], true) if lb.caches.listens.data and lb.caches.listens.data.listens each track in lb.caches.listens.data.listens diff --git a/blueprints/risdeveau/templates/steam.pug b/blueprints/risdeveau/templates/steam.pug index c8ec9d1..c31daba 100644 --- a/blueprints/risdeveau/templates/steam.pug +++ b/blueprints/risdeveau/templates/steam.pug @@ -17,14 +17,14 @@ mixin game_block(g, show_last_played=false) abbr(title="On Linux") L | ) if lin and win - | + + = " + " if win = tmsmp(g.playtime_windows_forever * 60) | ( abbr(title="On Windows") W | ) if lin and win - | = + = " = " = tmsmp(g.playtime_forever * 60) if show_last_played and g.rtime_last_played != 0 p Last played: #{utmsmp(g.rtime_last_played)} diff --git a/blueprints/root/__init__.py b/blueprints/root/__init__.py index adf8495..10c3739 100644 --- a/blueprints/root/__init__.py +++ b/blueprints/root/__init__.py @@ -17,7 +17,7 @@ def render_tmpl(filename: str) -> str: @bp.route("/") def index(): - return render_tmpl('index.html') + return render_tmpl('index.pug') @bp.route("/host") def host(): diff --git a/blueprints/root/templates/base.pug b/blueprints/root/templates/base.pug new file mode 100644 index 0000000..0473c13 --- /dev/null +++ b/blueprints/root/templates/base.pug @@ -0,0 +1,33 @@ +doctype html +html(lang=g.locale) + head + title Lair + + link(rel="stylesheet" href="/static/style/main.css") + link(rel="icon" type="image/webp" href="/static/icon/lair.webp") + + script(src="/static/script/copy-mono.js") + script( + src="https://track.lair.moe/api/script.js" + data-site-id="1" + defer + ) + meta(name="viewport" content="width=device-width, initial-scale=1.0") + meta(name="mock-email" content="admin@example.com") + + meta(property="og:type" value="website") + meta(property="og:url" value="https://lair.moe") + meta(property="og:title" value="Lair.moe") + meta(property="og:image" value="https://lair.moe/static/icon/lair.webp") + meta(property="og:description" value=_("description")) + + body + include root/templates/header.pug + + h1 + block title + + main + block content + + include root/templates/footer.pug diff --git a/blueprints/root/templates/base.tmpl b/blueprints/root/templates/base.tmpl deleted file mode 100644 index bcb0f29..0000000 --- a/blueprints/root/templates/base.tmpl +++ /dev/null @@ -1,35 +0,0 @@ - - - - Lair - - - - - - - - - - - - - - - - - {% include 'header.tmpl' %} - -

{% block title %}{% endblock %}

- -
- {% block content %}{% endblock %} -
- - {% include 'footer.tmpl' %} - - \ No newline at end of file diff --git a/blueprints/root/templates/footer.pug b/blueprints/root/templates/footer.pug new file mode 100644 index 0000000..489396b --- /dev/null +++ b/blueprints/root/templates/footer.pug @@ -0,0 +1,9 @@ +footer + div + | lair.moe 🄯 2025 - 2026 + div + a(href="https://g.lair.moe/Sweetbread/lair.moe")= _('site source') + div + = _('contact us') + = ": " + a(href="mailto:admin@lair.moe") admin@lair.moe diff --git a/blueprints/root/templates/footer.tmpl b/blueprints/root/templates/footer.tmpl deleted file mode 100644 index 7fae879..0000000 --- a/blueprints/root/templates/footer.tmpl +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/blueprints/root/templates/header.pug b/blueprints/root/templates/header.pug new file mode 100644 index 0000000..96742ff --- /dev/null +++ b/blueprints/root/templates/header.pug @@ -0,0 +1,17 @@ +header + if request.path != url_for('.index') + a(href=url_for('.index')) Lair + else + div + + .header-links + - + var links = ( + ('.us', _('about us')), + ('.host', _('about host')), + ) + each l, t in links + if url_for(l) == request.path + strong= t + else + a(href=url_for(l))= t diff --git a/blueprints/root/templates/header.tmpl b/blueprints/root/templates/header.tmpl deleted file mode 100644 index e6fe82f..0000000 --- a/blueprints/root/templates/header.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -
- {%- if request.path != url_for('.index') %} - Lair - {%- else %} -
- {%- endif %} - - -
\ No newline at end of file diff --git a/blueprints/root/templates/host.pug b/blueprints/root/templates/host.pug index bbc757b..05614b7 100644 --- a/blueprints/root/templates/host.pug +++ b/blueprints/root/templates/host.pug @@ -1,4 +1,4 @@ -extends base.tmpl +extends root/templates/base.pug block title = _('about host') diff --git a/blueprints/root/templates/index.html b/blueprints/root/templates/index.html deleted file mode 100644 index 4b3ff0b..0000000 --- a/blueprints/root/templates/index.html +++ /dev/null @@ -1,52 +0,0 @@ -{% extends 'base.tmpl' %} - -{% block title %} - - Lair -{% endblock %} - -{% block content %} - -
- - Sharkey -
-

{{ _('index.descr:sharkey') }}

-
- -
- - Gitea -
-

{{ _('index.descr:gitea') }}

-
- -
-

Matrix — {{ _('index.descr:matrix') }}

-

Copyparty — {{ _('index.descr:copyparty') }}

-

IT-tools — {{ _('index.descr:tools') }}

-

Vert — {{ _('index.descr:vert') }}

-
- -
- {{ _('index:altfronts') }} -

4get — {{ _('index.descr:4get') }}

-

TransLite — {{ _('index.descr:tl') }}

-

Intellectual — {{ _('index.descr:lyr') }}

-
- -
-
- DNS: -
    -
  • 64.188.64.176
  • -
  • DoT: lair.moe:853
  • -
  • DoH: dns.lair.moe
  • -
-
-

- Yggdrasil: - 200:ee1:bad2:1732:4b91:c3e3:2f08:29b3 -

-
-{% endblock %} diff --git a/blueprints/root/templates/index.pug b/blueprints/root/templates/index.pug new file mode 100644 index 0000000..2cf0fb3 --- /dev/null +++ b/blueprints/root/templates/index.pug @@ -0,0 +1,70 @@ +extends root/templates/base.pug + +block title + img.icon(src="/static/icon/lair.webp") + | Lair + +block content + a.block(href="https://b.lair.moe" target="_blank") + .header + img.icon(src="/static/icon/service/sharkey.webp") + strong Sharkey + p= _('index.descr:sharkey') + + a.block(href="https://g.lair.moe" target="_blank") + .header + img.icon(src="/static/icon/service/gitea.webp") + strong Gitea + p= _('index.descr:gitea') + + .block + p + a(href="https://m.lair.moe" target="_blank") + strong Matrix + | — {{ _('index.descr:matrix') }} + p + a(href="//c.lair.moe" target="_blank") + strong Copyparty + | — {{ _('index.descr:copyparty') }} + p + a(href="https://tools.lair.moe" target="_blank") + strong IT-tools + | — {{ _('index.descr:tools') }} + p + a(href="https://vert.lair.moe" target="_blank") + strong Vert + | — {{ _('index.descr:vert') }} + + .block + strong= _('index:altfronts') + p + a(href="https://s.lair.moe" target="_blank") + strong 4get + | — {{ _('index.descr:4get') }} + p + a(href="https://tl.lair.moe" target="_blank") + strong TransLite + | — {{ _('index.descr:tl') }} + p + a(href="https://lyr.lair.moe" target="_blank") + strong Intellectual + | — {{ _('index.descr:lyr') }} + + .block + div + strong DNS + | : + ul + li + span.mono 64.188.64.176 + li + | DoT: + span.mono lair.moe:853 + li + | DoH: + span.mono dns.lair.moe + + p + strong Yggdrasil + | : + span.mono 200:ee1:bad2:1732:4b91:c3e3:2f08:29b3 diff --git a/blueprints/root/templates/us.pug b/blueprints/root/templates/us.pug index c2136b0..da63a8b 100644 --- a/blueprints/root/templates/us.pug +++ b/blueprints/root/templates/us.pug @@ -1,10 +1,10 @@ -extends base.tmpl +extends root/templates/base.pug block title | О нас block content - a.block.green(href="{{ url_for('risdeveau.index') }}") + a.block.green(href=url_for('risdeveau.index')) .header img.icon(src="/static/icon/us/risdeveau.webp") | Sweetbread diff --git a/requirements.txt b/requirements.txt index 94c9862..22e8d2d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,4 +5,4 @@ requests APScheduler musicbrainzngs python-magic -pypugjs +git+https://github.com/VerySweetBread/pypugjs diff --git a/shell.nix b/shell.nix index 03ed89b..9c7c75d 100644 --- a/shell.nix +++ b/shell.nix @@ -9,7 +9,7 @@ pkgs.mkShell { python python-magic virtualenv - # pkgs.nodePackages.sass + pkgs.dart-sass ]; shellHook = ''