Files
windmill/frontend/src/lib/apiBaseUrl.svelte.ts
T
Ruben Fiszelandwindmill-internal-app[bot] 6acf185854 feat: add an api base url instance setting for displayed urls (#11628)
* feat: add an api base url instance setting for displayed urls

* feat: show the api base url as cli remote, keep mcp url on origin

* fix: keep push captures on origin and load the api base url on svix page

* fix: reject shell metacharacters in webhook and api base urls

* test: drop the trivial api base url resolver test

* feat: hide the api base url setting behind a toggle

* fix: let the quick setup toggle reveal the api base url field

* chore: update ee-repo-ref to 017710bdd0a10de857f0f40800dde238cdb1ad24

This commit updates the EE repository reference after PR #863 was merged in windmill-ee-private.

Previous ee-repo-ref: f67cd621bd45840e6389e0469a67378864f269a0

New ee-repo-ref: 017710bdd0a10de857f0f40800dde238cdb1ad24

Automated by sync-ee-ref workflow.

---------

Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>
2026-10-08 22:35:07 +02:00

23 lines
906 B
TypeScript

import { fromStore } from 'svelte/store'
import { base } from '$lib/base'
import { instanceUi } from '$lib/instanceUi'
const ui = fromStore(instanceUi)
/**
* Base of every URL shown for an external client to call (webhooks, HTTP routes, push
* trigger endpoints, the CLI remote): the `api_base_url` instance setting, else the
* origin being browsed. Append `/api/...` to it.
*
* Not for URLs the editor itself calls or opens (captures, previews, OAuth popups, links
* to pages): those must stay on the browsing origin, where the session cookie lives.
*
* Reactive: the setting lands after page load, so read it inside a `$derived` or the
* template rather than caching the result.
*/
export function apiBaseUrl(): string {
const setting = ui.current?.api_base_url
const configured = typeof setting === 'string' ? setting.trim() : ''
return configured || `${window.location.origin}${base}`
}