mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
Merge remote-tracking branch 'origin/feat/linked-opencode-servers' into feat/remote-server-automation
# Conflicts: # frontend/src/lib/navigation.test.ts
This commit is contained in:
commit
24745597f2
21 files changed
+1033
-84
No files matched your search
@@ -53,6 +53,7 @@ export const TestOpenCodeServerRequestSchema = z.object({
|
||||
baseUrl: HttpUrlSchema,
|
||||
username: z.string().trim().min(1).max(100).default(OPENCODE_SERVER_USERNAME),
|
||||
password: z.string().max(1024).optional(),
|
||||
serverId: z.string().trim().min(1).optional(),
|
||||
});
|
||||
|
||||
export const OpenCodeServerTestResultSchema = z.object({
|
||||
|
||||
@@ -2,3 +2,17 @@
|
||||
export function trimUrlTrailingSlashes(url: string): string {
|
||||
return url.trim().replace(/\/+$/, '')
|
||||
}
|
||||
|
||||
/** Reports whether two URLs share the same origin; false when either URL is invalid. */
|
||||
export function haveSameUrlOrigin(first: string, second: string): boolean {
|
||||
const origin = readUrlOrigin(first)
|
||||
return origin !== null && origin === readUrlOrigin(second)
|
||||
}
|
||||
|
||||
function readUrlOrigin(value: string): string | null {
|
||||
try {
|
||||
return new URL(value).origin
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user