phirepass-widgets 0.0.111 → 0.0.113
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 +33 -0
- package/dist/cjs/{index-B8w6l0VL.js → index-CurErEK7.js} +101 -30
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/phirepass-downloader_3.cjs.entry.js +3696 -0
- package/dist/cjs/phirepass-rdp.cjs.entry.js +18 -6
- package/dist/cjs/phirepass-terminal.cjs.entry.js +6 -5
- package/dist/cjs/phirepass-widgets.cjs.js +3 -3
- package/dist/cjs/{protocol-CCD7cbHu.js → protocol-DCBMfc2u.js} +557 -360
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/common/channel.js +21 -1
- package/dist/collection/common/fetch.js +40 -0
- package/dist/collection/components/phirepass-downloader/form.js +69 -0
- package/dist/collection/components/phirepass-downloader/format.js +105 -0
- package/dist/collection/components/phirepass-downloader/jobs.js +370 -0
- package/dist/collection/components/phirepass-downloader/phirepass-downloader.css +1109 -0
- package/dist/collection/components/phirepass-downloader/phirepass-downloader.js +1455 -0
- package/dist/collection/components/phirepass-downloader/source.js +106 -0
- package/dist/collection/components/phirepass-downloader/views/dialogs.js +34 -0
- package/dist/collection/components/phirepass-downloader/views/fetch-form.js +65 -0
- package/dist/collection/components/phirepass-downloader/views/icons.js +33 -0
- package/dist/collection/components/phirepass-downloader/views/job-row.js +91 -0
- package/dist/collection/components/phirepass-downloader/views/notices.js +15 -0
- package/dist/collection/components/phirepass-downloader/views/states.js +19 -0
- package/dist/collection/components/phirepass-media-player/phirepass-media-player.css +216 -0
- package/dist/collection/components/phirepass-media-player/phirepass-media-player.js +473 -0
- package/dist/collection/components/phirepass-media-player/player.js +94 -0
- package/dist/collection/components/phirepass-rdp/phirepass-rdp.js +36 -13
- package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.css +122 -0
- package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.fetch.js +35 -0
- package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.js +181 -31
- package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +2 -2
- package/dist/collection/phirepass-channel_bg.wasm +0 -0
- package/dist/collection/testing/fixtures.js +219 -0
- package/dist/collection/testing/mock-channel.js +410 -0
- package/dist/components/index.js +1 -1
- package/dist/components/p-C4cmk3bS.js +1 -0
- package/dist/components/p-CsYQJXY2.js +1 -0
- package/dist/components/p-D6Geq8Rn.js +1 -0
- package/dist/components/phirepass-downloader.d.ts +11 -0
- package/dist/components/phirepass-downloader.js +1 -0
- package/dist/components/phirepass-media-player.d.ts +11 -0
- package/dist/components/phirepass-media-player.js +1 -0
- package/dist/components/phirepass-rdp.js +1 -1
- package/dist/components/phirepass-sftp-client.js +1 -1
- package/dist/components/phirepass-terminal.js +2 -2
- package/dist/esm/{index-DGq2b7rM.js → index-B9qUl6FW.js} +101 -30
- package/dist/esm/loader.js +3 -3
- package/dist/esm/phirepass-downloader_3.entry.js +3692 -0
- package/dist/esm/phirepass-rdp.entry.js +18 -6
- package/dist/esm/phirepass-terminal.entry.js +6 -5
- package/dist/esm/phirepass-widgets.js +4 -4
- package/dist/esm/{protocol-D4JeTIHt.js → protocol-CsYQJXY2.js} +556 -359
- package/dist/phirepass-widgets/p-1b84c526.entry.js +1 -0
- package/dist/phirepass-widgets/{p-9eebbf05.entry.js → p-41dd1ac9.entry.js} +2 -2
- package/dist/phirepass-widgets/p-614ab3de.entry.js +1 -0
- package/dist/phirepass-widgets/p-B9qUl6FW.js +3 -0
- package/dist/phirepass-widgets/p-CsYQJXY2.js +1 -0
- package/dist/phirepass-widgets/phirepass-channel_bg.wasm +0 -0
- package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
- package/dist/types/common/channel.d.ts +30 -0
- package/dist/types/common/fetch.d.ts +161 -0
- package/dist/types/components/phirepass-downloader/form.d.ts +54 -0
- package/dist/types/components/phirepass-downloader/format.d.ts +17 -0
- package/dist/types/components/phirepass-downloader/jobs.d.ts +115 -0
- package/dist/types/components/phirepass-downloader/phirepass-downloader.d.ts +231 -0
- package/dist/types/components/phirepass-downloader/source.d.ts +61 -0
- package/dist/types/components/phirepass-downloader/views/dialogs.d.ts +52 -0
- package/dist/types/components/phirepass-downloader/views/fetch-form.d.ts +31 -0
- package/dist/types/components/phirepass-downloader/views/icons.d.ts +5 -0
- package/dist/types/components/phirepass-downloader/views/job-row.d.ts +21 -0
- package/dist/types/components/phirepass-downloader/views/notices.d.ts +18 -0
- package/dist/types/components/phirepass-downloader/views/states.d.ts +38 -0
- package/dist/types/components/phirepass-media-player/phirepass-media-player.d.ts +67 -0
- package/dist/types/components/phirepass-media-player/player.d.ts +43 -0
- package/dist/types/components/phirepass-rdp/phirepass-rdp.d.ts +10 -0
- package/dist/types/components/phirepass-sftp-client/phirepass-sftp-client.d.ts +30 -0
- package/dist/types/components/phirepass-sftp-client/phirepass-sftp-client.fetch.d.ts +40 -0
- package/dist/types/components.d.ts +426 -34
- package/dist/types/stencil-public-runtime.d.ts +1 -1
- package/dist/types/testing/fixtures.d.ts +25 -0
- package/dist/types/testing/mock-channel.d.ts +132 -0
- package/package.json +26 -12
- package/dist/cjs/phirepass-sftp-client.cjs.entry.js +0 -1469
- package/dist/components/p-D4JeTIHt.js +0 -1
- package/dist/esm/phirepass-sftp-client.entry.js +0 -1467
- package/dist/phirepass-widgets/p-401631af.entry.js +0 -1
- package/dist/phirepass-widgets/p-5f27300b.entry.js +0 -1
- package/dist/phirepass-widgets/p-D4JeTIHt.js +0 -1
- package/dist/phirepass-widgets/p-DGq2b7rM.js +0 -3
|
@@ -1258,3 +1258,125 @@
|
|
|
1258
1258
|
padding: 7px 0;
|
|
1259
1259
|
}
|
|
1260
1260
|
}
|
|
1261
|
+
|
|
1262
|
+
/* ---------- Remote Fetch (the hosted <phirepass-downloader>) ---------- */
|
|
1263
|
+
|
|
1264
|
+
:host .listing main .navigation .action.fetch {
|
|
1265
|
+
position: relative;
|
|
1266
|
+
display: inline-grid;
|
|
1267
|
+
place-items: center;
|
|
1268
|
+
color: hsl(var(--primary));
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
:host .listing main .navigation .action.fetch .badge {
|
|
1272
|
+
position: absolute;
|
|
1273
|
+
top: -5px;
|
|
1274
|
+
right: -6px;
|
|
1275
|
+
min-width: 15px;
|
|
1276
|
+
height: 15px;
|
|
1277
|
+
padding: 0 4px;
|
|
1278
|
+
border-radius: 8px;
|
|
1279
|
+
background: hsl(var(--primary));
|
|
1280
|
+
color: hsl(var(--primary-foreground));
|
|
1281
|
+
font-size: 9px;
|
|
1282
|
+
font-weight: 700;
|
|
1283
|
+
line-height: 15px;
|
|
1284
|
+
text-align: center;
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
/* A download still arriving: its real name appears only when it finishes. */
|
|
1288
|
+
:host .listing main .content table tbody tr.part td {
|
|
1289
|
+
color: hsl(var(--muted-foreground));
|
|
1290
|
+
font-style: italic;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
:host .listing main .content table tbody tr.fresh {
|
|
1294
|
+
background-color: hsl(var(--primary) / 0.1);
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
:host .listing main .content table tbody tr.fresh .name::after {
|
|
1298
|
+
content: 'new';
|
|
1299
|
+
margin-left: 8px;
|
|
1300
|
+
font-size: 10px;
|
|
1301
|
+
padding: 1px 6px;
|
|
1302
|
+
border-radius: 3px;
|
|
1303
|
+
background: hsl(var(--primary));
|
|
1304
|
+
color: hsl(var(--primary-foreground));
|
|
1305
|
+
font-weight: 600;
|
|
1306
|
+
font-style: normal;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
:host .delete-dialog .file-name.inline {
|
|
1310
|
+
display: inline;
|
|
1311
|
+
padding: 0;
|
|
1312
|
+
border: 0;
|
|
1313
|
+
background: none;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
:host .context-backdrop {
|
|
1317
|
+
position: absolute;
|
|
1318
|
+
inset: 0;
|
|
1319
|
+
z-index: 8;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
:host .context-menu {
|
|
1323
|
+
position: absolute;
|
|
1324
|
+
min-width: 220px;
|
|
1325
|
+
max-width: calc(100% - 16px);
|
|
1326
|
+
padding: 4px;
|
|
1327
|
+
background: hsl(var(--card));
|
|
1328
|
+
border: 1px solid hsl(var(--border));
|
|
1329
|
+
border-radius: 6px;
|
|
1330
|
+
box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.7);
|
|
1331
|
+
display: flex;
|
|
1332
|
+
flex-direction: column;
|
|
1333
|
+
font-size: 12px;
|
|
1334
|
+
|
|
1335
|
+
button {
|
|
1336
|
+
display: flex;
|
|
1337
|
+
align-items: center;
|
|
1338
|
+
gap: 8px;
|
|
1339
|
+
text-align: left;
|
|
1340
|
+
padding: 6px 10px;
|
|
1341
|
+
border: 0;
|
|
1342
|
+
border-radius: 4px;
|
|
1343
|
+
background: transparent;
|
|
1344
|
+
color: rgb(189, 219, 209);
|
|
1345
|
+
font: inherit;
|
|
1346
|
+
cursor: pointer;
|
|
1347
|
+
|
|
1348
|
+
&:hover,
|
|
1349
|
+
&:focus-visible {
|
|
1350
|
+
background: hsl(var(--muted));
|
|
1351
|
+
outline: none;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
&.primary {
|
|
1355
|
+
color: hsl(var(--primary));
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
&.danger {
|
|
1359
|
+
color: hsl(var(--destructive));
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
hr {
|
|
1364
|
+
border: 0;
|
|
1365
|
+
border-top: 1px solid hsl(var(--border));
|
|
1366
|
+
margin: 4px 0;
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
:host .player-modal {
|
|
1371
|
+
position: absolute;
|
|
1372
|
+
inset: 0;
|
|
1373
|
+
z-index: 7;
|
|
1374
|
+
display: grid;
|
|
1375
|
+
place-items: center;
|
|
1376
|
+
padding: 10px;
|
|
1377
|
+
background: rgba(5, 7, 9, 0.6);
|
|
1378
|
+
|
|
1379
|
+
phirepass-media-player {
|
|
1380
|
+
width: min(100%, 880px);
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { Icon } from "../phirepass-downloader/views/icons";
|
|
3
|
+
/**
|
|
4
|
+
* The SFTP browser's side of Remote Fetch, kept out of the component so it
|
|
5
|
+
* stays a host and nothing more: the downloads themselves are the
|
|
6
|
+
* `<phirepass-downloader>`'s, and nothing here goes over SFTP.
|
|
7
|
+
*/
|
|
8
|
+
export const PART_SUFFIX = '.phirepass-part';
|
|
9
|
+
export function isPartFile(name) {
|
|
10
|
+
return name.endsWith(PART_SUFFIX);
|
|
11
|
+
}
|
|
12
|
+
const PLAYABLE = /\.(mp4|m4v|webm|mkv|mov|mp3|m4a|flac|ogg|oga|opus|wav)$/i;
|
|
13
|
+
export function isPlayableFile(name) {
|
|
14
|
+
return PLAYABLE.test(name) && !isPartFile(name);
|
|
15
|
+
}
|
|
16
|
+
function normalize(path) {
|
|
17
|
+
const p = path.replace(/\/{2,}/g, '/');
|
|
18
|
+
return p.length > 1 ? p.replace(/\/+$/, '') : p;
|
|
19
|
+
}
|
|
20
|
+
/** Whether a finished download's folder is the one on screen. */
|
|
21
|
+
export function sameFolder(a, b) {
|
|
22
|
+
return normalize(a) === normalize(b);
|
|
23
|
+
}
|
|
24
|
+
export function folderOfCompleted(detail) {
|
|
25
|
+
return normalize(detail.sub_dir ? `${detail.dest_root}/${detail.sub_dir}` : detail.dest_root);
|
|
26
|
+
}
|
|
27
|
+
export const FetchButton = ({ count, onClick }) => (h("button", { type: "button", class: "action fetch", onClick: onClick, title: "Fetch from a link, magnet or torrent", "aria-label": "Fetch from a link, magnet or torrent" }, h(Icon, { name: "fetch", size: 14 }), count > 0 && (h("span", { class: "badge", "aria-label": `${count} active` }, count))));
|
|
28
|
+
/** K3: replaces the plain delete prompt for a part file that belongs to a running download. */
|
|
29
|
+
export const PartDeleteDialog = ({ name, busy, onCancel, onConfirm }) => (h("section", { class: "delete-modal visible" }, h("div", { class: "delete-dialog", role: "dialog", "aria-modal": "true", "aria-label": "This file is still downloading", tabindex: -1, onKeyDown: e => {
|
|
30
|
+
if (e.key === 'Escape') {
|
|
31
|
+
onCancel();
|
|
32
|
+
}
|
|
33
|
+
} }, h("div", { class: "title" }, "This file is still downloading"), h("div", { class: "message" }, "Deleting ", h("span", { class: "file-name inline" }, name), " deletes its download."), h("div", { class: "modal-actions" }, h("button", { type: "button", class: "btn secondary", onClick: onCancel, disabled: busy }, "Keep it"), h("button", { type: "button", class: "btn destructive", onClick: onConfirm, disabled: busy }, "Delete download")))));
|
|
34
|
+
/** C: right-click a `.torrent` that lies inside the node's download folder. */
|
|
35
|
+
export const TorrentContextMenu = ({ menu, onFetch, onDownload, onRename, onDelete, onClose, }) => (h("div", { class: "context-backdrop", onClick: onClose, onContextMenu: e => (e.preventDefault(), onClose()) }, h("div", { class: "context-menu", role: "menu", "aria-label": `Actions for ${menu.name}`, style: { left: `${menu.x}px`, top: `${menu.y}px` }, onClick: e => e.stopPropagation() }, h("button", { type: "button", role: "menuitem", class: "primary", onClick: onFetch }, h(Icon, { name: "fetch", size: 13 }), " Download torrent contents here"), h("hr", null), h("button", { type: "button", role: "menuitem", onClick: onDownload }, "Download"), h("button", { type: "button", role: "menuitem", onClick: onRename }, "Rename"), h("button", { type: "button", role: "menuitem", class: "danger", onClick: onDelete }, "Delete"))));
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
import init, { Channel as PhirepassChannel } from "phirepass-channel";
|
|
3
|
+
import { supportsDownloads } from "../../common/channel";
|
|
4
|
+
import { DOWNLOADER_MSG_ID_BASE, isDownloadFrame } from "../../common/fetch";
|
|
5
|
+
import { FetchButton, PartDeleteDialog, TorrentContextMenu, folderOfCompleted, isPartFile, isPlayableFile, sameFolder, } from "./phirepass-sftp-client.fetch";
|
|
3
6
|
import svg from "./phirepass-sftp-client.logo.svg";
|
|
4
7
|
import max from "./phirepass-sftp-client.max.svg";
|
|
5
8
|
import chevron from "./phirepass-sftp-client.chevron.svg";
|
|
@@ -11,6 +14,7 @@ import upload from "./phirepass-sftp-client.upload.svg";
|
|
|
11
14
|
import { ConnectionState, ProtocolMessageError, ProtocolMessageType, } from "../../common/protocol";
|
|
12
15
|
// https://sweet-sftp-view.lovable.app/
|
|
13
16
|
export class PhirepassSftpClient {
|
|
17
|
+
el_host;
|
|
14
18
|
channel;
|
|
15
19
|
domReady = false;
|
|
16
20
|
runtimeReady = false;
|
|
@@ -130,6 +134,81 @@ export class PhirepassSftpClient {
|
|
|
130
134
|
filter = '';
|
|
131
135
|
sort_key = 'name';
|
|
132
136
|
sort_asc = true;
|
|
137
|
+
// ---- Remote Fetch (hosted <phirepass-downloader>) ----
|
|
138
|
+
/** True once the channel is authenticated: the downloader shares it from then on. */
|
|
139
|
+
channel_ready = false;
|
|
140
|
+
/** Running downloads, for the Fetch button's badge. */
|
|
141
|
+
fetch_count = 0;
|
|
142
|
+
/** Files a download just finished into the open folder, highlighted as new. */
|
|
143
|
+
fresh_names = [];
|
|
144
|
+
/** K3: a part file whose download a delete would end. */
|
|
145
|
+
part_delete = null;
|
|
146
|
+
torrent_menu = null;
|
|
147
|
+
/** A listing file open in the player (not a download). */
|
|
148
|
+
listing_player = null;
|
|
149
|
+
downloaderEl;
|
|
150
|
+
fetch_enabled() {
|
|
151
|
+
return supportsDownloads(this.channel);
|
|
152
|
+
}
|
|
153
|
+
stream_base() {
|
|
154
|
+
const protocol = this.allowInsecure ? 'http' : 'https';
|
|
155
|
+
const standard = (!this.allowInsecure && this.serverPort === 443) || (this.allowInsecure && this.serverPort === 80);
|
|
156
|
+
return `${protocol}://${this.serverHost}${standard ? '' : `:${this.serverPort}`}`;
|
|
157
|
+
}
|
|
158
|
+
on_fetch_completed(detail) {
|
|
159
|
+
if (!sameFolder(folderOfCompleted(detail), this.current_dir)) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
this.fresh_names = [...this.fresh_names.filter((n) => n !== detail.name), detail.name];
|
|
163
|
+
this.refresh_directory();
|
|
164
|
+
}
|
|
165
|
+
on_show_in_folder(detail) {
|
|
166
|
+
this.fresh_names = [detail.name];
|
|
167
|
+
if (!sameFolder(detail.path, this.current_dir)) {
|
|
168
|
+
this.list_breadcrumb(detail.path);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
async on_row_context_menu(item, event) {
|
|
172
|
+
if (item.kind !== 'File' || !/\.torrent$/i.test(item.name) || !this.downloaderEl) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
const path = this.item_path(item);
|
|
176
|
+
event.preventDefault();
|
|
177
|
+
const rel = await this.downloaderEl.torrentPathFor(path);
|
|
178
|
+
if (rel === null) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
const box = this.el_host.getBoundingClientRect();
|
|
182
|
+
this.selected_item = item;
|
|
183
|
+
this.torrent_menu = { x: event.clientX - box.left, y: event.clientY - box.top, path, name: item.name };
|
|
184
|
+
}
|
|
185
|
+
async play_listing_file(item, event) {
|
|
186
|
+
event.preventDefault();
|
|
187
|
+
event.stopPropagation();
|
|
188
|
+
const channel = this.channel;
|
|
189
|
+
if (typeof channel.send_sftp_open_stream !== 'function') {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const path = this.item_path(item);
|
|
193
|
+
try {
|
|
194
|
+
const answer = (await this.run_op('play', (msgId) => channel.send_sftp_open_stream(this.nodeId, this.session_id, path, msgId)));
|
|
195
|
+
if (answer.result !== 'Stream' || !answer.token) {
|
|
196
|
+
throw new Error('The node did not open a stream.');
|
|
197
|
+
}
|
|
198
|
+
this.listing_player = {
|
|
199
|
+
src: `${this.stream_base()}/api/web/stream/${encodeURIComponent(this.nodeId)}/t/${encodeURIComponent(answer.token)}`,
|
|
200
|
+
name: item.name,
|
|
201
|
+
key: `node:${this.nodeId}:${path}`,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
catch (err) {
|
|
205
|
+
this.error_message = this.error_text(err);
|
|
206
|
+
this.show_error = true;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
listing_can_play() {
|
|
210
|
+
return typeof this.channel?.send_sftp_open_stream === 'function';
|
|
211
|
+
}
|
|
133
212
|
toggle_max() {
|
|
134
213
|
this.maximizeEvent?.emit(!this.max);
|
|
135
214
|
}
|
|
@@ -369,6 +448,7 @@ export class PhirepassSftpClient {
|
|
|
369
448
|
this.channel.start_heartbeat(this.heartbeatInterval <= 15_000 ? 30_000 : this.heartbeatInterval);
|
|
370
449
|
this.channel.open_sftp_tunnel(this.nodeId, this.serviceId);
|
|
371
450
|
this.status = 'Connected';
|
|
451
|
+
this.channel_ready = true;
|
|
372
452
|
}
|
|
373
453
|
handle_tunnel_opened(web) {
|
|
374
454
|
this.session_id = web.sid;
|
|
@@ -386,6 +466,9 @@ export class PhirepassSftpClient {
|
|
|
386
466
|
if (web.path !== this.current_dir) {
|
|
387
467
|
this.filter = '';
|
|
388
468
|
}
|
|
469
|
+
if (web.path !== this.current_dir) {
|
|
470
|
+
this.fresh_names = [];
|
|
471
|
+
}
|
|
389
472
|
this.listing = web.dir.items;
|
|
390
473
|
this.current_dir = web.path;
|
|
391
474
|
this.breadcrumbs = web.path.split('/').map((path, index, arr) => {
|
|
@@ -709,6 +792,7 @@ export class PhirepassSftpClient {
|
|
|
709
792
|
this.channel.on_connection_close(() => {
|
|
710
793
|
this.connectionStateChanged.emit([ConnectionState.Disconnected]);
|
|
711
794
|
this.status = 'Disconnected';
|
|
795
|
+
this.channel_ready = false;
|
|
712
796
|
});
|
|
713
797
|
this.channel.on_connection_error((err) => {
|
|
714
798
|
this.connectionStateChanged.emit([ConnectionState.Error, err]);
|
|
@@ -719,6 +803,11 @@ export class PhirepassSftpClient {
|
|
|
719
803
|
});
|
|
720
804
|
this.channel.on_protocol_message((msg) => {
|
|
721
805
|
const { web } = msg.data;
|
|
806
|
+
// The downloader shares this channel: hand it what it asked for.
|
|
807
|
+
if (isDownloadFrame(web) || (web.type === ProtocolMessageType.Error && (web.msg_id ?? 0) >= DOWNLOADER_MSG_ID_BASE)) {
|
|
808
|
+
void this.downloaderEl?.receive(msg);
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
722
811
|
switch (web.type) {
|
|
723
812
|
case ProtocolMessageType.Error:
|
|
724
813
|
this.handle_error(web);
|
|
@@ -837,6 +926,10 @@ export class PhirepassSftpClient {
|
|
|
837
926
|
this.filter = '';
|
|
838
927
|
this.version = '';
|
|
839
928
|
this.status = 'Disconnected';
|
|
929
|
+
this.channel_ready = false;
|
|
930
|
+
this.part_delete = null;
|
|
931
|
+
this.torrent_menu = null;
|
|
932
|
+
this.listing_player = null;
|
|
840
933
|
}
|
|
841
934
|
on_file_row_action(item, event) {
|
|
842
935
|
event.preventDefault();
|
|
@@ -850,6 +943,23 @@ export class PhirepassSftpClient {
|
|
|
850
943
|
event.preventDefault();
|
|
851
944
|
event.stopPropagation();
|
|
852
945
|
this.selected_item = item;
|
|
946
|
+
// A plain SFTP delete of a running download's part file would only
|
|
947
|
+
// make the job retry: ask the downloader to delete the download.
|
|
948
|
+
if (item.kind === 'File' && isPartFile(item.name) && this.downloaderEl) {
|
|
949
|
+
const downloader = this.downloaderEl;
|
|
950
|
+
void downloader.jobForPath(this.item_path(item)).then((job) => {
|
|
951
|
+
if (job) {
|
|
952
|
+
this.part_delete = { download_id: job.download_id, name: item.name, busy: false };
|
|
953
|
+
}
|
|
954
|
+
else {
|
|
955
|
+
this.open_delete_prompt(item);
|
|
956
|
+
}
|
|
957
|
+
});
|
|
958
|
+
return;
|
|
959
|
+
}
|
|
960
|
+
this.open_delete_prompt(item);
|
|
961
|
+
}
|
|
962
|
+
open_delete_prompt(item) {
|
|
853
963
|
this.delete_file_name = item.name;
|
|
854
964
|
this.delete_is_dir = item.kind === 'Folder';
|
|
855
965
|
this.delete_recursive = false;
|
|
@@ -1357,20 +1467,24 @@ export class PhirepassSftpClient {
|
|
|
1357
1467
|
return `${typeChar}${chars.join('')}`;
|
|
1358
1468
|
}
|
|
1359
1469
|
render() {
|
|
1360
|
-
return (h(Host, { key: '
|
|
1470
|
+
return (h(Host, { key: '1add0943926c6c6a88bc981f8a1518d65236683c', class: {
|
|
1361
1471
|
'default': !this.max,
|
|
1362
1472
|
'max': this.max,
|
|
1363
|
-
} }, h("section", { key: '
|
|
1364
|
-
h("header", { key: '
|
|
1473
|
+
} }, h("section", { key: '28626f9858866d915616b2ebc085a1ce859b03f0', class: "listing" }, !this.hideHeader &&
|
|
1474
|
+
h("header", { key: 'f8f10d47f0b16ed1bf1967f5cf600b4c70495d70' }, h("section", { key: '4ab613e910bbfed7cacb119db7edf547fbda39fa', class: "title" }, h("img", { key: '2642eacb535e5aafac0e6425bc7cd0526957001d', src: svg, alt: "SFTP Client" }), h("div", { key: '6f34a92afe6d4000c6f583289a8f6217b2368900', class: "text" }, h("div", { key: '456e5506271447a8d2ae276672b3a34f016417e6', class: "name" }, this.name), h("div", { key: 'ecb14900f1abb5d306f8fc385bf8c17f85a58d11', class: "description" }, this.description))), h("section", { key: 'bb30a18acda6ae3eefff0b56b393d379d0c21c06', class: "actions" }, h("div", { key: '07bafaa8f7b854a997e8a90f84b757e4b78c30a7', class: "action", onClick: () => this.toggle_max() }, h("img", { key: 'd302666026a736aa471b4f6c156114566d56f35c', src: max, alt: "Maximize" })))), h("main", { key: '0233f33b0205f6b4d6e7847e3a606d2564a61f65' }, this.show_navigation && h("nav", { key: '36c75ce35cd00479b436b7928cd121f36cfb275a', class: "navigation" }, h("div", { key: '3b34fd062152edeb9e1d4de19151b209a5994211', 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: '6c424e6318c729acbeed5d9c1b6bef8e24dc931a', class: "actions", "aria-label": "SFTP actions" }, h("input", { key: '5642bb923cfae63906cef97b927dd8851cc05ebd', 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: '782f09887a6e13c13a2de97eb1f6d12b12848965', type: "button", class: "action", onClick: () => this.go_to_parent_directory(), title: "Go to parent directory", "aria-label": "Go to parent directory" }, h("img", { key: 'a13174c473a0dc9ed9bd9473e37246f891e9cae0', src: go_up, alt: "Go up" })), h("button", { key: '07dc546a7954bd9410d817b429dc245bb54fe50d', type: "button", class: "action", onClick: () => this.refresh_directory(), title: "Refresh", "aria-label": "Refresh" }, h("img", { key: 'de81815c636c37a6509b04e629c433d2b8c5e55b', src: refresh, alt: "Refresh" })), h("button", { key: '11deba37930ab320b8c20da92b5b1abd5de407ee', type: "button", class: "action", onClick: () => this.open_mkdir(), title: "New folder", "aria-label": "New folder" }, h("svg", { key: '5354cbb7a1a391c89616d4a0d257c4466ef3b860', 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: '9547220371703834e0ed2a90ac391183c6c13a48', 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: 'ee583af7f725b2dc7d8a35b051dd602f8ddd4105', x1: "12", x2: "12", y1: "10", y2: "16" }), h("line", { key: 'f9aa4e2038d64a58e9a2ff5ccf3bfc03b6d048f3', x1: "9", x2: "15", y1: "13", y2: "13" }))), this.fetch_enabled() && h(FetchButton, { key: '093626170ba4326e0ae5f4b16e043a18534fd110', count: this.fetch_count, onClick: () => void this.downloaderEl?.openFetch(this.current_dir) }), h("button", { key: '40dca240acdfa6c4c3e6afc3813440a5ef098c70', type: "button", class: "action", onClick: () => this.open_upload_picker(), title: "Upload", "aria-label": "Upload" }, h("img", { key: '35ff0f2a46f15850e3e5fdd4cae2b6a539711cc3', src: upload, alt: "Upload" })), h("button", { key: '4d4d80c880618cb4af35cdab7afd6372f69c6d55', type: "button", class: "action disconnect", onClick: () => this.disconnect_session(), title: "Disconnect", "aria-label": "Disconnect" }, "DISCONNECT"))), h("input", { key: 'cfcf588e1f5ae8b1bf860bfcb661e3dc2b8a26c7', type: "file", ref: (el) => this.uploadInputEl = el, onChange: (event) => this.on_upload_selected(event), style: { display: 'none' } }), this.show_content && h("div", { key: '55d94cb9a1b0e602294935f7fa09e981b8dbd6dd', class: "content", tabindex: 0, onKeyDown: (event) => this.on_listing_keydown(event) }, h("table", { key: '4bfc73c7db0c0eb2da44365fc911a9d03b1b5819' }, h("thead", { key: 'df798e9fc8156b5bde598150d51c097085c3bd81' }, h("tr", { key: '932c08d84c66323158f03e7b17b59b8ea0d9a7d0' }, h("th", { key: 'c6ff81a180383fd784b33616cbe52ce3124e446a', class: "sortable", onClick: () => this.toggle_sort('name'), title: "Sort by name" }, "Name", this.sort_indicator('name')), h("th", { key: '652645c923b13094b5149b975140f664d8a2f39c', class: "sortable", onClick: () => this.toggle_sort('size'), title: "Sort by size" }, "Size", this.sort_indicator('size')), h("th", { key: '452672f41f731bca3f0ecc2f15d730d8bb9ae408' }, "Permissions"), h("th", { key: '8792a16415236c42d1d85ee71d45eb2b8bdfe71a' }, "Owner"), h("th", { key: '697619d7691aebff7f58c3845d07bb14adec66ab', class: "sortable", onClick: () => this.toggle_sort('modified'), title: "Sort by modified date" }, "Modified", this.sort_indicator('modified')), h("th", { key: '332072e87b227e6b274ec728db080c2a44fe7b82', class: "action-col", "aria-label": "Actions" }))), h("tbody", { key: '5bfa829bf47f0696b3aac2c67cc445a77deb31fc' }, this.visible_listing().map((item, index) => (h("tr", { key: index, class: {
|
|
1365
1475
|
'selected': this.is_selected(item),
|
|
1366
|
-
|
|
1476
|
+
'part': item.kind === 'File' && isPartFile(item.name),
|
|
1477
|
+
'fresh': item.kind === 'File' && this.fresh_names.includes(item.name),
|
|
1478
|
+
}, onClick: () => this.list_directory(item), onContextMenu: (event) => void this.on_row_context_menu(item, event) }, h("td", null, item.kind === 'Folder' ? h("img", { class: "kind", src: folder, alt: "Folder" }) : h("img", { class: "kind", src: file, alt: "File" }), h("span", { class: `name ${item.kind.toLowerCase()}` }, item.name)), h("td", null, item.kind === 'Folder' ? '-' : this.format_size(item.attributes.size)), h("td", null, this.format_permissions(item.attributes.permissions, item.kind)), h("td", null, item.attributes.user ?? '-'), h("td", null, new Date(item.attributes.modified * 1000).toLocaleString()), h("td", { class: "action-col" }, h("div", { class: "file-actions" }, item.kind === 'File' && isPlayableFile(item.name) && this.listing_can_play() &&
|
|
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' &&
|
|
1367
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' &&
|
|
1368
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 &&
|
|
1369
|
-
h("tr", { key: '
|
|
1370
|
-
h("section", { key: '
|
|
1482
|
+
h("tr", { key: '4482356f0cea6d59c08b94aa907118c0cd246d7a', class: "empty" }, h("td", { key: 'c5caefb25d955bc7978a743d395bcf825518e6f2', colSpan: 6 }, this.filter ? `Nothing here matches "${this.filter}".` : 'This directory is empty.'))))), this.show_loader && h("div", { key: 'fbee827272c265491cda4cf0ee551d050c28eb26', class: "loader" }, "Loading..."), this.show_error && h("div", { key: 'c48be0f9bf98efae82848863ba67aab7cbe94cfa', class: "error" }, this.error_message)), this.fetch_enabled() &&
|
|
1483
|
+
h("phirepass-downloader", { key: '299ca33e978ac5267a78fd554fa4cc368416ab72', 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: '51483dfe57fe920139a94bac637a21d9387f93bd' }, h("section", { key: '4800e113635d349fb7223ba5d84c10036106471e', class: "status" }, this.status, this.selected_item && h("span", { key: 'c8a2189794096852b1bf59903fcb9e4225420af3', class: "selected-item" }, this.selected_item.name)), h("section", { key: '0003dd6457a61bb70f1f2beb1fe09902a9a7d9a6', class: "version" }, this.version ? `Version: ${this.version}` : ''))), this.show_login_screen &&
|
|
1484
|
+
h("section", { key: 'cd32e7b1357f1edfefa6f6cdef6bb1b8d3293ffd', class: {
|
|
1371
1485
|
'creds': true,
|
|
1372
1486
|
'blurred': this.show_login_screen,
|
|
1373
|
-
} }, h("form", { key: '
|
|
1487
|
+
} }, h("form", { key: 'cde44856f2fb11347aadd9eedf2774383ac88818', class: "auth", onSubmit: (event) => {
|
|
1374
1488
|
const formData = new FormData(event.target);
|
|
1375
1489
|
let username = undefined;
|
|
1376
1490
|
if (this.show_login_screen_username) {
|
|
@@ -1387,57 +1501,86 @@ export class PhirepassSftpClient {
|
|
|
1387
1501
|
this.show_loader = true;
|
|
1388
1502
|
event.stopPropagation();
|
|
1389
1503
|
event.preventDefault();
|
|
1390
|
-
} }, h("div", { key: '
|
|
1391
|
-
h("div", { key: '
|
|
1392
|
-
h("div", { key: '
|
|
1393
|
-
h("section", { key: '
|
|
1504
|
+
} }, h("div", { key: 'a030e1ff396252b7aa5b9a1384ecfbb035018d81', class: "title" }, "SFTP Connection"), this.show_login_screen_username &&
|
|
1505
|
+
h("div", { key: '6cec65370e2254527939d83c4214f57747eb4437' }, h("label", { key: '21e7fd85d58893e44ec025896f1a4da007b33869', htmlFor: "username" }, "Username"), h("input", { key: '5e3e039e5d543b1507095f1020f713c8174d73ca', autocorrect: "off", autocapitalize: "none", autoComplete: "off", id: "username", name: "username", type: "text", placeholder: "" })), this.show_login_screen_password &&
|
|
1506
|
+
h("div", { key: '6ea710ff7ac77e4ac015083ee44eaa5bd9f18fb2' }, h("label", { key: '096fa5ca5f41ecf6de193016011f159ca3e742be', htmlFor: "password" }, "Password"), h("input", { key: 'b6edc254626bcdf8266c2870436d2f14f3d2dd08', autocorrect: "off", autocapitalize: "none", autoComplete: "off", id: "password", name: "password", type: "password", placeholder: "" })), h("div", { key: '5c0cb7f8e6e4d5277c6b026f0e47c43ec01d2739' }, h("button", { key: '8b9e95c1bfda24bcdf40e9b27c80b037d30d9f94', type: "submit" }, "Connect")))), this.show_upload_modal &&
|
|
1507
|
+
h("section", { key: '268de116ac02bf628d5d04b8ce0d8a844ff9c77f', class: {
|
|
1394
1508
|
'upload-modal': true,
|
|
1395
1509
|
'visible': this.show_upload_modal,
|
|
1396
|
-
} }, h("div", { key: '
|
|
1510
|
+
} }, h("div", { key: '53e6ff8ba3a404f3575efda6fe228a11272f3799', class: "upload-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Upload progress" }, h("div", { key: 'a543b63fbd0ffb0e3e2cca0e3feca09c6be19214', class: "title" }, "Uploading File"), h("div", { key: '465d349e6cc1b59cb4d63222354beb83ee9b5242', class: "file-name", title: this.upload_file_name }, this.upload_file_name), h("div", { key: 'e809cdb7c3d0a94d49b410508582b5db0767665b', class: "progress-track", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": this.upload_progress }, h("div", { key: '5a5bc88e8287b02b937969add54daf117d8d96a4', class: "progress-fill", style: { width: `${this.upload_progress}%` } })), h("div", { key: '251e8fef171cba5912d15cbbbf93f4297527fc44', class: "progress-meta" }, h("div", { key: 'd8fc5f31ca6012500b413c8f8c769b2f9235cf03', class: "progress-speed" }, this.upload_speed), h("div", { key: 'c2c6da0c0435eb2391980c3c15029ae80e0cf09c', class: "progress-value" }, this.format_percent(this.upload_progress))), h("button", { key: '3040b677c47f5d042744d9e42c3d906ea01aa28b', type: "button", class: {
|
|
1397
1511
|
'cancel': true,
|
|
1398
1512
|
'finished': this.upload_finished,
|
|
1399
1513
|
}, onClick: () => this.cancel_upload() }, this.upload_finished ? 'Close' : 'Cancel'))), this.show_download_modal &&
|
|
1400
|
-
h("section", { key: '
|
|
1514
|
+
h("section", { key: '9be248d46c503fca474d410beb3b5f0224fa8f01', class: {
|
|
1401
1515
|
'download-modal': true,
|
|
1402
1516
|
'visible': this.show_download_modal,
|
|
1403
|
-
} }, h("div", { key: '
|
|
1517
|
+
} }, h("div", { key: '494342f0e61d6ecf3bdf59613234337fa03b1060', class: "download-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Download progress" }, h("div", { key: '70bf1682654a6f8992fad36efc6f674e9b0aa652', class: "title" }, "Downloading File"), h("div", { key: '2d595a897f62fb305f235394a272c4e79c2cbc5a', class: "file-name", title: this.download_file_name }, this.download_file_name), h("div", { key: '4876918db59b29347b53fa95598e0600e4a608e4', class: "progress-track", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": this.download_progress }, h("div", { key: '19b49f11524f024a38c56a541d87683fbd381f2a', class: "progress-fill", style: { width: `${this.download_progress}%` } })), h("div", { key: 'b14e6df3c52fe9a39d3d41bc50414eea10898ec6', class: "progress-meta" }, h("div", { key: 'b1510407a47fc2546074b8bda19165b8ab869616', class: "progress-speed" }, this.download_speed), h("div", { key: 'aecf960be679c4943d3089cc1f0d3545f4cc8ce2', class: "progress-value" }, this.format_percent(this.download_progress))), h("button", { key: '67b9c16ec6dbbcfabd7dd9601bef2e99a8e79387', type: "button", class: {
|
|
1404
1518
|
'cancel': true,
|
|
1405
1519
|
'finished': this.download_finished,
|
|
1406
1520
|
}, onClick: () => this.cancel_download() }, this.download_finished ? 'Close' : 'Cancel'))), this.show_delete_modal &&
|
|
1407
|
-
h("section", { key: '
|
|
1521
|
+
h("section", { key: 'd59cef90ed1172a230e6d7698dec6426f99d9884', class: {
|
|
1408
1522
|
'delete-modal': true,
|
|
1409
1523
|
'visible': this.show_delete_modal,
|
|
1410
|
-
} }, h("div", { key: '
|
|
1524
|
+
} }, h("div", { key: '660767440e69e1f26e62ae425cf447fcb323e01c', 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: '93d4a9afbe2c792244d83d5d44c12daa81da29a5', class: "title" }, this.delete_is_dir ? 'Delete Folder' : 'Delete File'), h("div", { key: '04a74d9f586d6c12c71295412caf76ca9001f964', class: "message" }, this.delete_loading
|
|
1411
1525
|
? (this.delete_recursive ? 'Deleting the folder and everything in it...' : 'Deleting...')
|
|
1412
|
-
: `Are you sure you want to delete this ${this.delete_is_dir ? 'folder' : 'file'}?`), h("div", { key: '
|
|
1413
|
-
h("label", { key: '
|
|
1414
|
-
h("div", { class: "hint" }, "Without this, the remote refuses a folder that is not empty."), this.delete_error && h("div", { key: '
|
|
1415
|
-
h("div", { key: '
|
|
1416
|
-
h("section", { key: '
|
|
1526
|
+
: `Are you sure you want to delete this ${this.delete_is_dir ? 'folder' : 'file'}?`), h("div", { key: 'e210a51de468e7e86ef78948f110042aff124014', class: "file-name", title: this.delete_file_name }, this.delete_file_name), this.delete_is_dir &&
|
|
1527
|
+
h("label", { key: 'ebe09093a817c7cee09bafc5a390eedbb6894a7d', class: "checkline" }, h("input", { key: '57941f4851616517593934289a6289c28140c464', type: "checkbox", checked: this.delete_recursive, disabled: this.delete_loading, onChange: (event) => this.delete_recursive = event.target.checked }), h("span", { key: '7ffce1f1c5c9b10808e571664f327a7f02d14dee' }, "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: '885f914bc1bd1a5a878d77501106ac33c67be1ab', class: "dialog-error" }, this.delete_error), this.delete_loading &&
|
|
1529
|
+
h("div", { key: '64aa48b84fabf80d19a394c632e2f7fadf803080', class: "delete-loader", "aria-hidden": "true" }, h("span", { key: 'a38b4b5e4825c18208872a74092905d716049c9a', class: "spinner" })), h("div", { key: '30edaa0fbdcf408de35e456ee23c50acf221120d', class: "modal-actions" }, h("button", { key: '47e03980bc5189b3a08ded71cbd994241119b415', type: "button", class: "btn secondary", onClick: () => this.cancel_delete(), disabled: this.delete_loading }, "Cancel"), h("button", { key: '613d80e7607f365ac74bb878cadd2beb54161aec', 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: '301de6586f5ef4df8690c589a175c27c5583c3c5', class: "prompt-modal visible" }, h("div", { key: 'b9b8d962d727a7634e9191ebb5c63d796a216c53', 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: '10cb310b35b4dead8d6550fb34ccb832a65fd1b2', class: "title" }, this.prompt_kind === 'mkdir' ? 'New Folder' : 'Rename'), h("div", { key: 'e05a7a4a0a35b5be2845834eb55870842c0d17ef', class: "message" }, this.prompt_kind === 'mkdir'
|
|
1417
1531
|
? `Create a folder in ${this.current_dir}`
|
|
1418
|
-
: 'Give it a new name. Existing names are not overwritten.'), h("form", { key: '
|
|
1419
|
-
h("section", { key: '
|
|
1532
|
+
: 'Give it a new name. Existing names are not overwritten.'), h("form", { key: '79a3d81f678b8ccd52580e0eb972f539cbe9f30f', onSubmit: (event) => { event.preventDefault(); event.stopPropagation(); void this.submit_prompt(); } }, h("input", { key: '9d250a5956fc6e7698490d522648fd20cf4414c7', 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: 'b17730b911abb499a63a993d0c3639f118590c0c', class: "dialog-error" }, this.prompt_error), h("div", { key: 'bbb9cede972be9ec6ec24ec2d346559a7f3351ab', class: "modal-actions" }, h("button", { key: 'e5e9f0b04d8cfaa0a1b4403594b50050e09fb303', type: "button", class: "btn secondary", onClick: () => this.close_prompt(), disabled: this.prompt_busy }, "Cancel"), h("button", { key: '5e5bedb0ff6b13fbf83149915863069a2d546fa8', 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: '5d99487be165e07de0e8b1ad614eeae7bcbc7872', class: "prompt-modal visible" }, h("div", { key: '695afa14bb481bfa2577b30e6152f586360d833e', 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: '8738d7ba896ecb2a752965cc9b1d698165598299', class: "title" }, "Permissions"), h("div", { key: '649ec7e7db8046156b43e1b0d6e8d50e07e02e4f', class: "file-name", title: this.chmod_target.name }, this.chmod_target.name), h("table", { key: '3f97d70594c54e602e297ab71b6d399598696498', class: "perm-grid" }, h("thead", { key: '0fe7ef70c02cbac2d4ee5e746e8066245071b24d' }, h("tr", { key: 'af2285e351eb0228180be0bd5d7131f8e5b66cd1' }, h("th", { key: 'abe22f0637551c96ebf4e0a9482c50e788510b6b', "aria-label": "Class" }), h("th", { key: '35a0a3f0ad80dae8028da7696d19d8d930a05e1c' }, "Read"), h("th", { key: 'f67ac96284ee4fd3b275cdbcee361cc6cd46ab07' }, "Write"), h("th", { key: 'ecab3e2a37deb94ea2fb3b922d39d46220fef1e0' }, "Execute"))), h("tbody", { key: 'c24e7f92cc2a95dd633858510aca3b2cdd56861b' }, [
|
|
1420
1534
|
{ label: 'Owner', read: 0o400, write: 0o200, exec: 0o100 },
|
|
1421
1535
|
{ label: 'Group', read: 0o040, write: 0o020, exec: 0o010 },
|
|
1422
1536
|
{ label: 'Other', read: 0o004, write: 0o002, exec: 0o001 },
|
|
1423
|
-
].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: '8b6520714e3f16a484e798f3e8e435a4a2cdf623', class: "perm-special" }, [
|
|
1424
1538
|
{ label: 'setuid', bit: 0o4000 },
|
|
1425
1539
|
{ label: 'setgid', bit: 0o2000 },
|
|
1426
1540
|
{ label: 'sticky', bit: 0o1000 },
|
|
1427
|
-
].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: '
|
|
1428
|
-
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: '205f0ece8a0d8ea7668e367bdc9db898fb5246bc', class: "perm-octal" }, h("label", { key: '98fb6673ef8d84b3be12bf88996ff8365a20de2e', htmlFor: "chmod-octal" }, "Octal"), h("input", { key: '608666086fdac97e33b6f58b8eed6ebf173b44d7', 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: '84a6afb198c0a3078ff16fe0c1fc3c3546cc2f20', class: "perm-preview" }, this.format_permissions(this.chmod_mode, this.chmod_target.kind))), this.chmod_error && h("div", { key: '079368ae29a0acc2690b9b5648d035001fbb6a9f', class: "dialog-error" }, this.chmod_error), h("div", { key: 'cda31e7896518dfcaad7697e2e72e476d3821605', class: "modal-actions" }, h("button", { key: 'b904a28a3dad29ee03ea6c24036a2ff91d04da6a', type: "button", class: "btn secondary", onClick: () => this.close_chmod(), disabled: this.chmod_busy }, "Cancel"), h("button", { key: 'bd7bd7c11a73d7cc1cec1405c0693f898a7b493a', 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: '7a195dda87e6b87ce2dfb52f87c8627e9ea6e5a7', class: "editor-modal visible" }, h("div", { key: 'caabc3db3d6311f34ff42be97e469ffa64e55ed5', class: "editor-dialog", role: "dialog", "aria-modal": "true", "aria-label": `Editing ${this.editor_name}`, tabindex: -1, onKeyDown: (event) => {
|
|
1429
1543
|
if ((event.ctrlKey || event.metaKey) && event.key === 's') {
|
|
1430
1544
|
event.preventDefault();
|
|
1431
1545
|
void this.save_editor();
|
|
1432
1546
|
return;
|
|
1433
1547
|
}
|
|
1434
1548
|
this.on_modal_keydown(event, () => this.close_editor());
|
|
1435
|
-
} }, h("div", { key: '
|
|
1549
|
+
} }, h("div", { key: 'b5b5cffca1d0c586a9d99aa1abd95930403970cb', class: "editor-head" }, h("div", { key: '3c957b920459ff3e7593ce1ac3a33096e6792063', class: "title" }, this.editor_name, this.editor_is_dirty() ? ' *' : ''), h("button", { key: 'd397267be9355ac675bd4503628992396e83785c', type: "button", class: "editor-close", onClick: () => this.close_editor(), "aria-label": "Close editor", disabled: this.editor_busy === 'saving' }, "x")), this.editor_busy === 'loading'
|
|
1436
1550
|
? h("div", { class: "editor-loading" }, "Loading...")
|
|
1437
|
-
: 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: '
|
|
1438
|
-
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: '9725a5c01bed575c4e6e047709239f629b753ee6', class: "dialog-error" }, this.editor_error), this.editor_confirm_discard &&
|
|
1552
|
+
h("div", { key: '8f57947f27b8d98a4976f72308da77ad0bc0dd81', class: "dialog-error" }, "Unsaved changes. Close anyway?"), h("div", { key: '699edc1344ea9f3eb8da85062f9b790bcb137a17', class: "modal-actions" }, this.editor_confirm_discard
|
|
1439
1553
|
? h("button", { type: "button", class: "btn destructive", onClick: () => this.close_editor(true) }, "Discard")
|
|
1440
|
-
: h("button", { type: "button", class: "btn secondary", onClick: () => this.close_editor(), disabled: this.editor_busy === 'saving' }, "Close"), h("button", { key: '
|
|
1554
|
+
: h("button", { type: "button", class: "btn secondary", onClick: () => this.close_editor(), disabled: this.editor_busy === 'saving' }, "Close"), h("button", { key: '98b5856690b7cfc00a8ea992ffd87ee2229a7384', 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: 'b6d85a1c323044094236f9d353c0967e37ba8a2b', name: this.part_delete.name, busy: this.part_delete.busy, onCancel: () => this.part_delete = null, onConfirm: () => {
|
|
1556
|
+
const target = this.part_delete;
|
|
1557
|
+
this.part_delete = { ...target, busy: true };
|
|
1558
|
+
void this.downloaderEl?.deleteDownload(target.download_id).finally(() => {
|
|
1559
|
+
this.part_delete = null;
|
|
1560
|
+
this.refresh_directory();
|
|
1561
|
+
});
|
|
1562
|
+
} }), this.torrent_menu &&
|
|
1563
|
+
h(TorrentContextMenu, { key: 'ecffff22fef17b34aaaa86279a6a117ad56ff091', menu: this.torrent_menu, onClose: () => this.torrent_menu = null, onFetch: () => {
|
|
1564
|
+
const path = this.torrent_menu.path;
|
|
1565
|
+
this.torrent_menu = null;
|
|
1566
|
+
void this.downloaderEl?.startTorrentPath(path);
|
|
1567
|
+
}, onDownload: () => {
|
|
1568
|
+
const item = this.selected_item;
|
|
1569
|
+
this.torrent_menu = null;
|
|
1570
|
+
if (item)
|
|
1571
|
+
void this.start_download(item);
|
|
1572
|
+
}, onRename: () => {
|
|
1573
|
+
const item = this.selected_item;
|
|
1574
|
+
this.torrent_menu = null;
|
|
1575
|
+
if (item)
|
|
1576
|
+
this.on_rename_action(item, new window.Event('click'));
|
|
1577
|
+
}, onDelete: () => {
|
|
1578
|
+
const item = this.selected_item;
|
|
1579
|
+
this.torrent_menu = null;
|
|
1580
|
+
if (item)
|
|
1581
|
+
this.on_file_delete_action(item, new window.Event('click'));
|
|
1582
|
+
} }), this.listing_player &&
|
|
1583
|
+
h("section", { key: '2a14b61054682ce21422d953c3997912331079ae', class: "player-modal visible" }, h("phirepass-media-player", { key: 'aa5dc1638310f59ec127dc915faa12e66784a7f5', src: this.listing_player.src, name: this.listing_player.name, status: "On the node", positionKey: this.listing_player.key, onPhirepassPlayerClose: () => this.listing_player = null }))));
|
|
1441
1584
|
}
|
|
1442
1585
|
static get is() { return "phirepass-sftp-client"; }
|
|
1443
1586
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1746,7 +1889,13 @@ export class PhirepassSftpClient {
|
|
|
1746
1889
|
"editor_loaded": {},
|
|
1747
1890
|
"filter": {},
|
|
1748
1891
|
"sort_key": {},
|
|
1749
|
-
"sort_asc": {}
|
|
1892
|
+
"sort_asc": {},
|
|
1893
|
+
"channel_ready": {},
|
|
1894
|
+
"fetch_count": {},
|
|
1895
|
+
"fresh_names": {},
|
|
1896
|
+
"part_delete": {},
|
|
1897
|
+
"torrent_menu": {},
|
|
1898
|
+
"listing_player": {}
|
|
1750
1899
|
};
|
|
1751
1900
|
}
|
|
1752
1901
|
static get events() {
|
|
@@ -1827,6 +1976,7 @@ export class PhirepassSftpClient {
|
|
|
1827
1976
|
}
|
|
1828
1977
|
};
|
|
1829
1978
|
}
|
|
1979
|
+
static get elementRef() { return "el_host"; }
|
|
1830
1980
|
static get watchers() {
|
|
1831
1981
|
return [{
|
|
1832
1982
|
"propName": "nodeId",
|
|
@@ -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: '7916b1ec27e8557c5327364992658bbd9456a050', class: { 'keys-on': this.keyBar === 'on', 'keys-off': this.keyBar === 'off' } }, h("div", { key: '7b1716371a6df4d3330b94e8a23195069628ccc0', id: "ccc", ref: el => (this.containerEl = el) }), h("div", { key: 'fb43cc80fbf8d0d6374ed03d980f04cfaec1bd5a', 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: '0bbada06a098775bfdab27fde2580abe6fdd969d', 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"; }
|
|
Binary file
|