@oya-ai/cli 1.0.69 → 1.0.71
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/index.js +23 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -195,6 +195,29 @@ var Browser = class {
|
|
|
195
195
|
);
|
|
196
196
|
return `${this.http.baseUrl}/api/live/${this.id}?ticket=${encodeURIComponent(ticket)}`;
|
|
197
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* A shareable link to this browser's live view, for handing to a person or
|
|
200
|
+
* embedding in your own app. The token rides in the URL fragment, so it never
|
|
201
|
+
* reaches a server log or Referer header. `control: true` lets whoever opens
|
|
202
|
+
* it take over and act in the browser; otherwise it is view-only. The link
|
|
203
|
+
* expires (default one hour) and is revocable with `revokeShare(id)`.
|
|
204
|
+
*
|
|
205
|
+
* The credential is scoped to this one browser: it cannot see or touch the
|
|
206
|
+
* rest of your project. Anyone holding the link has that access until it
|
|
207
|
+
* expires or you revoke it, so treat it like a password.
|
|
208
|
+
*/
|
|
209
|
+
async shareUrl({ control = false, expiresInSeconds = 3600 } = {}) {
|
|
210
|
+
const c = await this.http.request(
|
|
211
|
+
"POST",
|
|
212
|
+
`/api/control/sessions/${encodeURIComponent(this.id)}/share`,
|
|
213
|
+
{ control, expiresIn: expiresInSeconds }
|
|
214
|
+
);
|
|
215
|
+
return { url: `${this.http.baseUrl}/live/${encodeURIComponent(this.id)}#t=${encodeURIComponent(c.token)}`, id: c.id, expiresAt: c.expiresAt };
|
|
216
|
+
}
|
|
217
|
+
/** Revoke a link from `shareUrl()` before it expires, by the id it returned. */
|
|
218
|
+
async revokeShare(id) {
|
|
219
|
+
await this.http.request("DELETE", `/api/control/credentials/${encodeURIComponent(id)}`);
|
|
220
|
+
}
|
|
198
221
|
/** Counters, health and the last 50 things this browser did. */
|
|
199
222
|
status() {
|
|
200
223
|
return this.http.request("GET", `/api/browsers/${this.id}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oya-ai/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.71",
|
|
4
4
|
"description": "Command line for the Oya browser control plane.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://browser.getoya.ai",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@oya-ai/browser": "1.0.
|
|
42
|
+
"@oya-ai/browser": "1.0.71",
|
|
43
43
|
"@types/node": "^20.19.43",
|
|
44
44
|
"tsup": "^8.0.0",
|
|
45
45
|
"typescript": "^5.4.0"
|