phirepass-widgets 0.0.117 → 0.0.118
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 +1 -12
- package/dist/cjs/{index-DehquNXP.js → index-C3v5xmUo.js} +2 -74
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/phirepass-rdp.cjs.entry.js +5 -16
- package/dist/cjs/phirepass-sftp-client.cjs.entry.js +1470 -0
- package/dist/cjs/phirepass-terminal.cjs.entry.js +4 -4
- package/dist/cjs/phirepass-widgets.cjs.js +2 -2
- package/dist/cjs/{protocol-BjOgJZ9-.js → protocol-DCBMfc2u.js} +21 -277
- package/dist/collection/collection-manifest.json +0 -2
- package/dist/collection/common/channel.js +1 -21
- package/dist/collection/components/phirepass-rdp/phirepass-rdp.js +13 -36
- package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.css +0 -122
- package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.js +31 -181
- package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +2 -2
- package/dist/collection/phirepass-channel_bg.wasm +0 -0
- package/dist/components/index.js +1 -1
- package/dist/components/p-CsYQJXY2.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 +5 -5
- package/dist/esm/{index-BinptKL7.js → index-BVOulYtW.js} +2 -74
- package/dist/esm/loader.js +3 -3
- package/dist/esm/phirepass-rdp.entry.js +5 -16
- package/dist/esm/phirepass-sftp-client.entry.js +1468 -0
- package/dist/esm/phirepass-terminal.entry.js +4 -4
- package/dist/esm/phirepass-widgets.js +3 -3
- package/dist/esm/{protocol-BekUePpu.js → protocol-CsYQJXY2.js} +20 -276
- package/dist/phirepass-widgets/{p-9e6f9220.entry.js → p-7ea2fdbc.entry.js} +5 -5
- package/dist/phirepass-widgets/p-BVOulYtW.js +3 -0
- package/dist/phirepass-widgets/p-CsYQJXY2.js +1 -0
- package/dist/phirepass-widgets/p-c1c616ca.entry.js +1 -0
- package/dist/phirepass-widgets/p-f1bc04a8.entry.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 +0 -30
- package/dist/types/components/phirepass-rdp/phirepass-rdp.d.ts +0 -10
- package/dist/types/components/phirepass-sftp-client/phirepass-sftp-client.d.ts +0 -30
- package/dist/types/components.d.ts +34 -434
- package/package.json +4 -18
- package/dist/cjs/phirepass-downloader_3.cjs.entry.js +0 -3823
- package/dist/collection/common/fetch.js +0 -44
- package/dist/collection/components/phirepass-downloader/form.js +0 -69
- package/dist/collection/components/phirepass-downloader/format.js +0 -105
- package/dist/collection/components/phirepass-downloader/jobs.js +0 -393
- package/dist/collection/components/phirepass-downloader/phirepass-downloader.css +0 -1109
- package/dist/collection/components/phirepass-downloader/phirepass-downloader.js +0 -1466
- package/dist/collection/components/phirepass-downloader/source.js +0 -120
- package/dist/collection/components/phirepass-downloader/views/dialogs.js +0 -34
- package/dist/collection/components/phirepass-downloader/views/fetch-form.js +0 -65
- package/dist/collection/components/phirepass-downloader/views/icons.js +0 -34
- package/dist/collection/components/phirepass-downloader/views/job-row.js +0 -91
- package/dist/collection/components/phirepass-downloader/views/notices.js +0 -15
- package/dist/collection/components/phirepass-downloader/views/states.js +0 -19
- package/dist/collection/components/phirepass-media-player/phirepass-media-player.css +0 -225
- package/dist/collection/components/phirepass-media-player/phirepass-media-player.js +0 -549
- package/dist/collection/components/phirepass-media-player/player.js +0 -118
- package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.fetch.js +0 -35
- package/dist/collection/testing/fixtures.js +0 -219
- package/dist/collection/testing/mock-channel.js +0 -410
- package/dist/components/p-B4kFfbHE.js +0 -1
- package/dist/components/p-BekUePpu.js +0 -1
- package/dist/components/p-DIf-Ru26.js +0 -1
- package/dist/components/phirepass-downloader.d.ts +0 -11
- package/dist/components/phirepass-downloader.js +0 -1
- package/dist/components/phirepass-media-player.d.ts +0 -11
- package/dist/components/phirepass-media-player.js +0 -1
- package/dist/esm/phirepass-downloader_3.entry.js +0 -3819
- package/dist/phirepass-widgets/p-6a192c8d.entry.js +0 -1
- package/dist/phirepass-widgets/p-BekUePpu.js +0 -1
- package/dist/phirepass-widgets/p-BinptKL7.js +0 -3
- package/dist/phirepass-widgets/p-fe1ce8da.entry.js +0 -1
- package/dist/types/common/fetch.d.ts +0 -167
- package/dist/types/components/phirepass-downloader/form.d.ts +0 -54
- package/dist/types/components/phirepass-downloader/format.d.ts +0 -17
- package/dist/types/components/phirepass-downloader/jobs.d.ts +0 -123
- package/dist/types/components/phirepass-downloader/phirepass-downloader.d.ts +0 -238
- package/dist/types/components/phirepass-downloader/source.d.ts +0 -61
- package/dist/types/components/phirepass-downloader/views/dialogs.d.ts +0 -52
- package/dist/types/components/phirepass-downloader/views/fetch-form.d.ts +0 -31
- package/dist/types/components/phirepass-downloader/views/icons.d.ts +0 -5
- package/dist/types/components/phirepass-downloader/views/job-row.d.ts +0 -21
- package/dist/types/components/phirepass-downloader/views/notices.d.ts +0 -18
- package/dist/types/components/phirepass-downloader/views/states.d.ts +0 -38
- package/dist/types/components/phirepass-media-player/phirepass-media-player.d.ts +0 -82
- package/dist/types/components/phirepass-media-player/player.d.ts +0 -53
- package/dist/types/components/phirepass-sftp-client/phirepass-sftp-client.fetch.d.ts +0 -40
- package/dist/types/testing/fixtures.d.ts +0 -25
- package/dist/types/testing/mock-channel.d.ts +0 -132
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Row } from '../jobs';
|
|
2
|
-
export declare const Modal: ({ label, onClose, wide }: {
|
|
3
|
-
label: string;
|
|
4
|
-
onClose: () => void;
|
|
5
|
-
wide?: boolean;
|
|
6
|
-
}, children: any) => any;
|
|
7
|
-
type ConfirmBase = {
|
|
8
|
-
onCancel: () => void;
|
|
9
|
-
onConfirm: () => void;
|
|
10
|
-
};
|
|
11
|
-
/** K1: ✕ on an unfinished row. Unticked → Stopped (resumable); ticked → Cancelled. */
|
|
12
|
-
export declare const ConfirmStop: ({ row, discard, onDiscard, ...b }: {
|
|
13
|
-
row: Row;
|
|
14
|
-
discard: boolean;
|
|
15
|
-
onDiscard: (v: boolean) => void;
|
|
16
|
-
} & ConfirmBase) => any;
|
|
17
|
-
/** K8: Delete on a finished, stopped or seeding row. */
|
|
18
|
-
export declare const ConfirmDelete: ({ row, deleteFile, onDeleteFile, nodeName, ...b }: {
|
|
19
|
-
row: Row;
|
|
20
|
-
deleteFile: boolean;
|
|
21
|
-
onDeleteFile: (v: boolean) => void;
|
|
22
|
-
nodeName: string;
|
|
23
|
-
} & ConfirmBase) => any;
|
|
24
|
-
/** K9: switching a torrent that is playing to Fastest stops playback. */
|
|
25
|
-
export declare const ConfirmFastest: ({ row, ...b }: {
|
|
26
|
-
row: Row;
|
|
27
|
-
} & ConfirmBase) => any;
|
|
28
|
-
/** K2: before the first magnet or .torrent on this browser. */
|
|
29
|
-
export declare const ConfirmTorrent: ({ nodeName, dontAsk, onDontAsk, ...b }: {
|
|
30
|
-
nodeName: string;
|
|
31
|
-
dontAsk: boolean;
|
|
32
|
-
onDontAsk: (v: boolean) => void;
|
|
33
|
-
} & ConfirmBase) => any;
|
|
34
|
-
/** K5: a notice, not a question. The node refused a Start that would not fit. */
|
|
35
|
-
export declare const NoSpace: ({ reason, onClose }: {
|
|
36
|
-
reason: string;
|
|
37
|
-
onClose: () => void;
|
|
38
|
-
}) => any;
|
|
39
|
-
/** H6: folders inside the node's download folder, listed by the agent. */
|
|
40
|
-
export declare const FolderPicker: (p: {
|
|
41
|
-
root: string;
|
|
42
|
-
path: string[];
|
|
43
|
-
folders: string[] | null;
|
|
44
|
-
error?: string;
|
|
45
|
-
newName: string | null;
|
|
46
|
-
onOpen: (name: string) => void;
|
|
47
|
-
onUp: (depth: number) => void;
|
|
48
|
-
onNewName: (name: string | null) => void;
|
|
49
|
-
onCancel: () => void;
|
|
50
|
-
onSave: () => void;
|
|
51
|
-
}) => any;
|
|
52
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { FetchCaps } from '../../../common/fetch';
|
|
2
|
-
import { FormModel, FormState, Note } from '../form';
|
|
3
|
-
import { AuthForm } from '../source';
|
|
4
|
-
export type FetchFormProps = {
|
|
5
|
-
form: FormState;
|
|
6
|
-
model: FormModel;
|
|
7
|
-
caps: FetchCaps | null;
|
|
8
|
-
layout: 'dialog' | 'inline';
|
|
9
|
-
title: string;
|
|
10
|
-
destination: {
|
|
11
|
-
path: string;
|
|
12
|
-
hint?: string;
|
|
13
|
-
} | null;
|
|
14
|
-
starting: boolean;
|
|
15
|
-
refusal: Note | null;
|
|
16
|
-
onChange: (patch: Partial<FormState>) => void;
|
|
17
|
-
/** A change to one login field, merged into the current login (not a render-time copy of it). */
|
|
18
|
-
onAuth: (patch: Partial<AuthForm>) => void;
|
|
19
|
-
onPickTorrent: (file: File) => void;
|
|
20
|
-
onStart: () => void;
|
|
21
|
-
onCancel?: () => void;
|
|
22
|
-
onChooseFolder?: () => void;
|
|
23
|
-
};
|
|
24
|
-
export declare const NoteLine: ({ note }: {
|
|
25
|
-
note: Note;
|
|
26
|
-
}) => any;
|
|
27
|
-
/**
|
|
28
|
-
* The add form: mockup B and its states, used as the SFTP browser's Fetch
|
|
29
|
-
* dialog (`dialog`) and as the top of the standalone downloader (`inline`).
|
|
30
|
-
*/
|
|
31
|
-
export declare const FetchForm: (p: FetchFormProps) => any;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Row } from '../jobs';
|
|
2
|
-
export type RowActions = {
|
|
3
|
-
play: (row: Row) => void;
|
|
4
|
-
pause: (row: Row) => void;
|
|
5
|
-
resume: (row: Row, ignoreWindow?: boolean) => void;
|
|
6
|
-
stop: (row: Row) => void;
|
|
7
|
-
remove: (row: Row) => void;
|
|
8
|
-
setOrder: (row: Row, inOrder: boolean) => void;
|
|
9
|
-
showInFolder: (row: Row) => void;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* One download, in any state (mockups R and R2). Which buttons show is decided
|
|
13
|
-
* by the state alone; what a button sends is the host's business.
|
|
14
|
-
*/
|
|
15
|
-
export declare const JobRow: ({ row, actions, running, source, compact }: {
|
|
16
|
-
row: Row;
|
|
17
|
-
actions: RowActions;
|
|
18
|
-
running: number;
|
|
19
|
-
source?: string;
|
|
20
|
-
compact?: boolean;
|
|
21
|
-
}) => any;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type NoticeKind = 'started' | 'queued' | 'stuck' | 'renamed' | 'completed' | 'error';
|
|
2
|
-
export type Notice = {
|
|
3
|
-
id: number;
|
|
4
|
-
kind: NoticeKind;
|
|
5
|
-
title: string;
|
|
6
|
-
detail: string;
|
|
7
|
-
/** Stays until dismissed (N3); the others leave by themselves. */
|
|
8
|
-
sticky?: boolean;
|
|
9
|
-
action?: {
|
|
10
|
-
label: string;
|
|
11
|
-
run: () => void;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
/** Small, self-dismissing notices at the bottom of the widget (N1–N4, D). */
|
|
15
|
-
export declare const Notices: ({ notices, onDismiss }: {
|
|
16
|
-
notices: Notice[];
|
|
17
|
-
onDismiss: (id: number) => void;
|
|
18
|
-
}) => any;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { Blocker } from '../jobs';
|
|
2
|
-
export declare const Empty: ({ icon, title, body, action }: {
|
|
3
|
-
icon: string;
|
|
4
|
-
title: string;
|
|
5
|
-
body: string;
|
|
6
|
-
action?: {
|
|
7
|
-
label: string;
|
|
8
|
-
onClick: () => void;
|
|
9
|
-
};
|
|
10
|
-
}) => any;
|
|
11
|
-
/** X1: embedded drawer with nothing in it. */
|
|
12
|
-
export declare const DrawerEmpty: () => any;
|
|
13
|
-
/** X2: standalone, first open. */
|
|
14
|
-
export declare const StandaloneEmpty: ({ nodeName, folder }: {
|
|
15
|
-
nodeName: string;
|
|
16
|
-
folder: string | null;
|
|
17
|
-
}) => any;
|
|
18
|
-
/** X3: no valid session. */
|
|
19
|
-
export declare const SignedOut: ({ onSignIn }: {
|
|
20
|
-
onSignIn: () => void;
|
|
21
|
-
}) => any;
|
|
22
|
-
/** X4: the node (or the server) cannot be reached. */
|
|
23
|
-
export declare const Unreachable: ({ nodeName, onRetry }: {
|
|
24
|
-
nodeName: string;
|
|
25
|
-
onRetry?: () => void;
|
|
26
|
-
}) => any;
|
|
27
|
-
/** The channel this page loaded predates Remote Fetch. */
|
|
28
|
-
export declare const Unsupported: () => any;
|
|
29
|
-
export declare const Loading: () => any;
|
|
30
|
-
/**
|
|
31
|
-
* Why nothing can be added on this node (B8, B9, L3). Shown in place of the
|
|
32
|
-
* form, in the dialog and in the standalone header alike.
|
|
33
|
-
*/
|
|
34
|
-
export declare const BlockerView: ({ blocker, onAction, onClose }: {
|
|
35
|
-
blocker: Blocker;
|
|
36
|
-
onAction?: () => void;
|
|
37
|
-
onClose?: () => void;
|
|
38
|
-
}) => any;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
-
import { LinkMinter, PositionStore, RemotePlaybackLike, StoredPosition } from './player';
|
|
3
|
-
/**
|
|
4
|
-
* What the player is showing. `buffering` is before the first frame;
|
|
5
|
-
* `waiting` is a stall after it (a seek past what the node has, G2).
|
|
6
|
-
*/
|
|
7
|
-
export type PlayerPhase = 'prompt' | 'buffering' | 'playing' | 'waiting' | 'unsupported' | 'stopped' | 'casting';
|
|
8
|
-
/**
|
|
9
|
-
* Plays a file from the node with the browser's own `<video>` or `<audio>`.
|
|
10
|
-
*
|
|
11
|
-
* It knows nothing of channels or WASM: `src` is a stream URL the server turns
|
|
12
|
-
* into stream events towards the agent, and the browser's range requests do
|
|
13
|
-
* the rest. A download that is still arriving plays as far as `ready` bytes;
|
|
14
|
-
* past that the element waits, and so does the player, saying why.
|
|
15
|
-
*/
|
|
16
|
-
export declare class PhirepassMediaPlayer {
|
|
17
|
-
el: HTMLElement;
|
|
18
|
-
private media?;
|
|
19
|
-
private lastSave;
|
|
20
|
-
private resumeAt;
|
|
21
|
-
private everPlayed;
|
|
22
|
-
/** A stored position was offered (G6): then `startAt` plays, not `autoplay`. */
|
|
23
|
-
private positionPrompted;
|
|
24
|
-
private availabilityId?;
|
|
25
|
-
private onRemoteConnect;
|
|
26
|
-
private onRemoteDisconnect;
|
|
27
|
-
/** The stream URL: `/api/web/stream/{node}/{download}/{file}` or a listing token URL. */
|
|
28
|
-
src: string;
|
|
29
|
-
name: string;
|
|
30
|
-
/** Overrides the mime the extension implies. */
|
|
31
|
-
mime?: string;
|
|
32
|
-
/** The status line above the picture, from the job: “Downloading · 23.4%”, “On the node”. */
|
|
33
|
-
status?: string;
|
|
34
|
-
/** Bytes ready from the start of the file, while it is still downloading. */
|
|
35
|
-
ready?: number;
|
|
36
|
-
/** “Continue watching”. Without one, positions stay in this browser. */
|
|
37
|
-
positionStore?: PositionStore;
|
|
38
|
-
/** Key for the stored position: `dl:<download_id>:<file>` or `node:<node_id>:<path>`. */
|
|
39
|
-
positionKey?: string;
|
|
40
|
-
/** Stands in for `video.remote`, for demos and tests (like `channelFactory`). */
|
|
41
|
-
remotePlayback?: RemotePlaybackLike;
|
|
42
|
-
/** Makes the link a TV or VLC opens (T2.9). Defaults to POSTing `src`. */
|
|
43
|
-
linkMinter?: LinkMinter;
|
|
44
|
-
/** Shown while casting, when the host knows the device's name. */
|
|
45
|
-
castDevice?: string;
|
|
46
|
-
playerClose: EventEmitter<void>;
|
|
47
|
-
phase: PlayerPhase;
|
|
48
|
-
stored: StoredPosition | null;
|
|
49
|
-
castAvailable: boolean;
|
|
50
|
-
/** The ticket URL the element plays from once casting was asked for. */
|
|
51
|
-
castSrc: string | null;
|
|
52
|
-
linkNote: string | null;
|
|
53
|
-
currentTime: number;
|
|
54
|
-
duration: number;
|
|
55
|
-
private get store();
|
|
56
|
-
private get audio();
|
|
57
|
-
componentWillLoad(): Promise<void>;
|
|
58
|
-
componentDidLoad(): void;
|
|
59
|
-
disconnectedCallback(): void;
|
|
60
|
-
onSrc(): void;
|
|
61
|
-
/** Closes the player, saving where it stopped. The download is not affected. */
|
|
62
|
-
close(): Promise<void>;
|
|
63
|
-
private get minter();
|
|
64
|
-
/**
|
|
65
|
-
* The TV fetches the file itself and has no cookie, so the element first
|
|
66
|
-
* moves to a ticket URL (same bytes, same position), then the device picker
|
|
67
|
-
* opens. A ticket that cannot be had still opens the picker: on a
|
|
68
|
-
* development stack the plain URL plays.
|
|
69
|
-
*/
|
|
70
|
-
private cast;
|
|
71
|
-
/** “Copy link for VLC”: the same ticket, on the clipboard. */
|
|
72
|
-
private copyLink;
|
|
73
|
-
private remote;
|
|
74
|
-
private watchRemote;
|
|
75
|
-
private savePosition;
|
|
76
|
-
private startAt;
|
|
77
|
-
private retry;
|
|
78
|
-
private onError;
|
|
79
|
-
private bindMedia;
|
|
80
|
-
private renderStage;
|
|
81
|
-
render(): any;
|
|
82
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/** A stored playback position. `at` is when it was saved (unix ms). */
|
|
2
|
-
export type StoredPosition = {
|
|
3
|
-
secs: number;
|
|
4
|
-
duration: number;
|
|
5
|
-
at: number;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Where “Continue watching” keeps positions. The dashboard implements it with
|
|
9
|
-
* `/api/playback`; with none given the player falls back to `localStorage`.
|
|
10
|
-
*/
|
|
11
|
-
export type PositionStore = {
|
|
12
|
-
get(key: string): Promise<StoredPosition | null>;
|
|
13
|
-
set(key: string, secs: number, duration: number): Promise<void>;
|
|
14
|
-
clear?(key: string): Promise<void>;
|
|
15
|
-
};
|
|
16
|
-
export declare function extOf(name: string): string;
|
|
17
|
-
/** Mime from the extension, as the agent's stream server decides it. */
|
|
18
|
-
export declare function mimeFor(name: string): string;
|
|
19
|
-
export declare function isAudio(name: string, mime?: string): boolean;
|
|
20
|
-
export declare function isPlayableName(name: string): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Whether a Cast receiver can play this. The Default Media Receiver plays MP4
|
|
23
|
-
* (H.264/AAC), WebM and common audio, mostly not MKV or MOV.
|
|
24
|
-
*/
|
|
25
|
-
export declare function castBlocker(name: string, mime?: string): string | null;
|
|
26
|
-
/**
|
|
27
|
-
* Turns a stream URL into one a TV or VLC can open without the dashboard's
|
|
28
|
-
* cookie: a stream ticket (T2.9) that lasts the organisation's “Cast and player
|
|
29
|
-
* links last”. `null` when the server would not make one.
|
|
30
|
-
*/
|
|
31
|
-
export type LinkMinter = (src: string) => Promise<string | null>;
|
|
32
|
-
/** `src` with its ticket, absolute, since it leaves this page. */
|
|
33
|
-
export declare function ticketUrl(src: string, ticket: string, base?: string): string;
|
|
34
|
-
/** POSTs the stream URL with the session cookie; the server answers `{ ticket }`. */
|
|
35
|
-
export declare function fetchLinkMinter(fetcher?: typeof fetch): LinkMinter;
|
|
36
|
-
/** Nothing is saved in the first 30 seconds. */
|
|
37
|
-
export declare const SAVE_AFTER_SECS = 30;
|
|
38
|
-
export declare const SAVE_EVERY_MS = 10000;
|
|
39
|
-
/** Past 95%, or within the last two minutes, the file counts as watched and the position is cleared. */
|
|
40
|
-
export declare function isWatched(secs: number, duration: number): boolean;
|
|
41
|
-
export type PositionAction = 'skip' | 'save' | 'clear';
|
|
42
|
-
export declare function positionAction(secs: number, duration: number): PositionAction;
|
|
43
|
-
/** The fallback store, per browser. Every access is guarded: storage can be missing or refuse. */
|
|
44
|
-
export declare const localPositionStore: PositionStore;
|
|
45
|
-
/** The subset of `RemotePlayback` the player uses; a property seam for demos and tests. */
|
|
46
|
-
export type RemotePlaybackLike = {
|
|
47
|
-
state: 'disconnected' | 'connecting' | 'connected';
|
|
48
|
-
watchAvailability(cb: (available: boolean) => void): Promise<number>;
|
|
49
|
-
cancelWatchAvailability(id?: number): Promise<void>;
|
|
50
|
-
prompt(): Promise<void>;
|
|
51
|
-
addEventListener(type: 'connect' | 'connecting' | 'disconnect', cb: () => void): void;
|
|
52
|
-
removeEventListener(type: 'connect' | 'connecting' | 'disconnect', cb: () => void): void;
|
|
53
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The SFTP browser's side of Remote Fetch, kept out of the component so it
|
|
3
|
-
* stays a host and nothing more: the downloads themselves are the
|
|
4
|
-
* `<phirepass-downloader>`'s, and nothing here goes over SFTP.
|
|
5
|
-
*/
|
|
6
|
-
export declare const PART_SUFFIX = ".phirepass-part";
|
|
7
|
-
export declare function isPartFile(name: string): boolean;
|
|
8
|
-
export declare function isPlayableFile(name: string): boolean;
|
|
9
|
-
/** Whether a finished download's folder is the one on screen. */
|
|
10
|
-
export declare function sameFolder(a: string, b: string): boolean;
|
|
11
|
-
export declare function folderOfCompleted(detail: {
|
|
12
|
-
dest_root: string;
|
|
13
|
-
sub_dir: string | null;
|
|
14
|
-
}): string;
|
|
15
|
-
export declare const FetchButton: ({ count, onClick }: {
|
|
16
|
-
count: number;
|
|
17
|
-
onClick: () => void;
|
|
18
|
-
}) => any;
|
|
19
|
-
/** K3: replaces the plain delete prompt for a part file that belongs to a running download. */
|
|
20
|
-
export declare const PartDeleteDialog: ({ name, busy, onCancel, onConfirm }: {
|
|
21
|
-
name: string;
|
|
22
|
-
busy: boolean;
|
|
23
|
-
onCancel: () => void;
|
|
24
|
-
onConfirm: () => void;
|
|
25
|
-
}) => any;
|
|
26
|
-
export type TorrentMenu = {
|
|
27
|
-
x: number;
|
|
28
|
-
y: number;
|
|
29
|
-
path: string;
|
|
30
|
-
name: string;
|
|
31
|
-
};
|
|
32
|
-
/** C: right-click a `.torrent` that lies inside the node's download folder. */
|
|
33
|
-
export declare const TorrentContextMenu: ({ menu, onFetch, onDownload, onRename, onDelete, onClose, }: {
|
|
34
|
-
menu: TorrentMenu;
|
|
35
|
-
onFetch: () => void;
|
|
36
|
-
onDownload: () => void;
|
|
37
|
-
onRename: () => void;
|
|
38
|
-
onDelete: () => void;
|
|
39
|
-
onClose: () => void;
|
|
40
|
-
}) => any;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { FetchCaps, FetchJob } from '../common/fetch';
|
|
2
|
-
import type { SFTPListItem } from '../common/protocol';
|
|
3
|
-
/**
|
|
4
|
-
* Data for stories and tests: the nodes, folders and downloads the Remote
|
|
5
|
-
* Fetch mockups draw, so every screen can be shown with the real widgets.
|
|
6
|
-
*/
|
|
7
|
-
export declare const NODE_ID = "7b0c3c1e-6f0a-4f43-9d1e-0c5b8f1a2d10";
|
|
8
|
-
export declare const NODE_LABEL = "raspberrypi";
|
|
9
|
-
export declare const DOWNLOAD_FOLDER = "/home/pi/Downloads";
|
|
10
|
-
export declare const MEDIA_FOLDER = "/home/pi/media";
|
|
11
|
-
export declare function caps(over?: Partial<FetchCaps>): FetchCaps;
|
|
12
|
-
export declare function job(over?: Partial<FetchJob>): FetchJob;
|
|
13
|
-
/** Rows from mockup A: three active, one finished, one retrying. */
|
|
14
|
-
export declare function drawerJobs(): FetchJob[];
|
|
15
|
-
/** Mockup R: one row per state, top to bottom. */
|
|
16
|
-
export declare function everyState(): FetchJob[];
|
|
17
|
-
/** Mockup R2: torrent, schedule, disk and login states. */
|
|
18
|
-
export declare function moreStates(): FetchJob[];
|
|
19
|
-
/** H4: the Finished tab. */
|
|
20
|
-
export declare function finishedJobs(): FetchJob[];
|
|
21
|
-
/** H: the standalone desktop. */
|
|
22
|
-
export declare function standaloneJobs(): FetchJob[];
|
|
23
|
-
export declare function entry(name: string, kind: SFTPListItem['kind'], over?: Partial<SFTPListItem['attributes']>, path?: string): SFTPListItem;
|
|
24
|
-
/** The folders mockups A and C browse. */
|
|
25
|
-
export declare function mediaListing(): Record<string, SFTPListItem[]>;
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import type { Browsing, FetchCaps, FetchJob, FetchOptions, FetchSource, SubscribeScope } from '../common/fetch';
|
|
2
|
-
import type { SFTPListItem } from '../common/protocol';
|
|
3
|
-
/**
|
|
4
|
-
* A scriptable stand-in for `phirepass-channel`'s `Channel`, for stories and
|
|
5
|
-
* tests. Pass it through a widget's `channelFactory` and the real widget runs
|
|
6
|
-
* against it: it authenticates, opens its tunnel and handles the same frames.
|
|
7
|
-
*
|
|
8
|
-
* Every call is recorded in `calls`. `emit()` pushes any frame at the widget.
|
|
9
|
-
*/
|
|
10
|
-
export type Call = {
|
|
11
|
-
method: string;
|
|
12
|
-
args: unknown[];
|
|
13
|
-
};
|
|
14
|
-
type Cb<T = unknown> = (value: T) => void;
|
|
15
|
-
export type DownloadScript = {
|
|
16
|
-
caps?: FetchCaps;
|
|
17
|
-
jobs?: FetchJob[];
|
|
18
|
-
/** Answer to `DownloadWhere`. Default: mapped into the folder asked about. */
|
|
19
|
-
where?: (browsing: Browsing) => {
|
|
20
|
-
saves_to: string;
|
|
21
|
-
mapped: boolean;
|
|
22
|
-
};
|
|
23
|
-
/** Sub-folders for the picker, keyed by sub-dir ('' for the root). */
|
|
24
|
-
folders?: Record<string, string[]>;
|
|
25
|
-
/**
|
|
26
|
-
* What happens after `DownloadStart`. Default: accepted, then the node reports
|
|
27
|
-
* the job Downloading. `'silent'`: accepted, and the node never reports
|
|
28
|
-
* (offline). `'refuse'`: the node answers Cancelled with `refuseReason`.
|
|
29
|
-
* `'error'`: the server answers an `Error` frame. `'hang'`: nothing at all.
|
|
30
|
-
*/
|
|
31
|
-
onStart?: 'progress' | 'queued' | 'silent' | 'refuse' | 'error' | 'hang';
|
|
32
|
-
refuseReason?: string;
|
|
33
|
-
/** The name the node uses for a started link (to show N4). */
|
|
34
|
-
savedAs?: string;
|
|
35
|
-
/** Advance Downloading rows every second, for a live drawer. */
|
|
36
|
-
live?: boolean;
|
|
37
|
-
};
|
|
38
|
-
export type MockOptions = {
|
|
39
|
-
/** Delay before each answer, in ms. */
|
|
40
|
-
latency?: number;
|
|
41
|
-
/** `fail`: the server rejects the token. `never`: no answer at all. */
|
|
42
|
-
auth?: 'ok' | 'fail' | 'never';
|
|
43
|
-
/** `refuse`: the connection errors and closes. `never`: it never opens. */
|
|
44
|
-
connect?: 'ok' | 'refuse' | 'never';
|
|
45
|
-
version?: string;
|
|
46
|
-
/** SFTP folders by path. */
|
|
47
|
-
sftp?: {
|
|
48
|
-
cwd: string;
|
|
49
|
-
tree: Record<string, SFTPListItem[]>;
|
|
50
|
-
requires?: 'username' | 'password' | 'both';
|
|
51
|
-
streams?: boolean;
|
|
52
|
-
};
|
|
53
|
-
/** Bytes to print when an SSH tunnel opens, and whether keystrokes echo back. */
|
|
54
|
-
ssh?: {
|
|
55
|
-
banner?: string;
|
|
56
|
-
echo?: boolean;
|
|
57
|
-
requires?: 'username' | 'password';
|
|
58
|
-
};
|
|
59
|
-
rdp?: {
|
|
60
|
-
ticket?: boolean;
|
|
61
|
-
error?: string;
|
|
62
|
-
};
|
|
63
|
-
/** Omit to build a channel that predates Remote Fetch. */
|
|
64
|
-
downloads?: DownloadScript;
|
|
65
|
-
};
|
|
66
|
-
export declare class MockChannel {
|
|
67
|
-
readonly endpoint: string;
|
|
68
|
-
readonly nodeId: string;
|
|
69
|
-
readonly options: MockOptions;
|
|
70
|
-
readonly calls: Call[];
|
|
71
|
-
readonly jobs: Map<string, FetchJob>;
|
|
72
|
-
private cb;
|
|
73
|
-
private connected;
|
|
74
|
-
private timers;
|
|
75
|
-
private ticker?;
|
|
76
|
-
constructor(endpoint: string, nodeId: string, options?: MockOptions);
|
|
77
|
-
/** A `channelFactory` that builds one of these and keeps the last one built in `ref.current`. */
|
|
78
|
-
static factory(options?: MockOptions, ref?: {
|
|
79
|
-
current?: MockChannel;
|
|
80
|
-
}): (endpoint: string, nodeId: string) => MockChannel;
|
|
81
|
-
private record;
|
|
82
|
-
callsTo(method: string): unknown[][];
|
|
83
|
-
private later;
|
|
84
|
-
/** Pushes a frame at the widget, as the server would. */
|
|
85
|
-
emit(web: Record<string, unknown> & {
|
|
86
|
-
type: string;
|
|
87
|
-
}): void;
|
|
88
|
-
/** Sends the node's latest word on a download to the widget. */
|
|
89
|
-
progress(job: FetchJob): void;
|
|
90
|
-
update(downloadId: string, patch: Partial<FetchJob>): void;
|
|
91
|
-
/** Drops the connection, as a network failure would. */
|
|
92
|
-
drop(): void;
|
|
93
|
-
connect(): void;
|
|
94
|
-
disconnect(): void;
|
|
95
|
-
is_connected(): boolean;
|
|
96
|
-
authenticate(token: string, nodeId: string): void;
|
|
97
|
-
start_heartbeat(ms: number): void;
|
|
98
|
-
stop_heartbeat(): void;
|
|
99
|
-
on_connection_open(cb: Cb<void>): void;
|
|
100
|
-
on_connection_close(cb: Cb<void>): void;
|
|
101
|
-
on_connection_error(cb: Cb<Error>): void;
|
|
102
|
-
on_connection_message(cb: Cb): void;
|
|
103
|
-
on_protocol_message(cb: Cb): void;
|
|
104
|
-
open_ssh_tunnel(nodeId: string, serviceId: string, username?: string, password?: string): void;
|
|
105
|
-
send_ssh_tunnel_data(nodeId: string, sid: number, data: string): void;
|
|
106
|
-
send_ssh_terminal_resize(...args: unknown[]): void;
|
|
107
|
-
open_rdp_tunnel(...args: unknown[]): void;
|
|
108
|
-
open_sftp_tunnel(nodeId: string, serviceId: string, username?: string, password?: string): void;
|
|
109
|
-
send_sftp_list_data(nodeId: string, sid: number, path: string, msgId?: number): void;
|
|
110
|
-
private opDone;
|
|
111
|
-
send_sftp_mkdir(_n: string, sid: number, path: string, msgId?: number): void;
|
|
112
|
-
send_sftp_rename(_n: string, sid: number, from: string, to: string, msgId?: number): void;
|
|
113
|
-
send_sftp_chmod(_n: string, sid: number, path: string, mode: number, msgId?: number): void;
|
|
114
|
-
send_sftp_remove(_n: string, sid: number, path: string, recursive: boolean, msgId?: number): void;
|
|
115
|
-
send_sftp_read_file(_n: string, sid: number, path: string, msgId?: number): void;
|
|
116
|
-
send_sftp_write_file(_n: string, sid: number, path: string, _contents: unknown, msgId?: number): void;
|
|
117
|
-
send_sftp_open_stream(_n: string, sid: number, path: string, msgId?: number): void;
|
|
118
|
-
send_sftp_download_start(...args: unknown[]): void;
|
|
119
|
-
send_sftp_download_ack(...args: unknown[]): void;
|
|
120
|
-
send_sftp_upload_start(...args: unknown[]): void;
|
|
121
|
-
send_sftp_upload_chunk(...args: unknown[]): void;
|
|
122
|
-
send_download_subscribe(scope: SubscribeScope): void;
|
|
123
|
-
private tick;
|
|
124
|
-
send_download_where(nodeId: string, browsing: Browsing, msgId?: number): void;
|
|
125
|
-
send_download_folders(nodeId: string, subDir: string | null, msgId?: number): void;
|
|
126
|
-
send_download_start(nodeId: string, source: FetchSource, subDir: string | null, browsing: Browsing | null, inOrder: boolean, options: FetchOptions, msgId?: number): void;
|
|
127
|
-
send_download_stop(downloadId: string, discard: boolean, msgId?: number): void;
|
|
128
|
-
send_download_resume(downloadId: string, ignoreWindow: boolean, msgId?: number): void;
|
|
129
|
-
send_download_set_order(downloadId: string, inOrder: boolean, msgId?: number): void;
|
|
130
|
-
send_download_delete(downloadId: string, deleteFile: boolean, msgId?: number): void;
|
|
131
|
-
}
|
|
132
|
-
export {};
|