Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f7558e76c | ||
|
|
8c1ffdcdfe | ||
|
|
b78e4185d1 | ||
|
|
bf05be13ea | ||
|
|
b030991905 |
No files matched your search
@@ -15,6 +15,7 @@ WORKDIR /app
|
|||||||
COPY . .
|
COPY . .
|
||||||
COPY --from=sass /build/blueprints/ ./blueprints/
|
COPY --from=sass /build/blueprints/ ./blueprints/
|
||||||
|
|
||||||
|
RUN apt install libmagic1
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
ENV FLASK_ENV=production
|
ENV FLASK_ENV=production
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import magic
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from htmlmin import minify
|
from htmlmin import minify
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
@@ -53,7 +54,8 @@ def static(filename: str):
|
|||||||
|
|
||||||
@bp.route("/asset/mb/<mbid>")
|
@bp.route("/asset/mb/<mbid>")
|
||||||
def mb_cover(mbid):
|
def mb_cover(mbid):
|
||||||
r = make_response(get_image_front(mbid, "250"))
|
r = make_response(image := get_image_front(mbid, "250"))
|
||||||
|
r.headers['Content-Type'] = magic.from_buffer(image[:2048], mime=True)
|
||||||
r.headers['Cache-Control'] = 'public, max-age=86400'
|
r.headers['Cache-Control'] = 'public, max-age=86400'
|
||||||
r.headers['Expires'] = (datetime.now() + timedelta(days=1)) \
|
r.headers['Expires'] = (datetime.now() + timedelta(days=1)) \
|
||||||
.strftime('%a, %d %b %Y %H:%M:%S GMT')
|
.strftime('%a, %d %b %Y %H:%M:%S GMT')
|
||||||
@@ -61,8 +63,6 @@ def mb_cover(mbid):
|
|||||||
|
|
||||||
@bp.route("/")
|
@bp.route("/")
|
||||||
def index():
|
def index():
|
||||||
print(recent)
|
|
||||||
|
|
||||||
return render_tmpl(
|
return render_tmpl(
|
||||||
'index.html',
|
'index.html',
|
||||||
lb=listens,
|
lb=listens,
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ def get_cover_url(appid: int) -> str:
|
|||||||
def inject_cover_url(json: dict) -> dict:
|
def inject_cover_url(json: dict) -> dict:
|
||||||
if 'games' in json.keys():
|
if 'games' in json.keys():
|
||||||
for i, g in enumerate(json['games']):
|
for i, g in enumerate(json['games']):
|
||||||
json['games'][i]['img_icon_url'] = get_cover_url(g['appid'])
|
json['games'][i]['h_cover'] = f"https://shared.fastly.steamstatic.com/store_item_assets//steam/apps/{g['appid']}/header.jpg"
|
||||||
|
json['games'][i]['v_cover'] = f"https://shared.fastly.steamstatic.com/store_item_assets//steam/apps/{g['appid']}/library_600x900.jpg"
|
||||||
return json
|
return json
|
||||||
|
|
||||||
def steam_request(interface: str, method: str, v: int = 1, **kwargs) -> requests.Response:
|
def steam_request(interface: str, method: str, v: int = 1, **kwargs) -> requests.Response:
|
||||||
@@ -59,7 +60,4 @@ scheduler.add_job(
|
|||||||
)
|
)
|
||||||
scheduler.start()
|
scheduler.start()
|
||||||
|
|
||||||
api_request(recent, "IPlayerService", "GetRecentlyPlayedGames", steamid=76561198826355942)
|
|
||||||
api_request(owned, "IPlayerService", "GetOwnedGames", steamid=76561198826355942, include_appinfo=1, include_played_free_games=1)
|
|
||||||
|
|
||||||
atexit.register(lambda: scheduler.shutdown())
|
atexit.register(lambda: scheduler.shutdown())
|
||||||
@@ -51,16 +51,13 @@ h3 {
|
|||||||
.steam {
|
.steam {
|
||||||
.block {
|
.block {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: stretch;
|
|
||||||
|
|
||||||
img {
|
img {
|
||||||
height: 6rem;
|
height: 7rem;
|
||||||
flex: 0 0 auto;
|
|
||||||
margin-right: .5rem;
|
margin-right: .5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
flex: 1;
|
|
||||||
margin: .5rem 0;
|
margin: .5rem 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
<div class="block steam">
|
<div class="block steam">
|
||||||
<h2><a href="https://steamcommunity.com/id/risdeveau">Steam</a></h2>
|
<h2><a href="https://steamcommunity.com/id/risdeveau">Steam</a></h2>
|
||||||
|
|
||||||
|
{% if recent.games %}
|
||||||
<h3>Recently played:</h3>
|
<h3>Recently played:</h3>
|
||||||
{% for g in recent.games %}
|
{% for g in recent.games %}
|
||||||
<a href="https://store.steampowered.com/app/{{ g.appid }}" class="block">
|
<a href="https://store.steampowered.com/app/{{ g.appid }}" class="block">
|
||||||
<img src="{{ g.img_icon_url }}"/>
|
<picture>
|
||||||
|
<source media="(max-width: 45rem)" srcset="{{ g.v_cover }}">
|
||||||
|
<img src="{{ g.h_cover }}">
|
||||||
|
</picture>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<strong>{{ g.name }}</strong>
|
<strong>{{ g.name }}</strong>
|
||||||
@@ -18,18 +22,20 @@
|
|||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if owned.games %}
|
||||||
<h3>Top played games:</h3>
|
<h3>Top played games:</h3>
|
||||||
{% set owned_games = owned.games | sort(attribute="playtime_forever", reverse=true) %}
|
{% set owned_games = owned.games | sort(attribute="playtime_forever", reverse=true) %}
|
||||||
{% for g in owned_games[:5] %}
|
{% for g in owned_games[:5] %}
|
||||||
<a href="https://store.steampowered.com/app/{{ g.appid }}" class="block">
|
<a href="https://store.steampowered.com/app/{{ g.appid }}" class="block">
|
||||||
<img src="{{ g.img_icon_url }}"/>
|
<picture>
|
||||||
|
<source media="(max-width: 45rem)" srcset="{{ g.v_cover }}">
|
||||||
|
<img src="{{ g.h_cover }}">
|
||||||
|
</picture>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<strong>{{ g.name }}</strong>
|
<strong>{{ g.name }}</strong>
|
||||||
{% if g.playtime_2weeks %}
|
|
||||||
<p>Played last 2 weeks: {{ tmsmp(g.playtime_2weeks) }}
|
|
||||||
{% endif %}
|
|
||||||
<p>
|
<p>
|
||||||
Total played:
|
Total played:
|
||||||
{{ tmsmp(g.playtime_linux_forever) }} (<abbr title="On Linux">L</abbr>) +
|
{{ tmsmp(g.playtime_linux_forever) }} (<abbr title="On Linux">L</abbr>) +
|
||||||
@@ -42,4 +48,5 @@
|
|||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
@@ -8,6 +8,8 @@ about host = About host
|
|||||||
contacts = Contacts
|
contacts = Contacts
|
||||||
donate = Donate
|
donate = Donate
|
||||||
|
|
||||||
|
description = Small personal site
|
||||||
|
|
||||||
|
|
||||||
[index]
|
[index]
|
||||||
altfronts = Altfronts
|
altfronts = Altfronts
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ about host = О хосте
|
|||||||
contacts = Контакты
|
contacts = Контакты
|
||||||
donate = Донат
|
donate = Донат
|
||||||
|
|
||||||
|
description = Небольшой личный сайт
|
||||||
|
|
||||||
|
|
||||||
[index]
|
[index]
|
||||||
altfronts = Альтфронты
|
altfronts = Альтфронты
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ htmlmin2
|
|||||||
requests
|
requests
|
||||||
APScheduler
|
APScheduler
|
||||||
musicbrainzngs
|
musicbrainzngs
|
||||||
|
python-magic
|
||||||
Reference in new issue
Block a user