clavarium 0.2.57-beta.1 → 0.2.58-beta.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.
- package/npm-shrinkwrap.json +6 -6
- package/package.json +2 -2
- package/server/accounts.mjs +9 -5
- package/web/index.html +1 -1
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.58-beta.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "clavarium",
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.58-beta.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"clavarium-binder": "0.1.8-next.1",
|
|
15
15
|
"clavarium-docket": "0.1.1",
|
|
16
16
|
"clavarium-parley": "0.17.11-next.1",
|
|
17
|
-
"clavarium-tether": "0.1.0-next.
|
|
17
|
+
"clavarium-tether": "0.1.0-next.13",
|
|
18
18
|
"mermaid": "11.17.2",
|
|
19
19
|
"node-pty": "^1.1.0",
|
|
20
20
|
"pdfjs-dist": "6.4.299",
|
|
@@ -755,9 +755,9 @@
|
|
|
755
755
|
}
|
|
756
756
|
},
|
|
757
757
|
"node_modules/clavarium-tether": {
|
|
758
|
-
"version": "0.1.0-next.
|
|
759
|
-
"resolved": "https://registry.npmjs.org/clavarium-tether/-/clavarium-tether-0.1.0-next.
|
|
760
|
-
"integrity": "sha512-
|
|
758
|
+
"version": "0.1.0-next.13",
|
|
759
|
+
"resolved": "https://registry.npmjs.org/clavarium-tether/-/clavarium-tether-0.1.0-next.13.tgz",
|
|
760
|
+
"integrity": "sha512-2H4OcE43KcXnDo44Ptlzu3LM9upLYKEck4u5AWsYQcgvwrkSdG5D7aN4/jMuJALSf1/mJVrD6jvxgUCjb6n+GA==",
|
|
761
761
|
"license": "MIT",
|
|
762
762
|
"bin": {
|
|
763
763
|
"tether": "bin/cli.mjs",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.58-beta.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "A conversation is a VM with a terminal in it. Everything else is a folder.",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"clavarium-binder": "0.1.8-next.1",
|
|
48
48
|
"clavarium-docket": "0.1.1",
|
|
49
49
|
"clavarium-parley": "0.17.11-next.1",
|
|
50
|
-
"clavarium-tether": "0.1.0-next.
|
|
50
|
+
"clavarium-tether": "0.1.0-next.13",
|
|
51
51
|
"mermaid": "11.17.2",
|
|
52
52
|
"node-pty": "^1.1.0",
|
|
53
53
|
"pdfjs-dist": "6.4.299",
|
package/server/accounts.mjs
CHANGED
|
@@ -27,10 +27,14 @@ import { consentUrl, exchangeCode, extractCode, thunderbird, scopeFor, pkcePair,
|
|
|
27
27
|
|
|
28
28
|
/* The loopback the provider sends the code back to; nothing listens there. The
|
|
29
29
|
person's browser lands on a page that will not load, and they copy the whole
|
|
30
|
-
address -- which carries the code -- back into Clavarium.
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
address -- which carries the code -- back into Clavarium. The same address
|
|
31
|
+
trades the code, so it only has to stay constant. Google's desktop client
|
|
32
|
+
accepts any 127.0.0.1 port; Microsoft (Azure) rejects a 127.0.0.1 whose exact
|
|
33
|
+
port is not registered but accepts http://localhost with ANY port for a public
|
|
34
|
+
client, so Microsoft uses localhost. */
|
|
33
35
|
const REDIRECT = 'http://127.0.0.1:47813/';
|
|
36
|
+
const REDIRECT_LOCALHOST = 'http://localhost:47813/';
|
|
37
|
+
const redirectFor = (provider) => (provider === 'microsoft' ? REDIRECT_LOCALHOST : REDIRECT);
|
|
34
38
|
const PENDING_MS = 10 * 60_000;
|
|
35
39
|
const PENDING_MAX = 20;
|
|
36
40
|
|
|
@@ -85,7 +89,7 @@ export class Accounts {
|
|
|
85
89
|
const { clientId } = thunderbird(prov);
|
|
86
90
|
const state = newState();
|
|
87
91
|
const { verifier, challenge } = pkcePair();
|
|
88
|
-
const url = consentUrl(prov, { clientId, redirectUri:
|
|
92
|
+
const url = consentUrl(prov, { clientId, redirectUri: redirectFor(prov), scope: scopeFor(prov, chosen), state, codeChallenge: challenge, loginHint: address });
|
|
89
93
|
this.#pending.set(state, { provider: prov, user: address, kinds: chosen, verifier, at: Date.now() });
|
|
90
94
|
return { url };
|
|
91
95
|
}
|
|
@@ -103,7 +107,7 @@ export class Accounts {
|
|
|
103
107
|
try { code = extractCode(redirected, { state }); } catch (e) { throw new Refusal(400, e.message); }
|
|
104
108
|
const { clientId, clientSecret } = thunderbird(p.provider);
|
|
105
109
|
let refreshToken;
|
|
106
|
-
try { ({ refreshToken } = await exchangeCode(p.provider, { clientId, clientSecret, redirectUri:
|
|
110
|
+
try { ({ refreshToken } = await exchangeCode(p.provider, { clientId, clientSecret, redirectUri: redirectFor(p.provider), code, codeVerifier: p.verifier, fetch: this.#fetch })); }
|
|
107
111
|
catch (e) { throw new Refusal(502, `The connection could not be completed: ${e.message}`); }
|
|
108
112
|
if (!refreshToken) throw new Refusal(502, 'The account returned no lasting token; allow offline access and try again.');
|
|
109
113
|
/* The token is kept host-only: it can never be attached to a conversation,
|
package/web/index.html
CHANGED
|
@@ -548,7 +548,7 @@
|
|
|
548
548
|
<div class="row"><button type="button" id="connexion-open" class="primary">Open the sign-in page</button></div>
|
|
549
549
|
<div id="connexion-paste" hidden>
|
|
550
550
|
<label for="connexion-code">After you allow, the page will not load — copy its full address and paste it here</label>
|
|
551
|
-
<div class="row"><input id="connexion-code" spellcheck="false" autocapitalize="off" placeholder="http://127.0.0.1..."><button type="button" id="connexion-connect" class="primary">Connect</button></div>
|
|
551
|
+
<div class="row"><input id="connexion-code" spellcheck="false" autocapitalize="off" placeholder="http://localhost... or http://127.0.0.1..."><button type="button" id="connexion-connect" class="primary">Connect</button></div>
|
|
552
552
|
</div>
|
|
553
553
|
<p id="connexion-error" class="error" role="alert" hidden></p>
|
|
554
554
|
</form>
|