mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
fix(device-pairing): clean up push subscriptions on admin reset and share URL helpers
The admin password reset finds the admin case-insensitively and deletes the push subscriptions of the sessions it ends. The app re-sends its push subscription once per signed-in session so revoke reaches re-signed-in devices, and the upsert keeps the stored device name. Plain-HTTP and URL parsing checks are shared helpers.
This commit is contained in:
1 parent
cbe4f7ed9e
commit
6e398c4d40
21 files changed
+540
-85
No files matched your search
@@ -12,7 +12,7 @@ import {
|
||||
type OpenCodeServerLink,
|
||||
type OpenCodeServerTestResult,
|
||||
} from '@opencode-manager/shared/schemas'
|
||||
import { haveSameUrlOrigin, isLoopbackHost, isPrivateNetworkHost } from '@opencode-manager/shared/utils'
|
||||
import { haveSameUrlOrigin, isPublicPlainHttpUrl, parseHttpUrl } from '@opencode-manager/shared/utils'
|
||||
import { Badge } from '@/components/ui/badge'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Checkbox } from '@/components/ui/checkbox'
|
||||
@@ -85,16 +85,8 @@ const serverFormSchema = z.object({
|
||||
type ServerFormValues = z.infer<typeof serverFormSchema>
|
||||
|
||||
function sendsCredentialsInClear(baseUrl: string): boolean {
|
||||
try {
|
||||
const url = new URL(baseUrl)
|
||||
return (
|
||||
url.protocol === 'http:' &&
|
||||
!isLoopbackHost(url.hostname) &&
|
||||
!isPrivateNetworkHost(url.hostname)
|
||||
)
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
const url = parseHttpUrl(baseUrl)
|
||||
return url !== null && isPublicPlainHttpUrl(url)
|
||||
}
|
||||
|
||||
function buildDefaultValues(server?: OpenCodeServer | null): ServerFormValues {
|
||||
|
||||
Reference in new issue
Block a user