diff --git a/src/web/templates/base.html b/src/web/templates/base.html new file mode 100644 index 0000000..0992170 --- /dev/null +++ b/src/web/templates/base.html @@ -0,0 +1,26 @@ + + + + {% block title %} {% endblock %} + + + +
+
+

Steamgifts Bot

+ +
+
+
+ {% block content %} {% endblock %} +
+ + \ No newline at end of file diff --git a/src/web/templates/configuration.html b/src/web/templates/configuration.html index 670abb9..0e9979f 100644 --- a/src/web/templates/configuration.html +++ b/src/web/templates/configuration.html @@ -1,26 +1,6 @@ - - - - {{name}} Steamgifts Bot Configuration - - - -
-
-

Steamgifts Bot

- -
-
-
-
{{content}}
-
- - \ No newline at end of file +{% extends 'base.html' %} + +{% block title %} {{name}} Steamgifts Bot Configuration {% endblock %} +{% block content %} +
{{data}}
+{% endblock %} \ No newline at end of file diff --git a/src/web/templates/giveaways.html b/src/web/templates/giveaways.html index d33163c..b3e5f64 100644 --- a/src/web/templates/giveaways.html +++ b/src/web/templates/giveaways.html @@ -1,35 +1,15 @@ - - - - {{name}} Steamgifts Bot DB View - - - -
-
-

Steamgifts Bot

- - - -
-
-
-
- - \ No newline at end of file +{% endblock %} \ No newline at end of file diff --git a/src/web/templates/log.html b/src/web/templates/log.html index 8a7408f..70960cf 100644 --- a/src/web/templates/log.html +++ b/src/web/templates/log.html @@ -1,26 +1,6 @@ - - - - {{name}} Steamgifts Bot {{log_type}} Logs - - - -
-
-

Steamgifts Bot

- -
-
-
-
{{content}}
-
- - \ No newline at end of file +{% extends 'base.html' %} + +{% block title %} {{name}} Steamgifts Bot {{log_type}} Logs{% endblock %} +{% block content %} +
{{data}}
+{% endblock %} \ No newline at end of file diff --git a/src/web/templates/notifications.html b/src/web/templates/notifications.html index b11fe88..6a9b518 100644 --- a/src/web/templates/notifications.html +++ b/src/web/templates/notifications.html @@ -1,28 +1,8 @@ - - - - {{name}} Steamgifts Bot DB View - - - -
-
-

Steamgifts Bot

- - - -
-
-
- +{% extends 'base.html' %} + +{% block title %} {{name}} Steamgifts Bot Notifications {% endblock %} +{% block content %} +
@@ -46,6 +26,4 @@ {% endfor %}
ID
-
- - \ No newline at end of file +{% endblock %} \ No newline at end of file diff --git a/src/web/webserver_thread.py b/src/web/webserver_thread.py index 9cf74b8..f517722 100644 --- a/src/web/webserver_thread.py +++ b/src/web/webserver_thread.py @@ -42,20 +42,20 @@ class WebServerThread(threading.Thread): @app.route(f"{self.app_root}") def config(): with open(f"{os.getenv('BOT_CONFIG_DIR', './config')}/config.ini", 'r') as f: - content = f.read() - return render_template('configuration.html', name=self.prefix, content=content) + data = f.read() + return render_template('configuration.html', name=self.prefix, data=data) @app.route(f"{self.app_root}log_info") def log_info(): with open(f"{os.getenv('BOT_CONFIG_DIR', './config')}/info.log", 'r') as f: - content = f.read() - return render_template('log.html', name=self.prefix, log_type='info', content=content) + data = f.read() + return render_template('log.html', name=self.prefix, log_type='info', data=data) @app.route(f"{self.app_root}log_debug") def log_debug(): with open(f"{os.getenv('BOT_CONFIG_DIR', './config')}/debug.log", 'r') as f: - content = f.read() - return render_template('log.html', name=self.prefix, log_type='debug', content=content) + data = f.read() + return render_template('log.html', name=self.prefix, log_type='debug', data=data) @app.route(f"{self.app_root}alive") def alive(): @@ -63,12 +63,12 @@ class WebServerThread(threading.Thread): @app.route(f"{self.app_root}notifications") def db_notifications(): - return render_template('notifications.html', name=self.prefix, content=NotificationHelper.get()) + return render_template('notifications.html', name=self.prefix, data=NotificationHelper.get()) @app.route(f"{self.app_root}giveaways", methods=['GET'], defaults={"page": 1}) @app.route(f"{self.app_root}giveaways/", methods=['GET']) def db_giveaways(page): - return render_template('giveaways.html', name=self.prefix, content=GiveawayHelper.paginate(page=page)) + return render_template('giveaways.html', name=self.prefix, data=GiveawayHelper.paginate(page=page)) if self.enabled: logger.info("Webserver Enabled. Running")