tabby-tftp 0.2.1 → 0.2.2
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/buttonProvider.d.ts +7 -7
- package/dist/components/tftpModal.component.d.ts +30 -30
- package/dist/components/tftpServer.component.d.ts +24 -24
- package/dist/config.d.ts +37 -37
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/services/tftp.service.d.ts +19 -19
- package/dist/services/tftpServer.service.d.ts +32 -32
- package/dist/tftp/client.d.ts +45 -43
- package/dist/tftp/protocol.d.ts +32 -30
- package/dist/tftp/server.d.ts +43 -41
- package/package.json +5 -4
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { BehaviorSubject } from 'rxjs';
|
|
2
|
-
import { NotificationsService, PlatformService } from 'tabby-core';
|
|
3
|
-
import { TftpPluginSettings } from '../config';
|
|
4
|
-
import { TftpProgress, TftpResult } from '../tftp/client';
|
|
5
|
-
export declare class TftpService {
|
|
6
|
-
private readonly platform;
|
|
7
|
-
private readonly notifications;
|
|
8
|
-
readonly progress$: BehaviorSubject<TftpProgress>;
|
|
9
|
-
private controller;
|
|
10
|
-
private readonly client;
|
|
11
|
-
constructor(platform: PlatformService, notifications: NotificationsService);
|
|
12
|
-
get busy(): boolean;
|
|
13
|
-
upload(settings: TftpPluginSettings): Promise<TftpResult | null>;
|
|
14
|
-
download(settings: TftpPluginSettings): Promise<TftpResult | null>;
|
|
15
|
-
cancel(): void;
|
|
16
|
-
private run;
|
|
17
|
-
private ensureIdle;
|
|
18
|
-
private toClientOptions;
|
|
19
|
-
}
|
|
1
|
+
import { BehaviorSubject } from 'rxjs';
|
|
2
|
+
import { NotificationsService, PlatformService } from 'tabby-core';
|
|
3
|
+
import { TftpPluginSettings } from '../config';
|
|
4
|
+
import { TftpProgress, TftpResult } from '../tftp/client';
|
|
5
|
+
export declare class TftpService {
|
|
6
|
+
private readonly platform;
|
|
7
|
+
private readonly notifications;
|
|
8
|
+
readonly progress$: BehaviorSubject<TftpProgress>;
|
|
9
|
+
private controller;
|
|
10
|
+
private readonly client;
|
|
11
|
+
constructor(platform: PlatformService, notifications: NotificationsService);
|
|
12
|
+
get busy(): boolean;
|
|
13
|
+
upload(settings: TftpPluginSettings): Promise<TftpResult | null>;
|
|
14
|
+
download(settings: TftpPluginSettings): Promise<TftpResult | null>;
|
|
15
|
+
cancel(): void;
|
|
16
|
+
private run;
|
|
17
|
+
private ensureIdle;
|
|
18
|
+
private toClientOptions;
|
|
19
|
+
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { BehaviorSubject } from 'rxjs';
|
|
2
|
-
import { NotificationsService, PlatformService } from 'tabby-core';
|
|
3
|
-
import { TftpServerSettings } from '../config';
|
|
4
|
-
export interface TftpServerLog {
|
|
5
|
-
timestamp: number;
|
|
6
|
-
level: 'info' | 'success' | 'error';
|
|
7
|
-
message: string;
|
|
8
|
-
}
|
|
9
|
-
export interface TftpServerState {
|
|
10
|
-
running: boolean;
|
|
11
|
-
activeTransfers: number;
|
|
12
|
-
startedAt?: number;
|
|
13
|
-
logs: TftpServerLog[];
|
|
14
|
-
}
|
|
15
|
-
export declare class TftpServerService {
|
|
16
|
-
private readonly notifications;
|
|
17
|
-
private readonly platform;
|
|
18
|
-
readonly state$: BehaviorSubject<TftpServerState>;
|
|
19
|
-
private readonly server;
|
|
20
|
-
constructor(notifications: NotificationsService, platform: PlatformService);
|
|
21
|
-
get running(): boolean;
|
|
22
|
-
get activeSettings(): TftpServerSettings | null;
|
|
23
|
-
getLocalIPv4Addresses(): string[];
|
|
24
|
-
chooseRootDirectory(): Promise<string | null>;
|
|
25
|
-
openRootDirectory(directory: string): void;
|
|
26
|
-
copyAddress(address: string): void;
|
|
27
|
-
start(settings: TftpServerSettings): Promise<void>;
|
|
28
|
-
stop(): void;
|
|
29
|
-
clearLogs(): void;
|
|
30
|
-
private handleEvent;
|
|
31
|
-
private appendLog;
|
|
32
|
-
}
|
|
1
|
+
import { BehaviorSubject } from 'rxjs';
|
|
2
|
+
import { NotificationsService, PlatformService } from 'tabby-core';
|
|
3
|
+
import { TftpServerSettings } from '../config';
|
|
4
|
+
export interface TftpServerLog {
|
|
5
|
+
timestamp: number;
|
|
6
|
+
level: 'info' | 'success' | 'error';
|
|
7
|
+
message: string;
|
|
8
|
+
}
|
|
9
|
+
export interface TftpServerState {
|
|
10
|
+
running: boolean;
|
|
11
|
+
activeTransfers: number;
|
|
12
|
+
startedAt?: number;
|
|
13
|
+
logs: TftpServerLog[];
|
|
14
|
+
}
|
|
15
|
+
export declare class TftpServerService {
|
|
16
|
+
private readonly notifications;
|
|
17
|
+
private readonly platform;
|
|
18
|
+
readonly state$: BehaviorSubject<TftpServerState>;
|
|
19
|
+
private readonly server;
|
|
20
|
+
constructor(notifications: NotificationsService, platform: PlatformService);
|
|
21
|
+
get running(): boolean;
|
|
22
|
+
get activeSettings(): TftpServerSettings | null;
|
|
23
|
+
getLocalIPv4Addresses(): string[];
|
|
24
|
+
chooseRootDirectory(): Promise<string | null>;
|
|
25
|
+
openRootDirectory(directory: string): void;
|
|
26
|
+
copyAddress(address: string): void;
|
|
27
|
+
start(settings: TftpServerSettings): Promise<void>;
|
|
28
|
+
stop(): void;
|
|
29
|
+
clearLogs(): void;
|
|
30
|
+
private handleEvent;
|
|
31
|
+
private appendLog;
|
|
32
|
+
}
|
package/dist/tftp/client.d.ts
CHANGED
|
@@ -1,43 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
export
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
export interface TftpClientOptions {
|
|
4
|
+
host: string;
|
|
5
|
+
port?: number;
|
|
6
|
+
remoteFilename: string;
|
|
7
|
+
blockSize?: number;
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
retries?: number;
|
|
10
|
+
}
|
|
11
|
+
export type TransferDirection = 'upload' | 'download';
|
|
12
|
+
export type TransferState = 'idle' | 'negotiating' | 'transferring' | 'retrying' | 'completed' | 'cancelled' | 'error';
|
|
13
|
+
export interface TftpProgress {
|
|
14
|
+
direction: TransferDirection;
|
|
15
|
+
state: TransferState;
|
|
16
|
+
transferred: number;
|
|
17
|
+
total?: number;
|
|
18
|
+
speed: number;
|
|
19
|
+
attempt?: number;
|
|
20
|
+
message?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface TftpResult {
|
|
23
|
+
bytes: number;
|
|
24
|
+
blockSize: number;
|
|
25
|
+
durationMs: number;
|
|
26
|
+
}
|
|
27
|
+
export interface UploadSource {
|
|
28
|
+
readonly size: number;
|
|
29
|
+
read(maximumBytes: number): Promise<Buffer>;
|
|
30
|
+
close(): void;
|
|
31
|
+
abort?(): void;
|
|
32
|
+
isCancelled?(): boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface DownloadSink {
|
|
35
|
+
write(data: Buffer): Promise<void>;
|
|
36
|
+
close(): void;
|
|
37
|
+
abort?(): void;
|
|
38
|
+
isCancelled?(): boolean;
|
|
39
|
+
}
|
|
40
|
+
export type DownloadSinkFactory = (size?: number) => Promise<DownloadSink | null>;
|
|
41
|
+
export type ProgressHandler = (progress: TftpProgress) => void;
|
|
42
|
+
export declare class TftpClient {
|
|
43
|
+
download(options: TftpClientOptions, sinkFactory: DownloadSinkFactory, signal?: AbortSignal, onProgress?: ProgressHandler): Promise<TftpResult>;
|
|
44
|
+
upload(options: TftpClientOptions, source: UploadSource, signal?: AbortSignal, onProgress?: ProgressHandler): Promise<TftpResult>;
|
|
45
|
+
}
|
package/dist/tftp/protocol.d.ts
CHANGED
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export declare function
|
|
27
|
-
export declare function
|
|
28
|
-
export declare function
|
|
29
|
-
export declare function
|
|
30
|
-
export declare function
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
export declare enum Opcode {
|
|
4
|
+
RRQ = 1,
|
|
5
|
+
WRQ = 2,
|
|
6
|
+
DATA = 3,
|
|
7
|
+
ACK = 4,
|
|
8
|
+
ERROR = 5,
|
|
9
|
+
OACK = 6
|
|
10
|
+
}
|
|
11
|
+
export type TftpPacket = {
|
|
12
|
+
opcode: Opcode.DATA;
|
|
13
|
+
block: number;
|
|
14
|
+
data: Buffer;
|
|
15
|
+
} | {
|
|
16
|
+
opcode: Opcode.ACK;
|
|
17
|
+
block: number;
|
|
18
|
+
} | {
|
|
19
|
+
opcode: Opcode.ERROR;
|
|
20
|
+
code: number;
|
|
21
|
+
message: string;
|
|
22
|
+
} | {
|
|
23
|
+
opcode: Opcode.OACK;
|
|
24
|
+
options: Record<string, string>;
|
|
25
|
+
};
|
|
26
|
+
export declare function createRequest(opcode: Opcode.RRQ | Opcode.WRQ, filename: string, options?: Record<string, string | number>): Buffer;
|
|
27
|
+
export declare function createData(block: number, data: Buffer): Buffer;
|
|
28
|
+
export declare function createAck(block: number): Buffer;
|
|
29
|
+
export declare function createError(code: number, message: string): Buffer;
|
|
30
|
+
export declare function parsePacket(packet: Buffer): TftpPacket;
|
|
31
|
+
export declare function parseNegotiatedBlockSize(options: Record<string, string>, fallback?: number): number;
|
|
32
|
+
export declare function parseTransferSize(options: Record<string, string>): number | undefined;
|
package/dist/tftp/server.d.ts
CHANGED
|
@@ -1,41 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
private
|
|
32
|
-
private
|
|
33
|
-
private
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { Opcode } from './protocol';
|
|
4
|
+
export interface TftpServerOptions {
|
|
5
|
+
rootDirectory: string;
|
|
6
|
+
bindAddress?: string;
|
|
7
|
+
port?: number;
|
|
8
|
+
blockSize?: number;
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
retries?: number;
|
|
11
|
+
autoStopSeconds?: number;
|
|
12
|
+
}
|
|
13
|
+
export type TftpServerEventType = 'started' | 'stopped' | 'request' | 'progress' | 'completed' | 'error';
|
|
14
|
+
export interface TftpServerEvent {
|
|
15
|
+
type: TftpServerEventType;
|
|
16
|
+
timestamp: number;
|
|
17
|
+
message: string;
|
|
18
|
+
peer?: string;
|
|
19
|
+
filename?: string;
|
|
20
|
+
bytes?: number;
|
|
21
|
+
activeTransfers: number;
|
|
22
|
+
}
|
|
23
|
+
interface TftpRequest {
|
|
24
|
+
opcode: Opcode.RRQ | Opcode.WRQ;
|
|
25
|
+
filename: string;
|
|
26
|
+
mode: string;
|
|
27
|
+
options: Record<string, string>;
|
|
28
|
+
}
|
|
29
|
+
export declare function parseRequest(packet: Buffer): TftpRequest;
|
|
30
|
+
export declare class TftpServer {
|
|
31
|
+
private listener;
|
|
32
|
+
private options;
|
|
33
|
+
private readonly transfers;
|
|
34
|
+
private autoStopTimer;
|
|
35
|
+
private eventHandler;
|
|
36
|
+
get running(): boolean;
|
|
37
|
+
get activeTransfers(): number;
|
|
38
|
+
start(serverOptions: TftpServerOptions, onEvent?: (event: TftpServerEvent) => void): Promise<void>;
|
|
39
|
+
stop(reason?: string): void;
|
|
40
|
+
private handleRequest;
|
|
41
|
+
private emit;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tabby-tftp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "TFTP client and read-only firmware server for Tabby terminal",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tabby-plugin",
|
|
@@ -58,19 +58,20 @@
|
|
|
58
58
|
"@angular/forms": ">=15 <17",
|
|
59
59
|
"@ng-bootstrap/ng-bootstrap": ">=14 <16",
|
|
60
60
|
"rxjs": ">=7 <8",
|
|
61
|
-
"tabby-core": ">=1.0.
|
|
61
|
+
"tabby-core": ">=1.0.156"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@angular/animations": "^15.2.10",
|
|
65
65
|
"@angular/common": "^15.2.10",
|
|
66
66
|
"@angular/core": "^15.2.10",
|
|
67
67
|
"@angular/forms": "^15.2.10",
|
|
68
|
+
"@angular/localize": "^15.2.10",
|
|
68
69
|
"@ng-bootstrap/ng-bootstrap": "^14.2.0",
|
|
69
70
|
"@types/node": "^20.10.0",
|
|
70
71
|
"rxjs": "^7.8.1",
|
|
71
|
-
"tabby-core": "1.0.
|
|
72
|
+
"tabby-core": "^1.0.156",
|
|
72
73
|
"ts-loader": "^9.5.4",
|
|
73
|
-
"typescript": "
|
|
74
|
+
"typescript": "~4.9.5",
|
|
74
75
|
"webpack": "^5.89.0",
|
|
75
76
|
"webpack-cli": "^5.1.4"
|
|
76
77
|
}
|