diff --git a/MIND.py b/MIND.py
index c2db3e5..4f39517 100644
--- a/MIND.py
+++ b/MIND.py
@@ -17,7 +17,7 @@ from frontend.ui import ui
HOST = '0.0.0.0'
PORT = '8080'
-URL_PREFIX = '' # Must start with '/' e.g. '/mind'
+URL_PREFIX = '' # Must either be empty or start with '/' e.g. '/mind'
THREADS = 10
DB_FILENAME = 'db', 'MIND.db'
@@ -74,6 +74,7 @@ def MIND() -> None:
# Check python version
if (version_info.major < 3) or (version_info.major == 3 and version_info.minor < 7):
print('Error: the minimum python version required is python3.7 (currently ' + version_info.major + '.' + version_info.minor + '.' + version_info.micro + ')')
+ exit(1)
# Register web server
# We need to get the value to ui.py but MIND.py imports from ui.py so we get an import loop.
diff --git a/backend/db.py b/backend/db.py
index bc1f550..2294a47 100644
--- a/backend/db.py
+++ b/backend/db.py
@@ -8,7 +8,7 @@ from typing import Union
from flask import g
-__DATABASE_VERSION__ = 3
+__DATABASE_VERSION__ = 4
class Singleton(type):
_instances = {}
@@ -90,6 +90,15 @@ def migrate_db(current_db_version: int) -> None:
ADD color VARCHAR(7);
""")
current_db_version = 3
+
+ if current_db_version == 3:
+ # V3 -> V4
+ cursor.executescript("""
+ UPDATE reminders
+ SET repeat_quantity = repeat_quantity || 's'
+ WHERE repeat_quantity NOT LIKE '%s';
+ """)
+ current_db_version = 4
return
diff --git a/backend/reminders.py b/backend/reminders.py
index d07167a..84020aa 100644
--- a/backend/reminders.py
+++ b/backend/reminders.py
@@ -4,7 +4,6 @@ from datetime import datetime
from sqlite3 import IntegrityError
from threading import Thread
from time import sleep
-from time import time as epoch_time
from typing import List, Literal
from apprise import Apprise
@@ -24,7 +23,7 @@ filter_function = lambda query, p: (
def _find_next_time(
original_time: int,
- repeat_quantity: Literal["year", "month", "week", "day", "hours", "minutes"],
+ repeat_quantity: Literal["years", "months", "weeks", "days", "hours", "minutes"],
repeat_interval: int
) -> int:
td = relativedelta(**{repeat_quantity: repeat_interval})
@@ -176,7 +175,7 @@ class Reminder:
time: int = None,
notification_service: int = None,
text: str = None,
- repeat_quantity: Literal["year", "month", "week", "day", "hours", "minutes"] = None,
+ repeat_quantity: Literal["years", "months", "weeks", "days", "hours", "minutes"] = None,
repeat_interval: int = None,
color: str = None
) -> dict:
@@ -187,7 +186,7 @@ class Reminder:
time (int): The new UTC epoch timestamp the the reminder should be send. Defaults to None.
notification_service (int): The new id of the notification service to use to send the reminder. Defaults to None.
text (str, optional): The new body of the reminder. Defaults to None.
- repeat_quantity (Literal["year", "month", "week", "day", "hours", "minutes"], optional): The new quantity of the repeat specified for the reminder. Defaults to None.
+ repeat_quantity (Literal["years", "months", "weeks", "days", "hours", "minutes"], optional): The new quantity of the repeat specified for the reminder. Defaults to None.
repeat_interval (int, optional): The new amount of repeat_quantity, like "5" (hours). Defaults to None.
color (str, optional): The new hex code of the color of the reminder, which is shown in the web-ui. Defaults to None.
@@ -358,7 +357,7 @@ class Reminders:
time: int,
notification_service: int,
text: str = '',
- repeat_quantity: Literal["year", "month", "week", "day", "hours", "minutes"] = None,
+ repeat_quantity: Literal["years", "months", "weeks", "days", "hours", "minutes"] = None,
repeat_interval: int = None,
color: str = None
) -> Reminder:
@@ -369,7 +368,7 @@ class Reminders:
time (int): The UTC epoch timestamp the the reminder should be send.
notification_service (int): The id of the notification service to use to send the reminder.
text (str, optional): The body of the reminder. Defaults to ''.
- repeat_quantity (Literal["year", "month", "week", "day", "hours", "minutes"], optional): The quantity of the repeat specified for the reminder. Defaults to None.
+ repeat_quantity (Literal["years", "months", "weeks", "days", "hours", "minutes"], optional): The quantity of the repeat specified for the reminder. Defaults to None.
repeat_interval (int, optional): The amount of repeat_quantity, like "5" (hours). Defaults to None.
color (str, optional): The hex code of the color of the reminder, which is shown in the web-ui. Defaults to None.
diff --git a/frontend/api.py b/frontend/api.py
index 813e340..8bfb57e 100644
--- a/frontend/api.py
+++ b/frontend/api.py
@@ -99,7 +99,7 @@ def extract_key(values: dict, key: str, check_existence: bool=True) -> Any:
raise InvalidKeyValue(key, value)
elif key == 'repeat_quantity':
- if not value in ("year", "month", "week", "day", "hours", "minutes"):
+ if not value in ("years", "months", "weeks", "days", "hours", "minutes"):
raise InvalidKeyValue(key, value)
elif key in ('username', 'password', 'new_password', 'title', 'url',
@@ -414,7 +414,7 @@ def api_reminders_list():
time (required): the UTC epoch timestamp that the reminder should be sent at
notification_service (required): the id of the notification service to use to send the notification
text: the body of the reminder
- repeat_quantity ('year', 'month', 'week', 'day', 'hours', 'minutes'): The quantity of the repeat_interval
+ repeat_quantity ('years', 'months', 'weeks', 'days', 'hours', 'minutes'): The quantity of the repeat_interval
repeat_interval: The number of the interval
color: The hex code of the color of the reminder, which is shown in the web-ui
Returns:
@@ -527,7 +527,7 @@ def api_get_reminder(r_id: int):
time: The new UTC epoch timestamp the the reminder should be send.
notification_service: The new id of the notification service to use to send the reminder.
text: The new body of the reminder.
- repeat_quantity ('year', 'month', 'week', 'day', 'hours', 'minutes'): The new quantity of the repeat_interval.
+ repeat_quantity ('years', 'months', 'weeks', 'days', 'hours', 'minutes'): The new quantity of the repeat_interval.
repeat_interval: The new number of the interval.
color: The new hex code of the color of the reminder, which is shown in the web-ui.
Returns:
diff --git a/frontend/static/js/general.js b/frontend/static/js/general.js
index 244724e..83a7142 100644
--- a/frontend/static/js/general.js
+++ b/frontend/static/js/general.js
@@ -4,7 +4,7 @@ function logout() {
})
.then(response => {
sessionStorage.removeItem('api_key');
- window.location.href = url_prefix;
+ window.location.href = url_prefix || '/';
});
};
diff --git a/frontend/templates/reminders.html b/frontend/templates/reminders.html
index ea5f499..1f6badd 100644
--- a/frontend/templates/reminders.html
+++ b/frontend/templates/reminders.html
@@ -174,10 +174,10 @@
@@ -227,10 +227,10 @@