print local and remote app urls when app host is set to "0.0.0.0"

+ update app version in settings.py
This commit is contained in:
geoffrey45
2023-01-20 22:21:40 +03:00
parent 5dad45f188
commit 3dc9bc1f15
8 changed files with 790 additions and 650 deletions
+6
View File
@@ -20,6 +20,12 @@ CREATE TABLE IF NOT EXISTS favorites (
hash text not null,
type text not null
);
CREATE TABLE IF NOT EXISTS settings (
id integer PRIMARY KEY,
root_dirs text NOT NULL,
exclude_dirs text
)
"""
CREATE_APPDB_TABLES = """
+50
View File
@@ -0,0 +1,50 @@
import json
from app.db.sqlite.utils import SQLiteManager
class SettingsSQLMethods:
"""
Methods for interacting with the settings table.
"""
@staticmethod
def update_root_dirs(dirs: list[str]):
"""
Updates custom root directories in the database.
"""
sql = "UPDATE settings SET root_dirs = ?"
dirs_str = json.dumps(dirs)
with SQLiteManager(userdata_db=True) as cur:
cur.execute(sql, (dirs_str,))
@staticmethod
def get_root_dirs() -> list[str]:
"""
Gets custom root directories from the database.
"""
sql = "SELECT value FROM settings"
with SQLiteManager(userdata_db=True) as cur:
cur.execute(sql)
data = cur.fetchone()
if data is not None:
return json.loads(data[0])
return []
@staticmethod
def update_exclude_dirs(dirs: list[str]):
"""
Updates excluded directories in the database.
"""
sql = "UPDATE settings SET exclude_dirs = ?"
dirs_str = json.dumps(dirs)
with SQLiteManager(userdata_db=True) as cur:
cur.execute(sql, (dirs_str,))