@vacantthinker/firefox-addon-framework-easy 2026.528.1550 → 2026.528.2315
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/package.json +1 -1
- package/src/opTab.js +1 -0
- package/src/serviceCommon.js +0 -1
- package/src/serviceOpContent.js +22 -8
package/package.json
CHANGED
package/src/opTab.js
CHANGED
|
@@ -27,6 +27,7 @@ export async function tabOpCreate(properties) {
|
|
|
27
27
|
*/
|
|
28
28
|
export async function tabOpCreateNear(properties) {
|
|
29
29
|
let tabPrev = await tabOpGet(properties.tabId);
|
|
30
|
+
delete properties.tabId;
|
|
30
31
|
Object.assign(properties, {
|
|
31
32
|
index: tabPrev.index + 1, openerTabId: tabPrev.id,
|
|
32
33
|
})
|
package/src/serviceCommon.js
CHANGED
package/src/serviceOpContent.js
CHANGED
|
@@ -65,14 +65,28 @@ export async function serviceGenerateMkvToolNixScript({vid, title}) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* @
|
|
68
|
+
* Ultimate sanitization function: Filters all Chinese/English punctuation, full-width symbols, and illegal characters.
|
|
69
|
+
* (100% prevents download errors and copy-paste character corruption)
|
|
70
|
+
* @param {string} value - The original video title
|
|
71
|
+
* @returns {string} - A clean, safe plaintext/alphanumeric filename
|
|
71
72
|
*/
|
|
72
73
|
export function serviceRemoveIllegalWord(value) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
let
|
|
77
|
-
|
|
74
|
+
if (!value) return '';
|
|
75
|
+
|
|
76
|
+
// 1. Get the first line and trim whitespace from both ends
|
|
77
|
+
let name = value.trim().split(/\r?\n/).shift();
|
|
78
|
+
|
|
79
|
+
// 2. Use Unicode properties to remove all punctuation (\p{P}) and all symbols/geometry (\p{S})
|
|
80
|
+
// This natively crushes Chinese full-width punctuation, em dashes (—), Emojis, math symbols, and special brackets.
|
|
81
|
+
// Note: The 'u' flag is mandatory to enable Unicode mode in the regex.
|
|
82
|
+
name = name.replace(/[\p{P}\p{S}]/gu, ' ');
|
|
83
|
+
|
|
84
|
+
// 3. Additional defense: Filter out hidden control characters that Firefox/OS are extremely sensitive to (0-31 and 127-159)
|
|
85
|
+
name = name.replace(/[\x00-\x1F\x7F-\x9F]/g, ' ');
|
|
86
|
+
|
|
87
|
+
// 4. Clean up Emojis and any remaining surrogate pairs
|
|
88
|
+
name = name.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, ' ');
|
|
89
|
+
|
|
90
|
+
// 5. Merge consecutive spaces (including Chinese full-width spaces) into a single standard space
|
|
91
|
+
return name.replace(/[\s\u3000]+/g, ' ').trim();
|
|
78
92
|
}
|