From 0699dbef3180ded4223c3e727eae77dade640a82 Mon Sep 17 00:00:00 2001 From: Martin Drechsel Date: Mon, 19 May 2025 12:29:37 +0200 Subject: [PATCH] added settings page, cleanup --- nuxt.config.ts | 4 +- src-tauri/capabilities/default.json | 1 + .../migrations/0002_married_bushwacker.sql | 4 + .../migrations/meta/0002_snapshot.json | 180 ++++++++++++++++++ .../database/migrations/meta/_journal.json | 7 + src-tauri/database/schemas/vault.ts | 14 +- src-tauri/database/vault.db | Bin 49152 -> 49152 bytes src-tauri/src/lib.rs | 1 - src-tauri/tauri.conf.json | 4 +- src/app.vue | 4 +- src/components/haex/browser/index.vue | 101 +++++----- src/components/haex/browser/tabBar.vue | 27 ++- src/components/haex/browser/urlBar.vue | 42 ++-- src/components/haex/menu/main.vue | 59 ++++++ src/components/ui/dropdown/index.vue | 54 ++++++ src/components/ui/dropdown/locale.vue | 33 ++++ src/components/ui/dropdown/theme.vue | 26 +++ src/components/ui/input/index.vue | 175 ++++++----------- src/components/ui/input/password.vue | 22 ++- src/components/vault/button/create.vue | 119 +++++++----- .../vault/dialog/host/firstTime.vue | 1 + src/layouts/app.vue | 131 ++++--------- src/pages/index.vue | 94 ++++----- src/pages/vault.vue | 6 +- .../[vaultId]/extensions/[extensionId].vue | 52 +++-- src/pages/vault/[vaultId]/index.vue | 12 +- src/pages/vault/[vaultId]/settings.vue | 77 ++++++++ src/stores/browser/extensions.ts | 3 +- src/stores/extensions/index.ts | 12 +- src/stores/ui/de.json | 3 +- src/stores/ui/en.json | 3 +- src/stores/ui/index.ts | 18 +- src/stores/ui/sidebar.ts | 7 - src/stores/vault/index.ts | 98 +++++++++- tailwind.config.ts.old | 148 -------------- 35 files changed, 889 insertions(+), 653 deletions(-) create mode 100644 src-tauri/database/migrations/0002_married_bushwacker.sql create mode 100644 src-tauri/database/migrations/meta/0002_snapshot.json create mode 100644 src/components/haex/menu/main.vue create mode 100644 src/components/ui/dropdown/index.vue create mode 100644 src/components/ui/dropdown/locale.vue create mode 100644 src/components/ui/dropdown/theme.vue create mode 100644 src/components/vault/dialog/host/firstTime.vue create mode 100644 src/pages/vault/[vaultId]/settings.vue delete mode 100644 tailwind.config.ts.old diff --git a/nuxt.config.ts b/nuxt.config.ts index 1587788..0f711f6 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -22,11 +22,11 @@ export default defineNuxtConfig({ provider: 'server', mode: "svg", clientBundle: { - icons: ["solar:global-outline", "gg:extension"], + icons: ["solar:global-outline", "gg:extension", "hugeicons:corporate"], scan: true, includeCustomCollections: true, }, - serverBundle: { collections: ["mdi", "line-md", "solar", "gg"] } + serverBundle: { collections: ["mdi", "line-md", "solar", "gg", "emojione"] } //collections: ["mdi", "line-md"] }, diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index d8d46f4..ea33923 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -25,6 +25,7 @@ "opener:allow-open-url", "opener:default", "os:default", + "os:allow-hostname", "store:default" ] } diff --git a/src-tauri/database/migrations/0002_married_bushwacker.sql b/src-tauri/database/migrations/0002_married_bushwacker.sql new file mode 100644 index 0000000..4fa851e --- /dev/null +++ b/src-tauri/database/migrations/0002_married_bushwacker.sql @@ -0,0 +1,4 @@ +ALTER TABLE `haex_settings` RENAME COLUMN "value_text" TO "value";--> statement-breakpoint +DROP TABLE `testTable`;--> statement-breakpoint +ALTER TABLE `haex_settings` DROP COLUMN `value_json`;--> statement-breakpoint +ALTER TABLE `haex_settings` DROP COLUMN `value_number`; \ No newline at end of file diff --git a/src-tauri/database/migrations/meta/0002_snapshot.json b/src-tauri/database/migrations/meta/0002_snapshot.json new file mode 100644 index 0000000..e8dc4a8 --- /dev/null +++ b/src-tauri/database/migrations/meta/0002_snapshot.json @@ -0,0 +1,180 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "ea3507ca-77bc-4f3c-a605-8426614f5803", + "prevId": "6fb5396b-9f87-4fb5-87a2-22d4eecaa11e", + "tables": { + "haex_extensions": { + "name": "haex_extensions", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "author": { + "name": "author", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "enabled": { + "name": "enabled", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "haex_extensions_permissions": { + "name": "haex_extensions_permissions", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "extension_id": { + "name": "extension_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "resource": { + "name": "resource", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "operation": { + "name": "operation", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "haex_extensions_permissions_extension_id_resource_operation_path_unique": { + "name": "haex_extensions_permissions_extension_id_resource_operation_path_unique", + "columns": [ + "extension_id", + "resource", + "operation", + "path" + ], + "isUnique": true + } + }, + "foreignKeys": { + "haex_extensions_permissions_extension_id_haex_extensions_id_fk": { + "name": "haex_extensions_permissions_extension_id_haex_extensions_id_fk", + "tableFrom": "haex_extensions_permissions", + "tableTo": "haex_extensions", + "columnsFrom": [ + "extension_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "haex_settings": { + "name": "haex_settings", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": { + "\"haex_settings\".\"value_text\"": "\"haex_settings\".\"value\"" + } + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/src-tauri/database/migrations/meta/_journal.json b/src-tauri/database/migrations/meta/_journal.json index 734f0be..6e34ff1 100644 --- a/src-tauri/database/migrations/meta/_journal.json +++ b/src-tauri/database/migrations/meta/_journal.json @@ -15,6 +15,13 @@ "when": 1746281577722, "tag": "0001_wealthy_thaddeus_ross", "breakpoints": true + }, + { + "idx": 2, + "version": "6", + "when": 1747583956679, + "tag": "0002_married_bushwacker", + "breakpoints": true } ] } \ No newline at end of file diff --git a/src-tauri/database/schemas/vault.ts b/src-tauri/database/schemas/vault.ts index 55cbc55..5ed2639 100644 --- a/src-tauri/database/schemas/vault.ts +++ b/src-tauri/database/schemas/vault.ts @@ -1,18 +1,15 @@ import { integer, - numeric, sqliteTable, text, - type AnySQLiteColumn, unique, + type AnySQLiteColumn } from "drizzle-orm/sqlite-core"; export const haexSettings = sqliteTable("haex_settings", { id: text().primaryKey(), key: text(), - value_text: text(), - value_json: text({ mode: "json" }), - value_number: numeric(), + value: text(), }); export const haexExtensions = sqliteTable("haex_extensions", { @@ -25,18 +22,13 @@ export const haexExtensions = sqliteTable("haex_extensions", { version: text(), }); -export const testTable = sqliteTable("testTable", { - id: text().primaryKey(), - author: text(), - test: text(), -}); export const haexExtensionsPermissions = sqliteTable( "haex_extensions_permissions", { id: text().primaryKey(), extensionId: text("extension_id").references((): AnySQLiteColumn => haexExtensions.id), - resource: text({ enum: ["fs", "http", "database"] }), + resource: text({ enum: ["fs", "http", "db", "shell"] }), operation: text({ enum: ["read", "write", "create"] }), path: text(), }, diff --git a/src-tauri/database/vault.db b/src-tauri/database/vault.db index e9ea78905550cb6edbb3f0fbcc8aa333a3cae097..7dfe673ceed71ebe569fbfc12aef6cf108fedc1c 100644 GIT binary patch delta 288 zcmZo@U~Xt&o}kRh!@$761jO7Ebu6VhS2A#N++pBn=U>lphwlVW7Vk!GFRm_belC@b z4Vs)Rd>jl9C$HsPWea4miZ>c?u#2m!Gd9VWBqrsgW+bLo#5c-7#2U*HV#TQ?C7F4R zOi&r;$%$NfJW6GWIi;ye3MHu(C7b!Uzp-#J^Gh=DZ{|c2F zn8?cXKd1(JcTRIKA|izr!+ObB(K>4{AmpQoB7i=3o1nMPfnAc2Ne0v!2gH;`({Cd*ZiBm L>vJ|Nau5IjMTIxu diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 18680e7..fd66225 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -41,7 +41,6 @@ pub fn run() { }) } } - //extension::core::extension_protocol_handler(&context, &request) }) .plugin(tauri_plugin_http::init()) .manage(DbConnection(Mutex::new(None))) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 6356f8d..1307807 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -19,7 +19,7 @@ ], "security": { "csp": { - "default-src": ["'self'", "haex-extension: data: blob: asset:"], + "default-src": "'self' ipc: http://ipc.localhost; img-src 'self' asset: http://asset.localhost; default-src 'self' asset: http://asset.localhost", "script-src": ["'self'", "haex-extension:"], "style-src": ["'self'", "haex-extension:"], "connect-src": ["'self'", "haex-extension:"], @@ -29,7 +29,7 @@ }, "assetProtocol": { "enable": true, - "scope": ["$RESOURCE/extensions/**"] + "scope": ["$RESOURCE/**", "$APPDATA/**"] } } }, diff --git a/src/app.vue b/src/app.vue index fd21238..2bbc3ba 100644 --- a/src/app.vue +++ b/src/app.vue @@ -1,6 +1,6 @@