forked from rDrama/rDrama
1
0
Fork 0
Aevann 2024-02-21 22:24:21 +02:00
parent 57bdf64d3a
commit c665e5cdd6
2 changed files with 8 additions and 1 deletions

View File

@ -1,6 +1,7 @@
import time
import math
import datetime
import random
from os import environ, listdir, path
@ -87,6 +88,12 @@ def selected_tab(request):
return 'home'
@app.template_filter("seeded_random")
def seeded_random(choices, url):
if url.startswith('/post/'):
random.seed(url)
return random.choice(choices)
def current_registered_users():
return "{:,}".format(g.db.query(User).count())

View File

@ -5,7 +5,7 @@
{%- endmacro -%}
{%- macro random_image(path) -%}
{{- SITE_FULL_IMAGES ~ "/" ~ path ~ "/" ~ listdir('files/' ~ path)|random() ~ '?x=7' -}}
{{- SITE_FULL_IMAGES ~ "/" ~ path ~ "/" ~ listdir('files/' ~ path)|seeded_random(request.path) ~ '?x=7' -}}
{%- endmacro -%}
{% macro post_meta(p) %}