phirepass-widgets 0.0.114 → 0.0.115
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/cjs/loader.cjs.js +1 -1
- package/dist/cjs/phirepass-downloader_3.cjs.entry.js +133 -38
- package/dist/cjs/phirepass-rdp.cjs.entry.js +1 -1
- package/dist/cjs/phirepass-terminal.cjs.entry.js +2 -2
- package/dist/cjs/phirepass-widgets.cjs.js +1 -1
- package/dist/collection/components/phirepass-downloader/jobs.js +22 -2
- package/dist/collection/components/phirepass-downloader/views/icons.js +1 -0
- package/dist/collection/components/phirepass-media-player/phirepass-media-player.css +9 -0
- package/dist/collection/components/phirepass-media-player/phirepass-media-player.js +79 -3
- package/dist/collection/components/phirepass-media-player/player.js +24 -0
- package/dist/collection/components/phirepass-rdp/phirepass-rdp.js +1 -1
- package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.js +33 -33
- package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +2 -2
- package/dist/components/p-DIf-Ru26.js +1 -0
- package/dist/components/p-DqT-qhTU.js +1 -0
- package/dist/components/phirepass-downloader.js +1 -1
- package/dist/components/phirepass-media-player.js +1 -1
- package/dist/components/phirepass-rdp.js +1 -1
- package/dist/components/phirepass-sftp-client.js +1 -1
- package/dist/components/phirepass-terminal.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/phirepass-downloader_3.entry.js +133 -38
- package/dist/esm/phirepass-rdp.entry.js +1 -1
- package/dist/esm/phirepass-terminal.entry.js +2 -2
- package/dist/esm/phirepass-widgets.js +1 -1
- package/dist/phirepass-widgets/{p-a4a5e5f5.entry.js → p-2fd32ec5.entry.js} +1 -1
- package/dist/phirepass-widgets/{p-a5ce104d.entry.js → p-705501d4.entry.js} +1 -1
- package/dist/phirepass-widgets/p-b8caf9e1.entry.js +1 -0
- package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
- package/dist/types/components/phirepass-downloader/jobs.d.ts +7 -0
- package/dist/types/components/phirepass-media-player/phirepass-media-player.d.ts +16 -1
- package/dist/types/components/phirepass-media-player/player.d.ts +10 -0
- package/dist/types/components.d.ts +10 -2
- package/package.json +4 -4
- package/dist/components/p-C4cmk3bS.js +0 -1
- package/dist/components/p-CKnb-oeB.js +0 -1
- package/dist/phirepass-widgets/p-97d84225.entry.js +0 -1
|
@@ -29,10 +29,22 @@ export function applyProgress(prev, job) {
|
|
|
29
29
|
return { jobs, completed, first: !before };
|
|
30
30
|
}
|
|
31
31
|
const ACTIVE_STATES = new Set(['Queued', 'Scheduled', 'Resolving', 'FetchingMetadata', 'Downloading', 'Verifying', 'Paused', 'Stopped', 'Unknown']);
|
|
32
|
+
/**
|
|
33
|
+
* A finished torrent whose seeding was stopped. Its files are whole and
|
|
34
|
+
* Resume seeds again, so it stays with the finished rows. The agent keeps
|
|
35
|
+
* `seeding_since` through a Stop, which is what tells it apart from a
|
|
36
|
+
* download stopped half-way.
|
|
37
|
+
*/
|
|
38
|
+
export function isPausedSeeding(row) {
|
|
39
|
+
return row.state === 'Stopped' && row.kind === 'Torrent' && !!row.seeding_since;
|
|
40
|
+
}
|
|
32
41
|
export function tabOf(row) {
|
|
33
42
|
if (row.state === 'Retrying') {
|
|
34
43
|
return 'retrying';
|
|
35
44
|
}
|
|
45
|
+
if (isPausedSeeding(row)) {
|
|
46
|
+
return 'finished';
|
|
47
|
+
}
|
|
36
48
|
if (ACTIVE_STATES.has(row.state)) {
|
|
37
49
|
return 'active';
|
|
38
50
|
}
|
|
@@ -118,7 +130,9 @@ export function playCheck(row) {
|
|
|
118
130
|
if (row.in_order) {
|
|
119
131
|
return { play: true, file, switchToInOrder: false };
|
|
120
132
|
}
|
|
121
|
-
|
|
133
|
+
// Paused seeding has nothing left to download, so switching the order
|
|
134
|
+
// would change nothing.
|
|
135
|
+
return { play: false, file: null, switchToInOrder: row.kind === 'Torrent' && !isPausedSeeding(row) };
|
|
122
136
|
}
|
|
123
137
|
export function streamUrl(base, nodeId, downloadId, fileIndex) {
|
|
124
138
|
return `${base.replace(/\/+$/, '')}/api/web/stream/${encodeURIComponent(nodeId)}/${encodeURIComponent(downloadId)}/${fileIndex}`;
|
|
@@ -167,7 +181,7 @@ export function statePill(row) {
|
|
|
167
181
|
case 'Completed':
|
|
168
182
|
return { text: 'Completed', tone: 'ok' };
|
|
169
183
|
case 'Stopped':
|
|
170
|
-
return { text: 'Stopped', tone: 'ps' };
|
|
184
|
+
return { text: isPausedSeeding(row) ? 'Seeding paused' : 'Stopped', tone: 'ps' };
|
|
171
185
|
case 'Cancelled':
|
|
172
186
|
return { text: 'Cancelled', tone: 'err' };
|
|
173
187
|
default:
|
|
@@ -281,6 +295,12 @@ export function statsLine(row, ctx = {}) {
|
|
|
281
295
|
break;
|
|
282
296
|
}
|
|
283
297
|
case 'Stopped':
|
|
298
|
+
if (isPausedSeeding(row)) {
|
|
299
|
+
push(`${formatBytes(row.up_total)} uploaded`);
|
|
300
|
+
push(row.reason ?? 'Seeding paused by you');
|
|
301
|
+
push('Resume shares it again');
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
284
304
|
push(pct, { strong: true });
|
|
285
305
|
push(row.reason ?? 'Stopped by you');
|
|
286
306
|
push('Resume continues from here');
|
|
@@ -22,6 +22,7 @@ const paths = {
|
|
|
22
22
|
lock: () => [h("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2" }), h("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })],
|
|
23
23
|
signal: () => [h("path", { d: "M2 20h.01M7 20v-4M12 20v-8M17 20V8M22 4v16" })],
|
|
24
24
|
plus: () => [h("path", { d: "M12 5v14M5 12h14" })],
|
|
25
|
+
link: () => [h("path", { d: "M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.7 1.7" }), h("path", { d: "M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.7-1.7" })],
|
|
25
26
|
};
|
|
26
27
|
const filled = {
|
|
27
28
|
pause: () => [h("rect", { x: "6", y: "5", width: "4", height: "14", rx: "1" }), h("rect", { x: "14", y: "5", width: "4", height: "14", rx: "1" })],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
import { formatBytes, formatClock, formatDay } from "../phirepass-downloader/format";
|
|
3
3
|
import { Icon } from "../phirepass-downloader/views/icons";
|
|
4
|
-
import { SAVE_EVERY_MS, castBlocker, isAudio, localPositionStore, positionAction } from "./player";
|
|
4
|
+
import { SAVE_EVERY_MS, castBlocker, fetchLinkMinter, isAudio, localPositionStore, positionAction } from "./player";
|
|
5
5
|
/**
|
|
6
6
|
* Plays a file from the node with the browser's own `<video>` or `<audio>`.
|
|
7
7
|
*
|
|
@@ -40,12 +40,17 @@ export class PhirepassMediaPlayer {
|
|
|
40
40
|
positionKey;
|
|
41
41
|
/** Stands in for `video.remote`, for demos and tests (like `channelFactory`). */
|
|
42
42
|
remotePlayback;
|
|
43
|
+
/** Makes the link a TV or VLC opens (T2.9). Defaults to POSTing `src`. */
|
|
44
|
+
linkMinter;
|
|
43
45
|
/** Shown while casting, when the host knows the device's name. */
|
|
44
46
|
castDevice;
|
|
45
47
|
playerClose;
|
|
46
48
|
phase = 'buffering';
|
|
47
49
|
stored = null;
|
|
48
50
|
castAvailable = false;
|
|
51
|
+
/** The ticket URL the element plays from once casting was asked for. */
|
|
52
|
+
castSrc = null;
|
|
53
|
+
linkNote = null;
|
|
49
54
|
currentTime = 0;
|
|
50
55
|
duration = 0;
|
|
51
56
|
get store() {
|
|
@@ -79,6 +84,7 @@ export class PhirepassMediaPlayer {
|
|
|
79
84
|
}
|
|
80
85
|
}
|
|
81
86
|
onSrc() {
|
|
87
|
+
this.castSrc = null;
|
|
82
88
|
this.everPlayed = false;
|
|
83
89
|
this.phase = 'buffering';
|
|
84
90
|
}
|
|
@@ -88,6 +94,50 @@ export class PhirepassMediaPlayer {
|
|
|
88
94
|
this.media?.pause?.();
|
|
89
95
|
this.playerClose.emit();
|
|
90
96
|
}
|
|
97
|
+
get minter() {
|
|
98
|
+
return this.linkMinter ?? fetchLinkMinter();
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The TV fetches the file itself and has no cookie, so the element first
|
|
102
|
+
* moves to a ticket URL (same bytes, same position), then the device picker
|
|
103
|
+
* opens. A ticket that cannot be had still opens the picker: on a
|
|
104
|
+
* development stack the plain URL plays.
|
|
105
|
+
*/
|
|
106
|
+
async cast() {
|
|
107
|
+
if (!this.castSrc) {
|
|
108
|
+
const url = await this.minter(this.src);
|
|
109
|
+
const media = this.media;
|
|
110
|
+
if (url && media) {
|
|
111
|
+
const at = media.currentTime;
|
|
112
|
+
const playing = !media.paused;
|
|
113
|
+
this.castSrc = url;
|
|
114
|
+
media.src = url;
|
|
115
|
+
this.resumeAt = at;
|
|
116
|
+
if (at > 0) {
|
|
117
|
+
media.currentTime = at;
|
|
118
|
+
}
|
|
119
|
+
if (playing) {
|
|
120
|
+
void media.play?.()?.catch?.(() => undefined);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
await this.remote()?.prompt().catch(() => undefined);
|
|
125
|
+
}
|
|
126
|
+
/** “Copy link for VLC”: the same ticket, on the clipboard. */
|
|
127
|
+
async copyLink() {
|
|
128
|
+
const url = this.castSrc ?? (await this.minter(this.src));
|
|
129
|
+
if (!url) {
|
|
130
|
+
this.linkNote = 'Could not make a link.';
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
try {
|
|
134
|
+
await navigator.clipboard.writeText(url);
|
|
135
|
+
this.linkNote = 'Link copied. It works in VLC until it expires.';
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
this.linkNote = url;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
91
141
|
remote() {
|
|
92
142
|
return this.remotePlayback ?? this.media?.remote;
|
|
93
143
|
}
|
|
@@ -184,7 +234,7 @@ export class PhirepassMediaPlayer {
|
|
|
184
234
|
const hideMedia = this.phase === 'prompt' || this.phase === 'unsupported' || this.phase === 'stopped' || this.phase === 'casting';
|
|
185
235
|
const common = {
|
|
186
236
|
ref: (el) => this.bindMedia(el),
|
|
187
|
-
src: this.src,
|
|
237
|
+
src: this.castSrc ?? this.src,
|
|
188
238
|
controls: true,
|
|
189
239
|
// Play was pressed to get here; a stored position asks first (G6).
|
|
190
240
|
preload: this.phase === 'prompt' ? 'metadata' : 'auto',
|
|
@@ -216,7 +266,7 @@ export class PhirepassMediaPlayer {
|
|
|
216
266
|
onPause: () => void this.savePosition(true),
|
|
217
267
|
onError: () => this.onError(),
|
|
218
268
|
};
|
|
219
|
-
return (h(Host, { key: '
|
|
269
|
+
return (h(Host, { key: '2a0961d6bb91d0d28c516e42b11c8988a7721c99', class: { audio } }, h("header", { key: 'c2339f0ca216eb347a09c9be77df877a54cf8b47', class: "bar" }, h("span", { key: 'ae5b874219ff03c803febb079027549ee68751b6', class: "nm", title: this.name }, this.name), this.status && h("span", { key: '09ccaae203ecb0c205bd2e4b1ac9fc2f5d9b22a1', class: "pill" }, this.status), h("span", { key: '7304adbb0b50a3bcf8c4783f3444029f97e84fa9', class: "sp" }), !audio && (this.castAvailable || blocked) && (h("button", { key: '5c2b9d5d36ae0fd723d81da54e8e4acbf79a39d0', type: "button", class: "ib", disabled: !!blocked, title: blocked ?? 'Cast', "aria-label": blocked ? `Cast unavailable: ${blocked}` : 'Cast', onClick: () => void this.cast() }, h(Icon, { key: 'f45d71a1a5b1144376b6360812185dcbc7e5e57f', name: "cast", size: 15 }))), h("button", { key: '71964d197aee9de089f895fd0c017e1e4e04297a', type: "button", class: "ib", title: "Copy link for VLC", "aria-label": "Copy link for VLC", onClick: () => void this.copyLink() }, h(Icon, { key: '643d026d4dd85cad24e1e6b01dcba1bfda956825', name: "link", size: 15 })), !audio && airplay && (h("button", { key: 'a42d75246d807366e427b660062b47cc03890fac', type: "button", class: "ib", title: "AirPlay", "aria-label": "AirPlay", onClick: () => this.media.webkitShowPlaybackTargetPicker() }, h(Icon, { key: '21c9dc4e3ea560f72d230b017f2f73314ae17ef4', name: "cast", size: 15 }))), h("button", { key: 'f1413cec5dceb9f1dfe9b0470d3784ccaf20d08a', type: "button", class: "ib", "aria-label": "Close player", title: "Close", onClick: () => void this.close() }, h(Icon, { key: '707e719e7608edbad68185c8071ab90e2da614d4', name: "x", size: 14 }))), h("div", { key: '51673733f9cd732cfe5f1b9406ddec3787ba0e6c', class: { stage: true, audio }, "data-phase": this.phase }, audio ? h("audio", { ...common }) : h("video", { ...common }), this.renderStage()), this.linkNote && (h("p", { key: 'bd2db764da4183f67d1589a8be5aa4e8e7df76f3', class: "link-note", role: "status" }, this.linkNote))));
|
|
220
270
|
}
|
|
221
271
|
static get is() { return "phirepass-media-player"; }
|
|
222
272
|
static get encapsulation() { return "shadow"; }
|
|
@@ -394,6 +444,30 @@ export class PhirepassMediaPlayer {
|
|
|
394
444
|
"getter": false,
|
|
395
445
|
"setter": false
|
|
396
446
|
},
|
|
447
|
+
"linkMinter": {
|
|
448
|
+
"type": "unknown",
|
|
449
|
+
"mutable": false,
|
|
450
|
+
"complexType": {
|
|
451
|
+
"original": "LinkMinter",
|
|
452
|
+
"resolved": "(src: string) => Promise<string>",
|
|
453
|
+
"references": {
|
|
454
|
+
"LinkMinter": {
|
|
455
|
+
"location": "import",
|
|
456
|
+
"path": "./player",
|
|
457
|
+
"id": "src/components/phirepass-media-player/player.ts::LinkMinter",
|
|
458
|
+
"referenceLocation": "LinkMinter"
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
"required": false,
|
|
463
|
+
"optional": true,
|
|
464
|
+
"docs": {
|
|
465
|
+
"tags": [],
|
|
466
|
+
"text": "Makes the link a TV or VLC opens (T2.9). Defaults to POSTing `src`."
|
|
467
|
+
},
|
|
468
|
+
"getter": false,
|
|
469
|
+
"setter": false
|
|
470
|
+
},
|
|
397
471
|
"castDevice": {
|
|
398
472
|
"type": "string",
|
|
399
473
|
"mutable": false,
|
|
@@ -420,6 +494,8 @@ export class PhirepassMediaPlayer {
|
|
|
420
494
|
"phase": {},
|
|
421
495
|
"stored": {},
|
|
422
496
|
"castAvailable": {},
|
|
497
|
+
"castSrc": {},
|
|
498
|
+
"linkNote": {},
|
|
423
499
|
"currentTime": {},
|
|
424
500
|
"duration": {}
|
|
425
501
|
};
|
|
@@ -40,6 +40,30 @@ export function castBlocker(name, mime) {
|
|
|
40
40
|
}
|
|
41
41
|
return null;
|
|
42
42
|
}
|
|
43
|
+
/** `src` with its ticket, absolute, since it leaves this page. */
|
|
44
|
+
export function ticketUrl(src, ticket, base = globalThis.location?.href) {
|
|
45
|
+
// An invalid base throws even for an absolute src, so it is used only
|
|
46
|
+
// when src needs one.
|
|
47
|
+
const url = /^[a-z][a-z0-9+.-]*:/i.test(src) ? new URL(src) : new URL(src, base);
|
|
48
|
+
url.searchParams.set('ticket', ticket);
|
|
49
|
+
return url.href;
|
|
50
|
+
}
|
|
51
|
+
/** POSTs the stream URL with the session cookie; the server answers `{ ticket }`. */
|
|
52
|
+
export function fetchLinkMinter(fetcher = (input, init) => fetch(input, init)) {
|
|
53
|
+
return async (src) => {
|
|
54
|
+
try {
|
|
55
|
+
const res = await fetcher(src, { method: 'POST', credentials: 'include' });
|
|
56
|
+
if (!res.ok) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const body = (await res.json());
|
|
60
|
+
return typeof body.ticket === 'string' && body.ticket ? ticketUrl(src, body.ticket) : null;
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
43
67
|
/** Nothing is saved in the first 30 seconds. */
|
|
44
68
|
export const SAVE_AFTER_SECS = 30;
|
|
45
69
|
export const SAVE_EVERY_MS = 10_000;
|
|
@@ -537,7 +537,7 @@ export class PhirepassRdp {
|
|
|
537
537
|
this.request_tunnel();
|
|
538
538
|
}
|
|
539
539
|
render() {
|
|
540
|
-
return (h(Host, { key: '
|
|
540
|
+
return (h(Host, { key: '9db127da5dbe168ef5f7a021767e5cedeb8305e6' }, h("div", { key: '06d2de6763ec479198389032ab65033eefab21d6', class: "screen", ref: (el) => (this.containerEl = el) }, h("slot", { key: '7842ca9fd64795794e1b90e15319ddaa599f85b8' })), this.credentialsPrompt && (h("form", { key: 'ce53830ced182740f139a318f099918c31013d9f', class: "prompt", onSubmit: (event) => this.submit_credentials(event) }, h("label", { key: '2b55341b9cfc2e08a847e26985000f5e1bc86eca', htmlFor: "rdp-username" }, "Username"), h("input", { key: '243500ff59de6f16cc67acc5ddf9e15e3c0de0f6', id: "rdp-username", type: "text", autocomplete: "off", autofocus: true, onInput: (event) => (this.usernameBuffer = event.target.value) }), h("label", { key: '5a346aa6a730c4cb0dd550eab9a65db9f2e74bc6', htmlFor: "rdp-password" }, "Password"), h("input", { key: '0f1081b05f94e15a7f04df4de390a33a021ffe53', id: "rdp-password", type: "password", autocomplete: "off", onInput: (event) => (this.passwordBuffer = event.target.value) }), h("button", { key: 'e9657c9df124176210508f5125fc526e3c78c5f1', type: "submit" }, "Connect"))), this.statusMessage && !this.credentialsPrompt && (h("div", { key: '3c59dbae63b7c5c5ef80344abad4b1a2b4c0b79d', class: "status" }, this.statusMessage))));
|
|
541
541
|
}
|
|
542
542
|
static get is() { return "phirepass-rdp"; }
|
|
543
543
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1467,11 +1467,11 @@ export class PhirepassSftpClient {
|
|
|
1467
1467
|
return `${typeChar}${chars.join('')}`;
|
|
1468
1468
|
}
|
|
1469
1469
|
render() {
|
|
1470
|
-
return (h(Host, { key: '
|
|
1470
|
+
return (h(Host, { key: 'c8a576625404b5653c066c2844160c40cff71603', class: {
|
|
1471
1471
|
'default': !this.max,
|
|
1472
1472
|
'max': this.max,
|
|
1473
|
-
} }, h("section", { key: '
|
|
1474
|
-
h("header", { key: '
|
|
1473
|
+
} }, h("section", { key: '87cc1357c8cba09dc857ac0035d701ee46f72ad3', class: "listing" }, !this.hideHeader &&
|
|
1474
|
+
h("header", { key: 'f034a4a4d6498c8f813174566ce7ff258f6d98fb' }, h("section", { key: 'ce24941dbd0beffe42d5fa6bad89542d25e57ff8', class: "title" }, h("img", { key: '808e0b3f448e15ceb5a7daccce98f9314eb5b758', src: svg, alt: "SFTP Client" }), h("div", { key: '4b4e8244a97167010abc5ba2a518f9c7fd465b39', class: "text" }, h("div", { key: 'dc32511596fb480ef7fb280941b9de8099b5ff05', class: "name" }, this.name), h("div", { key: 'fc477ea5670b74c40f4af20022dac4f02bc8b96c', class: "description" }, this.description))), h("section", { key: '35beb6cd84dea257e428cca3338db239eed37cdb', class: "actions" }, h("div", { key: '7adecc9ecb0a24721fcf6e82f73b58d38946801e', class: "action", onClick: () => this.toggle_max() }, h("img", { key: 'e63674064553d3809a1d563bbe6fc83ad0aceb80', src: max, alt: "Maximize" })))), h("main", { key: '4bef9055a683d18e391c2620ba2351282a1165ca' }, this.show_navigation && h("nav", { key: 'e08ac22ec258e081195785661907d170b86bd83d', class: "navigation" }, h("div", { key: '026e32148d4062a7e6be2b58192676dc0102e2dd', class: "breadcrumbs" }, this.breadcrumbs.map((crumb, index, breadcrumbs) => (h("span", { key: index, class: "breadcrumb-container" }, h("span", { key: index, onClick: () => this.list_breadcrumb(crumb.path), class: "breadcrumb" }, crumb.label), index < breadcrumbs.length - 1 && h("img", { class: "arrow", src: chevron }))))), h("section", { key: '04f0111d530f2cb9a64bb0557b72820bd13832bf', class: "actions", "aria-label": "SFTP actions" }, h("input", { key: 'fb28f1861a4dd9c83aaa4a20a5d25dde3e6337c7', class: "filter", type: "search", autocorrect: "off", autocapitalize: "none", autoComplete: "off", placeholder: "Filter", "aria-label": "Filter this directory", value: this.filter, onInput: (event) => this.filter = event.target.value }), h("button", { key: '5e173f8426eee17b08b05547e9ba033746a5a84a', type: "button", class: "action", onClick: () => this.go_to_parent_directory(), title: "Go to parent directory", "aria-label": "Go to parent directory" }, h("img", { key: '64ed13f7093abc57f9b73638b902b160d11c1fd3', src: go_up, alt: "Go up" })), h("button", { key: 'e6a7d97bc089f3b023d06213852aec8e5cd83d18', type: "button", class: "action", onClick: () => this.refresh_directory(), title: "Refresh", "aria-label": "Refresh" }, h("img", { key: '66590858743453d7fc0fbb578e98da2a8bc762d5', src: refresh, alt: "Refresh" })), h("button", { key: '8eca55beb0377394da8fae85546b25ee74c0f6f9', type: "button", class: "action", onClick: () => this.open_mkdir(), title: "New folder", "aria-label": "New folder" }, h("svg", { key: '12d1fc50a9e325a1214462f2a06d734ab38ff1c1', xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { key: '7148c12cc461d1778ccfb3e3129786655f780dc2', d: "M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" }), h("line", { key: 'a5701765411cff983baa1c4248a383c3a3a9dca6', x1: "12", x2: "12", y1: "10", y2: "16" }), h("line", { key: '9c22835c4279619e8c8cd130007d07ed19795366', x1: "9", x2: "15", y1: "13", y2: "13" }))), this.fetch_enabled() && h(FetchButton, { key: '259d3c2e7bdadac5d1ed77724628459e6c440e09', count: this.fetch_count, onClick: () => void this.downloaderEl?.openFetch(this.current_dir) }), h("button", { key: 'f744681697e23f2f2892a01b625490fc66999592', type: "button", class: "action", onClick: () => this.open_upload_picker(), title: "Upload", "aria-label": "Upload" }, h("img", { key: 'bcb2e3f7c283f4213b0a27cb97afd3e61f8d954e', src: upload, alt: "Upload" })), h("button", { key: '5348bc25576e559e7b2f05ec6378fe72fc8483f5', type: "button", class: "action disconnect", onClick: () => this.disconnect_session(), title: "Disconnect", "aria-label": "Disconnect" }, "DISCONNECT"))), h("input", { key: '7daf75741416f3aeb759ddc6c94106167291d641', type: "file", ref: (el) => this.uploadInputEl = el, onChange: (event) => this.on_upload_selected(event), style: { display: 'none' } }), this.show_content && h("div", { key: 'e384c122d7454b16d13066a7cc6f7f3aa1414feb', class: "content", tabindex: 0, onKeyDown: (event) => this.on_listing_keydown(event) }, h("table", { key: 'bd1b14b317290eb59cb867a2bfbf23fb63b2fa94' }, h("thead", { key: 'c414438b0e8f2a776643bdaaf6441b01ed7c3be3' }, h("tr", { key: 'fd7d0947644aa0e0eb93d56dfacb8fe545c805f3' }, h("th", { key: '8e62f0daaaad938db61b85586aeb138844877ebe', class: "sortable", onClick: () => this.toggle_sort('name'), title: "Sort by name" }, "Name", this.sort_indicator('name')), h("th", { key: 'f2d3e287c8f0f97e23c173c10393d0eec4e4a752', class: "sortable", onClick: () => this.toggle_sort('size'), title: "Sort by size" }, "Size", this.sort_indicator('size')), h("th", { key: 'd62906a8dd76c22cfcf2c7a82d37ffe8ac3582ba' }, "Permissions"), h("th", { key: 'd5ce78f188629f956704a70a8d2280a1db945666' }, "Owner"), h("th", { key: '42d52536f0c5daa29af06c892c5ca3f79b888216', class: "sortable", onClick: () => this.toggle_sort('modified'), title: "Sort by modified date" }, "Modified", this.sort_indicator('modified')), h("th", { key: '4b80527286d771950be9219387fb938e92f07b63', class: "action-col", "aria-label": "Actions" }))), h("tbody", { key: '1959c3f04257c8c1a2e93b4717a6eef9a7999437' }, this.visible_listing().map((item, index) => (h("tr", { key: index, class: {
|
|
1475
1475
|
'selected': this.is_selected(item),
|
|
1476
1476
|
'part': item.kind === 'File' && isPartFile(item.name),
|
|
1477
1477
|
'fresh': item.kind === 'File' && this.fresh_names.includes(item.name),
|
|
@@ -1479,12 +1479,12 @@ export class PhirepassSftpClient {
|
|
|
1479
1479
|
h("button", { type: "button", class: "file-action", onClick: (event) => void this.play_listing_file(item, event), title: "Play", "aria-label": `Play ${item.name}` }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true" }, h("path", { d: "M7 5v14l12-7z" }))), item.kind === 'File' &&
|
|
1480
1480
|
h("button", { type: "button", class: "file-action", onClick: (event) => this.on_edit_action(item, event), title: "Edit", "aria-label": `Edit ${item.name}` }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }), h("path", { d: "M18.5 2.5a2.12 2.12 0 0 1 3 3L12 15l-4 1 1-4Z" }))), item.kind === 'File' &&
|
|
1481
1481
|
h("button", { type: "button", class: "file-action", onClick: (event) => this.on_file_row_action(item, event), title: "Download", "aria-label": `Download ${item.name}` }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), h("polyline", { points: "7 10 12 15 17 10" }), h("line", { x1: "12", x2: "12", y1: "15", y2: "3" }))), h("button", { type: "button", class: "file-action", onClick: (event) => this.on_rename_action(item, event), title: "Rename", "aria-label": `Rename ${item.name}` }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M12 20h9" }), h("path", { d: "M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z" }))), h("button", { type: "button", class: "file-action", onClick: (event) => this.on_chmod_action(item, event), title: "Permissions", "aria-label": `Change permissions on ${item.name}` }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }), h("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" }))), h("button", { type: "button", class: "file-action delete", onClick: (event) => this.on_file_delete_action(item, event), title: "Delete", "aria-label": `Delete ${item.name}` }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("polyline", { points: "3 6 5 6 21 6" }), h("path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }), h("path", { d: "M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" }), h("line", { x1: "10", x2: "10", y1: "11", y2: "17" }), h("line", { x1: "14", x2: "14", y1: "11", y2: "17" })))))))), this.visible_listing().length === 0 &&
|
|
1482
|
-
h("tr", { key: '
|
|
1483
|
-
h("phirepass-downloader", { key: '
|
|
1484
|
-
h("section", { key: '
|
|
1482
|
+
h("tr", { key: '94619eb9cf5506a57c6d085ac6b91d41b7770553', class: "empty" }, h("td", { key: '87161e6091cf501364eda0d0b1072a937f8c9946', colSpan: 6 }, this.filter ? `Nothing here matches "${this.filter}".` : 'This directory is empty.'))))), this.show_loader && h("div", { key: 'db0f871976de1f36a72fa947441e0fb1f6051438', class: "loader" }, "Loading..."), this.show_error && h("div", { key: '8870f437cfe246be74479d98f0a0d5a2bc72f781', class: "error" }, this.error_message)), this.fetch_enabled() &&
|
|
1483
|
+
h("phirepass-downloader", { key: '917af582cad03523807ef641710f85bd74bb317e', ref: (el) => this.downloaderEl = el, compact: true, channel: this.channel, connected: this.channel_ready, nodeId: this.nodeId, browsingService: this.serviceId, browsingPath: this.current_dir, streamBase: this.stream_base(), onPhirepassActiveCount: (event) => this.fetch_count = event.detail.n, onPhirepassFetchCompleted: (event) => this.on_fetch_completed(event.detail), onPhirepassShowInFolder: (event) => this.on_show_in_folder(event.detail) }), h("footer", { key: 'ff3c726b1762ca1789b1f3cd795613d9e64ec445' }, h("section", { key: '47e1cbc5a79ee62355136341add2b67456d1a462', class: "status" }, this.status, this.selected_item && h("span", { key: 'c828889045b7d0cca91ce0703a577f9a35a708e0', class: "selected-item" }, this.selected_item.name)), h("section", { key: '9e16fe486979999adadd80483542709570a5992d', class: "version" }, this.version ? `Version: ${this.version}` : ''))), this.show_login_screen &&
|
|
1484
|
+
h("section", { key: '4da9c7934d550538c3bd488c7ad455af30ff4e00', class: {
|
|
1485
1485
|
'creds': true,
|
|
1486
1486
|
'blurred': this.show_login_screen,
|
|
1487
|
-
} }, h("form", { key: '
|
|
1487
|
+
} }, h("form", { key: '576cc82e5cd90978039e1e644af04194485b86d6', class: "auth", onSubmit: (event) => {
|
|
1488
1488
|
const formData = new FormData(event.target);
|
|
1489
1489
|
let username = undefined;
|
|
1490
1490
|
if (this.show_login_screen_username) {
|
|
@@ -1501,58 +1501,58 @@ export class PhirepassSftpClient {
|
|
|
1501
1501
|
this.show_loader = true;
|
|
1502
1502
|
event.stopPropagation();
|
|
1503
1503
|
event.preventDefault();
|
|
1504
|
-
} }, h("div", { key: '
|
|
1505
|
-
h("div", { key: '
|
|
1506
|
-
h("div", { key: '
|
|
1507
|
-
h("section", { key: '
|
|
1504
|
+
} }, h("div", { key: '27098f0a63b4ceddd4e0bf0d84b3b3f321a3f512', class: "title" }, "SFTP Connection"), this.show_login_screen_username &&
|
|
1505
|
+
h("div", { key: '2714b5b014572d4f58523ddb79bde232bf9b65f1' }, h("label", { key: '8f0c73f148cc08fc8db445cd99fbab060807fe12', htmlFor: "username" }, "Username"), h("input", { key: 'c64fd60eb284e8a77d0943380cb3fcbacbc333fa', autocorrect: "off", autocapitalize: "none", autoComplete: "off", id: "username", name: "username", type: "text", placeholder: "" })), this.show_login_screen_password &&
|
|
1506
|
+
h("div", { key: '2d84bbacefcb3b4ba84a9b8ce74bd662fa62c8b3' }, h("label", { key: '0ce1b8309229d45ab0f54d5e2de1e40b3fab57f0', htmlFor: "password" }, "Password"), h("input", { key: '5752cbe6e72c332be94c0b9a813a66526ab06f3c', autocorrect: "off", autocapitalize: "none", autoComplete: "off", id: "password", name: "password", type: "password", placeholder: "" })), h("div", { key: 'e272596a07a758d008a90a2c2290e589feeb8b3f' }, h("button", { key: '5ddb365a8b700a8d5051539bed3c9aafef20a099', type: "submit" }, "Connect")))), this.show_upload_modal &&
|
|
1507
|
+
h("section", { key: 'b4314fc5bb3ace26757d690ff4113954144362f6', class: {
|
|
1508
1508
|
'upload-modal': true,
|
|
1509
1509
|
'visible': this.show_upload_modal,
|
|
1510
|
-
} }, h("div", { key: '
|
|
1510
|
+
} }, h("div", { key: '8d152c11c9c27528b667199e6cd66e7129506be6', class: "upload-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Upload progress" }, h("div", { key: '703aa9f78b0248f026ae168d95db2aaaea65a6ce', class: "title" }, "Uploading File"), h("div", { key: '8e9bceaea052b871b2b6700684384515260c864c', class: "file-name", title: this.upload_file_name }, this.upload_file_name), h("div", { key: '0c3f7be58a562e339dea87904297d0407bddb289', class: "progress-track", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": this.upload_progress }, h("div", { key: 'e003866966bdae3af7e9321b288dd23424491a16', class: "progress-fill", style: { width: `${this.upload_progress}%` } })), h("div", { key: 'ac5e45111e0d694b09c4af709378e827288ad418', class: "progress-meta" }, h("div", { key: '63e5c77d6af531e49fe9817167d945fc6e80e1be', class: "progress-speed" }, this.upload_speed), h("div", { key: '369628aa1ba577c4a4a9fa13930985716830b993', class: "progress-value" }, this.format_percent(this.upload_progress))), h("button", { key: 'da4984bb0fc81d65a8f2876aa1aaba5dc8ea9da8', type: "button", class: {
|
|
1511
1511
|
'cancel': true,
|
|
1512
1512
|
'finished': this.upload_finished,
|
|
1513
1513
|
}, onClick: () => this.cancel_upload() }, this.upload_finished ? 'Close' : 'Cancel'))), this.show_download_modal &&
|
|
1514
|
-
h("section", { key: '
|
|
1514
|
+
h("section", { key: '88a14959b710af2dcced2fc37b7c404272571084', class: {
|
|
1515
1515
|
'download-modal': true,
|
|
1516
1516
|
'visible': this.show_download_modal,
|
|
1517
|
-
} }, h("div", { key: '
|
|
1517
|
+
} }, h("div", { key: '86bbc1dd32612e7b63c4af35b366fe0a74597ed9', class: "download-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Download progress" }, h("div", { key: '8c3edb4fc04ffaecb3fbd5b6d1aeab4211d7876c', class: "title" }, "Downloading File"), h("div", { key: '4815f43687f525c0b6f598e98f9df237a4253dd9', class: "file-name", title: this.download_file_name }, this.download_file_name), h("div", { key: '095ac5ffbcb3f4a1bfe5742232752baffb93308e', class: "progress-track", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": this.download_progress }, h("div", { key: '6a1f3d4ddbbda2c8a4069b59c7882ddcddee5b4d', class: "progress-fill", style: { width: `${this.download_progress}%` } })), h("div", { key: 'db52703f7105f26aa4234eb6b623524362ced064', class: "progress-meta" }, h("div", { key: 'a12b2578badf08fc272f3533db2fd93fa946a4b2', class: "progress-speed" }, this.download_speed), h("div", { key: '3b2b1d92c4534d6f7adf01d64a1593af504f98d0', class: "progress-value" }, this.format_percent(this.download_progress))), h("button", { key: 'f9a668ef58d9566ebaf66ad9219d619005294a6f', type: "button", class: {
|
|
1518
1518
|
'cancel': true,
|
|
1519
1519
|
'finished': this.download_finished,
|
|
1520
1520
|
}, onClick: () => this.cancel_download() }, this.download_finished ? 'Close' : 'Cancel'))), this.show_delete_modal &&
|
|
1521
|
-
h("section", { key: '
|
|
1521
|
+
h("section", { key: 'cbcf699a17d748a8a7fa3daf1d96f42e47847bd6', class: {
|
|
1522
1522
|
'delete-modal': true,
|
|
1523
1523
|
'visible': this.show_delete_modal,
|
|
1524
|
-
} }, h("div", { key: '
|
|
1524
|
+
} }, h("div", { key: '3ac99ddba7dc86a7712a4cbb1516254a62f88ef4', class: "delete-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Delete confirmation", tabindex: -1, onKeyDown: (event) => this.on_modal_keydown(event, () => this.cancel_delete()) }, h("div", { key: '5075e7e7fda69e6941980d3bb257b30bd61d1b03', class: "title" }, this.delete_is_dir ? 'Delete Folder' : 'Delete File'), h("div", { key: 'a9bc63a90afc0f56caccdda8c782abf761b06fa9', class: "message" }, this.delete_loading
|
|
1525
1525
|
? (this.delete_recursive ? 'Deleting the folder and everything in it...' : 'Deleting...')
|
|
1526
|
-
: `Are you sure you want to delete this ${this.delete_is_dir ? 'folder' : 'file'}?`), h("div", { key: '
|
|
1527
|
-
h("label", { key: '
|
|
1528
|
-
h("div", { class: "hint" }, "Without this, the remote refuses a folder that is not empty."), this.delete_error && h("div", { key: '
|
|
1529
|
-
h("div", { key: '
|
|
1530
|
-
h("section", { key: '
|
|
1526
|
+
: `Are you sure you want to delete this ${this.delete_is_dir ? 'folder' : 'file'}?`), h("div", { key: '50a72830064fc1352787d6ac761a13e8c6d2d5ce', class: "file-name", title: this.delete_file_name }, this.delete_file_name), this.delete_is_dir &&
|
|
1527
|
+
h("label", { key: '528ba9b17f186d54e98fa5abe26d649721880eab', class: "checkline" }, h("input", { key: '33dc78531ac4833e95460b93de7d211979a7973b', type: "checkbox", checked: this.delete_recursive, disabled: this.delete_loading, onChange: (event) => this.delete_recursive = event.target.checked }), h("span", { key: '68517a96007ba248bbcac1fffaae2b048c4aafaf' }, "Delete everything inside it too")), !this.delete_is_dir || this.delete_recursive ? null :
|
|
1528
|
+
h("div", { class: "hint" }, "Without this, the remote refuses a folder that is not empty."), this.delete_error && h("div", { key: 'fb0df28a4daa756166deec9dd18c0acae8874202', class: "dialog-error" }, this.delete_error), this.delete_loading &&
|
|
1529
|
+
h("div", { key: '114fcfea0367efd1f2df2d06beeba2013058ff73', class: "delete-loader", "aria-hidden": "true" }, h("span", { key: '2b07a71d733ba7606fa45f0d24548b2b63dcc798', class: "spinner" })), h("div", { key: '44cfc262272484fdbd41257c39457d42de6e1f29', class: "modal-actions" }, h("button", { key: '5035eb462279fb4e89036a34b5b5b64eee052706', type: "button", class: "btn secondary", onClick: () => this.cancel_delete(), disabled: this.delete_loading }, "Cancel"), h("button", { key: 'f16d9f97ce99691c0cfbbad16679bb1dc3affbc9', type: "button", class: "btn destructive", onClick: () => this.confirm_delete(), disabled: this.delete_loading }, this.delete_loading ? 'Deleting...' : 'Delete')))), this.prompt_kind &&
|
|
1530
|
+
h("section", { key: '8ee05b491fbc60b2fa9115fa7a88b60960e3326a', class: "prompt-modal visible" }, h("div", { key: '46622ceafa285047e2df9082251d7a02e38cb49f', class: "prompt-dialog", role: "dialog", "aria-modal": "true", "aria-label": this.prompt_kind === 'mkdir' ? 'New folder' : 'Rename', tabindex: -1, onKeyDown: (event) => this.on_modal_keydown(event, () => this.close_prompt()) }, h("div", { key: '1dce2a864f58590017238fc76810297190dc223f', class: "title" }, this.prompt_kind === 'mkdir' ? 'New Folder' : 'Rename'), h("div", { key: '556e931df541d9ca07a58882cf658572c23276fe', class: "message" }, this.prompt_kind === 'mkdir'
|
|
1531
1531
|
? `Create a folder in ${this.current_dir}`
|
|
1532
|
-
: 'Give it a new name. Existing names are not overwritten.'), h("form", { key: '
|
|
1533
|
-
h("section", { key: '
|
|
1532
|
+
: 'Give it a new name. Existing names are not overwritten.'), h("form", { key: 'b6a5807b0208576e15468912c48bcdc314cf2d41', onSubmit: (event) => { event.preventDefault(); event.stopPropagation(); void this.submit_prompt(); } }, h("input", { key: 'd7ad180a2b431046905f37ee8ba21e6933f8eb09', class: "dialog-input", type: "text", autocorrect: "off", autocapitalize: "none", autoComplete: "off", spellcheck: false, "aria-label": "Name", disabled: this.prompt_busy, value: this.prompt_value, onInput: (event) => this.prompt_value = event.target.value, ref: (el) => this.focus_once(el, this.promptInputEl, (kept) => this.promptInputEl = kept) }), this.prompt_error && h("div", { key: 'c0afc0bc34860b1c8bcfea5087d8afca425edf6a', class: "dialog-error" }, this.prompt_error), h("div", { key: '91899e1d57a82434cc859e7d90636bd9f1df2545', class: "modal-actions" }, h("button", { key: '24f1d359789dbd40e8d98ddf220acf2e5cdbb1e1', type: "button", class: "btn secondary", onClick: () => this.close_prompt(), disabled: this.prompt_busy }, "Cancel"), h("button", { key: '3a5ae8f5edbbe70c226d9ec01d204b0f276607cd', type: "submit", class: "btn primary", disabled: this.prompt_busy }, this.prompt_busy ? 'Working...' : (this.prompt_kind === 'mkdir' ? 'Create' : 'Rename')))))), this.chmod_target &&
|
|
1533
|
+
h("section", { key: '3f5daa368a81ae49fd074c33979fad6d9dc1e79f', class: "prompt-modal visible" }, h("div", { key: 'a2cfc7cbecbead9ccd977e74213c48ba47d5e0f7', class: "prompt-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Change permissions", tabindex: -1, onKeyDown: (event) => this.on_modal_keydown(event, () => this.close_chmod()) }, h("div", { key: '6db7c2771db3bf9dc4c16c506c95fbadc01b24d5', class: "title" }, "Permissions"), h("div", { key: 'c6fba2cffb84fd01ac51171ddedc140978652756', class: "file-name", title: this.chmod_target.name }, this.chmod_target.name), h("table", { key: 'fc871c448ad4ad75754256f0b4d9ce9e5188ea90', class: "perm-grid" }, h("thead", { key: 'b2de44bba7219257af5e16687f1f9e44b64429b8' }, h("tr", { key: 'b4e964c7281f8088385d1707df0c638b99c0e1e7' }, h("th", { key: 'a0bebfa92a96c6276a8c57bbd56555c1c8cacbd2', "aria-label": "Class" }), h("th", { key: 'c7618c92048861c4ee94d0fb8078c6dd719d9603' }, "Read"), h("th", { key: '23d0d6cbf7de82f337d4230e0286174a5fc6bd97' }, "Write"), h("th", { key: 'fbbe7fafe3aa03ed29db6038157167362c736f9c' }, "Execute"))), h("tbody", { key: '5468214c98eb5e6278cade8d46bcae62394d0205' }, [
|
|
1534
1534
|
{ label: 'Owner', read: 0o400, write: 0o200, exec: 0o100 },
|
|
1535
1535
|
{ label: 'Group', read: 0o040, write: 0o020, exec: 0o010 },
|
|
1536
1536
|
{ label: 'Other', read: 0o004, write: 0o002, exec: 0o001 },
|
|
1537
|
-
].map((row) => (h("tr", { key: row.label }, h("th", { scope: "row" }, row.label), [row.read, row.write, row.exec].map((bit) => (h("td", { key: bit }, h("input", { type: "checkbox", "aria-label": `${row.label} ${bit}`, disabled: this.chmod_busy, checked: (this.chmod_mode & bit) !== 0, onChange: () => this.toggle_chmod_bit(bit) }))))))))), h("div", { key: '
|
|
1537
|
+
].map((row) => (h("tr", { key: row.label }, h("th", { scope: "row" }, row.label), [row.read, row.write, row.exec].map((bit) => (h("td", { key: bit }, h("input", { type: "checkbox", "aria-label": `${row.label} ${bit}`, disabled: this.chmod_busy, checked: (this.chmod_mode & bit) !== 0, onChange: () => this.toggle_chmod_bit(bit) }))))))))), h("div", { key: '61a09c4521472a61f3f7e71fe651cb42f125ed81', class: "perm-special" }, [
|
|
1538
1538
|
{ label: 'setuid', bit: 0o4000 },
|
|
1539
1539
|
{ label: 'setgid', bit: 0o2000 },
|
|
1540
1540
|
{ label: 'sticky', bit: 0o1000 },
|
|
1541
|
-
].map((special) => (h("label", { key: special.label, class: "checkline" }, h("input", { type: "checkbox", disabled: this.chmod_busy, checked: (this.chmod_mode & special.bit) !== 0, onChange: () => this.toggle_chmod_bit(special.bit) }), h("span", null, special.label))))), h("div", { key: '
|
|
1542
|
-
h("section", { key: '
|
|
1541
|
+
].map((special) => (h("label", { key: special.label, class: "checkline" }, h("input", { type: "checkbox", disabled: this.chmod_busy, checked: (this.chmod_mode & special.bit) !== 0, onChange: () => this.toggle_chmod_bit(special.bit) }), h("span", null, special.label))))), h("div", { key: '49370f167cbe30ee221f6373d4261571b25be38b', class: "perm-octal" }, h("label", { key: 'f0b17a2ed4c59cbbaf02cd34cc847c773118faef', htmlFor: "chmod-octal" }, "Octal"), h("input", { key: '020ec6003d98553c663cceb92502f6391c60691b', id: "chmod-octal", class: "dialog-input", type: "text", autocorrect: "off", autocapitalize: "none", autoComplete: "off", spellcheck: false, maxlength: 4, disabled: this.chmod_busy, value: this.chmod_mode.toString(8).padStart(4, '0'), onInput: (event) => this.on_chmod_octal_input(event.target.value) }), h("span", { key: '4cc7a1cbe4ddfb565f44b5ef3fd116feb879b6c0', class: "perm-preview" }, this.format_permissions(this.chmod_mode, this.chmod_target.kind))), this.chmod_error && h("div", { key: '99cc2d982aef130ea75fa61765d17921186cc2fb', class: "dialog-error" }, this.chmod_error), h("div", { key: 'd5796750cfa9eb9304340bb9fd091eea7781f3cc', class: "modal-actions" }, h("button", { key: 'dffe3756b1b4e593ff71663e931df57d53c4a842', type: "button", class: "btn secondary", onClick: () => this.close_chmod(), disabled: this.chmod_busy }, "Cancel"), h("button", { key: 'cb30401112b8f500b49e6974dc67ae9065319539', type: "button", class: "btn primary", onClick: () => void this.submit_chmod(), disabled: this.chmod_busy }, this.chmod_busy ? 'Applying...' : 'Apply')))), this.show_editor &&
|
|
1542
|
+
h("section", { key: 'c9be5edfe1feea95ca51495503dc0c1c3b213d70', class: "editor-modal visible" }, h("div", { key: 'bf7c2aec8559b42017dc7142bc8a12f0fb4f1c39', class: "editor-dialog", role: "dialog", "aria-modal": "true", "aria-label": `Editing ${this.editor_name}`, tabindex: -1, onKeyDown: (event) => {
|
|
1543
1543
|
if ((event.ctrlKey || event.metaKey) && event.key === 's') {
|
|
1544
1544
|
event.preventDefault();
|
|
1545
1545
|
void this.save_editor();
|
|
1546
1546
|
return;
|
|
1547
1547
|
}
|
|
1548
1548
|
this.on_modal_keydown(event, () => this.close_editor());
|
|
1549
|
-
} }, h("div", { key: '
|
|
1549
|
+
} }, h("div", { key: 'fb6c305fc54a7c5f419a133c9477a69b489b77f0', class: "editor-head" }, h("div", { key: '9b22c14a92be28cc42ea900b4907d4411f5e3c7d', class: "title" }, this.editor_name, this.editor_is_dirty() ? ' *' : ''), h("button", { key: '2c800c08e12448ddf3c0f92f34257960ea0ea713', type: "button", class: "editor-close", onClick: () => this.close_editor(), "aria-label": "Close editor", disabled: this.editor_busy === 'saving' }, "x")), this.editor_busy === 'loading'
|
|
1550
1550
|
? h("div", { class: "editor-loading" }, "Loading...")
|
|
1551
|
-
: h("textarea", { class: "editor-text", spellcheck: false, autocorrect: "off", autocapitalize: "none", autoComplete: "off", "aria-label": "File contents", disabled: this.editor_busy === 'saving' || !this.editor_loaded, value: this.editor_text, onInput: (event) => this.editor_text = event.target.value, ref: (el) => this.focus_once(el, this.editorTextEl, (kept) => this.editorTextEl = kept) }), this.editor_error && h("div", { key: '
|
|
1552
|
-
h("div", { key: '
|
|
1551
|
+
: h("textarea", { class: "editor-text", spellcheck: false, autocorrect: "off", autocapitalize: "none", autoComplete: "off", "aria-label": "File contents", disabled: this.editor_busy === 'saving' || !this.editor_loaded, value: this.editor_text, onInput: (event) => this.editor_text = event.target.value, ref: (el) => this.focus_once(el, this.editorTextEl, (kept) => this.editorTextEl = kept) }), this.editor_error && h("div", { key: '7918d367cbe8c9a3c179a20f8083b9c4e067ad79', class: "dialog-error" }, this.editor_error), this.editor_confirm_discard &&
|
|
1552
|
+
h("div", { key: '6b2ba93692a575bd2c6253dcd7c9abb65807a900', class: "dialog-error" }, "Unsaved changes. Close anyway?"), h("div", { key: '879a150fdb6501ad95847a09f984f5acd9301830', class: "modal-actions" }, this.editor_confirm_discard
|
|
1553
1553
|
? h("button", { type: "button", class: "btn destructive", onClick: () => this.close_editor(true) }, "Discard")
|
|
1554
|
-
: h("button", { type: "button", class: "btn secondary", onClick: () => this.close_editor(), disabled: this.editor_busy === 'saving' }, "Close"), h("button", { key: '
|
|
1555
|
-
h(PartDeleteDialog, { key: '
|
|
1554
|
+
: h("button", { type: "button", class: "btn secondary", onClick: () => this.close_editor(), disabled: this.editor_busy === 'saving' }, "Close"), h("button", { key: 'e034f852259bcf75f6ba28159706862cfefbe5fa', type: "button", class: "btn primary", onClick: () => void this.save_editor(), disabled: !!this.editor_busy || !this.editor_is_dirty() }, this.editor_busy === 'saving' ? 'Saving...' : 'Save')))), this.part_delete &&
|
|
1555
|
+
h(PartDeleteDialog, { key: 'e7789b9ddf6e9d7f9e479aa390e7391e61c208f7', name: this.part_delete.name, busy: this.part_delete.busy, onCancel: () => this.part_delete = null, onConfirm: () => {
|
|
1556
1556
|
const target = this.part_delete;
|
|
1557
1557
|
this.part_delete = { ...target, busy: true };
|
|
1558
1558
|
void this.downloaderEl?.deleteDownload(target.download_id).finally(() => {
|
|
@@ -1560,7 +1560,7 @@ export class PhirepassSftpClient {
|
|
|
1560
1560
|
this.refresh_directory();
|
|
1561
1561
|
});
|
|
1562
1562
|
} }), this.torrent_menu &&
|
|
1563
|
-
h(TorrentContextMenu, { key: '
|
|
1563
|
+
h(TorrentContextMenu, { key: '094cd2ab17cf975825db6afefcf205855221a03b', menu: this.torrent_menu, onClose: () => this.torrent_menu = null, onFetch: () => {
|
|
1564
1564
|
const path = this.torrent_menu.path;
|
|
1565
1565
|
this.torrent_menu = null;
|
|
1566
1566
|
void this.downloaderEl?.startTorrentPath(path);
|
|
@@ -1580,7 +1580,7 @@ export class PhirepassSftpClient {
|
|
|
1580
1580
|
if (item)
|
|
1581
1581
|
this.on_file_delete_action(item, new window.Event('click'));
|
|
1582
1582
|
} }), this.listing_player &&
|
|
1583
|
-
h("section", { key: '
|
|
1583
|
+
h("section", { key: 'f5b06ff083b4af19a7c4cc336d8be172c0e646e1', class: "player-modal visible" }, h("phirepass-media-player", { key: 'b2770268f3fb6af053a6a52da1e346d8ae3cdda9', src: this.listing_player.src, name: this.listing_player.name, status: "On the node", positionKey: this.listing_player.key, onPhirepassPlayerClose: () => this.listing_player = null }))));
|
|
1584
1584
|
}
|
|
1585
1585
|
static get is() { return "phirepass-sftp-client"; }
|
|
1586
1586
|
static get encapsulation() { return "shadow"; }
|
|
@@ -742,13 +742,13 @@ export class PhirepassTerminal {
|
|
|
742
742
|
return (h("button", { key: id, type: "button", class: { key: true, armed: !!armed }, "aria-label": hint, "aria-pressed": armed === undefined ? undefined : String(armed), onPointerDown: (event) => event.preventDefault(), onMouseDown: (event) => event.preventDefault(), onClick: onPress }, label));
|
|
743
743
|
}
|
|
744
744
|
render() {
|
|
745
|
-
return (h(Host, { key: '
|
|
745
|
+
return (h(Host, { key: '0cd75107af5640ebcd5fe0b829b0f7910a01f2c6', class: { 'keys-on': this.keyBar === 'on', 'keys-off': this.keyBar === 'off' } }, h("div", { key: 'c405840c6ae231c5ef2d0f39d139eaf4eb54f5de', id: "ccc", ref: el => (this.containerEl = el) }), h("div", { key: 'a4acfc2ee6b2bc4cdcd159a5c4b794c3ccf1c504', class: "keys", role: "toolbar", "aria-label": "Terminal keys" }, this.key_button('ctrl', 'ctrl', 'Control', () => {
|
|
746
746
|
this.ctrlArmed = !this.ctrlArmed;
|
|
747
747
|
this.terminal?.focus();
|
|
748
748
|
}, this.ctrlArmed), this.key_button('alt', 'alt', 'Alt', () => {
|
|
749
749
|
this.altArmed = !this.altArmed;
|
|
750
750
|
this.terminal?.focus();
|
|
751
|
-
}, this.altArmed), KEY_BAR_KEYS.map(entry => this.key_button(entry.id, entry.label, entry.hint, () => this.press(entry.data))), h("span", { key: '
|
|
751
|
+
}, this.altArmed), KEY_BAR_KEYS.map(entry => this.key_button(entry.id, entry.label, entry.hint, () => this.press(entry.data))), h("span", { key: '0d4b62865ccc92b9e82fff8375912f839c3ec32c', class: "spacer" }), this.key_button('left', '←', 'Left arrow', () => this.press(this.arrow('D'))), this.key_button('down', '↓', 'Down arrow', () => this.press(this.arrow('B'))), this.key_button('up', '↑', 'Up arrow', () => this.press(this.arrow('A'))), this.key_button('right', '→', 'Right arrow', () => this.press(this.arrow('C'))))));
|
|
752
752
|
}
|
|
753
753
|
static get is() { return "phirepass-terminal"; }
|
|
754
754
|
static get encapsulation() { return "shadow"; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as t,t as e,p as a,H as i,c as s,a as n}from"./index.js";const r=["B","KB","MB","GB","TB"];function o(t){if(null==t||!Number.isFinite(t)||t<0)return"—";let e=t,a=0;for(;e>=1e3&&a<r.length-1;)e/=1e3,a++;if(0===a)return`${Math.round(e)} B`;const i=e>=100?0:e>=10?1:a>=3?2:1,s=e.toFixed(i);return`${i?s.replace(/\.?0+$/,""):s} ${r[a]}`}function h(t,e="↓"){return!t||t<=0?"":`${e} ${o(t)}/s`}function l(t){const e=Math.max(0,Math.round(t));if(e<60)return`${e}s`;const a=Math.floor(e/60);if(a<10){const t=e%60;return t?`${a}m ${t}s`:`${a}m`}if(a<60)return`${a}m`;const i=Math.floor(a/60),s=a%60;return i<24?s?`${i}h ${s}m`:`${i}h`:`${Math.floor(i/24)}d ${i%24}h`}function d(t,e,a){return!e||!a||a<=0||t>=e?"":`${l((e-t)/a)} left`}function c(t,e){if(!e||e<=0)return"";const a=Math.min(100,t/e*100);return a>=100?"100%":`${a.toFixed(1)}%`}function p(t,e){return!e||e<=0?0:Math.max(0,Math.min(100,t/e*100))}function u(t){if(!Number.isFinite(t)||t<0)return"0:00";const e=Math.floor(t),a=Math.floor(e/3600),i=Math.floor(e%3600/60),s=String(e%60).padStart(2,"0");return a?`${a}:${String(i).padStart(2,"0")}:${s}`:`${i}:${s}`}const f={fetch:()=>[t("path",{d:"M17.5 19a4.5 4.5 0 1 0-1.4-8.8A6 6 0 0 0 4.3 12.7 4 4 0 0 0 6 19.9"}),t("path",{d:"M12 12v8"}),t("path",{d:"m8.5 16.5 3.5 3.5 3.5-3.5"})],magnet:()=>[t("path",{d:"M6 3v8a6 6 0 0 0 12 0V3"}),t("path",{d:"M6 7h4M14 7h4"}),t("path",{d:"M10 3v8a2 2 0 0 0 4 0V3"})],globe:()=>[t("circle",{cx:"12",cy:"12",r:"9"}),t("path",{d:"M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18"})],torrent:()=>[t("path",{d:"M6 3h8l4 4v14H6z"}),t("path",{d:"M14 3v4h4"}),t("path",{d:"M9.5 11.5 12 14l2.5-2.5M12 14v3"})],node:()=>[t("rect",{x:"3",y:"4",width:"18",height:"7",rx:"1.5"}),t("rect",{x:"3",y:"13",width:"18",height:"7",rx:"1.5"}),t("path",{d:"M7 7.5h.01M7 16.5h.01"})],x:()=>[t("path",{d:"M6 6l12 12M18 6 6 18"})],retry:()=>[t("path",{d:"M3 12a9 9 0 0 0 15.4 6.4L21 16"}),t("path",{d:"M21 21v-5h-5"}),t("path",{d:"M21 12A9 9 0 0 0 5.6 5.6L3 8"}),t("path",{d:"M3 3v5h5"})],check:()=>[t("circle",{cx:"12",cy:"12",r:"9.5"}),t("path",{d:"m8 12.5 2.7 2.7L16.5 9.5"})],locate:()=>[t("path",{d:"M3 6.5A1.5 1.5 0 0 1 4.5 5h4.6l2 2h8.4A1.5 1.5 0 0 1 21 8.5v9a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 17.5z"}),t("path",{d:"m11 13 2 2 3-3"})],file:()=>[t("path",{d:"M6 3h8l4 4v14H6z"}),t("path",{d:"M14 3v4h4"})],folder:()=>[t("path",{d:"M3 6.5A1.5 1.5 0 0 1 4.5 5h4.6l2 2h8.4A1.5 1.5 0 0 1 21 8.5v9a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 17.5z"})],warn:()=>[t("path",{d:"M12 3 2.5 20h19z"}),t("path",{d:"M12 10v4.5"}),t("path",{d:"M12 17.5v.01"})],trash:()=>[t("path",{d:"M3 6h18"}),t("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),t("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"})],chevron:()=>[t("path",{d:"m6 9 6 6 6-6"})],up:()=>[t("path",{d:"m6 15 6-6 6 6"})],cast:()=>[t("path",{d:"M3 8V6a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-5"}),t("path",{d:"M3 12a8 8 0 0 1 8 8"}),t("path",{d:"M3 16a4 4 0 0 1 4 4"}),t("path",{d:"M3 20h.01"})],lock:()=>[t("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2"}),t("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})],signal:()=>[t("path",{d:"M2 20h.01M7 20v-4M12 20v-8M17 20V8M22 4v16"})],plus:()=>[t("path",{d:"M12 5v14M5 12h14"})],link:()=>[t("path",{d:"M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.7 1.7"}),t("path",{d:"M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.7-1.7"})]},g={pause:()=>[t("rect",{x:"6",y:"5",width:"4",height:"14",rx:"1"}),t("rect",{x:"14",y:"5",width:"4",height:"14",rx:"1"})],play:()=>[t("path",{d:"M7 5v14l12-7z"})]},b=({name:e,size:a=16,label:i})=>{const s=g[e];return t("svg",{xmlns:"http://www.w3.org/2000/svg",width:a,height:a,viewBox:"0 0 24 24",fill:s?"currentColor":"none",stroke:s?"none":"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":i?void 0:"true",role:i?"img":void 0,"aria-label":i},(s??f[e])?.()??null)},m={mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",mkv:"video/x-matroska",mov:"video/quicktime",mp3:"audio/mpeg",m4a:"audio/mp4",flac:"audio/flac",ogg:"audio/ogg",oga:"audio/ogg",opus:"audio/ogg",wav:"audio/wav"};function y(t){return m[function(t){const e=/\.([a-z0-9]+)$/i.exec(t);return e?e[1].toLowerCase():""}(t)]??"application/octet-stream"}function v(t,e){return function(t,e){return!(!Number.isFinite(e)||e<=0)&&(t>=.95*e||e-t<=120)}(t,e)?"clear":t<30?"skip":"save"}const x="phirepass.player.position.",w={async get(t){try{const e=window.localStorage.getItem(x+t);if(!e)return null;const a=JSON.parse(e);return"number"==typeof a?.secs?a:null}catch{return null}},async set(t,e,a){try{window.localStorage.setItem(x+t,JSON.stringify({secs:e,duration:a,at:Date.now()}))}catch{}},async clear(t){try{window.localStorage.removeItem(x+t)}catch{}}},k=a(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.playerClose=s(this,"phirepassPlayerClose")}get el(){return this}media;lastSave=0;resumeAt=0;everPlayed=!1;positionPrompted=!1;availabilityId;onRemoteConnect=()=>this.phase="casting";onRemoteDisconnect=()=>{"casting"===this.phase&&(this.phase=this.everPlayed?"playing":"buffering")};src;name;mime;status;ready;positionStore;positionKey;remotePlayback;linkMinter;castDevice;playerClose;phase="buffering";stored=null;castAvailable=!1;castSrc=null;linkNote=null;currentTime=0;duration=0;get store(){return this.positionStore??w}get audio(){return(this.mime??y(this.name)).startsWith("audio/")}async componentWillLoad(){if(this.positionKey){const t=await this.store.get(this.positionKey).catch((()=>null));t&&"save"===v(t.secs,t.duration)&&(this.stored=t,this.positionPrompted=!0,this.phase="prompt")}}componentDidLoad(){this.watchRemote()}disconnectedCallback(){this.savePosition(!0);const t=this.remote();t&&(t.removeEventListener("connect",this.onRemoteConnect),t.removeEventListener("disconnect",this.onRemoteDisconnect),void 0!==this.availabilityId&&t.cancelWatchAvailability(this.availabilityId).catch((()=>{})))}onSrc(){this.castSrc=null,this.everPlayed=!1,this.phase="buffering"}async close(){await this.savePosition(!0),this.media?.pause?.(),this.playerClose.emit()}get minter(){return this.linkMinter??function(t=(t,e)=>fetch(t,e)){return async e=>{try{const a=await t(e,{method:"POST",credentials:"include"});if(!a.ok)return null;const i=await a.json();return"string"==typeof i.ticket&&i.ticket?function(t,e,a=globalThis.location?.href){const i=/^[a-z][a-z0-9+.-]*:/i.test(t)?new URL(t):new URL(t,a);return i.searchParams.set("ticket",e),i.href}(e,i.ticket):null}catch{return null}}}()}async cast(){if(!this.castSrc){const t=await this.minter(this.src),e=this.media;if(t&&e){const a=e.currentTime,i=!e.paused;this.castSrc=t,e.src=t,this.resumeAt=a,a>0&&(e.currentTime=a),i&&e.play?.()?.catch?.((()=>{}))}}await(this.remote()?.prompt().catch((()=>{})))}async copyLink(){const t=this.castSrc??await this.minter(this.src);if(t)try{await navigator.clipboard.writeText(t),this.linkNote="Link copied. It works in VLC until it expires."}catch{this.linkNote=t}else this.linkNote="Could not make a link."}remote(){return this.remotePlayback??this.media?.remote}async watchRemote(){const t=this.remote();if(t&&!this.audio){t.addEventListener("connect",this.onRemoteConnect),t.addEventListener("disconnect",this.onRemoteDisconnect),"connected"===t.state&&(this.phase="casting");try{this.availabilityId=await t.watchAvailability((t=>this.castAvailable=t))}catch{this.castAvailable=!0}}}async savePosition(t=!1){const e=this.media;if(!e||!this.positionKey||!this.everPlayed)return;const a=Date.now();if(!t&&a-this.lastSave<1e4)return;this.lastSave=a;const i=v(e.currentTime,e.duration);"save"===i?await this.store.set(this.positionKey,e.currentTime,e.duration).catch((()=>{})):"clear"===i&&await(this.store.clear?.(this.positionKey).catch((()=>{})))}startAt(t){this.stored=null,this.phase="buffering",this.resumeAt=t;const e=this.media;e&&(t>0&&(e.currentTime=t),e.play?.()?.catch?.((()=>{})))}retry(){const t=this.media,e=t?.currentTime||this.resumeAt;this.phase="buffering",t&&(t.load?.(),this.startAt(e))}onError(){const t=this.media?.error?.code;this.phase=2===t?"stopped":"unsupported"}bindMedia(t){t&&t!==this.media&&(this.media=t)}renderStage(){switch(this.phase){case"prompt":return t("div",{class:"stage-msg","data-phase":"prompt"},t("b",null,"Resume from ",u(this.stored.secs),"?"),t("span",null,"You stopped here on ",function(t){const e=new Date(t);return`${e.getDate()} ${e.toLocaleString("en-GB",{month:"short"})}`}(this.stored.at),". ",u(this.stored.duration)," in total."),t("div",{class:"row"},t("button",{type:"button",class:"btn",onClick:()=>this.startAt(0)},"Start over"),t("button",{type:"button",class:"btn pri",onClick:()=>this.startAt(this.stored.secs)},"Resume")));case"buffering":return t("div",{class:"stage-msg overlay-msg","data-phase":"buffering"},t("span",{class:"spin","aria-hidden":"true"}),t("b",null,"Buffering"),void 0!==this.ready&&t("span",null,o(this.ready)," ready from the start"));case"waiting":return t("div",{class:"stage-msg overlay-msg","data-phase":"waiting"},t("span",{class:"spin","aria-hidden":"true"}),t("b",null,"Waiting for this part to download"),t("span",null,"You skipped ahead of what the node has. Playback resumes by itself."));case"unsupported":return t("div",{class:"stage-msg","data-phase":"unsupported"},t(b,{name:"warn",size:28}),t("b",null,"This browser cannot play this format"),t("span",null,"The download is not affected. Download the file to play it in another app."),t("a",{class:"btn pri",href:this.src,download:this.name},"Download file"));case"stopped":return t("div",{class:"stage-msg","data-phase":"stopped"},t(b,{name:"signal",size:28}),t("b",null,"Playback stopped"),t("span",null,"The connection to the node was lost."),t("button",{type:"button",class:"btn pri",onClick:()=>this.retry()},"Try again"));case"casting":return t("div",{class:"stage-msg","data-phase":"casting"},t(b,{name:"cast",size:28}),t("b",null,"Playing on ",this.castDevice??"your TV"),t("span",null,"The TV reads the file from the node. You can close this tab."),t("span",{class:"clock"},u(this.currentTime)," / ",u(this.duration)),t("button",{type:"button",class:"btn",onClick:()=>{this.remote()?.prompt().catch((()=>{}))}},"Stop casting"));default:return null}}render(){const e=this.audio,a=function(t,e){const a=e??y(t);return"video/x-matroska"===a?"TVs cannot play MKV files. Download it and play it with VLC.":"video/quicktime"===a?"TVs cannot play MOV files.":null}(this.name,this.mime),i="function"==typeof this.media?.webkitShowPlaybackTargetPicker,s={ref:t=>this.bindMedia(t),src:this.castSrc??this.src,controls:!0,preload:"prompt"===this.phase?"metadata":"auto",autoplay:!this.positionPrompted,playsInline:!0,class:{hidden:"prompt"===this.phase||"unsupported"===this.phase||"stopped"===this.phase||"casting"===this.phase},onCanPlay:()=>{"buffering"!==this.phase&&"waiting"!==this.phase||(this.phase="playing")},onPlaying:()=>{this.everPlayed=!0,"casting"!==this.phase&&(this.phase="playing")},onWaiting:()=>{"playing"===this.phase&&(this.phase=this.everPlayed?"waiting":"buffering")},onTimeUpdate:t=>{this.currentTime=t.target.currentTime,this.savePosition()},onDurationChange:t=>this.duration=t.target.duration||0,onPause:()=>{this.savePosition(!0)},onError:()=>this.onError()};return t(n,{key:"2a0961d6bb91d0d28c516e42b11c8988a7721c99",class:{audio:e}},t("header",{key:"c2339f0ca216eb347a09c9be77df877a54cf8b47",class:"bar"},t("span",{key:"ae5b874219ff03c803febb079027549ee68751b6",class:"nm",title:this.name},this.name),this.status&&t("span",{key:"09ccaae203ecb0c205bd2e4b1ac9fc2f5d9b22a1",class:"pill"},this.status),t("span",{key:"7304adbb0b50a3bcf8c4783f3444029f97e84fa9",class:"sp"}),!e&&(this.castAvailable||a)&&t("button",{key:"5c2b9d5d36ae0fd723d81da54e8e4acbf79a39d0",type:"button",class:"ib",disabled:!!a,title:a??"Cast","aria-label":a?`Cast unavailable: ${a}`:"Cast",onClick:()=>{this.cast()}},t(b,{key:"f45d71a1a5b1144376b6360812185dcbc7e5e57f",name:"cast",size:15})),t("button",{key:"71964d197aee9de089f895fd0c017e1e4e04297a",type:"button",class:"ib",title:"Copy link for VLC","aria-label":"Copy link for VLC",onClick:()=>{this.copyLink()}},t(b,{key:"643d026d4dd85cad24e1e6b01dcba1bfda956825",name:"link",size:15})),!e&&i&&t("button",{key:"a42d75246d807366e427b660062b47cc03890fac",type:"button",class:"ib",title:"AirPlay","aria-label":"AirPlay",onClick:()=>this.media.webkitShowPlaybackTargetPicker()},t(b,{key:"21c9dc4e3ea560f72d230b017f2f73314ae17ef4",name:"cast",size:15})),t("button",{key:"f1413cec5dceb9f1dfe9b0470d3784ccaf20d08a",type:"button",class:"ib","aria-label":"Close player",title:"Close",onClick:()=>{this.close()}},t(b,{key:"707e719e7608edbad68185c8071ab90e2da614d4",name:"x",size:14}))),t("div",{key:"51673733f9cd732cfe5f1b9406ddec3787ba0e6c",class:{stage:!0,audio:e},"data-phase":this.phase},t(e?"audio":"video",{...s}),this.renderStage()),this.linkNote&&t("p",{key:"bd2db764da4183f67d1589a8be5aa4e8e7df76f3",class:"link-note",role:"status"},this.linkNote))}static get watchers(){return{src:[{onSrc:0}]}}static get style(){return":host{--card:220 18% 10%;--bg:216 18% 7%;--border:220 15% 18%;--primary:160 60% 45%;--primary-foreground:220 20% 7%;--muted:220 15% 13%;--muted-foreground:215 10% 52%;--foreground:210 20% 90%;--amber:38 75% 55%;display:flex;flex-direction:column;background:hsl(var(--card));color:hsl(var(--foreground));border:1px solid hsl(var(--border));border-radius:8px;overflow:hidden;font-family:ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;font-size:13px;line-height:1.45;box-shadow:0 20px 50px -10px rgba(0, 0, 0, 0.7)}*{box-sizing:border-box}button,a.btn{font:inherit;color:inherit;cursor:pointer}:focus-visible{outline:2px solid hsl(var(--primary));outline-offset:2px}.bar{display:flex;align-items:center;gap:8px;padding:8px 10px;border-bottom:1px solid hsl(var(--border));min-width:0}.nm{font-family:ui-monospace, SFMono-Regular, Menlo, monospace;font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.pill{font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.05em;padding:2px 7px;border-radius:3px;white-space:nowrap;background:hsl(var(--primary) / 0.18);color:hsl(var(--primary));flex:none}.sp{flex:1}.ib{width:28px;height:28px;display:inline-grid;place-items:center;border-radius:4px;border:1px solid transparent;background:transparent;color:hsl(var(--muted-foreground));padding:0;flex:none}.ib:hover:not(:disabled){background:hsl(var(--muted));color:hsl(var(--foreground))}.ib:disabled{opacity:0.4;cursor:not-allowed}.btn{border-radius:4px;padding:7px 14px;font-size:12px;font-weight:600;border:1px solid hsl(var(--border));background:hsl(var(--muted));text-decoration:none;display:inline-flex;align-items:center}.btn.pri{background:hsl(var(--primary));border-color:hsl(var(--primary));color:hsl(var(--primary-foreground))}.stage{position:relative;background:#000;min-height:220px;display:grid}.stage.audio{min-height:0;background:hsl(var(--bg));padding:14px}.stage>video,.stage>audio{grid-area:1 / 1;width:100%;max-height:70vh;display:block}.stage>audio{align-self:center}.stage>.hidden{visibility:hidden}.stage-msg{grid-area:1 / 1;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:8px;padding:22px;z-index:1}.stage.audio .stage-msg{padding:8px}.overlay-msg{background:rgba(0, 0, 0, 0.55);pointer-events:none}.stage-msg>svg{color:hsl(var(--amber))}.stage-msg[data-phase='casting']>svg{color:hsl(var(--primary))}.stage-msg b{font-size:14px;font-weight:600}.stage-msg span{color:hsl(var(--muted-foreground));font-size:12px;max-width:44ch}.stage-msg .clock{font-family:ui-monospace, SFMono-Regular, Menlo, monospace;font-variant-numeric:tabular-nums}.stage-msg .row{display:flex;gap:8px;margin-top:4px}.spin{width:26px;height:26px;border-radius:50%;border:3px solid hsl(var(--border));border-top-color:hsl(var(--primary));animation:spin 1s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion: reduce){.spin{animation:none}}.link-note{margin:0;padding:6px 10px;font-size:12px;color:var(--w-dim, #737f8c);overflow-wrap:anywhere;border-top:1px solid var(--w-border, #262c35)}"}},[513,"phirepass-media-player",{src:[1],name:[1],mime:[1],status:[1],ready:[2],positionStore:[16],positionKey:[1,"position-key"],remotePlayback:[16],linkMinter:[16],castDevice:[1,"cast-device"],phase:[32],stored:[32],castAvailable:[32],castSrc:[32],linkNote:[32],currentTime:[32],duration:[32],close:[64]},void 0,{src:[{onSrc:0}]}]);function M(){"undefined"!=typeof customElements&&["phirepass-media-player"].forEach((t=>{"phirepass-media-player"===t&&(customElements.get(e(t))||customElements.define(e(t),k))}))}M();export{b as I,k as P,o as a,l as b,h as c,M as d,d as e,c as f,u as g,p}
|