oorja 2.2.0 → 2.3.0
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/README.md +5 -5
- package/dist/commands/teletype/index.js +5 -4
- package/dist/lib/config.d.ts +1 -1
- package/dist/lib/config.js +1 -1
- package/dist/lib/connect/index.d.ts +4 -1
- package/dist/lib/connect/index.js +16 -0
- package/dist/lib/connect/types.d.ts +12 -2
- package/dist/lib/oorja/index.d.ts +2 -1
- package/dist/lib/oorja/index.js +4 -2
- package/dist/lib/teletype/auxiliary.d.ts +1 -2
- package/oclif.manifest.json +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,20 +83,20 @@ DESCRIPTION
|
|
|
83
83
|
Display help for oorja.
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
## `oorja teletype [
|
|
86
|
+
## `oorja teletype [STREAM_KEY]`
|
|
87
87
|
|
|
88
88
|
Launch a terminal streaming session in oorja.
|
|
89
89
|
|
|
90
90
|
```
|
|
91
91
|
USAGE
|
|
92
|
-
$ oorja teletype [
|
|
92
|
+
$ oorja teletype [STREAM_KEY] [-h] [-s <value>] [-m] [-n]
|
|
93
93
|
|
|
94
94
|
FLAGS
|
|
95
95
|
-h, --help Show CLI help.
|
|
96
96
|
-m, --multiplex Allows users to WRITE TO YOUR SHELL i.e enables collaboration mode. Make sure you trust space
|
|
97
97
|
participants. Off by default
|
|
98
98
|
-n, --new_space Create new space
|
|
99
|
-
-s, --shell=<value> [default: /usr/bin/
|
|
99
|
+
-s, --shell=<value> [default: /usr/bin/bash] shell to use. e.g. bash, fish
|
|
100
100
|
|
|
101
101
|
DESCRIPTION
|
|
102
102
|
Launch a terminal streaming session in oorja.
|
|
@@ -108,8 +108,8 @@ EXAMPLES
|
|
|
108
108
|
$ teletype
|
|
109
109
|
Will prompt to choose streaming destination - existing space or create a new one.
|
|
110
110
|
|
|
111
|
-
$ teletype
|
|
112
|
-
Will stream to the space specified by secret link
|
|
111
|
+
$ teletype $stream-key
|
|
112
|
+
Will stream to the space specified by secret link.
|
|
113
113
|
|
|
114
114
|
$ teletype -m
|
|
115
115
|
Will also allow participants to write to your terminal!
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import inquirer from 'inquirer';
|
|
2
2
|
import { Command, Flags, Args } from '@oclif/core';
|
|
3
3
|
import ora from 'ora';
|
|
4
|
-
import { hostname } from 'os';
|
|
4
|
+
import { hostname, platform } from 'os';
|
|
5
5
|
import chalk from 'chalk';
|
|
6
6
|
import { Config, STREAM_KEY_SAMPLE } from '../../lib/config.js';
|
|
7
7
|
import { App, parseStreamKey } from '../../lib/oorja/index.js';
|
|
8
8
|
import { printExitMessage, promptStreamKey } from '../../lib/utils.js';
|
|
9
9
|
import { Unauthorized } from '../../lib/connect/errors.js';
|
|
10
10
|
import { exit } from '../../lib/exit.js';
|
|
11
|
+
const DEFAULT_SHELL = platform() === 'win32' ? 'powershell.exe' : process.env.SHELL || 'bash';
|
|
11
12
|
export default class TeleTypeCommand extends Command {
|
|
12
13
|
static order = 1;
|
|
13
14
|
static aliases = ['tty'];
|
|
@@ -32,7 +33,7 @@ Will also allow participants to write to your terminal! Collaboration mode must
|
|
|
32
33
|
shell: Flags.string({
|
|
33
34
|
char: 's',
|
|
34
35
|
description: 'shell to use. e.g. bash, fish',
|
|
35
|
-
default:
|
|
36
|
+
default: DEFAULT_SHELL,
|
|
36
37
|
}),
|
|
37
38
|
multiplex: Flags.boolean({
|
|
38
39
|
char: 'm',
|
|
@@ -101,7 +102,7 @@ Will also allow participants to write to your terminal! Collaboration mode must
|
|
|
101
102
|
discardStdin: false,
|
|
102
103
|
}).start();
|
|
103
104
|
const now = new Date();
|
|
104
|
-
const { roomKey } = await oorja
|
|
105
|
+
const { roomKey, inviteCode } = await oorja
|
|
105
106
|
.createRoom({
|
|
106
107
|
roomName: `Teletype session - ${hostname()} @ ${now.getHours()}:${now.getMinutes().toString().padStart(2, '0')}`,
|
|
107
108
|
apps: {
|
|
@@ -126,7 +127,7 @@ Will also allow participants to write to your terminal! Collaboration mode must
|
|
|
126
127
|
return Promise.reject();
|
|
127
128
|
});
|
|
128
129
|
spinner.succeed(chalk.bold('Space created')).clear();
|
|
129
|
-
const link = oorja.linkForRoom(roomKey);
|
|
130
|
+
const link = oorja.linkForRoom(roomKey, inviteCode);
|
|
130
131
|
console.log(`\n${chalk.bold(chalk.blueBright(link))}\n`);
|
|
131
132
|
console.log(chalk.bold("^^ You'll be streaming here ^^"));
|
|
132
133
|
this.clearstdin();
|
package/dist/lib/config.d.ts
CHANGED
package/dist/lib/config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { User, RoomApps, Room, CliManifest } from './types.js';
|
|
1
|
+
import { User, RoomApps, Room, CliManifest, NewRoomInviteResponse } from './types.js';
|
|
2
2
|
import { env } from '../config.js';
|
|
3
3
|
import { Channel } from 'phoenix';
|
|
4
4
|
export declare class ApiClientError extends Error {
|
|
@@ -16,6 +16,9 @@ export declare class ConnectClient {
|
|
|
16
16
|
fetchCliManifest: () => Promise<CliManifest>;
|
|
17
17
|
fetchSessionUser: (v2?: boolean) => Promise<User>;
|
|
18
18
|
createRoom: ({ roomName, apps }: CreateRoomOptions) => Promise<Room>;
|
|
19
|
+
createInviteCode: ({ roomId }: {
|
|
20
|
+
roomId: string;
|
|
21
|
+
}) => Promise<NewRoomInviteResponse>;
|
|
19
22
|
createAnonymousUser: () => Promise<string>;
|
|
20
23
|
fetchRoom: (roomId: string) => Promise<Room>;
|
|
21
24
|
establishSocket: () => Promise<void>;
|
|
@@ -100,6 +100,22 @@ export class ConnectClient {
|
|
|
100
100
|
return handleError(error);
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
|
+
createInviteCode = async ({ roomId }) => {
|
|
104
|
+
const body = {
|
|
105
|
+
participant_access: 'can_edit',
|
|
106
|
+
};
|
|
107
|
+
try {
|
|
108
|
+
const response = await this._fetch(`/v1/rooms/${roomId}/invites`, {
|
|
109
|
+
method: 'POST',
|
|
110
|
+
body: JSON.stringify(body),
|
|
111
|
+
});
|
|
112
|
+
const data = await response.json();
|
|
113
|
+
return defaultParser(data);
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
return handleError(error);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
103
119
|
createAnonymousUser = async () => {
|
|
104
120
|
try {
|
|
105
121
|
const response = await this._fetch('/v1/session/anon', { method: 'POST' });
|
|
@@ -34,7 +34,17 @@ export type RoomKey = {
|
|
|
34
34
|
roomId: string;
|
|
35
35
|
key: Buffer;
|
|
36
36
|
};
|
|
37
|
-
export type
|
|
38
|
-
|
|
37
|
+
export type ParticipantAccess = 'full_access' | 'can_edit' | 'can_view';
|
|
38
|
+
export type RoomInvite = {
|
|
39
|
+
id: string;
|
|
40
|
+
creatorId: string;
|
|
41
|
+
insertedAt: string;
|
|
42
|
+
inviteCode: string;
|
|
43
|
+
participantAccess: ParticipantAccess;
|
|
44
|
+
roomId: string;
|
|
45
|
+
};
|
|
46
|
+
export type NewRoomInviteResponse = {
|
|
47
|
+
allInvites: RoomInvite[];
|
|
48
|
+
data: RoomInvite;
|
|
39
49
|
};
|
|
40
50
|
export {};
|
|
@@ -13,8 +13,9 @@ export declare class OORJA {
|
|
|
13
13
|
createRoom: (options: CreateRoomOptions) => Promise<{
|
|
14
14
|
room: import("../connect/types.js").Room;
|
|
15
15
|
roomKey: RoomKey;
|
|
16
|
+
inviteCode: string;
|
|
16
17
|
}>;
|
|
17
|
-
linkForRoom: (roomKey: RoomKey) => string;
|
|
18
|
+
linkForRoom: (roomKey: RoomKey, inviteCode: string) => string;
|
|
18
19
|
getRoomKey(streamKey: StreamKey): RoomKey;
|
|
19
20
|
teletype: (options: Omit<TeletypeOptions, "userId" | "joinChannel">) => Promise<unknown>;
|
|
20
21
|
}
|
package/dist/lib/oorja/index.js
CHANGED
|
@@ -24,13 +24,15 @@ export class OORJA {
|
|
|
24
24
|
createRoom = async (options) => {
|
|
25
25
|
const room = await this.connectClient.createRoom(options);
|
|
26
26
|
const roomKey = createRoomKey(room.id);
|
|
27
|
+
const { data: { inviteCode }, } = await this.connectClient.createInviteCode({ roomId: room.id });
|
|
27
28
|
return {
|
|
28
29
|
room,
|
|
29
30
|
roomKey,
|
|
31
|
+
inviteCode,
|
|
30
32
|
};
|
|
31
33
|
};
|
|
32
|
-
linkForRoom = (roomKey) => {
|
|
33
|
-
return `${oorjaURL(this.config)}/rooms?id=${roomKey.roomId}#${exportKey(roomKey.key)}`;
|
|
34
|
+
linkForRoom = (roomKey, inviteCode) => {
|
|
35
|
+
return `${oorjaURL(this.config)}/rooms?id=${roomKey.roomId}&inviteCode=${inviteCode}#${exportKey(roomKey.key)}`;
|
|
34
36
|
};
|
|
35
37
|
getRoomKey(streamKey) {
|
|
36
38
|
return {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { IPty } from 'node-pty';
|
|
2
|
-
import { Hash } from '../connect/types.js';
|
|
3
2
|
export declare const initScreen: (username: string, hostname: string, shell: string, multiplexed: boolean) => void;
|
|
4
3
|
export type dimensions = {
|
|
5
4
|
rows: number;
|
|
@@ -7,4 +6,4 @@ export type dimensions = {
|
|
|
7
6
|
};
|
|
8
7
|
export declare const getDimensions: () => dimensions;
|
|
9
8
|
export declare const areDimensionEqual: (a: dimensions, b: dimensions) => boolean;
|
|
10
|
-
export declare const resizeBestFit: (term: IPty, userDimensions:
|
|
9
|
+
export declare const resizeBestFit: (term: IPty, userDimensions: Record<string, dimensions>, shouldClearScreen?: boolean) => void;
|
package/oclif.manifest.json
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"char": "s",
|
|
48
48
|
"description": "shell to use. e.g. bash, fish",
|
|
49
49
|
"name": "shell",
|
|
50
|
-
"default": "
|
|
50
|
+
"default": "/usr/bin/zsh",
|
|
51
51
|
"hasDynamicHelp": false,
|
|
52
52
|
"multiple": false,
|
|
53
53
|
"type": "option"
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
]
|
|
86
86
|
}
|
|
87
87
|
},
|
|
88
|
-
"version": "2.
|
|
88
|
+
"version": "2.3.0"
|
|
89
89
|
}
|