@vacantthinker/firefox-addon-framework-easy 2026.5.2212 → 2026.524.1751

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.
@@ -0,0 +1,34 @@
1
+ # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
+ # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
+
4
+ name: Node.js Package
5
+
6
+ on:
7
+ push:
8
+ branches:
9
+ - main #
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v6
16
+ - uses: actions/setup-node@v6
17
+ with:
18
+ node-version: 24
19
+ - run: npm ci
20
+
21
+ publish-npm:
22
+ needs: build
23
+ runs-on: ubuntu-latest
24
+ permissions:
25
+ contents: read
26
+ id-token: write
27
+ steps:
28
+ - uses: actions/checkout@v6
29
+ - uses: actions/setup-node@v6
30
+ with:
31
+ node-version: 24
32
+ registry-url: https://registry.npmjs.org/
33
+ - run: npm ci
34
+ - run: npm publish --provenance --access public
package/README.md CHANGED
@@ -1 +1,158 @@
1
- # firefox-addon-framework-easy
1
+ # firefox-addon-framework-easy
2
+
3
+ [![License: AGPL v3](https://shields.io)](https://gnu.org)
4
+
5
+ ## License
6
+
7
+ This project is licensed under the GNU Affero General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
8
+
9
+
10
+ ## Source Code Access
11
+
12
+ According to the terms of the AGPL-3.0, the source code for this network service must be made available to all users.
13
+
14
+ You can download, clone, or view the complete source code for this application here: [Insert your GitHub/GitLab URL].
15
+
16
+ ## API Reference (Auto-Generated)
17
+
18
+ Below is a list of all public functions found inside the `src` directory:
19
+
20
+ ### File: `src/baseORM.js`
21
+ ```javascript
22
+ export class BaseORM { }
23
+
24
+ ```
25
+
26
+ ### File: `src/browserNotification.js`
27
+ ```javascript
28
+ export async function browserNotificationCreate(content, title = null) { }
29
+
30
+ ```
31
+
32
+ ### File: `src/browserRuntime.js`
33
+ ```javascript
34
+ export function browserRuntimeReload() { }
35
+
36
+ export async function browserRuntimeSetUninstallURL(
37
+ url = 'https://addons.mozilla.org/en-US/firefox/user/17783213/',
38
+ ) { }
39
+
40
+ export function browserRuntimeOnUpdateAvailable(doWhat = null) { }
41
+
42
+ export function browserRuntimeGeckoId() { }
43
+
44
+ export async function browserRuntimePlatformInfo() { }
45
+
46
+ export function browserRuntimeManifestVersion() { }
47
+
48
+ ```
49
+
50
+ ### File: `src/generate.js`
51
+ ```javascript
52
+ export function generateHtmlByUserSettings(
53
+ userSettings,
54
+ radioItemClickFn,
55
+ ) { }
56
+
57
+ ```
58
+
59
+ ### File: `src/opStorage.js`
60
+ ```javascript
61
+ export async function stoOpCheck(k) { }
62
+
63
+ export async function stoOpGet(k) { }
64
+
65
+ export async function stoOpGetAll() { }
66
+
67
+ export async function stoOpQueryStartWith(k) { }
68
+
69
+ export async function stoOpSet(k, v) { }
70
+
71
+ export async function stoOpRem(k) { }
72
+
73
+ export async function stoOpSetNull(k) { }
74
+
75
+ ```
76
+
77
+ ### File: `src/opTab.js`
78
+ ```javascript
79
+ export async function tabOpGet(tabId) { }
80
+
81
+ export async function tabOpQueryAll() { }
82
+
83
+ export async function tabOpQueryUrl(urlQuery) { }
84
+
85
+ export async function tabOpQueryUrlThenRemove(urlQuery) { }
86
+
87
+ export async function tabOpReload(tabId) { }
88
+
89
+ export async function tabOpCreate(urlOrArgs) { }
90
+
91
+ export async function tabOpCreateNormal(urlOrArgs) { }
92
+
93
+ export async function tabOpRemove(tabId) { }
94
+
95
+ export async function tabOpHide(tabId) { }
96
+
97
+ export async function tabOpUpdate(tabId, updateProperties) { }
98
+
99
+ export async function tabOpUpdateActiveFalse(tabId) { }
100
+
101
+ export async function tabOpFocus(tabId) { }
102
+
103
+ export async function tabOpInsertCssCode(tabId, code) { }
104
+
105
+ export async function tabOpRemoveCssCode(tabId, code) { }
106
+
107
+ ```
108
+
109
+ ### File: `src/serviceFetch.js`
110
+ ```javascript
111
+ export async function servicePostJson(
112
+ serverUrl,
113
+ message,
114
+ handleError,
115
+ ) { }
116
+
117
+ ```
118
+
119
+ ### File: `src/serviceGet.js`
120
+ ```javascript
121
+ export function serviceGetDomainByUrl(url) { }
122
+
123
+ export function serviceGetCurrentDateYYYYMMDDHHMMSS() { }
124
+
125
+ ```
126
+
127
+ ### File: `src/serviceOpContent.js`
128
+ ```javascript
129
+ export function serviceCopyContentToClipboard(content) { }
130
+
131
+ export function serviceSaveContentToLocal(content, filename, ext = 'txt') { }
132
+
133
+ export function serviceRemoveIllegalWord(value) { }
134
+
135
+ ```
136
+
137
+ ### File: `src/servicePureVideolink.js`
138
+ ```javascript
139
+ export function servicePureVideolinkYTB(videolinkOrigin) { }
140
+
141
+ ```
142
+
143
+ ### File: `src/serviceUpdateALLStyle.js`
144
+ ```javascript
145
+ export async function serviceUpdataALLTextNodeColor(message) { }
146
+
147
+ export async function serviceUpdataALLNodeBackgroundColor(message) { }
148
+
149
+ ```
150
+
151
+ ### File: `src/serviceUserSettings.js`
152
+ ```javascript
153
+ export async function serviceInitUserSettings(userSettings) { }
154
+
155
+ export async function serviceGetUserSettings(userSettings) { }
156
+
157
+ ```
158
+
package/index.js CHANGED
@@ -1,12 +1,12 @@
1
-
2
-
3
- export * from './src/baseOp.js'
4
- export * from './src/baseOpTab.js'
5
- export * from './src/baseOpStorage.js'
6
-
7
-
8
1
  export * from './src/baseORM.js'
9
-
10
- export * from './src/baseService.js'
11
- export * from './src/baseRuntimeSetup.js'
12
- export * from './src/baseServiceZipFilesOrDirectorys.js'
2
+ export * from './src/browserNotification.js'
3
+ export * from './src/browserRuntime.js'
4
+ export * from './src/generate.js'
5
+ export * from './src/opStorage.js'
6
+ export * from './src/opTab.js'
7
+ export * from './src/serviceFetch.js'
8
+ export * from './src/serviceGet.js'
9
+ export * from './src/serviceOpContent.js'
10
+ export * from './src/servicePureVideolink.js'
11
+ export * from './src/serviceUpdateALLStyle.js'
12
+ export * from './src/serviceUserSettings.js'
package/package.json CHANGED
@@ -1,19 +1,15 @@
1
1
  {
2
2
  "name": "@vacantthinker/firefox-addon-framework-easy",
3
- "version": "2026.5.2212",
3
+ "version": "2026.0524.1751",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
7
- "access": "public"
7
+ "access": "public",
8
+ "provenance": true
8
9
  },
9
- "scripts": {
10
- "npm_install": "npm install",
11
- "git_acp": "git add . && git commit -m 'add baseServiceZipFilesOrDirectorys.js' && git push",
12
- "npm_publish": "npm publish",
13
- "webpack": "webpack",
14
- "webpack_pack": "webpack && node _zipit.js"
15
- },
16
- "author": "vacantthinker",
10
+ "scripts": {},
11
+ "author": "VacantThinker",
12
+ "license": "AGPL-3.0-only",
17
13
  "repository": {
18
14
  "type": "git",
19
15
  "url": "git@github.com:VacantThinker/firefox-addon-framework-easy.git"
@@ -22,15 +18,7 @@
22
18
  "bugs": {
23
19
  "url": "https://github.com/VacantThinker/firefox-addon-framework-easy/issues"
24
20
  },
25
- "devDependencies": {
26
- "@types/firefox-webext-browser": "^143.0.0",
27
- "@types/node": "^22.18.0",
28
- "archiver": "^7.0.1",
29
- "copy-webpack-plugin": "^13.0.1",
30
- "html-minimizer-webpack-plugin": "^5.0.3",
31
- "json-minimizer-webpack-plugin": "^5.0.1",
32
- "terser-webpack-plugin": "^5.3.14",
33
- "webpack": "^5.102.1",
34
- "webpack-cli": "^6.0.1"
21
+ "dependencies": {
22
+ "@types/firefox-webext-browser": "^143.0.0"
35
23
  }
36
- }
24
+ }
package/publish.sh ADDED
@@ -0,0 +1,81 @@
1
+ #!/bin/bash
2
+
3
+ # 1. Get the current time (Format example: 2026.0522.0443)
4
+ # This includes the date, hour, and minute to ensure the version number increments every time you push.
5
+ NEW_VERSION=$(date +'%Y.%m%d.%H%M')
6
+
7
+ echo "🚀 Starting version update to: $NEW_VERSION"
8
+
9
+ # 2. Use jq to automatically modify the version field in package.json and write it back
10
+ jq ".version = \"$NEW_VERSION\"" package.json > package.json.tmp && mv package.json.tmp package.json
11
+
12
+ # 2.5 Automatically scan all js files in the src directory and generate export statements for index.js
13
+ echo "🚀 Dynamically generating index.js exports..."
14
+ true > index.js
15
+ for file in src/*.js; do
16
+ if [ -f "$file" ]; then
17
+ echo "export * from './$file'" >> index.js
18
+ fi
19
+ done
20
+
21
+ # 2.6 Automatically reset README.md and append the scanned public functions
22
+ echo "📝 Updating README.md..."
23
+
24
+ # 1. Write the default fixed content
25
+ cat << 'EOF' > README.md
26
+ # firefox-addon-framework-easy
27
+
28
+ [![License: AGPL v3](https://shields.io)](https://gnu.org)
29
+
30
+ ## License
31
+
32
+ This project is licensed under the GNU Affero General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
33
+
34
+
35
+ ## Source Code Access
36
+
37
+ According to the terms of the AGPL-3.0, the source code for this network service must be made available to all users.
38
+
39
+ You can download, clone, or view the complete source code for this application here: [Insert your GitHub/GitLab URL].
40
+
41
+ ## API Reference (Auto-Generated)
42
+
43
+ Below is a list of all public functions found inside the `src` directory:
44
+
45
+ EOF
46
+
47
+ # 2. Iterate through all js files, capture multi-line signatures, and append them to README
48
+ for file in src/*.js; do
49
+ if [ -f "$file" ]; then
50
+ echo "### File: \`$file\`" >> README.md
51
+ echo "\`\`\`javascript" >> README.md
52
+
53
+ # Reads multi-line signatures up to the opening brace or semicolon
54
+ awk '/^export (async )?(function|const|let|var|class) / {
55
+ line = $0
56
+ # Keep reading lines if there is no opening brace or semicolon yet
57
+ while (line !~ /\{/ && line !~ /;/ && (getline next_line) > 0) {
58
+ line = line "\n" next_line
59
+ }
60
+ # Clean up the function body and replace it with standard closing
61
+ sub(/\{.*/, "{ }", line)
62
+ print line
63
+ print ""
64
+ }' "$file" >> README.md
65
+
66
+ echo "\`\`\`" >> README.md
67
+ echo "" >> README.md
68
+ fi
69
+ done
70
+
71
+ # 3. Check if there are any code changes to commit
72
+ git add .
73
+
74
+ # 4. Automatically commit and log this release version
75
+ git commit -m "chore: bump version to $NEW_VERSION and publish"
76
+
77
+ # 5. Push to GitHub to trigger cloud-based automated publishing
78
+ echo "📤 Pushing to GitHub..."
79
+ git push origin main
80
+
81
+ echo "✅ Push complete! Please check the GitHub Actions page to view the deployment status."
package/src/baseORM.js CHANGED
@@ -1,5 +1,10 @@
1
- import {stoOpCheck, stoOpGet, stoOpQuery_startsWith, stoOpRem, stoOpSet} from "./baseOpStorage.js";
2
-
1
+ import {
2
+ stoOpCheck,
3
+ stoOpGet,
4
+ stoOpQueryStartWith,
5
+ stoOpRem,
6
+ stoOpSet,
7
+ } from './opStorage.js';
3
8
 
4
9
  /**
5
10
  * eg:
@@ -9,220 +14,108 @@ import {stoOpCheck, stoOpGet, stoOpQuery_startsWith, stoOpRem, stoOpSet} from ".
9
14
  * }
10
15
  */
11
16
  export class BaseORM {
12
- // Private class fields for encapsulation
13
- #keyPrefix = `domain `;
14
- #domainDefaultValue = {};
15
-
16
- // Private helper method to generate the prefix key
17
- #domainKey(k) {
18
- return `${this.#keyPrefix}${k}`;
19
- }
20
-
21
- /**
22
- * check domain exists, return true/false
23
- * @param {string} domain
24
- * @return {Promise<boolean>}
25
- */
26
- async #checkDomain(domain) {
27
- return await stoOpCheck(this.#domainKey(domain));
17
+ // Private class fields for encapsulation
18
+ #keyPrefix = `domain `;
19
+ #domainDefaultValue = {};
20
+
21
+ // Private helper method to generate the prefix key
22
+ #domainKey(k) {
23
+ return `${this.#keyPrefix}${k}`;
24
+ }
25
+
26
+ /**
27
+ * check domain exists, return true/false
28
+ * @param {string} domain
29
+ * @return {Promise<boolean>}
30
+ */
31
+ async #checkDomain(domain) {
32
+ return await stoOpCheck(this.#domainKey(domain));
33
+ }
34
+
35
+ /**
36
+ * @param {string} domain
37
+ * @return {Promise<void>}
38
+ */
39
+ async #addDomain(domain) {
40
+ await stoOpSet(this.#domainKey(domain), this.#domainDefaultValue);
41
+ }
42
+
43
+ /**
44
+ * @param {string} domain
45
+ * @return {Promise<void>}
46
+ */
47
+ async #removeDomain(domain) {
48
+ await stoOpRem(this.#domainKey(domain));
49
+ }
50
+
51
+ /**
52
+ * @param {string} domain
53
+ * @param {*} valueNew
54
+ * @return {Promise<void>}
55
+ */
56
+ async #updateDomain(domain, valueNew) {
57
+ await stoOpSet(this.#domainKey(domain), valueNew);
58
+ }
59
+
60
+ /**
61
+ * eg: ['a.com', 'b.com', 'c.com']
62
+ * @returns {Promise<string[]>}
63
+ */
64
+ async getALLDomainKey() {
65
+ // stoOpQueryByPrefix
66
+ let strings = await stoOpQueryStartWith(this.#keyPrefix);
67
+ return strings.map(v => v.replaceAll(this.#keyPrefix, ''));
68
+ }
69
+
70
+ /**
71
+ * @returns {Promise<{domainList: string[], domainKeyValueMap: {}}>}
72
+ */
73
+ async getALLDomainMap() {
74
+ let domainList = await this.getALLDomainKey();
75
+
76
+ const domainKeyValueMap = {};
77
+ for (let domain of domainList) {
78
+ domainKeyValueMap[domain] = await this.getDomain(domain);
28
79
  }
29
80
 
30
- /**
31
- * @param {string} domain
32
- * @return {Promise<void>}
33
- */
34
- async #addDomain(domain) {
35
- await stoOpSet(this.#domainKey(domain), this.#domainDefaultValue);
36
- }
81
+ return {domainList, domainKeyValueMap};
82
+ }
37
83
 
38
- /**
39
- * @param {string} domain
40
- * @return {Promise<void>}
41
- */
42
- async #removeDomain(domain) {
43
- await stoOpRem(this.#domainKey(domain));
84
+ /**
85
+ * @param {string} domain
86
+ * @returns {Promise<{}>}
87
+ */
88
+ async getDomain(domain) {
89
+ if (!(await this.#checkDomain(domain))) {
90
+ await this.#addDomain(domain);
44
91
  }
45
-
46
- /**
47
- * @param {string} domain
48
- * @param {*} valueNew
49
- * @return {Promise<void>}
50
- */
51
- async #updateDomain(domain, valueNew) {
52
- await stoOpSet(this.#domainKey(domain), valueNew);
53
- }
54
-
55
- /**
56
- * eg: ['a.com', 'b.com', 'c.com']
57
- * @returns {Promise<string[]>}
58
- */
59
- async getALLDomainKey() {
60
- // stoOpQueryByPrefix
61
- let strings = await stoOpQuery_startsWith(this.#keyPrefix);
62
- return strings.map(v => v.replaceAll(this.#keyPrefix, ''));
63
- }
64
-
65
- /**
66
- * @returns {Promise<{domainList: string[], domainKeyValueMap: {}}>}
67
- */
68
- async getALLDomainMap() {
69
- let domainList = await this.getALLDomainKey();
70
-
71
- const domainKeyValueMap = {};
72
- for (let domain of domainList) {
73
- domainKeyValueMap[domain] = await this.getDomain(domain);
74
- }
75
-
76
- return {domainList, domainKeyValueMap};
77
- }
78
-
79
- /**
80
- * @param {string} domain
81
- * @returns {Promise<{}>}
82
- */
83
- async getDomain(domain) {
84
- if (!(await this.#checkDomain(domain))) {
85
- await this.#addDomain(domain);
86
- }
87
- return await stoOpGet(this.#domainKey(domain));
88
- }
89
-
90
- /**
91
- * {a:a1} => {a:a222}
92
- * @param {string} domain 'xxx.xxxxx.xxx'
93
- * @param {string} key
94
- * @param {string} valueToUpdate
95
- * @return {Promise<{}>}
96
- */
97
- async updateDomainValueByOneKeyValue(domain, key, valueToUpdate) {
98
- if (!(await this.#checkDomain(domain))) {
99
- await this.#addDomain(domain);
100
- }
101
- let domainValueGet = await this.getDomain(domain);
102
- domainValueGet[key] = valueToUpdate;
103
- await this.#updateDomain(domain, domainValueGet);
104
- return await this.getDomain(domain);
105
- }
106
-
107
- /**
108
- * @param {string} domain 'xxx.xxxxx.xxx'
109
- * @return {Promise<{}>}
110
- */
111
- async clearThisDomain(domain) {
112
- let domainValue = await this.getDomain(domain);
113
- await this.#removeDomain(domain);
114
- return domainValue;
92
+ return await stoOpGet(this.#domainKey(domain));
93
+ }
94
+
95
+ /**
96
+ * {a:a1} => {a:a222}
97
+ * @param {string} domain 'xxx.xxxxx.xxx'
98
+ * @param {string} key
99
+ * @param {string} valueToUpdate
100
+ * @return {Promise<{}>}
101
+ */
102
+ async updateDomainValueByOneKeyValue(domain, key, valueToUpdate) {
103
+ if (!(await this.#checkDomain(domain))) {
104
+ await this.#addDomain(domain);
115
105
  }
106
+ let domainValueGet = await this.getDomain(domain);
107
+ domainValueGet[key] = valueToUpdate;
108
+ await this.#updateDomain(domain, domainValueGet);
109
+ return await this.getDomain(domain);
110
+ }
111
+
112
+ /**
113
+ * @param {string} domain 'xxx.xxxxx.xxx'
114
+ * @return {Promise<{}>}
115
+ */
116
+ async clearThisDomain(domain) {
117
+ let domainValue = await this.getDomain(domain);
118
+ await this.#removeDomain(domain);
119
+ return domainValue;
120
+ }
116
121
  }
117
-
118
- /**
119
- * eg:
120
- *
121
- * "domain www.abcdefg.com":{
122
- * "keyAAA": "valueBBB"
123
- * }
124
- *
125
- * @returns {{getALLDomainKey: function(): Promise<string[]>, getALLDomainMap: function(): Promise<{domainList: *, domainKeyValueMap: {}}>, getDomain: function(string): Promise<{}>, updateDomainValueByOneKeyValue: function(string, string, string): Promise<{}>, clearThisDomain: function(*): Promise<{}>}}
126
- */
127
- export function baseORM() {
128
-
129
- let keyPrefix = `domain `;
130
- const domainKey = (k) => `${keyPrefix}${k}`;
131
- const domainDefaultValue = {};
132
-
133
- /**
134
- * check domain exists, return true/false
135
- * @param domain{string}
136
- * @return {Promise<boolean>}
137
- */
138
- async function checkDomain(domain) {
139
- return await stoOpCheck(domainKey(domain));
140
- }
141
-
142
- /**
143
- * @param domain{string}
144
- * @return {Promise<void>}
145
- */
146
- async function addDomain(domain) {
147
- await stoOpSet(domainKey(domain), domainDefaultValue);
148
- }
149
-
150
- /**
151
- * @param domain{string}
152
- * @return {Promise<void>}
153
- */
154
- async function removeDomain(domain) {
155
- await stoOpRem(domainKey(domain));
156
- }
157
-
158
- /**
159
- * @param domain{string}
160
- * @param valueNew
161
- * @return {Promise<void>}
162
- */
163
- async function updateDomain(domain, valueNew) {
164
- await stoOpSet(domainKey(domain), valueNew);
165
- }
166
-
167
- return {
168
- /**
169
- * eg: ['a.com', 'b.com', 'c.com']
170
- * @returns {Promise<string[]>}
171
- */
172
- getALLDomainKey: async function () {
173
- // stoOpQueryByPrefix
174
- let strings = await stoOpQuery_startsWith(keyPrefix);
175
- return strings.map(v => v.replaceAll(keyPrefix, ''));
176
- },
177
- getALLDomainMap: async function () {
178
- let domainList = await this.getALLDomainKey();
179
-
180
- // todo use for-loop not the reduce()!
181
- const domainKeyValueMap = {}
182
- for (let domain of domainList) {
183
- domainKeyValueMap[domain] = await this.getDomain(domain)
184
- }
185
-
186
- return {domainList, domainKeyValueMap};
187
- },
188
-
189
- /**
190
- *
191
- * @param {string}domain
192
- * @returns {Promise<{}>}
193
- */
194
- getDomain: async function (domain) {
195
- if (!await checkDomain(domain)) {
196
- await addDomain(domain);
197
- }
198
- return await stoOpGet(domainKey(domain));
199
- },
200
-
201
- /**
202
- * {a:a1} => {a:a222}
203
- * @param {string}domain 'xxx.xxxxx.xxx'
204
- * @param{string}key
205
- * @param {string}valueToUpdate
206
- * @return {Promise<{}>}
207
- */
208
- updateDomainValueByOneKeyValue: async function (domain, key, valueToUpdate) {
209
- if (!await checkDomain(domain)) {
210
- await addDomain(domain);
211
- }
212
- let domainValueGet = await this.getDomain(domain);
213
- domainValueGet[key] = valueToUpdate;
214
- await updateDomain(domain, domainValueGet);
215
- return (await this.getDomain(domain));
216
- },
217
-
218
- /**
219
- * @param domain 'xxx.xxxxx.xxx'
220
- * @return {Promise<{}>}
221
- */
222
- clearThisDomain: async function (domain) {
223
- let domainValue = await this.getDomain(domain);
224
- await removeDomain(domain);
225
- return domainValue;
226
- },
227
- };
228
- }
@@ -0,0 +1,22 @@
1
+ /**
2
+ *
3
+ * @param { string}content
4
+ * @param {string|null}title
5
+ * @returns {Promise<string>}
6
+ */
7
+ export async function browserNotificationCreate(content, title = null) {
8
+ const tag = 'browserNotificationCreate';
9
+ try {
10
+ let notificationId = `${tag}cake-noti`;
11
+ title = title ? title : browser.runtime.getManifest().name;
12
+ console.info(tag, `content=${content}`, `title=${title}`);
13
+ await browser.notifications.create(notificationId, {
14
+ type: 'basic',
15
+ title,
16
+ message: content,
17
+ });
18
+ return notificationId;
19
+ } catch (e) {
20
+ console.error(tag, e);
21
+ }
22
+ }