mirror of
https://github.com/kunkunsh/kunkun.git
synced 2025-04-12 01:39:43 +00:00
refactor: move svelte files into app folder
This commit is contained in:
parent
8ee1a13c6d
commit
92d1df4928
@ -24,7 +24,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
|
||||
description: "Go to Extension Store",
|
||||
function: async () => {
|
||||
appState.clearSearchTerm()
|
||||
goto("/appextension/store")
|
||||
goto("/app/extension/store")
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -35,7 +35,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
|
||||
},
|
||||
description: "",
|
||||
function: async () => {
|
||||
goto("/appauth")
|
||||
goto("/app/auth")
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -97,7 +97,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
|
||||
},
|
||||
description: "",
|
||||
function: async () => {
|
||||
goto("/appextension/file-transfer")
|
||||
goto("/app/extension/file-transfer")
|
||||
appState.clearSearchTerm()
|
||||
}
|
||||
},
|
||||
@ -111,7 +111,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
|
||||
description: "",
|
||||
function: async () => {
|
||||
appState.clearSearchTerm()
|
||||
goto("/appsettings/add-dev-extension")
|
||||
goto("/app/settings/add-dev-extension")
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -136,7 +136,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
|
||||
function: async () => {
|
||||
// const appStateStore = useAppStateStore()
|
||||
appState.clearSearchTerm()
|
||||
goto("/appsettings/set-dev-ext-path")
|
||||
goto("/app/settings/set-dev-ext-path")
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -148,11 +148,11 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
|
||||
description: "",
|
||||
function: async () => {
|
||||
appState.clearSearchTerm()
|
||||
// goto("/appwindow-troubleshooter")
|
||||
// goto("/app/window-troubleshooter")
|
||||
const winLabel = `main:extension-window-troubleshooter-${uuidv4()}`
|
||||
console.log(winLabel)
|
||||
new WebviewWindow(winLabel, {
|
||||
url: "/troubleshooters/extension-window",
|
||||
url: "/app/troubleshooters/extension-window",
|
||||
title: "Extension Window Troubleshooter"
|
||||
})
|
||||
},
|
||||
@ -167,7 +167,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
|
||||
description: "",
|
||||
function: async () => {
|
||||
appState.clearSearchTerm()
|
||||
goto("/appextension/permission-inspector")
|
||||
goto("/app/extension/permission-inspector")
|
||||
},
|
||||
keywords: ["extension"]
|
||||
},
|
||||
@ -180,7 +180,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
|
||||
description: "",
|
||||
function: async () => {
|
||||
appState.clearSearchTerm()
|
||||
goto("/apptroubleshooters/extension-loading")
|
||||
goto("/app/troubleshooters/extension-loading")
|
||||
},
|
||||
keywords: ["extension", "troubleshooter"]
|
||||
},
|
||||
@ -193,7 +193,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
|
||||
description: "Create a Quicklink",
|
||||
function: async () => {
|
||||
appState.clearSearchTerm()
|
||||
goto("/appextension/create-quick-link")
|
||||
goto("/app/extension/create-quick-link")
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -204,7 +204,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
|
||||
},
|
||||
description: "Open Settings",
|
||||
function: async () => {
|
||||
goto("/appsettings")
|
||||
goto("/app/settings")
|
||||
appState.clearSearchTerm()
|
||||
}
|
||||
},
|
||||
@ -264,7 +264,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
|
||||
},
|
||||
description: "Dance",
|
||||
function: async () => {
|
||||
goto("/appdance")
|
||||
goto("/app/dance")
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -305,7 +305,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
|
||||
description: "Clipboard History",
|
||||
function: async () => {
|
||||
appState.clearSearchTerm()
|
||||
goto("/appextension/clipboard")
|
||||
goto("/app/extension/clipboard")
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -322,7 +322,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
|
||||
return
|
||||
}
|
||||
const window = new WebviewWindow(`main:pinned-screenshot-${uuidv4()}`, {
|
||||
url: "/extension/pin-screenshot",
|
||||
url: "/app/extension/pin-screenshot",
|
||||
title: "Pinned Screenshot",
|
||||
hiddenTitle: true,
|
||||
titleBarStyle: "transparent",
|
||||
@ -342,7 +342,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
|
||||
},
|
||||
description: "MDNS Debugger",
|
||||
function: async () => {
|
||||
goto("/apptroubleshooters/mdns-debugger")
|
||||
goto("/app/troubleshooters/mdns-debugger")
|
||||
},
|
||||
flags: {
|
||||
developer: true
|
||||
|
@ -24,7 +24,7 @@ export async function onTemplateUiCmdSelect(
|
||||
) {
|
||||
await createExtSupportDir(ext.extPath)
|
||||
// console.log("onTemplateUiCmdSelect", ext, cmd, isDev, hmr)
|
||||
const url = `/extension/ui-worker?extPath=${encodeURIComponent(ext.extPath)}&cmdName=${encodeURIComponent(cmd.name)}`
|
||||
const url = `/app/extension/ui-worker?extPath=${encodeURIComponent(ext.extPath)}&cmdName=${encodeURIComponent(cmd.name)}`
|
||||
if (cmd.window) {
|
||||
const winLabel = await winExtMap.registerExtensionWithWindow({ extPath: ext.extPath })
|
||||
const window = launchNewExtWindow(winLabel, url, cmd.window)
|
||||
@ -52,7 +52,7 @@ export async function onCustomUiCmdSelect(
|
||||
} else {
|
||||
url = decodeURIComponent(convertFileSrc(`${trimSlash(cmd.main)}`, "ext"))
|
||||
}
|
||||
let url2 = `/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) {
|
||||
const winLabel = await winExtMap.registerExtensionWithWindow({
|
||||
extPath: ext.extPath,
|
||||
@ -61,7 +61,7 @@ export async function onCustomUiCmdSelect(
|
||||
if (platform() === "windows" && !useDevMain) {
|
||||
const addr = await spawnExtensionFileServer(winLabel)
|
||||
const newUrl = `http://${addr}`
|
||||
url2 = `/extension/ui-iframe?url=${encodeURIComponent(newUrl)}&extPath=${encodeURIComponent(ext.extPath)}`
|
||||
url2 = `/app/extension/ui-iframe?url=${encodeURIComponent(newUrl)}&extPath=${encodeURIComponent(ext.extPath)}`
|
||||
}
|
||||
const window = launchNewExtWindow(winLabel, url2, cmd.window)
|
||||
window.onCloseRequested(async (event) => {
|
||||
@ -78,7 +78,7 @@ export async function onCustomUiCmdSelect(
|
||||
const addr = await spawnExtensionFileServer(winLabel) // addr has format "127.0.0.1:<port>"
|
||||
console.log("Extension file server address: ", addr)
|
||||
const newUrl = `http://${addr}`
|
||||
url2 = `/extension/ui-iframe?url=${encodeURIComponent(newUrl)}&extPath=${encodeURIComponent(ext.extPath)}`
|
||||
url2 = `/app/extension/ui-iframe?url=${encodeURIComponent(newUrl)}&extPath=${encodeURIComponent(ext.extPath)}`
|
||||
}
|
||||
goto(url2)
|
||||
}
|
||||
|
@ -87,7 +87,7 @@
|
||||
async function pickExtFiles() {
|
||||
if (!$appConfig.devExtensionPath) {
|
||||
toast.warning("Please set the dev extension path in the settings")
|
||||
return goto("/appsettings/set-dev-ext-path")
|
||||
return goto("/app/settings/set-dev-ext-path")
|
||||
}
|
||||
const selected = await openFileSelector({
|
||||
directory: false,
|
||||
|
@ -17,7 +17,7 @@
|
||||
toast.warning(
|
||||
"Please set the dev extension path in the settings to install tarball extension"
|
||||
)
|
||||
return goto("/appsettings/set-dev-ext-path")
|
||||
return goto("/app/settings/set-dev-ext-path")
|
||||
}
|
||||
await extensions
|
||||
.installFromNpmPackageName(data.name, $appConfig.devExtensionPath)
|
||||
|
@ -19,7 +19,7 @@
|
||||
toast.warning(
|
||||
"Please set the dev extension path in the settings to install tarball extension"
|
||||
)
|
||||
return goto("/appsettings/set-dev-ext-path")
|
||||
return goto("/app/settings/set-dev-ext-path")
|
||||
}
|
||||
await extensions
|
||||
.installFromTarballUrl(data.url, $appConfig.devExtensionPath)
|
||||
|
@ -59,7 +59,7 @@ export async function handleKunkunProtocol(parsedUrl: URL) {
|
||||
if (parsed.identifier) {
|
||||
goto(`/extension/store/${parsed.identifier}`)
|
||||
} else {
|
||||
goto("/appextension/store")
|
||||
goto("/app/extension/store")
|
||||
}
|
||||
} else if (href.startsWith(DEEP_LINK_PATH_REFRESH_DEV_EXTENSION)) {
|
||||
emitRefreshDevExt()
|
||||
|
@ -76,7 +76,7 @@ export async function globalKeyDownHandler(e: KeyboardEvent) {
|
||||
if ((_platform === "macos" && e.metaKey) || (_platform === "windows" && e.ctrlKey)) {
|
||||
if (e.key === ",") {
|
||||
e.preventDefault()
|
||||
goto("/appsettings")
|
||||
goto("/app/settings")
|
||||
}
|
||||
}
|
||||
// Toggle Devtools with control + shift + I
|
||||
|
@ -7,7 +7,7 @@ export function goBack() {
|
||||
}
|
||||
|
||||
export function goHome() {
|
||||
goto("/app")
|
||||
goto("/app/")
|
||||
}
|
||||
|
||||
export function goHomeOrCloseDependingOnWindow() {
|
||||
|
@ -44,7 +44,7 @@
|
||||
function onSignOut() {
|
||||
auth
|
||||
.signOut()
|
||||
.then(() => goto("/appauth"))
|
||||
.then(() => goto("/app/auth"))
|
||||
.catch((err) => toast.error("Failed to sign out", { description: err.message }))
|
||||
}
|
||||
</script>
|
||||
@ -56,7 +56,7 @@
|
||||
size="icon"
|
||||
onclick={() => {
|
||||
console.log("go Home")
|
||||
goto("/app")
|
||||
goto("/app/")
|
||||
}}
|
||||
>
|
||||
<ArrowLeft class="size-4" />
|
@ -5,7 +5,7 @@
|
||||
|
||||
function handleKeyDown(event: KeyboardEvent) {
|
||||
if (event.key === "Enter") {
|
||||
goto("/app")
|
||||
goto("/app/")
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -17,7 +17,7 @@
|
||||
title="Fail to Load Extension"
|
||||
class="w-fit max-w-screen-sm border-2 border-red-500"
|
||||
message={$page.error?.message ?? "Unknown Error"}
|
||||
onGoBack={() => goto("/app")}
|
||||
onGoBack={() => goto("/app/")}
|
||||
rawJsonError={JSON.stringify($page, null, 2)}
|
||||
/>
|
||||
</Layouts.Center>
|
@ -136,7 +136,7 @@
|
||||
function handleKeydown(e: KeyboardEvent) {
|
||||
if (e.key === "Escape") {
|
||||
if (!delayedImageDialogOpen) {
|
||||
goto("/appextension/store")
|
||||
goto("/app/extension/store")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -148,7 +148,7 @@
|
||||
size="icon"
|
||||
class={cn("fixed left-3 top-3", Constants.CLASSNAMES.BACK_BUTTON)}
|
||||
data-flip-id={Constants.CLASSNAMES.BACK_BUTTON}
|
||||
onclick={() => goto("/appextension/store")}
|
||||
onclick={() => goto("/app/extension/store")}
|
||||
>
|
||||
<ArrowLeftIcon />
|
||||
</Button>
|
@ -51,7 +51,7 @@
|
||||
const iframeUiAPI: IUiIframeServer2 = {
|
||||
goBack: async () => {
|
||||
if (isInMainWindow()) {
|
||||
goto("/app")
|
||||
goto("/app/")
|
||||
} else {
|
||||
appWin.close()
|
||||
}
|
@ -24,7 +24,7 @@ export const load: PageLoad = async ({
|
||||
if (!_extPath || !_extUrl) {
|
||||
toast.error("Invalid extension path or url")
|
||||
error("Invalid extension path or url")
|
||||
goto("/app")
|
||||
goto("/app/")
|
||||
}
|
||||
const extPath = z.string().parse(_extPath)
|
||||
const extUrl = z.string().parse(_extUrl)
|
||||
@ -36,7 +36,7 @@ export const load: PageLoad = async ({
|
||||
toast.error("Error loading extension manifest", {
|
||||
description: `${err}`
|
||||
})
|
||||
goto("/app")
|
||||
goto("/app/")
|
||||
}
|
||||
const loadedExt = _loadedExt!
|
||||
const extInfoInDB = await db.getUniqueExtensionByPath(loadedExt.extPath)
|
||||
@ -44,7 +44,7 @@ export const load: PageLoad = async ({
|
||||
toast.error("Unexpected Error", {
|
||||
description: `Extension ${loadedExt.kunkun.identifier} not found in database. Run Troubleshooter.`
|
||||
})
|
||||
goto("/app")
|
||||
goto("/app/")
|
||||
}
|
||||
return { extPath, url: extUrl, loadedExt, extInfoInDB: extInfoInDB! }
|
||||
}
|
@ -63,7 +63,7 @@
|
||||
|
||||
async function goBack() {
|
||||
if (isInMainWindow()) {
|
||||
goto("/app")
|
||||
goto("/app/")
|
||||
} else {
|
||||
appWin.close()
|
||||
}
|
@ -27,7 +27,7 @@ export const load: PageLoad = async ({ url }) => {
|
||||
if (!extPath || !cmdName) {
|
||||
toast.error("Invalid extension path or url")
|
||||
error("Invalid extension path or url")
|
||||
goto("/app")
|
||||
goto("/app/")
|
||||
}
|
||||
|
||||
let _loadedExt: ExtPackageJsonExtra | undefined
|
||||
@ -38,7 +38,7 @@ export const load: PageLoad = async ({ url }) => {
|
||||
toast.error("Error loading extension manifest", {
|
||||
description: `${err}`
|
||||
})
|
||||
goto("/app")
|
||||
goto("/app/")
|
||||
}
|
||||
const loadedExt = _loadedExt!
|
||||
const extInfoInDB = await db.getUniqueExtensionByPath(loadedExt.extPath)
|
||||
@ -46,7 +46,7 @@ export const load: PageLoad = async ({ url }) => {
|
||||
toast.error("Unexpected Error", {
|
||||
description: `Extension ${loadedExt.kunkun.identifier} not found in database. Run Troubleshooter.`
|
||||
})
|
||||
goto("/app")
|
||||
goto("/app/")
|
||||
}
|
||||
const pkgJsonPath = await join(extPath!, "package.json")
|
||||
if (!(await exists(extPath!))) {
|
Loading…
x
Reference in New Issue
Block a user