mirror of
https://github.com/kunkunsh/kunkun.git
synced 2025-04-11 17:29:44 +00:00
fix: fixed some small extension loading and installation bug
This commit is contained in:
parent
80a854e432
commit
130608cd92
@ -92,7 +92,9 @@ export async function onCustomUiCmdSelect(
|
|||||||
if (useDevMain) {
|
if (useDevMain) {
|
||||||
url = cmd.devMain
|
url = cmd.devMain
|
||||||
} else {
|
} else {
|
||||||
url = decodeURIComponent(convertFileSrc(`${trimSlash(cmd.main)}`, "ext"))
|
url = cmd.main.startsWith("http")
|
||||||
|
? cmd.main
|
||||||
|
: decodeURIComponent(convertFileSrc(`${trimSlash(cmd.main)}`, "ext"))
|
||||||
}
|
}
|
||||||
let url2 = `/app/extension/ui-iframe?url=${encodeURIComponent(url)}&extPath=${encodeURIComponent(ext.extPath)}`
|
let url2 = `/app/extension/ui-iframe?url=${encodeURIComponent(url)}&extPath=${encodeURIComponent(ext.extPath)}`
|
||||||
if (cmd.window) {
|
if (cmd.window) {
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
import { Constants } from "@kksh/ui"
|
import { Constants } from "@kksh/ui"
|
||||||
import { StoreExtDetail } from "@kksh/ui/extension"
|
import { StoreExtDetail } from "@kksh/ui/extension"
|
||||||
import { greaterThan, parse as parseSemver } from "@std/semver"
|
import { greaterThan, parse as parseSemver } from "@std/semver"
|
||||||
import { error } from "@tauri-apps/plugin-log"
|
import { error, info } from "@tauri-apps/plugin-log"
|
||||||
import { goto } from "$app/navigation"
|
import { goto } from "$app/navigation"
|
||||||
import { ArrowLeftIcon } from "lucide-svelte"
|
import { ArrowLeftIcon } from "lucide-svelte"
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
@ -81,6 +81,7 @@
|
|||||||
.installFromTarballUrl(tarballUrl, installDir, installExtras)
|
.installFromTarballUrl(tarballUrl, installDir, installExtras)
|
||||||
.then(() => toast.success(`Plugin ${ext.name} Installed`))
|
.then(() => toast.success(`Plugin ${ext.name} Installed`))
|
||||||
.then((loadedExt) => {
|
.then((loadedExt) => {
|
||||||
|
info(`Successfully installed ${ext.name}`)
|
||||||
supabaseAPI.incrementDownloads({
|
supabaseAPI.incrementDownloads({
|
||||||
identifier: ext.identifier,
|
identifier: ext.identifier,
|
||||||
version: ext.version
|
version: ext.version
|
||||||
@ -89,7 +90,7 @@
|
|||||||
showBtn.uninstall = true
|
showBtn.uninstall = true
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error("err", err)
|
error(`Fail to install tarball (${ext.identifier}): ${err}`)
|
||||||
toast.error("Fail to install tarball", { description: err })
|
toast.error("Fail to install tarball", { description: err })
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
@ -132,7 +132,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
appWin.show()
|
setTimeout(() => {
|
||||||
|
appWin.show()
|
||||||
|
}, 200)
|
||||||
if (iframeRef?.contentWindow) {
|
if (iframeRef?.contentWindow) {
|
||||||
const io = new IframeParentIO(iframeRef.contentWindow)
|
const io = new IframeParentIO(iframeRef.contentWindow)
|
||||||
const rpc = new RPCChannel(io, { expose: serverAPI })
|
const rpc = new RPCChannel(io, { expose: serverAPI })
|
||||||
|
@ -8,7 +8,10 @@
|
|||||||
import { toast } from "svelte-sonner"
|
import { toast } from "svelte-sonner"
|
||||||
import { derived, get } from "svelte/store"
|
import { derived, get } from "svelte/store"
|
||||||
|
|
||||||
|
let uninstalling = $state(false)
|
||||||
|
|
||||||
function onUninstall(ext: ExtPackageJsonExtra) {
|
function onUninstall(ext: ExtPackageJsonExtra) {
|
||||||
|
uninstalling = true
|
||||||
const extContainerPath = get(appConfig).extensionsInstallDir
|
const extContainerPath = get(appConfig).extensionsInstallDir
|
||||||
const isDev = extContainerPath && extAPI.isExtPathInDev(extContainerPath, ext.extPath)
|
const isDev = extContainerPath && extAPI.isExtPathInDev(extContainerPath, ext.extPath)
|
||||||
console.log("uninstall extension (isDev): ", isDev)
|
console.log("uninstall extension (isDev): ", isDev)
|
||||||
@ -25,7 +28,9 @@
|
|||||||
toast.error("Fail to uninstall extension", { description: err })
|
toast.error("Fail to uninstall extension", { description: err })
|
||||||
error(`Fail to uninstall store extension (${ext.kunkun.identifier}): ${err}`)
|
error(`Fail to uninstall store extension (${ext.kunkun.identifier}): ${err}`)
|
||||||
})
|
})
|
||||||
.finally(() => {})
|
.finally(() => {
|
||||||
|
uninstalling = false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -36,7 +41,12 @@
|
|||||||
<Table.Cell>{type}</Table.Cell>
|
<Table.Cell>{type}</Table.Cell>
|
||||||
<Table.Cell>{ext.version}</Table.Cell>
|
<Table.Cell>{ext.version}</Table.Cell>
|
||||||
<Table.Cell>
|
<Table.Cell>
|
||||||
<Button variant="destructive" size="icon" onclick={() => onUninstall(ext)}>
|
<Button
|
||||||
|
variant="destructive"
|
||||||
|
size="icon"
|
||||||
|
disabled={uninstalling}
|
||||||
|
onclick={() => onUninstall(ext)}
|
||||||
|
>
|
||||||
<TrashIcon />
|
<TrashIcon />
|
||||||
</Button>
|
</Button>
|
||||||
</Table.Cell>
|
</Table.Cell>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user