From 22ad96331a4456662f740c48882cab8aadd6d0b4 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Fri, 24 Jul 2026 18:46:47 -0500 Subject: feat: add Copy cURL Command button to the Local API page (#30) Adds a one-tap way to get a working, authenticated request from the Local API settings page. copyCurlCommand() copies a curl invocation using the current bound address and token via the Authorization header: curl -H "Authorization: Bearer " http://127.0.0.1:/portfolio Keeps the token in a header rather than a query string, so it stays out of URLs, browser history, and the request-log view (which masks the token). Guards on an empty token, matching copyToken(). --- LocalAPIService.swift | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'LocalAPIService.swift') diff --git a/LocalAPIService.swift b/LocalAPIService.swift index cd12fb8..0a5f8a2 100644 --- a/LocalAPIService.swift +++ b/LocalAPIService.swift @@ -142,6 +142,11 @@ final class LocalAPIService { AppClipboard.copy(config.token) } + func copyCurlCommand() { + guard !config.token.isEmpty else { return } + AppClipboard.copy("curl -H \"Authorization: Bearer \(config.token)\" \(address)/portfolio") + } + func localSecretReferences() -> [String] { [LocalAPISecretStore.reference] } -- cgit v1.2.3