+ {% for message in messages %} ++ {% endif %} + {% endwith %} +{{ message }}
+ {% endfor %} +
Date | +Auteur | +Commentaire | +Article | +Actions | +
---|---|---|---|---|
{{ comment.created }} | +{{ comment.author_name }} | +{{ comment.content }} | +{{ comment.url }} | ++ + + | +
From 9b2c14e3a0476bf2cb1125d706e868cb978036a0 Mon Sep 17 00:00:00 2001 From: Yax <1949284+kianby@users.noreply.github.com> Date: Sun, 30 Jan 2022 18:56:52 +0100 Subject: [PATCH] draft web admin: no action, no security --- run.py | 18 +++---- stacosys/db/dao.py | 4 ++ stacosys/interface/__init__.py | 3 ++ stacosys/interface/templates/admin_fr.html | 61 ++++++++++++++++++++++ stacosys/interface/web/admin.py | 24 +++++++++ stacosys/interface/webadmin.py | 28 ---------- 6 files changed, 101 insertions(+), 37 deletions(-) create mode 100644 stacosys/interface/templates/admin_fr.html create mode 100644 stacosys/interface/web/admin.py delete mode 100644 stacosys/interface/webadmin.py diff --git a/run.py b/run.py index 520e9ac..3608da2 100644 --- a/run.py +++ b/run.py @@ -1,21 +1,21 @@ #!/usr/bin/python # -*- coding: UTF-8 -*- -import sys -import os import argparse -import logging import hashlib +import logging +import os +import sys from stacosys.conf.config import Config, ConfigParameter -from stacosys.db import database -from stacosys.core.rss import Rss from stacosys.core.mailer import Mailer -from stacosys.interface import app +from stacosys.core.rss import Rss +from stacosys.db import database from stacosys.interface import api +from stacosys.interface import app from stacosys.interface import form -from stacosys.interface import webadmin from stacosys.interface import scheduler +from stacosys.interface.web import admin # configure logging @@ -33,7 +33,6 @@ def configure_logging(level): def stacosys_server(config_pathname): - # configure logging logger = logging.getLogger(__name__) configure_logging(logging.INFO) @@ -107,7 +106,8 @@ def stacosys_server(config_pathname): # inject config parameters into flask app.config.update(SITE_REDIRECT=conf.get(ConfigParameter.SITE_REDIRECT)) - logger.info(f"start interfaces {api} {form} {webadmin}") + app.config.update(SITE_URL=conf.get(ConfigParameter.SITE_URL)) + logger.info(f"start interfaces {api} {form} {admin}") # start Flask app.run( diff --git a/stacosys/db/dao.py b/stacosys/db/dao.py index 0a14761..e24fec2 100644 --- a/stacosys/db/dao.py +++ b/stacosys/db/dao.py @@ -29,6 +29,10 @@ def find_not_notified_comments(): return Comment.select().where(Comment.notified.is_null()) +def find_not_published_comments(): + return Comment.select().where(Comment.published.is_null()) + + def find_published_comments_by_url(url): return Comment.select(Comment).where((Comment.url == url) & (Comment.published.is_null(False))).order_by( +Comment.published) diff --git a/stacosys/interface/__init__.py b/stacosys/interface/__init__.py index 1fab892..ee1c258 100644 --- a/stacosys/interface/__init__.py +++ b/stacosys/interface/__init__.py @@ -4,3 +4,6 @@ from flask import Flask app = Flask(__name__) + +# Set the secret key to some random bytes. Keep this really secret! +app.secret_key = b'_5#y2L"F4Q8z\n\xec]/' \ No newline at end of file diff --git a/stacosys/interface/templates/admin_fr.html b/stacosys/interface/templates/admin_fr.html new file mode 100644 index 0000000..ee77e35 --- /dev/null +++ b/stacosys/interface/templates/admin_fr.html @@ -0,0 +1,61 @@ + + +
+ + ++ {% for message in messages %} ++ {% endif %} + {% endwith %} +{{ message }}
+ {% endfor %} +
Date | +Auteur | +Commentaire | +Article | +Actions | +
---|---|---|---|---|
{{ comment.created }} | +{{ comment.author_name }} | +{{ comment.content }} | +{{ comment.url }} | ++ + + | +