Compare commits
3 Commits
05cbc03e82
...
19bf98f5b5
Author | SHA1 | Date | |
---|---|---|---|
19bf98f5b5 | |||
a95200caf9 | |||
ea5ecc3a9f |
@ -7,6 +7,7 @@ from .constants import (
|
||||
PermissionLevel,
|
||||
InfoboxKind, InfoboxIcons, InfoboxHTMLClass
|
||||
)
|
||||
from datetime import datetime
|
||||
import os
|
||||
import time
|
||||
import secrets
|
||||
@ -74,6 +75,11 @@ def create_app():
|
||||
app.register_blueprint(topics_bp)
|
||||
app.register_blueprint(users_bp)
|
||||
|
||||
app.config['SESSION_COOKIE_SECURE'] = True
|
||||
|
||||
@app.before_request
|
||||
def make_session_permanent():
|
||||
session.permanent = True
|
||||
|
||||
@app.context_processor
|
||||
def inject_constants():
|
||||
@ -87,4 +93,8 @@ def create_app():
|
||||
def inject_auth():
|
||||
return {"is_logged_in": is_logged_in, "get_active_user": get_active_user, "active_user": get_active_user()}
|
||||
|
||||
@app.template_filter("ts_datetime")
|
||||
def ts_datetime(ts, format):
|
||||
return datetime.utcfromtimestamp(ts).strftime(format)
|
||||
|
||||
return app
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% from 'common/infobox.html' import infobox with context %}
|
||||
{% from 'common/macros.html' import infobox with context %}
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@ -25,4 +25,5 @@
|
||||
</footer>
|
||||
<script src="/static/js/copy-code.js"></script>
|
||||
<script src="/static/js/ui.js"></script>
|
||||
<script src="/static/js/date-fmt.js"></script>
|
||||
</body>
|
||||
|
@ -1,10 +0,0 @@
|
||||
{% macro infobox(message, kind=InfoboxKind.INFO) %}
|
||||
<div class="{{ "infobox " + InfoboxHTMLClass[kind] }}">
|
||||
<span>
|
||||
<div class="infobox-icon-container">
|
||||
<img src="{{ InfoboxIcons[kind] }}">
|
||||
</div>
|
||||
{{ message }}
|
||||
</span>
|
||||
</div>
|
||||
{% endmacro %}
|
@ -27,3 +27,18 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro infobox(message, kind=InfoboxKind.INFO) %}
|
||||
<div class="{{ "infobox " + InfoboxHTMLClass[kind] }}">
|
||||
<span>
|
||||
<div class="infobox-icon-container">
|
||||
<img src="{{ InfoboxIcons[kind] }}">
|
||||
</div>
|
||||
{{ message }}
|
||||
</span>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro timestamp(unix_ts) %}
|
||||
<span class="timestamp" data-utc="{{ unix_ts }}">{{ unix_ts | ts_datetime('%Y-%m-%d %H:%M')}} ST</span>
|
||||
{% endmacro %}
|
@ -1,4 +1,4 @@
|
||||
{% from 'common/pager.html' import pager %}
|
||||
{% from 'common/macros.html' import pager, timestamp %}
|
||||
{% extends "base.html" %}
|
||||
{% block title %}browsing topic {{ topic['name'] }}{% endblock %}
|
||||
{% block content %}
|
||||
@ -30,11 +30,11 @@
|
||||
<span>
|
||||
<span class="thread-title"><a href="{{ url_for("threads.thread", slug=thread['slug']) }}">{{thread['title']}}</a></span>
|
||||
•
|
||||
Started by <a href="{{ url_for("users.page", username=thread['started_by']) }}">{{ thread['started_by'] }}</a> on ...
|
||||
Started by <a href="{{ url_for("users.page", username=thread['started_by']) }}">{{ thread['started_by'] }}</a> on {{ timestamp(thread['created_at'])}}
|
||||
</span>
|
||||
<span>
|
||||
Latest post by <a href="{{ url_for("users.page", username=thread['latest_post_username']) }}">{{ thread['latest_post_username'] }}</a>
|
||||
on ...
|
||||
on <a href="{{ url_for("threads.thread", slug=thread['slug']) }}">on {{ timestamp(thread['latest_post_created_at'] )}}</a>:
|
||||
</span>
|
||||
<span class="thread-info-post-preview">
|
||||
{{ thread['latest_post_content'] }}
|
||||
|
@ -1,3 +1,4 @@
|
||||
{% from 'common/macros.html' import timestamp %}
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}{{ target_user.username }}'s profile{% endblock %}
|
||||
{% block content %}
|
||||
@ -17,9 +18,9 @@
|
||||
{% if active_user and active_user.is_mod() and not target_user.is_system() %}
|
||||
<h1 class="thread-title">Moderation controls</h1>
|
||||
{% if target_user.is_guest() %}
|
||||
<p>This user is a guest. They signed up on ... </p>
|
||||
<p>This user is a guest. They signed up on {{ timestamp(target_user['created_at']) }}</p>
|
||||
{% else %}
|
||||
<p>This user signed up on ... and was confirmed on ...</p>
|
||||
<p>This user signed up on {{ timestamp(target_user['created_at']) }} and was confirmed on {{ timestamp(target_user['confirmed_on']) }}</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user