@vacantthinker/firefox-addon-framework-easy 2026.611.821 → 2026.611.1433
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 +0 -217
- package/dist/BaseORM.d.ts +41 -0
- package/dist/BaseORM.d.ts.map +1 -0
- package/dist/BaseORM.js +77 -0
- package/dist/browserDownload.d.ts +9 -0
- package/dist/browserDownload.d.ts.map +1 -0
- package/dist/browserDownload.js +10 -0
- package/dist/browserNotification.d.ts +8 -0
- package/dist/browserNotification.d.ts.map +1 -0
- package/dist/browserNotification.js +17 -0
- package/dist/browserRuntime.d.ts +41 -0
- package/dist/browserRuntime.d.ts.map +1 -0
- package/dist/browserRuntime.js +61 -0
- package/dist/browserTab.d.ts +34 -0
- package/dist/browserTab.d.ts.map +1 -0
- package/dist/browserTab.js +105 -0
- package/dist/generate.d.ts +13 -0
- package/dist/generate.d.ts.map +1 -0
- package/dist/generate.js +99 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/opStorage.d.ts +40 -0
- package/dist/opStorage.d.ts.map +1 -0
- package/dist/opStorage.js +57 -0
- package/dist/opTab.d.ts +82 -0
- package/dist/opTab.d.ts.map +1 -0
- package/dist/opTab.js +152 -0
- package/dist/serviceCommon.d.ts +8 -0
- package/dist/serviceCommon.d.ts.map +1 -0
- package/dist/serviceCommon.js +21 -0
- package/dist/serviceFetch.d.ts +23 -0
- package/dist/serviceFetch.d.ts.map +1 -0
- package/dist/serviceFetch.js +38 -0
- package/dist/serviceGet.d.ts +13 -0
- package/dist/serviceGet.d.ts.map +1 -0
- package/dist/serviceGet.js +24 -0
- package/dist/serviceOpContent.d.ts +24 -0
- package/dist/serviceOpContent.d.ts.map +1 -0
- package/dist/serviceOpContent.js +69 -0
- package/dist/serviceOpJavascript.d.ts +41 -0
- package/dist/serviceOpJavascript.d.ts.map +1 -0
- package/dist/serviceOpJavascript.js +182 -0
- package/dist/servicePure.d.ts +18 -0
- package/dist/servicePure.d.ts.map +1 -0
- package/dist/servicePure.js +51 -0
- package/dist/serviceUpdateTabStyle.d.ts +17 -0
- package/dist/serviceUpdateTabStyle.d.ts.map +1 -0
- package/dist/serviceUpdateTabStyle.js +63 -0
- package/package.json +11 -4
- package/.github/workflows/npm-publish.yml +0 -34
- package/index.js +0 -17
- package/publish.sh +0 -81
- package/src/BaseORM.js +0 -66
- package/src/DomainORM.js +0 -11
- package/src/browserDownload.js +0 -23
- package/src/browserNotification.js +0 -22
- package/src/browserRuntime.js +0 -65
- package/src/browserRuntimeOnMessageCommon.js +0 -50
- package/src/browserTab.js +0 -138
- package/src/generate.js +0 -177
- package/src/opStorage.js +0 -76
- package/src/opTab.js +0 -237
- package/src/serviceCommon.js +0 -22
- package/src/serviceFetch.js +0 -65
- package/src/serviceGet.js +0 -31
- package/src/serviceOpContent.js +0 -83
- package/src/serviceOpJavascript.js +0 -346
- package/src/servicePure.js +0 -42
- package/src/serviceUpdateTabStyle.js +0 -130
package/README.md
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
This project is licensed under the GNU Affero General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
## Source Code Access
|
|
11
10
|
|
|
12
11
|
According to the terms of the AGPL-3.0, the source code for this network service must be made available to all users.
|
|
@@ -17,219 +16,3 @@ You can download, clone, or view the complete source code for this application h
|
|
|
17
16
|
|
|
18
17
|
Below is a list of all public functions found inside the `src` directory:
|
|
19
18
|
|
|
20
|
-
### 📄 File: `src/BaseORM.js`
|
|
21
|
-
```javascript
|
|
22
|
-
export class BaseORM { }
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### 📄 File: `src/browserDownload.js`
|
|
27
|
-
```javascript
|
|
28
|
-
export async function browserDownloadByDownlink(
|
|
29
|
-
{ }
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### 📄 File: `src/browserNotification.js`
|
|
34
|
-
```javascript
|
|
35
|
-
export async function browserNotificationCreate(
|
|
36
|
-
content,
|
|
37
|
-
title = browserRuntimeManifestName(),
|
|
38
|
-
) { }
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### 📄 File: `src/browserRuntime.js`
|
|
43
|
-
```javascript
|
|
44
|
-
export function browserRuntimeReload() { }
|
|
45
|
-
|
|
46
|
-
export async function browserRuntimeSetUninstallURL(
|
|
47
|
-
url = '',
|
|
48
|
-
) { }
|
|
49
|
-
|
|
50
|
-
export function browserRuntimeOnUpdateAvailable(doWhat = null) { }
|
|
51
|
-
|
|
52
|
-
export function browserRuntimeGetURL(path) { }
|
|
53
|
-
|
|
54
|
-
export function browserRuntimeGeckoId() { }
|
|
55
|
-
|
|
56
|
-
export async function browserRuntimePlatformInfo() { }
|
|
57
|
-
|
|
58
|
-
export function browserRuntimeManifestVersion() { }
|
|
59
|
-
|
|
60
|
-
export function browserRuntimeManifestName() { }
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### 📄 File: `src/browserRuntimeOnMessageCommon.js`
|
|
65
|
-
```javascript
|
|
66
|
-
export function browserRuntimeOnMessageCommon(act, message, sendResponse) { }
|
|
67
|
-
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### 📄 File: `src/browserTab.js`
|
|
71
|
-
```javascript
|
|
72
|
-
export async function browserTabSendMessage(
|
|
73
|
-
tabId,
|
|
74
|
-
message,
|
|
75
|
-
) { }
|
|
76
|
-
|
|
77
|
-
export function browserTabWaitReloadThenSendMessageToContentJs(message) { }
|
|
78
|
-
|
|
79
|
-
export async function browserTabCreateToDownload(message) { }
|
|
80
|
-
|
|
81
|
-
export async function browserTabCreateNearSendMessageToContentJs(message = { }
|
|
82
|
-
|
|
83
|
-
export function browserTabWaitReloadThenRemoveIt({ }
|
|
84
|
-
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### 📄 File: `src/DomainORM.js`
|
|
88
|
-
```javascript
|
|
89
|
-
export class DomainORM extends BaseORM { }
|
|
90
|
-
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### 📄 File: `src/generate.js`
|
|
94
|
-
```javascript
|
|
95
|
-
export function generateMkvScriptForSystemWindows(videoInfo) { }
|
|
96
|
-
|
|
97
|
-
export function generateMkvScriptForSystemFedora(videoInfo) { }
|
|
98
|
-
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### 📄 File: `src/opStorage.js`
|
|
102
|
-
```javascript
|
|
103
|
-
export async function stoOpCheck(k) { }
|
|
104
|
-
|
|
105
|
-
export async function stoOpGet(k) { }
|
|
106
|
-
|
|
107
|
-
export async function stoOpGetAll() { }
|
|
108
|
-
|
|
109
|
-
export async function stoOpQueryStartWith(k) { }
|
|
110
|
-
|
|
111
|
-
export async function stoOpSet(k, v) { }
|
|
112
|
-
|
|
113
|
-
export async function stoOpRem(k) { }
|
|
114
|
-
|
|
115
|
-
export async function stoOpSetNull(k) { }
|
|
116
|
-
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### 📄 File: `src/opTab.js`
|
|
120
|
-
```javascript
|
|
121
|
-
export function tabOpEnhance(tab) { }
|
|
122
|
-
|
|
123
|
-
export async function tabOpCreate(properties) { }
|
|
124
|
-
|
|
125
|
-
export async function tabOpCreateNear(properties) { }
|
|
126
|
-
|
|
127
|
-
export async function tabOpCreateActiveFalse(properties) { }
|
|
128
|
-
|
|
129
|
-
export async function tabOpCreateByWindow(url) { }
|
|
130
|
-
|
|
131
|
-
export function tabOpGet(tabId) { }
|
|
132
|
-
|
|
133
|
-
export function tabOpQueryAll() { }
|
|
134
|
-
|
|
135
|
-
export async function tabOpQueryUrl(urlQuery) { }
|
|
136
|
-
|
|
137
|
-
export async function tabOpQueryUrlThenRemove(urlQuery) { }
|
|
138
|
-
|
|
139
|
-
export function tabOpReload(tabId) { }
|
|
140
|
-
|
|
141
|
-
export function tabOpReloadByPassCacheTrue(tabId) { }
|
|
142
|
-
|
|
143
|
-
export function tabOpRemove(tabId) { }
|
|
144
|
-
|
|
145
|
-
export function tabOpHide(tabId) { }
|
|
146
|
-
|
|
147
|
-
export async function tabOpUpdate(
|
|
148
|
-
tabId,
|
|
149
|
-
updateProperties,
|
|
150
|
-
) { }
|
|
151
|
-
|
|
152
|
-
export function tabOpUpdateActiveFalse(tabId) { }
|
|
153
|
-
|
|
154
|
-
export async function tabOpFocus(tabId) { }
|
|
155
|
-
|
|
156
|
-
export function tabOpInsertCssCode(
|
|
157
|
-
tabId,
|
|
158
|
-
code,
|
|
159
|
-
) { }
|
|
160
|
-
|
|
161
|
-
export function tabOpRemoveCssCode(
|
|
162
|
-
tabId,
|
|
163
|
-
code,
|
|
164
|
-
) { }
|
|
165
|
-
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### 📄 File: `src/serviceCommon.js`
|
|
169
|
-
```javascript
|
|
170
|
-
export async function serviceDownloadByDownlink(message) { }
|
|
171
|
-
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### 📄 File: `src/serviceFetch.js`
|
|
175
|
-
```javascript
|
|
176
|
-
export async function servicePostJson(
|
|
177
|
-
serverUrl,
|
|
178
|
-
message,
|
|
179
|
-
) { }
|
|
180
|
-
|
|
181
|
-
export async function serviceSendDataToLocalAria2(message) { }
|
|
182
|
-
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
### 📄 File: `src/serviceGet.js`
|
|
186
|
-
```javascript
|
|
187
|
-
export function serviceGetDomainByUrl(url) { }
|
|
188
|
-
|
|
189
|
-
export function serviceGetCurrentDateYYYYMMDDHHMMSS() { }
|
|
190
|
-
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
### 📄 File: `src/serviceOpContent.js`
|
|
194
|
-
```javascript
|
|
195
|
-
export async function serviceCopyContentToClipboard(data) { }
|
|
196
|
-
|
|
197
|
-
export function serviceSaveContentToLocal(content, filename, ext = 'txt') { }
|
|
198
|
-
|
|
199
|
-
export async function serviceGenerateMkvToolNixScript({ }
|
|
200
|
-
|
|
201
|
-
export function serviceRemoveIllegalWord(value) { }
|
|
202
|
-
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
### 📄 File: `src/serviceOpJavascript.js`
|
|
206
|
-
```javascript
|
|
207
|
-
export async function serviceTakeScreenshot(
|
|
208
|
-
{ }
|
|
209
|
-
|
|
210
|
-
export async function serviceElementPicker(message) { }
|
|
211
|
-
|
|
212
|
-
export async function serviceGetFullPageRectData(message) { }
|
|
213
|
-
|
|
214
|
-
export async function serviceFindAllMagnetLink(message) { }
|
|
215
|
-
|
|
216
|
-
export async function serviceDealWithMagnetLink(message) { }
|
|
217
|
-
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
### 📄 File: `src/servicePure.js`
|
|
221
|
-
```javascript
|
|
222
|
-
export function servicePureVideolinkYTB(videolinkOrigin) { }
|
|
223
|
-
|
|
224
|
-
export function servicePurePlaylistVideolinkYTB(videolinkOrigin) { }
|
|
225
|
-
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
### 📄 File: `src/serviceUpdateTabStyle.js`
|
|
229
|
-
```javascript
|
|
230
|
-
export async function serviceUpdataALLTextNodeColor(message) { }
|
|
231
|
-
|
|
232
|
-
export async function serviceUpdataALLNodeBackgroundColor(message) { }
|
|
233
|
-
|
|
234
|
-
```
|
|
235
|
-
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract base class BaseORM.
|
|
3
|
+
* Provides encapsulated CRUD operations for JSON-serializable Key-Value pairs.
|
|
4
|
+
* Uses Generics (T) to ensure type safety for the stored object structure.
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class BaseORM<T extends Record<string, any>> {
|
|
7
|
+
#private;
|
|
8
|
+
/**
|
|
9
|
+
* @param prefix The prefix for the storage key.
|
|
10
|
+
* @param id The unique identifier for this instance.
|
|
11
|
+
* @param defaultValue The initial value to use if the key does not exist.
|
|
12
|
+
*/
|
|
13
|
+
protected constructor(prefix: string, id: string, defaultValue?: T);
|
|
14
|
+
get id(): string;
|
|
15
|
+
get storageKey(): string;
|
|
16
|
+
private exists;
|
|
17
|
+
private initDefaultObject;
|
|
18
|
+
/**
|
|
19
|
+
* Retrieve the value associated with the bound key.
|
|
20
|
+
* @returns {Promise<T>}
|
|
21
|
+
*/
|
|
22
|
+
get(): Promise<T>;
|
|
23
|
+
/**
|
|
24
|
+
* Overwrite the value of the bound key completely.
|
|
25
|
+
* @param {T} value
|
|
26
|
+
* @returns {Promise<void>}
|
|
27
|
+
*/
|
|
28
|
+
set(value: T): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Wipe the bound key from storage.
|
|
31
|
+
* @returns {Promise<T>}
|
|
32
|
+
*/
|
|
33
|
+
delete(): Promise<T>;
|
|
34
|
+
/**
|
|
35
|
+
* Modify a single targeted key-value pair nested deep within the stored object.
|
|
36
|
+
* @param {K} key The internal key path inside the main value object.
|
|
37
|
+
* @param {T[K]} value The new value to map to that key.
|
|
38
|
+
*/
|
|
39
|
+
updateValueKeyValue<K extends keyof T>(key: K, value: T[K]): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=BaseORM.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseORM.d.ts","sourceRoot":"","sources":["../src/BaseORM.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,8BAAsB,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;IAKzD;;;;OAIG;IACH,SAAS,aAAa,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,YAAY,GAAE,CAAW;IAc3E,IAAI,EAAE,IAAI,MAAM,CAEf;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;YAEa,MAAM;YAIN,iBAAiB;IAI/B;;;OAGG;IACG,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC;IAOvB;;;;OAIG;IACG,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlC;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC;IAM1B;;;;OAIG;IACG,mBAAmB,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAKjF"}
|
package/dist/BaseORM.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { stoOpCheck, stoOpGet, stoOpRem, stoOpSet } from './opStorage';
|
|
2
|
+
/**
|
|
3
|
+
* Abstract base class BaseORM.
|
|
4
|
+
* Provides encapsulated CRUD operations for JSON-serializable Key-Value pairs.
|
|
5
|
+
* Uses Generics (T) to ensure type safety for the stored object structure.
|
|
6
|
+
*/
|
|
7
|
+
export class BaseORM {
|
|
8
|
+
#id;
|
|
9
|
+
#fullStorageKey;
|
|
10
|
+
#defaultValue;
|
|
11
|
+
/**
|
|
12
|
+
* @param prefix The prefix for the storage key.
|
|
13
|
+
* @param id The unique identifier for this instance.
|
|
14
|
+
* @param defaultValue The initial value to use if the key does not exist.
|
|
15
|
+
*/
|
|
16
|
+
constructor(prefix, id, defaultValue = {}) {
|
|
17
|
+
if (new.target === BaseORM) {
|
|
18
|
+
throw new TypeError('Cannot construct BaseORM instances directly (Abstract Class).');
|
|
19
|
+
}
|
|
20
|
+
if (!prefix || !id) {
|
|
21
|
+
throw new Error('Both prefix and id must be specified.');
|
|
22
|
+
}
|
|
23
|
+
this.#id = id;
|
|
24
|
+
const formattedPrefix = prefix.endsWith(' ') ? prefix : `${prefix} `;
|
|
25
|
+
this.#fullStorageKey = `${formattedPrefix}${id}`;
|
|
26
|
+
this.#defaultValue = JSON.parse(JSON.stringify(defaultValue));
|
|
27
|
+
}
|
|
28
|
+
get id() {
|
|
29
|
+
return this.#id;
|
|
30
|
+
}
|
|
31
|
+
get storageKey() {
|
|
32
|
+
return this.#fullStorageKey;
|
|
33
|
+
}
|
|
34
|
+
async exists() {
|
|
35
|
+
return await stoOpCheck(this.#fullStorageKey);
|
|
36
|
+
}
|
|
37
|
+
async initDefaultObject() {
|
|
38
|
+
await stoOpSet(this.#fullStorageKey, this.#defaultValue);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Retrieve the value associated with the bound key.
|
|
42
|
+
* @returns {Promise<T>}
|
|
43
|
+
*/
|
|
44
|
+
async get() {
|
|
45
|
+
if (!(await this.exists())) {
|
|
46
|
+
await this.initDefaultObject();
|
|
47
|
+
}
|
|
48
|
+
return (await stoOpGet(this.#fullStorageKey));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Overwrite the value of the bound key completely.
|
|
52
|
+
* @param {T} value
|
|
53
|
+
* @returns {Promise<void>}
|
|
54
|
+
*/
|
|
55
|
+
async set(value) {
|
|
56
|
+
await stoOpSet(this.#fullStorageKey, value || this.#defaultValue);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Wipe the bound key from storage.
|
|
60
|
+
* @returns {Promise<T>}
|
|
61
|
+
*/
|
|
62
|
+
async delete() {
|
|
63
|
+
const previousValue = await this.get();
|
|
64
|
+
await stoOpRem(this.#fullStorageKey);
|
|
65
|
+
return previousValue;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Modify a single targeted key-value pair nested deep within the stored object.
|
|
69
|
+
* @param {K} key The internal key path inside the main value object.
|
|
70
|
+
* @param {T[K]} value The new value to map to that key.
|
|
71
|
+
*/
|
|
72
|
+
async updateValueKeyValue(key, value) {
|
|
73
|
+
const data = await this.get();
|
|
74
|
+
data[key] = value;
|
|
75
|
+
await this.set(data);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for the download request parameters.
|
|
3
|
+
*/
|
|
4
|
+
export interface DownloadParams {
|
|
5
|
+
downlink: string;
|
|
6
|
+
filename?: string | null;
|
|
7
|
+
}
|
|
8
|
+
export declare function browserDownloadByDownlink({ downlink, filename, }: DownloadParams): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=browserDownload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browserDownload.d.ts","sourceRoot":"","sources":["../src/browserDownload.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,wBAAsB,yBAAyB,CAAC,EACE,QAAQ,EACR,QAAe,GAChB,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAWhF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a browser notification with basic type.
|
|
3
|
+
* @param content The notification message string.
|
|
4
|
+
* @param title The notification title (defaults to manifest name).
|
|
5
|
+
* @returns The notification identifier.
|
|
6
|
+
*/
|
|
7
|
+
export declare function browserNotificationCreate(content: string, title?: string): Promise<string>;
|
|
8
|
+
//# sourceMappingURL=browserNotification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browserNotification.d.ts","sourceRoot":"","sources":["../src/browserNotification.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,MAAM,EACf,KAAK,GAAE,MAAqC,GAC3C,OAAO,CAAC,MAAM,CAAC,CAYjB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { browserRuntimeGeckoId, browserRuntimeManifestName } from './browserRuntime';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a browser notification with basic type.
|
|
4
|
+
* @param content The notification message string.
|
|
5
|
+
* @param title The notification title (defaults to manifest name).
|
|
6
|
+
* @returns The notification identifier.
|
|
7
|
+
*/
|
|
8
|
+
export async function browserNotificationCreate(content, title = browserRuntimeManifestName()) {
|
|
9
|
+
const notificationId = `${browserRuntimeGeckoId()}cake-noti`;
|
|
10
|
+
const options = {
|
|
11
|
+
type: 'basic',
|
|
12
|
+
title: title,
|
|
13
|
+
message: content,
|
|
14
|
+
};
|
|
15
|
+
await browser.notifications.create(notificationId, options);
|
|
16
|
+
return notificationId;
|
|
17
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reloads the current extension.
|
|
3
|
+
*/
|
|
4
|
+
export declare function browserRuntimeReload(): void;
|
|
5
|
+
/**
|
|
6
|
+
* Sets the URL to be visited upon uninstallation.
|
|
7
|
+
* @param url The URL string, defaults to empty.
|
|
8
|
+
*/
|
|
9
|
+
export declare function browserRuntimeSetUninstallURL(url?: string): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Adds a listener for available updates.
|
|
12
|
+
* @param callback Callback to execute when an update is available.
|
|
13
|
+
*/
|
|
14
|
+
export declare function browserRuntimeOnUpdateAvailable(callback?: (details: browser.runtime._OnUpdateAvailableDetails) => void | Promise<void>): void;
|
|
15
|
+
/**
|
|
16
|
+
* Converts a relative path to a fully qualified URL.
|
|
17
|
+
* @param path The path to the resource.
|
|
18
|
+
* @returns The absolute URL string.
|
|
19
|
+
*/
|
|
20
|
+
export declare function browserRuntimeGetURL(path: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves the Gecko ID from the manifest.
|
|
23
|
+
* @returns The Gecko ID or empty string if not found.
|
|
24
|
+
*/
|
|
25
|
+
export declare function browserRuntimeGeckoId(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Gets information about the current platform.
|
|
28
|
+
* @returns A promise resolving to PlatformInfo.
|
|
29
|
+
*/
|
|
30
|
+
export declare function browserRuntimePlatformInfo(): Promise<browser.runtime.PlatformInfo>;
|
|
31
|
+
/**
|
|
32
|
+
* Gets the version from the manifest.
|
|
33
|
+
* @returns The version string.
|
|
34
|
+
*/
|
|
35
|
+
export declare function browserRuntimeManifestVersion(): string;
|
|
36
|
+
/**
|
|
37
|
+
* Gets the extension name from the manifest.
|
|
38
|
+
* @returns The extension name.
|
|
39
|
+
*/
|
|
40
|
+
export declare function browserRuntimeManifestName(): string;
|
|
41
|
+
//# sourceMappingURL=browserRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browserRuntime.d.ts","sourceRoot":"","sources":["../src/browserRuntime.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAED;;;GAGG;AACH,wBAAsB,6BAA6B,CAAC,GAAG,GAAE,MAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnF;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,yBAAyB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GACtF,IAAI,CAMN;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAG9C;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAExF;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,IAAI,MAAM,CAEtD;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CAEnD"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reloads the current extension.
|
|
3
|
+
*/
|
|
4
|
+
export function browserRuntimeReload() {
|
|
5
|
+
browser.runtime.reload();
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Sets the URL to be visited upon uninstallation.
|
|
9
|
+
* @param url The URL string, defaults to empty.
|
|
10
|
+
*/
|
|
11
|
+
export async function browserRuntimeSetUninstallURL(url = '') {
|
|
12
|
+
await browser.runtime.setUninstallURL(url);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Adds a listener for available updates.
|
|
16
|
+
* @param callback Callback to execute when an update is available.
|
|
17
|
+
*/
|
|
18
|
+
export function browserRuntimeOnUpdateAvailable(callback) {
|
|
19
|
+
browser.runtime.onUpdateAvailable.addListener(async (details) => {
|
|
20
|
+
if (callback) {
|
|
21
|
+
await callback(details);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Converts a relative path to a fully qualified URL.
|
|
27
|
+
* @param path The path to the resource.
|
|
28
|
+
* @returns The absolute URL string.
|
|
29
|
+
*/
|
|
30
|
+
export function browserRuntimeGetURL(path) {
|
|
31
|
+
return browser.runtime.getURL(path);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves the Gecko ID from the manifest.
|
|
35
|
+
* @returns The Gecko ID or empty string if not found.
|
|
36
|
+
*/
|
|
37
|
+
export function browserRuntimeGeckoId() {
|
|
38
|
+
const manifest = browser.runtime.getManifest();
|
|
39
|
+
return manifest.browser_specific_settings?.gecko?.id ?? '';
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Gets information about the current platform.
|
|
43
|
+
* @returns A promise resolving to PlatformInfo.
|
|
44
|
+
*/
|
|
45
|
+
export async function browserRuntimePlatformInfo() {
|
|
46
|
+
return await browser.runtime.getPlatformInfo();
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Gets the version from the manifest.
|
|
50
|
+
* @returns The version string.
|
|
51
|
+
*/
|
|
52
|
+
export function browserRuntimeManifestVersion() {
|
|
53
|
+
return browser.runtime.getManifest().version;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Gets the extension name from the manifest.
|
|
57
|
+
* @returns The extension name.
|
|
58
|
+
*/
|
|
59
|
+
export function browserRuntimeManifestName() {
|
|
60
|
+
return browser.runtime.getManifest().name;
|
|
61
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface representing the structure of a message sent to a tab.
|
|
3
|
+
* Includes optional properties for tab creation and specific message data.
|
|
4
|
+
*/
|
|
5
|
+
export interface TabMessage {
|
|
6
|
+
targetTabId?: number;
|
|
7
|
+
previousTabId?: number;
|
|
8
|
+
url?: string;
|
|
9
|
+
focusNewTab?: boolean;
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Sends a message to a specific tab.
|
|
14
|
+
*/
|
|
15
|
+
export declare function browserTabSendMessage(tabId: number, message: any): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Waits for a tab to finish loading (status: complete) before sending a message.
|
|
18
|
+
*/
|
|
19
|
+
export declare function browserTabWaitReloadThenSendMessageToContentJs(message: TabMessage): void;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a tab for download, waits for load, and then removes it.
|
|
22
|
+
*/
|
|
23
|
+
export declare function browserTabCreateToDownload(message: TabMessage): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Safely handles incoming messages to create tabs and send messages to content scripts.
|
|
26
|
+
*/
|
|
27
|
+
export declare function browserTabCreateNearSendMessageToContentJs(message?: TabMessage): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Watches a tab for reload, then removes it upon completion.
|
|
30
|
+
*/
|
|
31
|
+
export declare function browserTabWaitReloadThenRemoveIt({ tabId }: {
|
|
32
|
+
tabId: number;
|
|
33
|
+
}): void;
|
|
34
|
+
//# sourceMappingURL=browserTab.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browserTab.d.ts","sourceRoot":"","sources":["../src/browserTab.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAEtF;AAED;;GAEG;AACH,wBAAgB,8CAA8C,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAkBxF;AAED;;GAEG;AACH,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BnF;AAED;;GAEG;AACH,wBAAsB,0CAA0C,CAAC,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAyCxG;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,EAAC,KAAK,EAAC,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAYjF"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { tabOpCreate, tabOpCreateNear, tabOpRemove } from './opTab';
|
|
2
|
+
/**
|
|
3
|
+
* Sends a message to a specific tab.
|
|
4
|
+
*/
|
|
5
|
+
export async function browserTabSendMessage(tabId, message) {
|
|
6
|
+
await browser.tabs.sendMessage(tabId, message);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Waits for a tab to finish loading (status: complete) before sending a message.
|
|
10
|
+
*/
|
|
11
|
+
export function browserTabWaitReloadThenSendMessageToContentJs(message) {
|
|
12
|
+
const { targetTabId, ...rest } = message;
|
|
13
|
+
if (targetTabId === undefined)
|
|
14
|
+
return;
|
|
15
|
+
const listener = async (tabId, changeInfo) => {
|
|
16
|
+
if (tabId === targetTabId && changeInfo.status === 'complete') {
|
|
17
|
+
browser.tabs.onUpdated.removeListener(listener);
|
|
18
|
+
await browserTabSendMessage(tabId, rest);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
browser.tabs.onUpdated.addListener(listener, {
|
|
22
|
+
tabId: targetTabId,
|
|
23
|
+
properties: ['status'],
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Creates a tab for download, waits for load, and then removes it.
|
|
28
|
+
*/
|
|
29
|
+
export async function browserTabCreateToDownload(message) {
|
|
30
|
+
if (!message.url)
|
|
31
|
+
return;
|
|
32
|
+
const properties = {
|
|
33
|
+
url: message.url,
|
|
34
|
+
};
|
|
35
|
+
if (message.focusNewTab !== undefined) {
|
|
36
|
+
properties.active = message.focusNewTab;
|
|
37
|
+
}
|
|
38
|
+
const { tabId } = await tabOpCreate(properties);
|
|
39
|
+
const listener = async (updatedTabId, changeInfo) => {
|
|
40
|
+
if (updatedTabId === tabId && changeInfo.status === 'complete') {
|
|
41
|
+
browser.tabs.onUpdated.removeListener(listener);
|
|
42
|
+
await tabOpRemove(tabId);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
browser.tabs.onUpdated.addListener(listener, {
|
|
46
|
+
tabId,
|
|
47
|
+
properties: ['status'],
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Safely handles incoming messages to create tabs and send messages to content scripts.
|
|
52
|
+
*/
|
|
53
|
+
export async function browserTabCreateNearSendMessageToContentJs(message = {}) {
|
|
54
|
+
if (!message.url)
|
|
55
|
+
return;
|
|
56
|
+
const { previousTabId, ...rest } = message;
|
|
57
|
+
const properties = {
|
|
58
|
+
url: message.url,
|
|
59
|
+
active: message.focusNewTab ?? false,
|
|
60
|
+
};
|
|
61
|
+
const { tabId: createdTabId } = message.previousTabId
|
|
62
|
+
? await tabOpCreateNear({ properties, previousTabId })
|
|
63
|
+
: await tabOpCreate(properties);
|
|
64
|
+
if (!createdTabId)
|
|
65
|
+
return;
|
|
66
|
+
const onUpdatedListener = async (tabId, changeInfo) => {
|
|
67
|
+
if (tabId === createdTabId && changeInfo.status === 'complete') {
|
|
68
|
+
cleanup();
|
|
69
|
+
await browserTabSendMessage(tabId, {
|
|
70
|
+
...rest,
|
|
71
|
+
tabId: tabId,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
// Listener to cleanup if tab is closed before loading completes
|
|
76
|
+
const onRemovedListener = (tabId) => {
|
|
77
|
+
if (tabId === createdTabId) {
|
|
78
|
+
cleanup();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const cleanup = () => {
|
|
82
|
+
browser.tabs.onUpdated.removeListener(onUpdatedListener);
|
|
83
|
+
browser.tabs.onRemoved.removeListener(onRemovedListener);
|
|
84
|
+
};
|
|
85
|
+
browser.tabs.onUpdated.addListener(onUpdatedListener, {
|
|
86
|
+
tabId: createdTabId,
|
|
87
|
+
properties: ['status'],
|
|
88
|
+
});
|
|
89
|
+
browser.tabs.onRemoved.addListener(onRemovedListener);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Watches a tab for reload, then removes it upon completion.
|
|
93
|
+
*/
|
|
94
|
+
export function browserTabWaitReloadThenRemoveIt({ tabId }) {
|
|
95
|
+
const listener = async (updatedTabId, changeInfo) => {
|
|
96
|
+
if (updatedTabId === tabId && changeInfo.status === 'complete') {
|
|
97
|
+
browser.tabs.onUpdated.removeListener(listener);
|
|
98
|
+
await tabOpRemove(tabId);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
browser.tabs.onUpdated.addListener(listener, {
|
|
102
|
+
tabId,
|
|
103
|
+
properties: ['status'],
|
|
104
|
+
});
|
|
105
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface VideoInfo {
|
|
2
|
+
vid: string;
|
|
3
|
+
videoTitle: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Generates an executable script for Windows.
|
|
7
|
+
*/
|
|
8
|
+
export declare function generateMkvScriptForSystemWindows(videoInfo: VideoInfo): string;
|
|
9
|
+
/**
|
|
10
|
+
* Generates a bash script for Fedora.
|
|
11
|
+
*/
|
|
12
|
+
export declare function generateMkvScriptForSystemFedora(videoInfo: VideoInfo): string;
|
|
13
|
+
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;CACpB;AAyED;;GAEG;AACH,wBAAgB,iCAAiC,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAc9E;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAsB7E"}
|