diff --git a/packaging/arch/knock/PKGBUILD b/packaging/arch/knock/PKGBUILD index 4b49382..6e877b8 100644 --- a/packaging/arch/knock/PKGBUILD +++ b/packaging/arch/knock/PKGBUILD @@ -36,11 +36,11 @@ package() { cd "$pkgname" install -Dm755 target/release/knock-app "$pkgdir/usr/bin/knock-app" install -Dm755 target/release/knock "$pkgdir/usr/bin/knock" - install -Dm644 packaging/linux/de.joshicodes.knock.desktop "$pkgdir/usr/share/applications/de.joshicodes.knock.desktop" - install -Dm644 logo/knock-app-icon.svg "$pkgdir/usr/share/icons/hicolor/scalable/apps/knock.svg" + install -Dm644 packaging/linux/knock-app.desktop "$pkgdir/usr/share/applications/knock-app.desktop" + install -Dm644 logo/knock-app-icon.svg "$pkgdir/usr/share/icons/hicolor/scalable/apps/knock-app.svg" for s in 32 128; do - install -Dm644 "src-tauri/icons/${s}x${s}.png" "$pkgdir/usr/share/icons/hicolor/${s}x${s}/apps/knock.png" + install -Dm644 "src-tauri/icons/${s}x${s}.png" "$pkgdir/usr/share/icons/hicolor/${s}x${s}/apps/knock-app.png" done - install -Dm644 src-tauri/icons/128x128@2x.png "$pkgdir/usr/share/icons/hicolor/256x256/apps/knock.png" + install -Dm644 src-tauri/icons/128x128@2x.png "$pkgdir/usr/share/icons/hicolor/256x256/apps/knock-app.png" install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" } diff --git a/packaging/linux/de.joshicodes.knock.desktop b/packaging/linux/knock-app.desktop similarity index 95% rename from packaging/linux/de.joshicodes.knock.desktop rename to packaging/linux/knock-app.desktop index 7e1d932..73fab3d 100644 --- a/packaging/linux/de.joshicodes.knock.desktop +++ b/packaging/linux/knock-app.desktop @@ -4,7 +4,7 @@ Name=knock GenericName=API Client Comment=Send HTTP, GraphQL and WebSocket requests Exec=knock-app %u -Icon=knock +Icon=knock-app Terminal=false Categories=Development;Network; Keywords=api;http;rest;graphql;websocket;oauth;postman;bruno; diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index ea4b703..194142e 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -2,7 +2,10 @@ "$schema": "../gen/schemas/desktop-schema.json", "identifier": "default", "description": "Main window", - "windows": ["main"], + "windows": [ + "main", + "debug-*" + ], "permissions": [ "core:default", "core:window:allow-start-dragging", @@ -13,6 +16,8 @@ "core:window:allow-start-resize-dragging", "dialog:default", "opener:default", - "deep-link:default" + "deep-link:default", + "core:webview:allow-create-webview-window", + "core:window:allow-set-title" ] } diff --git a/src/DebugWindow.svelte b/src/DebugWindow.svelte new file mode 100644 index 0000000..9761d6e --- /dev/null +++ b/src/DebugWindow.svelte @@ -0,0 +1,30 @@ + + +
+ {#if data} +
Auth debugger · {data.title}
+
+ {:else} +

Nothing to show.

+ {/if} +
+ diff --git a/src/lib/views/Sidebar.svelte b/src/lib/views/Sidebar.svelte index 1870a58..e6cd18e 100644 --- a/src/lib/views/Sidebar.svelte +++ b/src/lib/views/Sidebar.svelte @@ -11,6 +11,7 @@ import type { CollectionView, TreeNode } from '$lib/types'; import HistoryPanel from './HistoryPanel.svelte'; import { dialogs } from '$lib/state/dialogs.svelte'; + import { looksLikeCurl, parseCurl } from '$lib/curl'; const ROW = 26; @@ -177,6 +178,25 @@ } } + /** Ctrl+V with a cURL command creates a request in the selected folder. */ + async function pasteCurl(e: ClipboardEvent) { + const text = e.clipboardData?.getData('text/plain') ?? ''; + if (!looksLikeCurl(text)) return; + e.preventDefault(); + const r = rows.find((x) => x.key === selected) ?? null; + const col = r?.col.id ?? ws.focusCol; + if (!col) return; + try { + const req = await parseCurl(text); + const res = await api.requestCreate(col, folderOf(r), req); + ws.upsert(res.collection); + await ws.openRequest(col, res.id, false); + toast.success('Request created from cURL'); + } catch (err) { + toast.error('Could not import cURL', { description: errorText(err) }); + } + } + async function addFolder(r: Row | null) { const col = r?.col.id ?? ws.focusCol; if (!col) return; @@ -393,6 +413,7 @@ aria-label="Collections" onscroll={(e) => (scrollTop = (e.currentTarget as HTMLElement).scrollTop)} onkeydown={keydown} + onpaste={pasteCurl} >
{#each rows.slice(first, last) as r, i (r.key)} diff --git a/src/lib/views/auth/AuthDebugView.svelte b/src/lib/views/auth/AuthDebugView.svelte index 7808dcd..7825f5f 100644 --- a/src/lib/views/auth/AuthDebugView.svelte +++ b/src/lib/views/auth/AuthDebugView.svelte @@ -1,12 +1,28 @@