diff --git a/manyfold/cli/manyfold.sh b/manyfold/cli/manyfold.sh index ea2460d..283ae88 100755 --- a/manyfold/cli/manyfold.sh +++ b/manyfold/cli/manyfold.sh @@ -56,18 +56,20 @@ db(){ "$@" } +add_lib_to_db(){ + debug sqlite3 $db "INSERT INTO libraries SELECT NULL, '/mnt/$1', DATE('NOW'), DATE('NOW'), '', '', '$1', NULL, '', 'filesystem', '', '', '', '', '', '$1', 1 WHERE NOT EXISTS (SELECT 1 FROM libraries WHERE path = '/mnt/$1');" +} + set_upload_path(){ echocolor "[$APPNAME]" "configuring upload library" test -d $UPLOAD_PATH || mkdir $UPLOAD_PATH - #debug sqlite3 $db "UPDATE settings set value = default_library libraries SELECT NULL, '/mnt/$1', DATE('NOW'), DATE('NOW'), '', '', '$dir', NULL, '', 'filesystem', '', '', '', '', '', '$1', 1 WHERE NOT EXISTS (SELECT 1 FROM libraries WHERE path = '/mnt/$1');" + add_lib_to_db $(basename $UPLOAD_PATH) + id=$(sqlite3 $db "select id from libraries where path = '$UPLOAD_PATH';") + debug sqlite3 $db "UPDATE settings set value = $id where var = 'default_library';" } rclone_mount(){ - add_lib_to_db(){ - debug sqlite3 $db "INSERT INTO libraries SELECT NULL, '/mnt/$1', DATE('NOW'), DATE('NOW'), '', '', '$dir', NULL, '', 'filesystem', '', '', '', '', '', '$1', 1 WHERE NOT EXISTS (SELECT 1 FROM libraries WHERE path = '/mnt/$1');" - } - libraries(){ rclone listremotes | while read remote; do dir="${remote/:/}" diff --git a/manyfold/manyfold.sql b/manyfold/manyfold.sql index 7c9f3a8..ef017df 100644 --- a/manyfold/manyfold.sql +++ b/manyfold/manyfold.sql @@ -148,7 +148,7 @@ CREATE TABLE IF NOT EXISTS "links" ("id" integer PRIMARY KEY AUTOINCREMENT NOT N CREATE TABLE IF NOT EXISTS "settings" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "var" varchar NOT NULL, "value" text, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL); INSERT INTO settings VALUES(1,'default_library',replace('--- 2\n','\n',char(10)),'2025-07-25 10:58:00.004576','2025-07-28 13:30:03.381376'); INSERT INTO settings VALUES(2,'site_name',replace('--- XRForge\n','\n',char(10)),'2025-07-25 10:59:04.496016','2025-07-25 10:59:04.496016'); -INSERT INTO settings VALUES(3,'site_tagline',replace('--- Selfsovereign XR Experiences based on 3D files & URLs\n','\n',char(10)),'2025-07-25 10:59:04.519264','2025-07-25 10:59:04.519264'); +INSERT INTO settings VALUES(3,'site_tagline',replace('--- Self-sovereign XR Experiences based on 3D files & URLs\n','\n',char(10)),'2025-07-25 10:59:04.519264','2025-07-25 10:59:04.519264'); INSERT INTO settings VALUES(4,'theme','vapor','2025-07-25 10:59:04.522670','2025-07-28 13:47:54.690364'); INSERT INTO settings VALUES(5,'about',replace('--- ''''\n','\n',char(10)),'2025-07-25 10:59:04.527612','2025-07-25 10:59:04.527612'); INSERT INTO settings VALUES(6,'rules',replace('--- ''''\n','\n',char(10)),'2025-07-25 10:59:04.531378','2025-07-25 10:59:04.531378');