openrod 0.2.0 → 0.2.1-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as en,a as tn,r as Re,d as sn,s as hs,b as Xe,c as ls,e as cs,f as rn,j as V,p as ds,T as nn,L as on,B as us,R as an,D as hn,g as ln,C as cn,h as dn,i as un,t as _n}from"./index-
|
|
1
|
+
import{u as en,a as tn,r as Re,d as sn,s as hs,b as Xe,c as ls,e as cs,f as rn,j as V,p as ds,T as nn,L as on,B as us,R as an,D as hn,g as ln,C as cn,h as dn,i as un,t as _n}from"./index-Cd6-PxqN.js";/**
|
|
2
2
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
3
3
|
* @license MIT
|
|
4
4
|
*
|
package/dist/index.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<meta name="theme-color" content="#ffffff" />
|
|
8
8
|
<meta name="description" content="OpenRod — sandboxes, templates, and activity." />
|
|
9
9
|
<title>OpenRod</title>
|
|
10
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-Cd6-PxqN.js"></script>
|
|
11
11
|
<link rel="stylesheet" crossorigin href="/assets/index-BXCNsM6h.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|
package/package.json
CHANGED
package/src/lib/local-cloud.js
CHANGED
|
@@ -84,7 +84,16 @@ export async function authorizeLocalConnection(handoff, request = fetch) {
|
|
|
84
84
|
if (typeof result.code !== 'string' || !/^[a-f0-9]{64}\.[a-f0-9]{64}$/.test(result.code)) throw new Error('Invalid sign-in response.')
|
|
85
85
|
return result
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
// Asks the cloud console to ignore its existing session and show Google's
|
|
88
|
+
// account picker, so a disconnected computer can connect another account.
|
|
89
|
+
export const CHOOSE_ACCOUNT = 'account'
|
|
90
|
+
export const choosesAccount = search => new URLSearchParams(search).get(CHOOSE_ACCOUNT) === 'choose'
|
|
91
|
+
export function withAccountChoice(url) {
|
|
92
|
+
const next = new URL(url)
|
|
93
|
+
next.searchParams.set(CHOOSE_ACCOUNT, 'choose')
|
|
94
|
+
return next.href
|
|
95
|
+
}
|
|
96
|
+
export function createLocalSignInAttempt({ popup, origin, cloud = CLOUD_ORIGIN, chooseAccount = false, request = localCloudRequest, events = window, focus = () => window.focus(), setTimer = setInterval, clearTimer = clearInterval, now = Date.now }) {
|
|
88
97
|
let nonce, accepted = false, finished = false, resolve, reject
|
|
89
98
|
const promise = new Promise((yes, no) => { resolve = yes; reject = no })
|
|
90
99
|
const cancelNonce = async () => {
|
|
@@ -125,7 +134,7 @@ export function createLocalSignInAttempt({ popup, origin, cloud = CLOUD_ORIGIN,
|
|
|
125
134
|
const started = await request('start', { origin })
|
|
126
135
|
nonce = started.nonce
|
|
127
136
|
if (finished) { await cancelNonce(); return }
|
|
128
|
-
popup.location.href = started.url
|
|
137
|
+
popup.location.href = chooseAccount ? withAccountChoice(started.url) : started.url
|
|
129
138
|
}).catch(error => { if (!finished) cancel(error.message) })
|
|
130
139
|
return { promise, cancel }
|
|
131
140
|
}
|