tmp
This commit is contained in:
@@ -87,22 +87,14 @@ def index():
|
|||||||
|
|
||||||
@bp.route("/m/<module>")
|
@bp.route("/m/<module>")
|
||||||
def module(module):
|
def module(module):
|
||||||
if modified_since := request.headers.get('if-modified-since'):
|
if none_match := request.headers.get('if-none-match'):
|
||||||
modified_since = int(modified_since)
|
|
||||||
none_match = request.headers.get('if-none-match')
|
|
||||||
|
|
||||||
if any((modified_since, none_match)):
|
|
||||||
match module:
|
match module:
|
||||||
case "listenbrainz":
|
case "listenbrainz":
|
||||||
if modified_since >= int(lb_data['last_updated']):
|
|
||||||
return '', 304
|
|
||||||
if none_match == lb_data['etag']:
|
if none_match == lb_data['etag']:
|
||||||
return '', 304
|
return '', 304
|
||||||
|
|
||||||
case "steam":
|
case "steam":
|
||||||
if modified_since >= int(steam_data['last_updated']):
|
|
||||||
return '', 304
|
|
||||||
if none_match == steam_data['etag']:
|
if none_match == steam_data['etag']:
|
||||||
return '', 304
|
return '', 304
|
||||||
|
|
||||||
return render_tmpl(f'{module}.htm', **args)
|
return render_tmpl(f'{module}.pug', **args)
|
||||||
|
|||||||
@@ -3,39 +3,38 @@
|
|||||||
.blocks.badges
|
.blocks.badges
|
||||||
a.block(href="//g.lair.moe/Sweetbread")
|
a.block(href="//g.lair.moe/Sweetbread")
|
||||||
img.icon(src="/static/icon/service/gitea.webp")
|
img.icon(src="/static/icon/service/gitea.webp")
|
||||||
| Gitea
|
| Gitea
|
||||||
|
|
||||||
a.block(href="https://github.com/VerySweetBread")
|
a.block(href="https://github.com/VerySweetBread")
|
||||||
img.icon(src="https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png")
|
img.icon(src="https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png")
|
||||||
| GitHub
|
| GitHub
|
||||||
|
|
||||||
a.block(href="https://git.kolibrios.org/Sweetbread")
|
a.block(href="https://git.kolibrios.org/Sweetbread")
|
||||||
img.icon(src="https://git.kolibrios.org/assets/img/logo.svg")
|
img.icon(src="https://git.kolibrios.org/assets/img/logo.svg")
|
||||||
| KolibriOS Git
|
| KolibriOS Git
|
||||||
|
|
||||||
h3 Contacts
|
h3 Contacts
|
||||||
.blocks.badges
|
.blocks.badges
|
||||||
a.block(href="https://matrix.to/#/@risdeveau:lair.moe")
|
a.block(href="https://matrix.to/#/@risdeveau:lair.moe")
|
||||||
img.icon(src="https://matrix.org/assets/favicon.ico")
|
img.icon(src="https://matrix.org/assets/favicon.ico")
|
||||||
| Matrix
|
| Matrix
|
||||||
|
|
||||||
a.block(href="//b.lair.moe/@risdeveau")
|
a.block(href="//b.lair.moe/@risdeveau")
|
||||||
img.icon(src="/static/icon/service/sharkey.webp")
|
img.icon(src="/static/icon/service/sharkey.webp")
|
||||||
| Fediverse
|
| Fediverse
|
||||||
|
|
||||||
a.block(href="https://discord.com/users/459823895256498186")
|
a.block(href="https://discord.com/users/459823895256498186")
|
||||||
img.icon(src="https://cdn.prod.website-files.com/6257adef93867e50d84d30e2/66e3d80db9971f10a9757c99_Symbol.svg")
|
img.icon(src="https://cdn.prod.website-files.com/6257adef93867e50d84d30e2/66e3d80db9971f10a9757c99_Symbol.svg")
|
||||||
| Discord
|
| Discord
|
||||||
|
|
||||||
a.block(href="mailto:risdeveau@lair.moe")
|
a.block(href="mailto:risdeveau@lair.moe") Mail
|
||||||
| Mail
|
|
||||||
|
|
||||||
h3 Game accounts
|
h3 Game accounts
|
||||||
.blocks.badges
|
.blocks.badges
|
||||||
a.block(href="https://steamcommunity.com/id/risdeveau")
|
a.block(href="https://steamcommunity.com/id/risdeveau")
|
||||||
img.icon(src="https://store.steampowered.com/favicon.ico")
|
img.icon(src="https://store.steampowered.com/favicon.ico")
|
||||||
| Steam
|
| Steam
|
||||||
|
|
||||||
a.block(href="https://gamebanana.com/members/3899828")
|
a.block(href="https://gamebanana.com/members/3899828")
|
||||||
img.icon(src="https://images.gamebanana.com/static/img/favicon/favicon.ico")
|
img.icon(src="https://images.gamebanana.com/static/img/favicon/favicon.ico")
|
||||||
| GameBanana
|
| GameBanana
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
'donate',
|
'donate',
|
||||||
'88x31'
|
'88x31'
|
||||||
) %}
|
) %}
|
||||||
{% include 'risdeveau/templates/%s.pub' % m %}
|
{% include 'risdeveau/templates/%s.pug' % m %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
{% macro track_block(track, is_active=false) %}
|
|
||||||
<div class="block track{% if is_active %} active{% endif %}">
|
|
||||||
{% if track.cover_url %}
|
|
||||||
<img src="{{ track.cover_url }}"/>
|
|
||||||
{% endif %}
|
|
||||||
<div>
|
|
||||||
<p><b>{{ track.artist_name }}</b></p>
|
|
||||||
<p>{{ track.track_name }}</p>
|
|
||||||
{% if not is_active %}
|
|
||||||
<p
|
|
||||||
x-data="rtime({{ track.listened_at }})"
|
|
||||||
x-text="`Listened ${timeString}`"
|
|
||||||
:class="textColorClass"
|
|
||||||
></p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endmacro %}
|
|
||||||
|
|
||||||
<div
|
|
||||||
class="block"
|
|
||||||
hx-get="/m/listenbrainz"
|
|
||||||
hx-trigger="every 15s"
|
|
||||||
hx-swap="outerHTML"
|
|
||||||
hx-headers='{
|
|
||||||
"If-Modified-Since": {{ lb.last_updated | int }},
|
|
||||||
"If-None-Match": "{{ lb.etag }}"
|
|
||||||
}'
|
|
||||||
>
|
|
||||||
<h2><a href="https://listenbrainz.org/user/risdeveau/">Listenbrainz</a></h2>
|
|
||||||
{% if lb.caches.now.data and lb.caches.now.data.listens.0 %}
|
|
||||||
{{ track_block(lb.caches.now.data.listens.0, is_active=true) }}
|
|
||||||
{% endif %}
|
|
||||||
{% if lb.caches.listens.data and lb.caches.listens.data.listens %}
|
|
||||||
{% for track in lb.caches.listens.data.listens %}
|
|
||||||
{{ track_block(track) }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
mixin track_block(track, is_active=false)
|
||||||
|
.block.track
|
||||||
|
if track.cover_url
|
||||||
|
img(src=track.cover_url)
|
||||||
|
div
|
||||||
|
p
|
||||||
|
b= track.artist_name
|
||||||
|
p= track.track_name
|
||||||
|
|
||||||
|
if not is_active
|
||||||
|
p(
|
||||||
|
x-data="rtime(#{track.listened_at})",
|
||||||
|
x-text="`Listened ${timeString}`",
|
||||||
|
:class="textColorClass"
|
||||||
|
)
|
||||||
|
|
||||||
|
.block(
|
||||||
|
hx-get="/m/listenbrainz",
|
||||||
|
hx-trigger="every 15s",
|
||||||
|
hx-swap="outerHTML",
|
||||||
|
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])
|
||||||
|
|
||||||
|
if lb.caches.listens.data and lb.caches.listens.data.listens
|
||||||
|
each track in lb.caches.listens.data.listens
|
||||||
|
+track_block(track)
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
<div
|
|
||||||
class="block steam"
|
|
||||||
hx-get="/m/steam"
|
|
||||||
hx-trigger="every 1m"
|
|
||||||
hx-swap="outerHTML"
|
|
||||||
hx-headers='{
|
|
||||||
"If-Modified-Since": {{ steam.last_updated | int }},
|
|
||||||
"If-None-Match": "{{ steam.etag }}"
|
|
||||||
}'
|
|
||||||
>
|
|
||||||
<h2><a href="https://steamcommunity.com/id/risdeveau">Steam</a></h2>
|
|
||||||
|
|
||||||
{% if steam.caches.recent.data.games %}
|
|
||||||
<h3>Recently played:</h3>
|
|
||||||
{% for g in steam.caches.recent.data.games %}
|
|
||||||
<a href="https://store.steampowered.com/app/{{ g.appid }}" class="block">
|
|
||||||
<picture>
|
|
||||||
<source media="(max-width: 45rem)" srcset="{{ g.v_cover }}">
|
|
||||||
<img src="{{ g.h_cover }}">
|
|
||||||
</picture>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<strong>{{ g.name }}</strong>
|
|
||||||
<p>Played last 2 weeks: {{ tmsmp(g.playtime_2weeks*60) }}
|
|
||||||
<p>
|
|
||||||
Total played:
|
|
||||||
{{ tmsmp(g.playtime_linux_forever*60) }} (<abbr title="On Linux">L</abbr>) +
|
|
||||||
{{ tmsmp(g.playtime_windows_forever*60) }} (<abbr title="On Windows">W</abbr>) =
|
|
||||||
{{ tmsmp(g.playtime_forever*60) }} (<abbr title="Total">T</abbr>)
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
{% endfor %}
|
|
||||||
<p
|
|
||||||
x-data="rtime({{steam.caches.recent.last_updated}})"
|
|
||||||
x-text="`Last updated: ${timeString}`"
|
|
||||||
></p>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if steam.caches.owned.data.games %}
|
|
||||||
<h3>Top played games:</h3>
|
|
||||||
{% set owned_games = steam.caches.owned.data.games | sort(attribute="playtime_forever", reverse=true) %}
|
|
||||||
{% for g in owned_games[:5] %}
|
|
||||||
<a href="https://store.steampowered.com/app/{{ g.appid }}" class="block">
|
|
||||||
<picture>
|
|
||||||
<source media="(max-width: 45rem)" srcset="{{ g.v_cover }}">
|
|
||||||
<img src="{{ g.h_cover }}">
|
|
||||||
</picture>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<strong>{{ g.name }}</strong>
|
|
||||||
<p>
|
|
||||||
Total played:
|
|
||||||
{{ tmsmp(g.playtime_linux_forever*60) }} (<abbr title="On Linux">L</abbr>) +
|
|
||||||
{{ tmsmp(g.playtime_windows_forever*60) }} (<abbr title="On Windows">W</abbr>) =
|
|
||||||
{{ tmsmp(g.playtime_forever*60) }} (<abbr title="Total">T</abbr>)
|
|
||||||
</p>
|
|
||||||
{% if g.rtime_last_played != 0 %}
|
|
||||||
<p>Last played: {{ utmsmp(g.rtime_last_played) }}</p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
{% endfor %}
|
|
||||||
<p
|
|
||||||
x-data="rtime({{steam.caches.owned.last_updated}})"
|
|
||||||
x-text="`Last updated: ${timeString}`"
|
|
||||||
></p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
mixin game_block(g, show_last_played=false)
|
||||||
|
a.block(href="https://store.steampowered.com/app/#{g.appid}", target="_blank")
|
||||||
|
picture
|
||||||
|
source(media="(max-width: 45rem)", srcset=g.v_cover)
|
||||||
|
img(src=g.h_cover)
|
||||||
|
div
|
||||||
|
strong= g.name
|
||||||
|
if g.playtime_2weeks
|
||||||
|
p Played last 2 weeks: #{tmsmp(g.playtime_2weeks * 60)}
|
||||||
|
p
|
||||||
|
- var lin = g.playtime_linux_forever > 0;
|
||||||
|
- var win = g.playtime_windows_forever > 0;
|
||||||
|
| Total played:
|
||||||
|
if lin
|
||||||
|
= tmsmp(g.playtime_linux_forever * 60)
|
||||||
|
| (
|
||||||
|
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)}
|
||||||
|
|
||||||
|
.block.steam(
|
||||||
|
hx-get="/m/steam",
|
||||||
|
hx-trigger="every 1m",
|
||||||
|
hx-swap="outerHTML",
|
||||||
|
hx-headers='{ "If-None-Match": "#{steam.etag}" }'
|
||||||
|
)
|
||||||
|
h2
|
||||||
|
a(href="https://steamcommunity.com/id/risdeveau") Steam
|
||||||
|
|
||||||
|
if steam.caches.recent.data.games
|
||||||
|
h3 Recently played:
|
||||||
|
each g in steam.caches.recent.data.games
|
||||||
|
+game_block(g)
|
||||||
|
p(x-data="rtime(#{steam.caches.recent.last_updated})", x-text="`Last updated: ${timeString}`")
|
||||||
|
|
||||||
|
if steam.caches.owned.data.games
|
||||||
|
h3 Top played games:
|
||||||
|
- var owned_games = steam.caches.owned.data.games | sort(attribute="playtime_forever", reverse=true)
|
||||||
|
each g in owned_games[:5]
|
||||||
|
+game_block(g, true)
|
||||||
|
p(x-data="rtime(#{steam.caches.owned.last_updated})", x-text="`Last updated: ${timeString}`")
|
||||||
Reference in New Issue
Block a user