mirror of
https://github.com/kunkunsh/kunkun.git
synced 2025-04-04 14:46:42 +00:00
Feature: fix extension delete (#96)
* chore: improve database and extension handling - Remove debug console log in extension uninstall - Add ON DELETE CASCADE to extension-related foreign keys - Enable foreign key constraints in database connection - Update database file extensions from .db to .sqlite - Modify command value generation for better identification * fix: add small delay to onboarding page navigation Without delay the page switch won't be triggered when window first loads
This commit is contained in:
parent
27fdff03d9
commit
839bad6751
@ -32,8 +32,7 @@
|
||||
QuickLinks,
|
||||
SystemCmds
|
||||
} from "@kksh/ui/main"
|
||||
import type { CmdValue } from "@kksh/ui/types"
|
||||
import { cn, commandScore } from "@kksh/ui/utils"
|
||||
import { cn } from "@kksh/ui/utils"
|
||||
import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow"
|
||||
import { getCurrentWindow, Window } from "@tauri-apps/api/window"
|
||||
import { platform } from "@tauri-apps/plugin-os"
|
||||
@ -74,7 +73,9 @@
|
||||
// to keep track of the loading status
|
||||
if (loaded) {
|
||||
if (!appConfig.get().onBoarded) {
|
||||
goto(i18n.resolveRoute("/app/help/onboarding"))
|
||||
setTimeout(() => {
|
||||
goto(i18n.resolveRoute("/app/help/onboarding"))
|
||||
}, 300)
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -93,15 +94,6 @@
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<!-- <div>appsFiltered: {$appsFiltered.length}</div> -->
|
||||
<!-- <div>appsLoader: {$appsLoader.length}</div> -->
|
||||
<!-- filter={(value, search, keywords) => {
|
||||
return commandScore(
|
||||
value.startsWith("{") ? (JSON.parse(value) as CmdValue).cmdName : value,
|
||||
search,
|
||||
keywords
|
||||
)
|
||||
}} -->
|
||||
<Command.Root
|
||||
class={cn("h-screen rounded-lg border shadow-md")}
|
||||
bind:value={$appState.highlightedCmd}
|
||||
|
@ -15,7 +15,6 @@
|
||||
uninstalling = true
|
||||
const extContainerPath = get(appConfig).extensionsInstallDir
|
||||
const isDev = extContainerPath && extAPI.isExtPathInDev(extContainerPath, ext.extPath)
|
||||
console.log("uninstall extension (isDev): ", isDev)
|
||||
|
||||
const uninstallFunc = isDev
|
||||
? extensions.uninstallDevExtensionByIdentifier
|
||||
|
@ -28,7 +28,7 @@ CREATE TABLE IF NOT EXISTS commands (
|
||||
)
|
||||
),
|
||||
data JSON,
|
||||
FOREIGN KEY (ext_id) REFERENCES extensions (ext_id)
|
||||
FOREIGN KEY (ext_id) REFERENCES extensions (ext_id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- Extension Data table
|
||||
@ -41,7 +41,7 @@ CREATE TABLE IF NOT EXISTS extension_data (
|
||||
search_text TEXT,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (ext_id) REFERENCES extensions (ext_id)
|
||||
FOREIGN KEY (ext_id) REFERENCES extensions (ext_id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- Full-text search index for ext_data
|
||||
|
@ -14,6 +14,7 @@ pub fn get_connection<P: AsRef<Path>>(
|
||||
let conn = Connection::open(file_path)?;
|
||||
if let Some(encryption_key) = encryption_key {
|
||||
conn.pragma_update(None, "key", &encryption_key)?;
|
||||
conn.pragma_update(None, "foreign_keys", "ON")?;
|
||||
}
|
||||
Ok(conn)
|
||||
}
|
||||
|
@ -17,8 +17,8 @@ pub fn get_default_extensions_storage_dir<R: Runtime>(
|
||||
|
||||
pub fn get_kunkun_db_path<R: Runtime>(app: &AppHandle<R>) -> anyhow::Result<PathBuf> {
|
||||
Ok(app.path().app_data_dir()?.join(if cfg!(debug_assertions) {
|
||||
"kk.dev.db"
|
||||
"kk.dev.sqlite"
|
||||
} else {
|
||||
"kk.db"
|
||||
"kk.sqlite"
|
||||
}))
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
onSelect={() => {
|
||||
onExtCmdSelect(ext, cmd, { isDev, hmr })
|
||||
}}
|
||||
value={cmd.name}
|
||||
value={`${isDev ? "dev-ext" : "ext"}-${cmd.name}`}
|
||||
>
|
||||
<!-- value={JSON.stringify({
|
||||
cmdName: cmd.name,
|
||||
|
Loading…
x
Reference in New Issue
Block a user