Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
feat(browser): normalizeAddress url helper
enesf8d8b51452c3
diff --git a/src/renderer/nodes/browserUrl.test.ts b/src/renderer/nodes/browserUrl.test.tsnew file mode 100644index 000000000..093b7673c--- /dev/null+++ b/src/renderer/nodes/browserUrl.test.ts@@ -0,0 +1,20 @@+import { describe, it, expect } from 'vitest'+import { normalizeAddress } from './browserUrl'++describe('normalizeAddress', () => {+ it('passes http(s) URLs through (normalized)', () => {+ expect(normalizeAddress('https://example.com')).toBe('https://example.com/')+ expect(normalizeAddress('http://a.dev/x')).toBe('http://a.dev/x')+ })+ it('prepends https:// to a bare host', () => {+ expect(normalizeAddress('example.com')).toBe('https://example.com/')+ expect(normalizeAddress(' news.ycombinator.com ')).toBe('https://news.ycombinator.com/')+ })+ it('rejects non-http schemes and junk', () => {+ expect(normalizeAddress('file:///etc/passwd')).toBeNull()+ expect(normalizeAddress('javascript:alert(1)')).toBeNull()+ expect(normalizeAddress('data:text/html,x')).toBeNull()+ expect(normalizeAddress('not a url')).toBeNull()+ expect(normalizeAddress('')).toBeNull()+ })+})diff --git a/src/renderer/nodes/browserUrl.ts b/src/renderer/nodes/browserUrl.tsnew file mode 100644index 000000000..5500841df--- /dev/null+++ b/src/renderer/nodes/browserUrl.ts@@ -0,0 +1,23 @@+// Normalize an address-bar entry into an http(s) URL, or null when it can't be one.+// Blocks file:/javascript:/data:/custom schemes; adds https:// to a bare host. No search fallback.+export function normalizeAddress(input: string): string | null {+ const raw = input.trim()+ if (!raw) return null+ // Already a URL with a scheme?+ if (/^[a-z][a-z0-9+.-]*:/i.test(raw)) {+ try {+ const u = new URL(raw)+ return u.protocol === 'http:' || u.protocol === 'https:' ? u.toString() : null+ } catch {+ return null+ }+ }+ // No scheme: only treat as a host if it has a dot and no spaces.+ if (/\s/.test(raw) || !raw.includes('.')) return null+ try {+ const u = new URL(`https://${raw}`)+ return u.toString()+ } catch {+ return null+ }+}