@vacantthinker/firefox-addon-framework-easy 2026.528.1550 → 2026.528.1648

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vacantthinker/firefox-addon-framework-easy",
3
- "version": "2026.0528.1550",
3
+ "version": "2026.0528.1648",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
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
  })
@@ -65,14 +65,28 @@ export async function serviceGenerateMkvToolNixScript({vid, title}) {
65
65
  }
66
66
 
67
67
  /**
68
- *
69
- * @param {string} value
70
- * @returns {string}
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
- let searchValue = /[\/\\\[\]\-"『』<>›::;❗”“'|丨|⦇⦈??!!「」【】─\(\)()《》*#$@&%、,,。+·•]/g;
74
- let name0 = value.trim().split(/\r?\n/).shift();
75
- let name1 = name0.replace(searchValue, ' ');
76
- let name2 = name1.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, ' ');
77
- return name2;
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
  }