terminus-cloud-settings-sync-plus 0.0.0-stage → 1.0.1
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/LICENSE +21 -0
- package/NOTICE +7 -0
- package/README.en.md +41 -0
- package/README.md +40 -2
- package/dist/index.js +2 -0
- package/dist/index.js.LICENSE.txt +7439 -0
- package/dist/src/components/change-logs/change-logs.component.d.ts +244 -0
- package/dist/src/components/checkbox.component.d.ts +13 -0
- package/dist/src/components/cloud-sync-settings.component.d.ts +431 -0
- package/dist/src/components/feeback-form/feeback.component.d.ts +242 -0
- package/dist/src/components/master-password/master-password.component.d.ts +244 -0
- package/dist/src/components/sub-components/about/about.component.d.ts +20 -0
- package/dist/src/components/sub-components/amazon/amazon-settings.component.d.ts +459 -0
- package/dist/src/components/sub-components/built-in/builtin-settings.component.d.ts +444 -0
- package/dist/src/components/sub-components/check-for-updates/check-for-updates.component.d.ts +267 -0
- package/dist/src/components/sub-components/dropbox/dropbox-encryption-secret-modal.component.d.ts +252 -0
- package/dist/src/components/sub-components/dropbox/dropbox-settings.component.d.ts +488 -0
- package/dist/src/components/sub-components/ftp/ftp-settings.component.d.ts +460 -0
- package/dist/src/components/sub-components/gist/gist-settings.component.d.ts +461 -0
- package/dist/src/components/sub-components/webdav/webdav-settings.component.d.ts +454 -0
- package/dist/src/components/toggle.component.d.ts +4 -0
- package/dist/src/data/lang.d.ts +245 -0
- package/dist/src/data/s3-data.d.ts +15 -0
- package/dist/src/data/setting-items.d.ts +198 -0
- package/dist/src/index.d.ts +47 -0
- package/dist/src/interface/index.d.ts +65 -0
- package/dist/src/providers/cloud-sync-actions.d.ts +15 -0
- package/dist/src/providers/cloud-sync-command.provider.d.ts +16 -0
- package/dist/src/providers/cloud-sync-toolbar.provider.d.ts +7 -0
- package/dist/src/services/dev-constants.d.ts +4 -0
- package/dist/src/services/tabby-sync-upgrade.d.ts +10 -0
- package/dist/src/services/toast.d.ts +61 -0
- package/dist/src/settings.d.ts +7 -0
- package/dist/src/utils/CloudSyncSettingsHelper.d.ts +8 -0
- package/dist/src/utils/Logger.d.ts +29 -0
- package/dist/src/utils/cloud-components/AmazonS3.d.ts +38 -0
- package/dist/src/utils/cloud-components/Dropbox.d.ts +50 -0
- package/dist/src/utils/cloud-components/FTP.d.ts +46 -0
- package/dist/src/utils/cloud-components/WebDav.d.ts +34 -0
- package/dist/src/utils/cloud-components/gist.d.ts +86 -0
- package/dist/src/utils/cloud-components/gists/gists.d.ts +15 -0
- package/dist/src/utils/cloud-components/gists/gitee.d.ts +16 -0
- package/dist/src/utils/cloud-components/gists/github.d.ts +16 -0
- package/dist/src/utils/cloud-components/gists/gitlab.d.ts +44 -0
- package/dist/src/utils/cloud-components/sync-utils.d.ts +90 -0
- package/dist/src/utils/config-hash.d.ts +21 -0
- package/dist/src/utils/dev-mock-data.d.ts +6 -0
- package/dist/src/utils/settings-crypto.d.ts +53 -0
- package/dist/src/utils/settings-helper.d.ts +177 -0
- package/dist/src/utils/settings-secret.d.ts +16 -0
- package/dist/src/utils/sync-lock.d.ts +44 -0
- package/dist/src/utils/sync-payload.d.ts +38 -0
- package/dist/src/utils/sync-state.d.ts +55 -0
- package/package.json +111 -6
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
declare const CloudSyncSettingsData: {
|
|
2
|
+
defaultSyncInterval: number;
|
|
3
|
+
/**
|
|
4
|
+
* Tolerance applied when local and remote timestamps have to decide the sync
|
|
5
|
+
* direction (only on the very first cycle, before a content baseline
|
|
6
|
+
* exists). Absorbs client clock drift and the second-level granularity of
|
|
7
|
+
* FTP `MDTM` / WebDav `lastmod`.
|
|
8
|
+
*/
|
|
9
|
+
syncSkewToleranceSeconds: number;
|
|
10
|
+
tabbySettingsFilename: string;
|
|
11
|
+
storedSettingsFilename: string;
|
|
12
|
+
syncStateFilename: string;
|
|
13
|
+
cloudSettingsFilename: string;
|
|
14
|
+
tabbyLocalEncryptedFile: string;
|
|
15
|
+
values: {
|
|
16
|
+
BUILT_IN: string;
|
|
17
|
+
S3: string;
|
|
18
|
+
WASABI: string;
|
|
19
|
+
DIGITAL_OCEAN: string;
|
|
20
|
+
BLACKBLAZE: string;
|
|
21
|
+
S3_COMPATIBLE: string;
|
|
22
|
+
WEBDAV: string;
|
|
23
|
+
FTP: string;
|
|
24
|
+
GIST: string;
|
|
25
|
+
DROPBOX: string;
|
|
26
|
+
};
|
|
27
|
+
amazonEndpoints: {
|
|
28
|
+
WASABI: string;
|
|
29
|
+
DIGITAL_OCEAN: string;
|
|
30
|
+
BLACKBLAZE: string;
|
|
31
|
+
S3_COMPATIBLE: string;
|
|
32
|
+
};
|
|
33
|
+
serviceProvidersList: {
|
|
34
|
+
name: string;
|
|
35
|
+
value: string;
|
|
36
|
+
}[];
|
|
37
|
+
BuiltinLoginMode: {
|
|
38
|
+
LOGIN: string;
|
|
39
|
+
RESET_PASSWORD: string;
|
|
40
|
+
};
|
|
41
|
+
availablePluginVersions: any[];
|
|
42
|
+
formData: {
|
|
43
|
+
[x: string]: {
|
|
44
|
+
email: string;
|
|
45
|
+
password: string;
|
|
46
|
+
reset_password_email: string;
|
|
47
|
+
appId?: undefined;
|
|
48
|
+
appSecret?: undefined;
|
|
49
|
+
location?: undefined;
|
|
50
|
+
bucket?: undefined;
|
|
51
|
+
region?: undefined;
|
|
52
|
+
endpointUrl?: undefined;
|
|
53
|
+
host?: undefined;
|
|
54
|
+
username?: undefined;
|
|
55
|
+
port?: undefined;
|
|
56
|
+
protocol?: undefined;
|
|
57
|
+
type?: undefined;
|
|
58
|
+
name?: undefined;
|
|
59
|
+
accessToken?: undefined;
|
|
60
|
+
id?: undefined;
|
|
61
|
+
apiKey?: undefined;
|
|
62
|
+
} | {
|
|
63
|
+
appId: string;
|
|
64
|
+
appSecret: string;
|
|
65
|
+
location: string;
|
|
66
|
+
bucket: string;
|
|
67
|
+
region: string;
|
|
68
|
+
email?: undefined;
|
|
69
|
+
password?: undefined;
|
|
70
|
+
reset_password_email?: undefined;
|
|
71
|
+
endpointUrl?: undefined;
|
|
72
|
+
host?: undefined;
|
|
73
|
+
username?: undefined;
|
|
74
|
+
port?: undefined;
|
|
75
|
+
protocol?: undefined;
|
|
76
|
+
type?: undefined;
|
|
77
|
+
name?: undefined;
|
|
78
|
+
accessToken?: undefined;
|
|
79
|
+
id?: undefined;
|
|
80
|
+
apiKey?: undefined;
|
|
81
|
+
} | {
|
|
82
|
+
endpointUrl: string;
|
|
83
|
+
appId: string;
|
|
84
|
+
appSecret: string;
|
|
85
|
+
location: string;
|
|
86
|
+
bucket: string;
|
|
87
|
+
region: string;
|
|
88
|
+
email?: undefined;
|
|
89
|
+
password?: undefined;
|
|
90
|
+
reset_password_email?: undefined;
|
|
91
|
+
host?: undefined;
|
|
92
|
+
username?: undefined;
|
|
93
|
+
port?: undefined;
|
|
94
|
+
protocol?: undefined;
|
|
95
|
+
type?: undefined;
|
|
96
|
+
name?: undefined;
|
|
97
|
+
accessToken?: undefined;
|
|
98
|
+
id?: undefined;
|
|
99
|
+
apiKey?: undefined;
|
|
100
|
+
} | {
|
|
101
|
+
host: string;
|
|
102
|
+
username: string;
|
|
103
|
+
password: string;
|
|
104
|
+
location: string;
|
|
105
|
+
port: string;
|
|
106
|
+
email?: undefined;
|
|
107
|
+
reset_password_email?: undefined;
|
|
108
|
+
appId?: undefined;
|
|
109
|
+
appSecret?: undefined;
|
|
110
|
+
bucket?: undefined;
|
|
111
|
+
region?: undefined;
|
|
112
|
+
endpointUrl?: undefined;
|
|
113
|
+
protocol?: undefined;
|
|
114
|
+
type?: undefined;
|
|
115
|
+
name?: undefined;
|
|
116
|
+
accessToken?: undefined;
|
|
117
|
+
id?: undefined;
|
|
118
|
+
apiKey?: undefined;
|
|
119
|
+
} | {
|
|
120
|
+
protocol: string;
|
|
121
|
+
host: string;
|
|
122
|
+
username: string;
|
|
123
|
+
password: string;
|
|
124
|
+
location: string;
|
|
125
|
+
port: number;
|
|
126
|
+
email?: undefined;
|
|
127
|
+
reset_password_email?: undefined;
|
|
128
|
+
appId?: undefined;
|
|
129
|
+
appSecret?: undefined;
|
|
130
|
+
bucket?: undefined;
|
|
131
|
+
region?: undefined;
|
|
132
|
+
endpointUrl?: undefined;
|
|
133
|
+
type?: undefined;
|
|
134
|
+
name?: undefined;
|
|
135
|
+
accessToken?: undefined;
|
|
136
|
+
id?: undefined;
|
|
137
|
+
apiKey?: undefined;
|
|
138
|
+
} | {
|
|
139
|
+
type: string;
|
|
140
|
+
name: string;
|
|
141
|
+
accessToken: string;
|
|
142
|
+
id: string;
|
|
143
|
+
email?: undefined;
|
|
144
|
+
password?: undefined;
|
|
145
|
+
reset_password_email?: undefined;
|
|
146
|
+
appId?: undefined;
|
|
147
|
+
appSecret?: undefined;
|
|
148
|
+
location?: undefined;
|
|
149
|
+
bucket?: undefined;
|
|
150
|
+
region?: undefined;
|
|
151
|
+
endpointUrl?: undefined;
|
|
152
|
+
host?: undefined;
|
|
153
|
+
username?: undefined;
|
|
154
|
+
port?: undefined;
|
|
155
|
+
protocol?: undefined;
|
|
156
|
+
apiKey?: undefined;
|
|
157
|
+
} | {
|
|
158
|
+
apiKey: string;
|
|
159
|
+
email?: undefined;
|
|
160
|
+
password?: undefined;
|
|
161
|
+
reset_password_email?: undefined;
|
|
162
|
+
appId?: undefined;
|
|
163
|
+
appSecret?: undefined;
|
|
164
|
+
location?: undefined;
|
|
165
|
+
bucket?: undefined;
|
|
166
|
+
region?: undefined;
|
|
167
|
+
endpointUrl?: undefined;
|
|
168
|
+
host?: undefined;
|
|
169
|
+
username?: undefined;
|
|
170
|
+
port?: undefined;
|
|
171
|
+
protocol?: undefined;
|
|
172
|
+
type?: undefined;
|
|
173
|
+
name?: undefined;
|
|
174
|
+
accessToken?: undefined;
|
|
175
|
+
id?: undefined;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
external_urls: {
|
|
179
|
+
ApiUrl: string;
|
|
180
|
+
BlackBlazeHelp: string;
|
|
181
|
+
checkForUpdateUrl: string;
|
|
182
|
+
githubIssuesUrl: string;
|
|
183
|
+
};
|
|
184
|
+
isCloudStorageS3Compatibility(provider: string): boolean;
|
|
185
|
+
gistUrls: {
|
|
186
|
+
viewItems: {
|
|
187
|
+
github: string;
|
|
188
|
+
gitee: string;
|
|
189
|
+
gitlab: string;
|
|
190
|
+
};
|
|
191
|
+
github: string;
|
|
192
|
+
gitee: string;
|
|
193
|
+
gitlab: string;
|
|
194
|
+
};
|
|
195
|
+
donationUrl: string;
|
|
196
|
+
pluginUrl: string;
|
|
197
|
+
};
|
|
198
|
+
export default CloudSyncSettingsData;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AppService, ConfigService, PlatformService } from 'terminus-core';
|
|
2
|
+
export default class CloudSyncSettingsModule {
|
|
3
|
+
private app;
|
|
4
|
+
private platform;
|
|
5
|
+
private configService;
|
|
6
|
+
constructor(app: AppService, platform: PlatformService, configService: ConfigService);
|
|
7
|
+
/**
|
|
8
|
+
* Schedule the next auto-sync run after the configured interval, replacing
|
|
9
|
+
* any run already pending so the loop can never fork into two timers.
|
|
10
|
+
*/
|
|
11
|
+
subscribeToAutoSyncEvent(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Push local changes as soon as Tabby reports its config was modified.
|
|
14
|
+
*
|
|
15
|
+
* Tabby also emits `changed$` when *we* write a pulled config, so the local
|
|
16
|
+
* hash is compared against the recorded sync baseline first. Without that
|
|
17
|
+
* check every pull immediately triggered a push, which bumped the remote
|
|
18
|
+
* timestamp, which made the next cycle pull again — the ping-pong users saw
|
|
19
|
+
* as "syncing is not right".
|
|
20
|
+
*/
|
|
21
|
+
subscribeToConfigChangeEvent(): void;
|
|
22
|
+
private detectSshConfigChange;
|
|
23
|
+
/** Upload the local config after a debounced change event, if it really changed. */
|
|
24
|
+
private pushLocalConfigChange;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the config on disk is equivalent to what was last synced, in which
|
|
27
|
+
* case the change event was an echo of our own write rather than a real edit.
|
|
28
|
+
*/
|
|
29
|
+
private isLocalConfigAlreadySynced;
|
|
30
|
+
/**
|
|
31
|
+
* Run one auto-sync cycle: pull/push with the cloud, then reschedule the
|
|
32
|
+
* next run. The loop is always rescheduled (even on failure or when sync is
|
|
33
|
+
* disabled) so a single error can no longer permanently stop auto-sync.
|
|
34
|
+
*
|
|
35
|
+
* Overlap is prevented by the shared {@link SyncLock} rather than a local
|
|
36
|
+
* flag, so the settings UI and the config-change listener are serialised
|
|
37
|
+
* against this loop too.
|
|
38
|
+
*/
|
|
39
|
+
syncCloudSettings(): Promise<void>;
|
|
40
|
+
private isTabbySyncActive;
|
|
41
|
+
/** Append the syncing loader element to the document body. */
|
|
42
|
+
injectLoaderIndicator(): void;
|
|
43
|
+
/** Show the syncing loader indicator, if present. */
|
|
44
|
+
showLoaderIndicator(): void;
|
|
45
|
+
/** Hide the syncing loader indicator, if present. */
|
|
46
|
+
hideLoaderIndicator(): void;
|
|
47
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export interface AmazonParams {
|
|
2
|
+
endpointUrl: string;
|
|
3
|
+
appId: string;
|
|
4
|
+
appSecret: string;
|
|
5
|
+
bucket: string;
|
|
6
|
+
region: string;
|
|
7
|
+
location: string;
|
|
8
|
+
}
|
|
9
|
+
export interface FtpParams {
|
|
10
|
+
protocol: string;
|
|
11
|
+
host: string;
|
|
12
|
+
username: string;
|
|
13
|
+
password: string;
|
|
14
|
+
location: string;
|
|
15
|
+
}
|
|
16
|
+
export interface GistParams {
|
|
17
|
+
type: string;
|
|
18
|
+
name: string;
|
|
19
|
+
id: string;
|
|
20
|
+
accessToken: string;
|
|
21
|
+
}
|
|
22
|
+
export interface WebDavParams {
|
|
23
|
+
host: string;
|
|
24
|
+
username: string;
|
|
25
|
+
password: string;
|
|
26
|
+
location: string;
|
|
27
|
+
port: string;
|
|
28
|
+
}
|
|
29
|
+
export interface DropboxParams {
|
|
30
|
+
isConnected?: boolean;
|
|
31
|
+
accessToken: string;
|
|
32
|
+
refreshToken: string;
|
|
33
|
+
location: string;
|
|
34
|
+
email?: string;
|
|
35
|
+
lastErrorMessage?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface ConnectionGroup {
|
|
38
|
+
name: string;
|
|
39
|
+
collapsed: boolean;
|
|
40
|
+
type: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Shape of the encrypted `sync-settings.json` file persisted next to the
|
|
44
|
+
* Tabby config. `configs` holds the provider-specific credentials/options.
|
|
45
|
+
*/
|
|
46
|
+
export interface StoredSettings {
|
|
47
|
+
adapter: string;
|
|
48
|
+
enabled: boolean;
|
|
49
|
+
showLoader: boolean;
|
|
50
|
+
interval_insync: number;
|
|
51
|
+
excludedSshBlocksByTarget?: Record<string, Array<{
|
|
52
|
+
key: string;
|
|
53
|
+
lines: string[];
|
|
54
|
+
}>>;
|
|
55
|
+
configs: any;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Normalized result returned by every cloud adapter's `sync` /
|
|
59
|
+
* `syncLocalSettingsToCloud` call so callers no longer need to guard against
|
|
60
|
+
* a bare boolean return value.
|
|
61
|
+
*/
|
|
62
|
+
export interface SyncResult {
|
|
63
|
+
result: boolean;
|
|
64
|
+
message: string;
|
|
65
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AppService, ConfigService, PlatformService } from 'terminus-core';
|
|
2
|
+
export declare type CloudSyncStatus = 'unconfigured' | 'disabled' | 'ready' | 'syncing' | 'conflict';
|
|
3
|
+
export declare class CloudSyncActions {
|
|
4
|
+
private app;
|
|
5
|
+
private config;
|
|
6
|
+
private platform;
|
|
7
|
+
constructor(app: AppService, config: ConfigService, platform: PlatformService);
|
|
8
|
+
get isTabbySyncActive(): boolean;
|
|
9
|
+
get status(): CloudSyncStatus;
|
|
10
|
+
private refuseWhenTabbySyncIsActive;
|
|
11
|
+
syncNow(): Promise<void>;
|
|
12
|
+
uploadLocalSettings(): Promise<void>;
|
|
13
|
+
downloadCloudSettings(): Promise<void>;
|
|
14
|
+
openSettings(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CloudSyncActions } from './cloud-sync-actions';
|
|
2
|
+
export declare const CommandProvider: any;
|
|
3
|
+
declare type CommandContext = {
|
|
4
|
+
tab?: any;
|
|
5
|
+
};
|
|
6
|
+
declare type Command = {
|
|
7
|
+
id?: string;
|
|
8
|
+
label: string;
|
|
9
|
+
run: () => Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
export declare class CloudSyncCommandProvider extends CommandProvider {
|
|
12
|
+
private actions;
|
|
13
|
+
constructor(actions: CloudSyncActions);
|
|
14
|
+
provide(_context: CommandContext): Promise<Command[]>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ToolbarButton, ToolbarButtonProvider } from 'terminus-core';
|
|
2
|
+
import { CloudSyncActions } from './cloud-sync-actions';
|
|
3
|
+
export declare class CloudSyncToolbarProvider extends ToolbarButtonProvider {
|
|
4
|
+
private actions;
|
|
5
|
+
constructor(actions: CloudSyncActions);
|
|
6
|
+
provide(): ToolbarButton[];
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PlatformService } from 'terminus-core';
|
|
2
|
+
export declare class TabbySyncUpgradeService {
|
|
3
|
+
private platform;
|
|
4
|
+
constructor(platform: PlatformService);
|
|
5
|
+
/**
|
|
6
|
+
* Installs (or upgrades to) the given version of this plugin.
|
|
7
|
+
* @param version Target plugin version to install.
|
|
8
|
+
*/
|
|
9
|
+
installPlugin(version: string): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-contained toast notifications for the Cloud Sync Settings plugin.
|
|
3
|
+
*
|
|
4
|
+
* Why not reuse Tabby's `ToastrService`? Two reasons:
|
|
5
|
+
*
|
|
6
|
+
* 1. Isolation. Tabby configures a single global `ToastrModule` with
|
|
7
|
+
* `positionClass: 'toast-bottom-center'` and `toastClass: 'toast'`, and
|
|
8
|
+
* restyles `#toast-container` in `app/src/toastr.scss`. Anything the plugin
|
|
9
|
+
* pushed through that service inherited those choices, and any styling the
|
|
10
|
+
* plugin added would have leaked into Tabby's own notifications.
|
|
11
|
+
* 2. Reach. Toasts are raised from plain singletons (`settings-helper`, the
|
|
12
|
+
* cloud adapters) that live outside Angular's injector, so an injectable
|
|
13
|
+
* service had to be threaded through as a parameter on ~30 method
|
|
14
|
+
* signatures just to be available.
|
|
15
|
+
*
|
|
16
|
+
* This module renders its own container into `document.body` and injects its own
|
|
17
|
+
* stylesheet, both under `tabby-cloud-sync-*` / `.tcss-toast*` names, so it
|
|
18
|
+
* cannot collide with Tabby's `#toast-container` or with Bootstrap's `.toast`.
|
|
19
|
+
* Every colour is stated explicitly rather than inherited, so a Tabby theme
|
|
20
|
+
* change can never render a message unreadable.
|
|
21
|
+
*/
|
|
22
|
+
export declare type PluginToastType = 'success' | 'error' | 'warning' | 'info';
|
|
23
|
+
export interface PluginToastOptions {
|
|
24
|
+
/** Milliseconds before the toast dismisses itself. `0` keeps it until clicked. */
|
|
25
|
+
timeout?: number;
|
|
26
|
+
/** Optional bold line rendered above the message. */
|
|
27
|
+
title?: string;
|
|
28
|
+
}
|
|
29
|
+
declare class PluginToastService {
|
|
30
|
+
private container;
|
|
31
|
+
private live;
|
|
32
|
+
/** Show a success message. */
|
|
33
|
+
success(message: string, options?: PluginToastOptions): void;
|
|
34
|
+
/** Show an error message. */
|
|
35
|
+
error(message: string, options?: PluginToastOptions): void;
|
|
36
|
+
/** Show a warning message. */
|
|
37
|
+
warning(message: string, options?: PluginToastOptions): void;
|
|
38
|
+
/** Show a neutral, informational message. */
|
|
39
|
+
info(message: string, options?: PluginToastOptions): void;
|
|
40
|
+
/**
|
|
41
|
+
* Render a toast in the bottom-right corner.
|
|
42
|
+
*
|
|
43
|
+
* Repeating a message that is already on screen restarts its timer instead
|
|
44
|
+
* of stacking a duplicate, which matters because several code paths report
|
|
45
|
+
* the same validation failure (e.g. "Please fill in all the fields.") on
|
|
46
|
+
* every keystroke-triggered revalidation.
|
|
47
|
+
*/
|
|
48
|
+
show(type: PluginToastType, message: string, options?: PluginToastOptions): void;
|
|
49
|
+
/** Dismiss every visible toast immediately. */
|
|
50
|
+
clear(): void;
|
|
51
|
+
private buildElement;
|
|
52
|
+
private scheduleDismiss;
|
|
53
|
+
private dismiss;
|
|
54
|
+
/**
|
|
55
|
+
* Create the container and stylesheet on first use. Both are looked up by
|
|
56
|
+
* id first so a plugin reload cannot leave two containers behind.
|
|
57
|
+
*/
|
|
58
|
+
private ensureContainer;
|
|
59
|
+
}
|
|
60
|
+
declare const _default: PluginToastService;
|
|
61
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PlatformService } from 'terminus-core';
|
|
2
|
+
/**
|
|
3
|
+
* Thin wrapper around winston that writes a daily rotating log file next to the
|
|
4
|
+
* Tabby config. Winston loggers are cached per log file so we do not rebuild the
|
|
5
|
+
* transports (and re-open the file handle) on every `new Logger(platform)`,
|
|
6
|
+
* which previously happened dozens of times per sync cycle.
|
|
7
|
+
*/
|
|
8
|
+
export default class Logger {
|
|
9
|
+
private static loggerCache;
|
|
10
|
+
private platform;
|
|
11
|
+
private logger;
|
|
12
|
+
constructor(platform: PlatformService);
|
|
13
|
+
/** Absolute path of today's log file. */
|
|
14
|
+
getCurrentLoggerFile(): string;
|
|
15
|
+
/** Absolute path of the log file for the given `DD-MM-YYYY` date string. */
|
|
16
|
+
private getLoggerFileForDate;
|
|
17
|
+
/** Build or reuse a cached winston logger bound to `filename`. */
|
|
18
|
+
private static getWinstonLogger;
|
|
19
|
+
/**
|
|
20
|
+
* Query the persisted log entries for a given day.
|
|
21
|
+
*
|
|
22
|
+
* @param callback Node-style `(err, result)` callback.
|
|
23
|
+
* @param date Day to query in `DD-MM-YYYY` format (defaults to today).
|
|
24
|
+
* @param limit Maximum number of entries to return.
|
|
25
|
+
*/
|
|
26
|
+
getLogContents(callback: any, date?: string, limit?: number): any;
|
|
27
|
+
/** Append a log entry at the given level (defaults to `info`). */
|
|
28
|
+
log(content: any, level?: string): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ConfigService, PlatformService } from 'terminus-core';
|
|
2
|
+
import { AmazonParams, SyncResult } from '../../interface';
|
|
3
|
+
declare class AmazonS3Class {
|
|
4
|
+
private provider;
|
|
5
|
+
private PERMISSIONS;
|
|
6
|
+
private TEST_FILE;
|
|
7
|
+
/** Select which S3-compatible provider subsequent calls should target. */
|
|
8
|
+
setProvider(provider: string): void;
|
|
9
|
+
/** Normalise the raw form params into a per-call config object. */
|
|
10
|
+
private resolveConfig;
|
|
11
|
+
/** Compute the remote object key for the encrypted config file. */
|
|
12
|
+
private getRemoteFileKey;
|
|
13
|
+
/**
|
|
14
|
+
* Verify the S3 credentials by uploading a small test file.
|
|
15
|
+
*
|
|
16
|
+
* @return `{ code: 1 }` on success or `{ code: 0, message }` on failure.
|
|
17
|
+
*/
|
|
18
|
+
testConnection: (platform: PlatformService, s3_params: AmazonParams) => Promise<any>;
|
|
19
|
+
/**
|
|
20
|
+
* Two-way sync between the local Tabby config and an S3-compatible bucket.
|
|
21
|
+
*
|
|
22
|
+
* @param firstInit When `true` prompts the user to choose the initial sync
|
|
23
|
+
* direction. Otherwise {@link resolveSyncDirection} compares content
|
|
24
|
+
* hashes against the recorded baseline to decide.
|
|
25
|
+
*/
|
|
26
|
+
sync(config: ConfigService, platform: PlatformService, params: AmazonParams, firstInit?: boolean): Promise<SyncResult>;
|
|
27
|
+
/**
|
|
28
|
+
* Force-push the local Tabby config to the configured S3 bucket.
|
|
29
|
+
*
|
|
30
|
+
* Concurrency is handled by the shared lock in `SettingsHelper`, so there is
|
|
31
|
+
* no adapter-local re-entrancy flag here any more.
|
|
32
|
+
*/
|
|
33
|
+
syncLocalSettingsToCloud(platform: PlatformService): Promise<SyncResult>;
|
|
34
|
+
/** Build an AWS S3 client for the resolved provider/endpoint. */
|
|
35
|
+
private createClient;
|
|
36
|
+
}
|
|
37
|
+
declare const _default: AmazonS3Class;
|
|
38
|
+
export default _default;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ConfigService, PlatformService } from 'terminus-core';
|
|
2
|
+
import { DropboxParams, SyncResult } from '../../interface';
|
|
3
|
+
import { EventEmitter } from '@angular/core';
|
|
4
|
+
declare class DropboxSync {
|
|
5
|
+
private _isFirstInit;
|
|
6
|
+
private _emitter;
|
|
7
|
+
private emitterActions;
|
|
8
|
+
private readonly adapterId;
|
|
9
|
+
/** Wire up the internal emitter so file-to-cloud events resolve the sync. */
|
|
10
|
+
internalEmitterHandler(): void;
|
|
11
|
+
/** Emit a `dropbox-sync-complete` event to any subscribed UI component. */
|
|
12
|
+
private emitSyncComplete;
|
|
13
|
+
/** Ask the provider UI to unlock an existing remote V2 config. */
|
|
14
|
+
private emitEncryptionSecretRequired;
|
|
15
|
+
/** Read a Dropbox file blob as a UTF-8 string. */
|
|
16
|
+
private readBlob;
|
|
17
|
+
/**
|
|
18
|
+
* Two-way sync between the local Tabby config and Dropbox.
|
|
19
|
+
*
|
|
20
|
+
* @param firstInit When `true` prompts the user to choose the initial sync
|
|
21
|
+
* direction and reports completion through the emitter. Otherwise
|
|
22
|
+
* {@link resolveSyncDirection} compares content hashes against the
|
|
23
|
+
* recorded baseline to decide.
|
|
24
|
+
*/
|
|
25
|
+
sync(config: ConfigService, platform: PlatformService, params: DropboxParams, firstInit?: boolean, emitter?: EventEmitter<any>): Promise<SyncResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Attempt to refresh the Dropbox access token using the stored refresh
|
|
28
|
+
* token when a download fails. Persists the refreshed tokens on success.
|
|
29
|
+
*/
|
|
30
|
+
private tryRefreshToken;
|
|
31
|
+
/**
|
|
32
|
+
* Upload the encrypted local config to Dropbox.
|
|
33
|
+
*
|
|
34
|
+
* Kept separate from {@link syncLocalSettingsToCloud} so a push driven by a
|
|
35
|
+
* sync cycle does not have to re-read the stored settings or contend with
|
|
36
|
+
* the shared sync lock, which the cycle already holds.
|
|
37
|
+
*/
|
|
38
|
+
private uploadLocalSettings;
|
|
39
|
+
/**
|
|
40
|
+
* Force-push the local Tabby config to Dropbox.
|
|
41
|
+
*
|
|
42
|
+
* Concurrency is handled by the shared lock in `SettingsHelper`, so there is
|
|
43
|
+
* no adapter-local re-entrancy flag here any more; the old per-adapter flags
|
|
44
|
+
* could silently turn a scheduled push into a no-op that still reported
|
|
45
|
+
* success.
|
|
46
|
+
*/
|
|
47
|
+
syncLocalSettingsToCloud(platform: PlatformService): Promise<SyncResult>;
|
|
48
|
+
}
|
|
49
|
+
declare const _default: DropboxSync;
|
|
50
|
+
export default _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ConfigService, PlatformService } from 'terminus-core';
|
|
2
|
+
import { FtpParams, SyncResult } from '../../interface';
|
|
3
|
+
declare class FTP {
|
|
4
|
+
private ftpClient;
|
|
5
|
+
private readonly adapterId;
|
|
6
|
+
/**
|
|
7
|
+
* Two-way sync between the local Tabby config and an FTP/FTPS server.
|
|
8
|
+
*
|
|
9
|
+
* @param firstInit When `true` prompts the user to choose the initial sync
|
|
10
|
+
* direction. Otherwise {@link resolveSyncDirection} compares content
|
|
11
|
+
* hashes against the recorded baseline to decide.
|
|
12
|
+
*/
|
|
13
|
+
sync(config: ConfigService, platform: PlatformService, params: FtpParams, firstInit?: boolean): Promise<SyncResult>;
|
|
14
|
+
/**
|
|
15
|
+
* Download the remote config into `tempFileLocal` and check that it arrived
|
|
16
|
+
* whole.
|
|
17
|
+
*
|
|
18
|
+
* `Client.downloadTo` creates the destination file *before* the transfer
|
|
19
|
+
* starts, so a connection dropped half way through leaves a file that
|
|
20
|
+
* exists and may even parse as YAML. Comparing the local size against the
|
|
21
|
+
* server's `SIZE` is what turns that silent corruption into a detectable
|
|
22
|
+
* error.
|
|
23
|
+
*/
|
|
24
|
+
private downloadRemoteConfig;
|
|
25
|
+
/**
|
|
26
|
+
* Encrypt the local config and upload it to the configured remote path.
|
|
27
|
+
*
|
|
28
|
+
* Returns a {@link SyncResult} rather than `void`: a failed upload used to
|
|
29
|
+
* only raise a toast, so a sync cycle would record a baseline for content
|
|
30
|
+
* the server never received and then believe both sides agreed.
|
|
31
|
+
*/
|
|
32
|
+
private uploadLocalSettings;
|
|
33
|
+
/**
|
|
34
|
+
* Force-push the local Tabby config to the FTP server.
|
|
35
|
+
*
|
|
36
|
+
* Concurrency is handled by the shared lock in `SettingsHelper`, so there is
|
|
37
|
+
* no adapter-local re-entrancy flag here any more; the old per-adapter flags
|
|
38
|
+
* could silently turn a scheduled push into a no-op that still reported
|
|
39
|
+
* success.
|
|
40
|
+
*/
|
|
41
|
+
syncLocalSettingsToCloud(platform: PlatformService): Promise<SyncResult>;
|
|
42
|
+
/** Establish an authenticated FTP/FTPS connection. */
|
|
43
|
+
private static createClient;
|
|
44
|
+
}
|
|
45
|
+
declare const _default: FTP;
|
|
46
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ConfigService, PlatformService } from 'terminus-core';
|
|
2
|
+
import { SyncResult, WebDavParams } from '../../interface';
|
|
3
|
+
declare class WebDav {
|
|
4
|
+
private readonly adapterId;
|
|
5
|
+
/**
|
|
6
|
+
* Two-way sync between the local Tabby config and a WebDav server.
|
|
7
|
+
*
|
|
8
|
+
* @param firstInit When `true` prompts the user to choose the initial sync
|
|
9
|
+
* direction. Otherwise {@link resolveSyncDirection} compares content
|
|
10
|
+
* hashes against the recorded baseline to decide.
|
|
11
|
+
*/
|
|
12
|
+
sync(config: ConfigService, platform: PlatformService, params: WebDavParams, firstInit?: boolean): Promise<SyncResult>;
|
|
13
|
+
/**
|
|
14
|
+
* Upload the encrypted local config to the given remote path.
|
|
15
|
+
*
|
|
16
|
+
* Kept separate from {@link syncLocalSettingsToCloud} so a push driven by a
|
|
17
|
+
* sync cycle does not have to re-read the stored settings or contend with
|
|
18
|
+
* the shared sync lock, which the cycle already holds.
|
|
19
|
+
*/
|
|
20
|
+
private uploadLocalSettings;
|
|
21
|
+
/**
|
|
22
|
+
* Force-push the local Tabby config to the WebDav server.
|
|
23
|
+
*
|
|
24
|
+
* Concurrency is handled by the shared lock in `SettingsHelper`, so there is
|
|
25
|
+
* no adapter-local re-entrancy flag here any more; the old per-adapter flags
|
|
26
|
+
* could silently turn a scheduled push into a no-op that still reported
|
|
27
|
+
* success.
|
|
28
|
+
*/
|
|
29
|
+
syncLocalSettingsToCloud(platform: PlatformService): Promise<SyncResult>;
|
|
30
|
+
/** Build a WebDav client from the stored connection params. */
|
|
31
|
+
private static createClient;
|
|
32
|
+
}
|
|
33
|
+
declare const _default: WebDav;
|
|
34
|
+
export default _default;
|