diff --git a/backend/internals/db_migration.py b/backend/internals/db_migration.py
index beb6c56..d53a1b9 100644
--- a/backend/internals/db_migration.py
+++ b/backend/internals/db_migration.py
@@ -298,15 +298,8 @@ class MigrateUpdateManifest(DBMigrator):
def run(self) -> None:
# V9 -> V10
-
- # Nothing is changed in the database
- # It's just that this code needs to run once
- # and the DB migration system does exactly that:
- # run pieces of code once.
- from backend.internals.settings import Settings, update_manifest
-
- update_manifest(
- Settings().get_settings().url_prefix
- )
-
+ # There used to be a migration here that fixed the manifest file.
+ # That has since been replaced by the dynamic endpoint serving the JSON.
+ # So the migration doesn't do anything anymore, and a function used
+ # doesn't exist anymore, so the whole migration is just removed.
return
diff --git a/backend/internals/settings.py b/backend/internals/settings.py
index 3e18c79..e27b8a4 100644
--- a/backend/internals/settings.py
+++ b/backend/internals/settings.py
@@ -139,15 +139,13 @@ class Settings(metaclass=Singleton):
reversed_tuples(formatted_data.items())
)
- for key, handler in (
- ('url_prefix', update_manifest),
- ('log_level', set_log_level)
+ if (
+ 'log_level' in data
+ and formatted_data['log_level'] != getattr(
+ self.get_settings(), 'log_level'
+ )
):
- if (
- key in data
- and formatted_data[key] != getattr(self.get_settings(), key)
- ):
- handler(formatted_data[key])
+ set_log_level(formatted_data['log_level'])
self._fetch_settings()
@@ -232,24 +230,3 @@ class Settings(metaclass=Singleton):
raise InvalidKeyValue(key, value)
return converted_value
-
-
-def update_manifest(url_base: str) -> None:
- """Update the url's in the manifest file.
- Needs to happen when url base changes.
-
- Args:
- url_base (str): The url base to use in the file.
- """
- filename = folder_path('frontend', 'static', 'json', 'pwa_manifest.json')
-
- with open(filename, 'r') as f:
- manifest = load(f)
- manifest['start_url'] = url_base + '/'
- manifest['scope'] = url_base + '/'
- manifest['icons'][0]['src'] = f'{url_base}/static/img/favicon.svg'
-
- with open(filename, 'w') as f:
- dump(manifest, f, indent=4)
-
- return
diff --git a/frontend/input_validation.py b/frontend/input_validation.py
index 7f573f0..4a5ea9b 100644
--- a/frontend/input_validation.py
+++ b/frontend/input_validation.py
@@ -385,6 +385,11 @@ class UrlPrefixVariable(NonRequiredInputVariable):
name = "url_prefix"
description = "The base URL to run on. Useful for reverse proxies. Empty string to disable."
+ def validate(self) -> bool:
+ return self.value is None or (
+ isinstance(self.value, str)
+ )
+
class LogLevelVariable(NonRequiredInputVariable):
name = "log_level"
diff --git a/frontend/static/json/pwa_manifest.json b/frontend/static/json/pwa_manifest.json
deleted file mode 100644
index 32919ca..0000000
--- a/frontend/static/json/pwa_manifest.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name": "MIND",
- "short_name": "MIND",
- "start_url": "/",
- "scope": "/",
- "display": "standalone",
- "background_color": "#1b1b1b",
- "theme_color": "#6b6b6b",
- "orientation": "portrait-primary",
- "icons": [
- {
- "src": "/static/img/favicon.svg",
- "type": "image/svg+xml",
- "sizes": "64x64 32x32 24x24 16x16"
- }
- ]
-}
\ No newline at end of file
diff --git a/frontend/templates/admin.html b/frontend/templates/admin.html
index d9dd3ec..98d769a 100644
--- a/frontend/templates/admin.html
+++ b/frontend/templates/admin.html
@@ -5,7 +5,7 @@
-
+
diff --git a/frontend/templates/login.html b/frontend/templates/login.html
index 7286228..b462b4f 100644
--- a/frontend/templates/login.html
+++ b/frontend/templates/login.html
@@ -6,7 +6,7 @@
-
+
diff --git a/frontend/templates/reminders.html b/frontend/templates/reminders.html
index 5c75db8..21cec88 100644
--- a/frontend/templates/reminders.html
+++ b/frontend/templates/reminders.html
@@ -6,7 +6,7 @@
-
+
diff --git a/frontend/ui.py b/frontend/ui.py
index 3e90d14..6c0f150 100644
--- a/frontend/ui.py
+++ b/frontend/ui.py
@@ -20,6 +20,41 @@ def ui_not_found(e):
return render('page_not_found.html')
+@ui.route('/manifest.json', methods=methods)
+def ui_manifest():
+ from io import BytesIO
+ from json import dumps
+
+ from flask import send_file
+
+ return send_file(
+ BytesIO(dumps(
+ {
+ "name": "MIND",
+ "short_name": "MIND",
+ "description": "MIND is a simple self hosted reminder application that can send push notifications to your device. Set the reminder and forget about it!",
+ "display": "standalone",
+ "orientation": "portrait-primary",
+ "start_url": f"{SERVER.url_prefix}/",
+ "scope": f"{SERVER.url_prefix}/",
+ "id": f"{SERVER.url_prefix}/",
+ "background_color": "#1b1b1b",
+ "theme_color": "#6b6b6b",
+ "icons": [
+ {
+ "src": f"{SERVER.url_prefix}/static/img/favicon.svg",
+ "type": "image/svg+xml",
+ "sizes": "any"
+ }
+ ]
+ },
+ indent=4
+ ).encode('utf-8')),
+ mimetype="application/manifest+json",
+ download_name="manifest.json"
+ ), 200
+
+
@ui.route('/', methods=methods)
def ui_login():
return render('login.html')