mirror of
https://github.com/JoshiCodes/knock.git
synced 2026-12-04 15:29:40 +01:00
GraphQL, WebSocket, import, runner and CLI (M5, M6) plus packaging
- GraphQL editor with schema introspection, cached schema, autocomplete and explorer - WebSocket: auth and subprotocols in the handshake, text/JSON/hex/file messages, saved messages, live log with filter, search and export, reconnect with backoff - Import from Postman (collections and environments), Bruno, Insomnia, OpenAPI/Swagger and cURL; imported scripts are kept as docs, never run; credentials move to the gitignored secrets file - Code snippets for cURL, fetch, Python, HTTPie, Go, PowerShell; Postman export - Runner for folders and collections with JSON and JUnit reports - knock CLI: send, run, import, auth login/debug/logout - Large JSON responses parsed off the main thread - PKGBUILDs, desktop entry with knock:// handler, CI workflow, README
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { plain } from '$lib/plain.svelte';
|
||||
import { toast, Switch } from '@joshicodes/cock';
|
||||
import { open as openDialog } from '@tauri-apps/plugin-dialog';
|
||||
import { open as openDialog, save as saveDialog } from '@tauri-apps/plugin-dialog';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import KeyValueTable from '$lib/ui/KeyValueTable.svelte';
|
||||
import AuthPanel from '$lib/views/auth/AuthPanel.svelte';
|
||||
import Icon from '$lib/ui/Icon.svelte';
|
||||
@@ -54,6 +55,17 @@
|
||||
return p.startsWith(root + '/') ? p.slice(root.length + 1) : p;
|
||||
}
|
||||
|
||||
async function exportPostman() {
|
||||
const path = await saveDialog({ defaultPath: `${m?.name ?? 'collection'}.postman_collection.json` });
|
||||
if (!path) return;
|
||||
try {
|
||||
await invoke('export_postman', { col, path });
|
||||
toast.success('Exported', { description: 'Secrets stay as {{secret.…}} placeholders.' });
|
||||
} catch (e) {
|
||||
toast.error('Export failed', { description: errorText(e) });
|
||||
}
|
||||
}
|
||||
|
||||
function onKey(e: KeyboardEvent) {
|
||||
if ((e.ctrlKey || e.metaKey) && e.key === 's') {
|
||||
e.preventDefault();
|
||||
@@ -75,6 +87,7 @@
|
||||
<input class="-ml-1 w-full rounded bg-transparent px-1 text-[20px] font-bold text-strong outline-none hover:bg-input focus:bg-input" bind:value={m.name} />
|
||||
<div class="mono text-[12px] text-fg-subtle">{root}/knock.yaml</div>
|
||||
</div>
|
||||
<button class="rounded px-3 py-1.5 text-fg-muted hover:text-fg" onclick={exportPostman}>Export as Postman</button>
|
||||
<button class="rounded bg-accent px-4 py-1.5 font-bold text-accent-fg disabled:opacity-40" disabled={!dirty} onclick={save}>Save</button>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user