Development
This commit is contained in:
parent
44261e5b5c
commit
8a8e947fcf
9 changed files with 289 additions and 33 deletions
|
|
@ -9,7 +9,7 @@ APP_DIR = _os.path.dirname(_os.path.abspath(__file__))
|
|||
CONFIGS_DIR = _settings.routlin_location()
|
||||
DATA_DIR = '/data'
|
||||
WWW_DIR = '/www'
|
||||
ACCOUNTS_DB = f'{DATA_DIR}/.dashboard-accounts'
|
||||
ACCOUNTS_DB = f'{DATA_DIR}/.dashboard-singleaccount' if _settings.is_single_user() else f'{DATA_DIR}/.dashboard-accounts'
|
||||
CONFIG_FILE = f'{CONFIGS_DIR}/config.json'
|
||||
DASHBOARD_QUEUE = f'{CONFIGS_DIR}/.dashboard-queue'
|
||||
DASHBOARD_DONE = f'{CONFIGS_DIR}/.dashboard-done'
|
||||
|
|
@ -81,6 +81,23 @@ def init_accounts_db():
|
|||
pass
|
||||
con.close()
|
||||
|
||||
def init_single_user_session_db():
|
||||
con = _sqlite3.connect(ACCOUNTS_DB, timeout=5)
|
||||
con.execute('PRAGMA journal_mode=WAL')
|
||||
con.executescript('''
|
||||
CREATE TABLE IF NOT EXISTS sessions (
|
||||
session_id TEXT PRIMARY KEY,
|
||||
logged_in INTEGER NOT NULL DEFAULT 0,
|
||||
timezone TEXT NOT NULL DEFAULT '',
|
||||
preferences_json TEXT NOT NULL DEFAULT '{}',
|
||||
flashes_json TEXT,
|
||||
session_started_ts INTEGER NOT NULL,
|
||||
last_seen_ts INTEGER NOT NULL
|
||||
);
|
||||
''')
|
||||
con.commit()
|
||||
con.close()
|
||||
|
||||
_LEVEL_INT_TO_STR = {0: 'nothing', 1: 'viewer', 2: 'administrator', 3: 'manager'}
|
||||
_LEVEL_STR_TO_INT = {'nothing': 0, 'viewer': 1, 'administrator': 2, 'manager': 3}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue