forked from rDrama/rDrama
parent
57bdf64d3a
commit
c665e5cdd6
|
@ -1,6 +1,7 @@
|
||||||
import time
|
import time
|
||||||
import math
|
import math
|
||||||
import datetime
|
import datetime
|
||||||
|
import random
|
||||||
|
|
||||||
from os import environ, listdir, path
|
from os import environ, listdir, path
|
||||||
|
|
||||||
|
@ -87,6 +88,12 @@ def selected_tab(request):
|
||||||
|
|
||||||
return 'home'
|
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():
|
def current_registered_users():
|
||||||
return "{:,}".format(g.db.query(User).count())
|
return "{:,}".format(g.db.query(User).count())
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
||||||
|
|
||||||
{%- macro random_image(path) -%}
|
{%- 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 -%}
|
{%- endmacro -%}
|
||||||
|
|
||||||
{% macro post_meta(p) %}
|
{% macro post_meta(p) %}
|
||||||
|
|
Loading…
Reference in New Issue