mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
fix(device-pairing): refuse to mint pairing codes from an address that cannot pair
A loopback origin in production or plain HTTP on a public address still minted a code and showed a browser QR no other device could use. - one availability rule decides untrusted, loopback and public plain-HTTP origins; POST /api/device-pairing/links checks it before minting - GET /api/device-pairing/availability reports the rule for the page origin without minting - Connect a device disables "Show QR code" and explains the fix when the address cannot pair - private-network plain HTTP keeps the browser QR; the app QR still needs the toggle
This commit is contained in:
1 parent
106e8f51fc
commit
b9d8d18124
12 files changed
+529
-64
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import type {
|
||||
CreateDevicePairingLinksRequest,
|
||||
DevicePairingAvailability,
|
||||
DevicePairingLinksResponse,
|
||||
PairedDevice,
|
||||
PairedDevicesResponse,
|
||||
@@ -62,6 +63,16 @@ export async function createDevicePairingLinks(
|
||||
})
|
||||
}
|
||||
|
||||
/** Reads whether the Manager can mint pairing codes for an address without minting one. */
|
||||
export async function getDevicePairingAvailability(
|
||||
origin: string,
|
||||
): Promise<DevicePairingAvailability> {
|
||||
return fetchWrapper<DevicePairingAvailability>(
|
||||
`${API_BASE_URL}/api/device-pairing/availability`,
|
||||
{ params: { origin } },
|
||||
)
|
||||
}
|
||||
|
||||
/** Lists the devices signed in to this account. */
|
||||
export async function listPairedDevices(): Promise<PairedDevice[]> {
|
||||
const response = await fetchWrapper<PairedDevicesResponse>(
|
||||
|
||||
Reference in new issue
Block a user