oorja 2.5.1 → 2.5.2
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/dist/commands/teletype/index.js +1 -1
- package/dist/lib/config.d.ts +3 -0
- package/dist/lib/config.js +15 -1
- package/dist/lib/oorja/index.js +12 -4
- package/dist/lib/oorja/preflight.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +13 -13
|
@@ -69,7 +69,7 @@ Will also allow participants to write to your terminal! Collaboration mode must
|
|
|
69
69
|
const STREAM_TO_NEW_SPACE = 'New space';
|
|
70
70
|
const { answer } = await inquirer.prompt([
|
|
71
71
|
{
|
|
72
|
-
type: '
|
|
72
|
+
type: 'select',
|
|
73
73
|
name: 'answer',
|
|
74
74
|
message: 'Choose streaming destination',
|
|
75
75
|
choices: [STREAM_TO_NEW_SPACE, STREAM_USING_STREAM_KEY],
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare const CLI_VERSION = 2.9;
|
|
2
2
|
export type env = 'local' | 'prod';
|
|
3
|
+
export declare const SUPAKIT_ACCESS_TOKEN_ENV = "SUPAKIT_ACCESS_TOKEN";
|
|
4
|
+
export declare const SUPAKIT_ENV_ENV = "SUPAKIT_ENV";
|
|
3
5
|
export declare class Config {
|
|
4
6
|
streamKeyAuth: boolean;
|
|
5
7
|
private configPath;
|
|
@@ -9,6 +11,7 @@ export declare class Config {
|
|
|
9
11
|
private saveConfig;
|
|
10
12
|
getEnv: () => env;
|
|
11
13
|
getAccessToken: () => string;
|
|
14
|
+
hasInjectedAccessToken: () => boolean;
|
|
12
15
|
setAccessToken: (token: string) => void;
|
|
13
16
|
}
|
|
14
17
|
export type ConnectConfig = {
|
package/dist/lib/config.js
CHANGED
|
@@ -2,6 +2,14 @@ import chalk from 'chalk';
|
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
export const CLI_VERSION = 2.9;
|
|
5
|
+
export const SUPAKIT_ACCESS_TOKEN_ENV = 'SUPAKIT_ACCESS_TOKEN';
|
|
6
|
+
export const SUPAKIT_ENV_ENV = 'SUPAKIT_ENV';
|
|
7
|
+
const envFromValue = (value) => {
|
|
8
|
+
if (value === 'local' || value === 'prod') {
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
return undefined;
|
|
12
|
+
};
|
|
5
13
|
export class Config {
|
|
6
14
|
streamKeyAuth = false;
|
|
7
15
|
configPath;
|
|
@@ -38,11 +46,17 @@ export class Config {
|
|
|
38
46
|
}
|
|
39
47
|
}
|
|
40
48
|
getEnv = () => {
|
|
41
|
-
return this.config['env'] || 'prod';
|
|
49
|
+
return envFromValue(process.env[SUPAKIT_ENV_ENV]) || envFromValue(this.config['env']) || 'prod';
|
|
42
50
|
};
|
|
43
51
|
getAccessToken = () => {
|
|
52
|
+
if (process.env[SUPAKIT_ACCESS_TOKEN_ENV]) {
|
|
53
|
+
return process.env[SUPAKIT_ACCESS_TOKEN_ENV];
|
|
54
|
+
}
|
|
44
55
|
return this.config[`${this.getEnv()}-access-token`] || '';
|
|
45
56
|
};
|
|
57
|
+
hasInjectedAccessToken = () => {
|
|
58
|
+
return Boolean(process.env[SUPAKIT_ACCESS_TOKEN_ENV]);
|
|
59
|
+
};
|
|
46
60
|
setAccessToken = (token) => {
|
|
47
61
|
this.config[`${this.getEnv()}-access-token`] = token;
|
|
48
62
|
this.saveConfig();
|
package/dist/lib/oorja/index.js
CHANGED
|
@@ -98,10 +98,11 @@ export class App {
|
|
|
98
98
|
}
|
|
99
99
|
spinner.succeed('Online');
|
|
100
100
|
const oorjaConfig = getoorjaConfig(this.config.getEnv());
|
|
101
|
+
const isControlledMode = this.config.hasInjectedAccessToken();
|
|
101
102
|
let user = undefined;
|
|
102
103
|
try {
|
|
103
104
|
if (!streamKey) {
|
|
104
|
-
user = await this.tryResumeSession();
|
|
105
|
+
user = await this.tryResumeSession(isControlledMode);
|
|
105
106
|
if (!user) {
|
|
106
107
|
const token = await promptAuth(this.connectClient, linkForTokenGen(oorjaConfig));
|
|
107
108
|
if (!token) {
|
|
@@ -127,10 +128,14 @@ export class App {
|
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
catch (e) {
|
|
130
|
-
|
|
131
|
+
if (!isControlledMode) {
|
|
132
|
+
this.config.setAccessToken('');
|
|
133
|
+
}
|
|
131
134
|
if (e instanceof Unauthorized) {
|
|
132
135
|
spinner.fail();
|
|
133
|
-
printExitMessage(
|
|
136
|
+
printExitMessage(isControlledMode
|
|
137
|
+
? 'The provided access token failed authentication.'
|
|
138
|
+
: 'Your access token failed authentication, resetting...');
|
|
134
139
|
exit(33);
|
|
135
140
|
return Promise.reject();
|
|
136
141
|
}
|
|
@@ -163,7 +168,7 @@ export class App {
|
|
|
163
168
|
this.connectionCheckFuture.resolve();
|
|
164
169
|
}
|
|
165
170
|
};
|
|
166
|
-
tryResumeSession = async () => {
|
|
171
|
+
tryResumeSession = async (isControlledMode) => {
|
|
167
172
|
const personalAccessToken = this.config.getAccessToken();
|
|
168
173
|
if (!personalAccessToken)
|
|
169
174
|
return;
|
|
@@ -172,6 +177,9 @@ export class App {
|
|
|
172
177
|
}
|
|
173
178
|
catch (e) {
|
|
174
179
|
if (e instanceof Unauthorized) {
|
|
180
|
+
if (isControlledMode) {
|
|
181
|
+
throw e;
|
|
182
|
+
}
|
|
175
183
|
this.config.setAccessToken(''); // reset
|
|
176
184
|
return;
|
|
177
185
|
}
|
|
@@ -18,7 +18,7 @@ export const promptAuth = async (connectClient, generateTokenLink) => {
|
|
|
18
18
|
console.log(`\n${chalk.bold('PRO-TIP:')} If you sign-in, you can control your shell from the web-ui as well, without enabling collaboration mode for the other participants\n`);
|
|
19
19
|
const { answer } = await inquirer.prompt([
|
|
20
20
|
{
|
|
21
|
-
type: '
|
|
21
|
+
type: 'select',
|
|
22
22
|
name: 'answer',
|
|
23
23
|
message: 'You need an access-token for authentication.\n ',
|
|
24
24
|
choices: [ANON, SIGN_IN],
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oorja",
|
|
3
3
|
"description": "stream terminals to the web and more.",
|
|
4
|
-
"version": "2.5.
|
|
4
|
+
"version": "2.5.2",
|
|
5
5
|
"packageManager": "pnpm@11.5.2",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"teletype",
|
|
@@ -55,17 +55,17 @@
|
|
|
55
55
|
]
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@msgpack/msgpack": "3.1.
|
|
59
|
-
"@oclif/core": "^4.
|
|
60
|
-
"@oclif/plugin-help": "^6.2.
|
|
61
|
-
"camelcase-keys": "^10.0.
|
|
58
|
+
"@msgpack/msgpack": "3.1.3",
|
|
59
|
+
"@oclif/core": "^4.11.4",
|
|
60
|
+
"@oclif/plugin-help": "^6.2.50",
|
|
61
|
+
"camelcase-keys": "^10.0.2",
|
|
62
62
|
"chalk": "^5.6.2",
|
|
63
63
|
"haversine-distance": "^1.2.4",
|
|
64
|
-
"inquirer": "^
|
|
64
|
+
"inquirer": "^14.0.2",
|
|
65
65
|
"node-pty": "^1.1.0",
|
|
66
|
-
"ora": "^
|
|
67
|
-
"phoenix": "1.8.
|
|
68
|
-
"terminal-size": "^4.0.
|
|
66
|
+
"ora": "^9.4.0",
|
|
67
|
+
"phoenix": "1.8.7",
|
|
68
|
+
"terminal-size": "^4.0.1"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@eslint/js": "^9.35.0",
|
|
@@ -74,15 +74,15 @@
|
|
|
74
74
|
"@types/node": "^22.10.2",
|
|
75
75
|
"@types/phoenix": "^1.6.6",
|
|
76
76
|
"eslint": "^9.39.4",
|
|
77
|
-
"eslint-config-oclif": "^6.0.
|
|
77
|
+
"eslint-config-oclif": "^6.0.167",
|
|
78
78
|
"eslint-config-prettier": "^10.1.8",
|
|
79
|
-
"globals": "^
|
|
79
|
+
"globals": "^17.6.0",
|
|
80
80
|
"oclif": "^4.23.10",
|
|
81
|
-
"prettier": "^3.
|
|
81
|
+
"prettier": "^3.8.3",
|
|
82
82
|
"shx": "^0.4.0",
|
|
83
83
|
"ts-node": "^10.9.2",
|
|
84
84
|
"typescript": "^5.9.2",
|
|
85
|
-
"typescript-eslint": "^8.
|
|
85
|
+
"typescript-eslint": "^8.60.1"
|
|
86
86
|
},
|
|
87
87
|
"engines": {
|
|
88
88
|
"node": ">=22.10.0"
|