@ecency/sdk 1.5.6 → 1.5.7
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/dist/browser/index.js +9 -8
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +22 -8
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +22 -8
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -158,35 +158,35 @@ var ConfigManager;
|
|
|
158
158
|
return { safe: true };
|
|
159
159
|
}
|
|
160
160
|
function safeCompileRegex(pattern, maxLength = 200) {
|
|
161
|
+
const isDevelopment = typeof process !== "undefined" && false;
|
|
161
162
|
try {
|
|
162
163
|
if (!pattern) {
|
|
163
|
-
|
|
164
|
+
if (isDevelopment) ;
|
|
164
165
|
return null;
|
|
165
166
|
}
|
|
166
167
|
if (pattern.length > maxLength) {
|
|
167
|
-
|
|
168
|
+
if (isDevelopment) ;
|
|
168
169
|
return null;
|
|
169
170
|
}
|
|
170
171
|
const staticAnalysis = analyzeRedosRisk(pattern);
|
|
171
172
|
if (!staticAnalysis.safe) {
|
|
172
|
-
|
|
173
|
+
if (isDevelopment) ;
|
|
173
174
|
return null;
|
|
174
175
|
}
|
|
175
176
|
let regex;
|
|
176
177
|
try {
|
|
177
178
|
regex = new RegExp(pattern);
|
|
178
179
|
} catch (compileErr) {
|
|
179
|
-
|
|
180
|
+
if (isDevelopment) ;
|
|
180
181
|
return null;
|
|
181
182
|
}
|
|
182
183
|
const runtimeTest = testRegexPerformance(regex);
|
|
183
184
|
if (!runtimeTest.safe) {
|
|
184
|
-
|
|
185
|
+
if (isDevelopment) ;
|
|
185
186
|
return null;
|
|
186
187
|
}
|
|
187
188
|
return regex;
|
|
188
189
|
} catch (err) {
|
|
189
|
-
console.warn(`[SDK] DMCA pattern rejected: unexpected error - pattern: ${pattern.substring(0, 50)}...`, err);
|
|
190
190
|
return null;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
@@ -197,7 +197,8 @@ var ConfigManager;
|
|
|
197
197
|
CONFIG.dmcaTagRegexes = tags.map((pattern) => safeCompileRegex(pattern)).filter((r) => r !== null);
|
|
198
198
|
CONFIG.dmcaPatternRegexes = [];
|
|
199
199
|
const rejectedTagCount = tags.length - CONFIG.dmcaTagRegexes.length;
|
|
200
|
-
|
|
200
|
+
const isDevelopment = typeof process !== "undefined" && false;
|
|
201
|
+
if (!CONFIG._dmcaInitialized && isDevelopment) {
|
|
201
202
|
console.log(`[SDK] DMCA configuration loaded:`);
|
|
202
203
|
console.log(` - Accounts: ${accounts.length}`);
|
|
203
204
|
console.log(` - Tag patterns: ${CONFIG.dmcaTagRegexes.length}/${tags.length} compiled (${rejectedTagCount} rejected)`);
|
|
@@ -205,8 +206,8 @@ var ConfigManager;
|
|
|
205
206
|
if (rejectedTagCount > 0) {
|
|
206
207
|
console.warn(`[SDK] ${rejectedTagCount} DMCA tag patterns were rejected due to security validation. Check warnings above for details.`);
|
|
207
208
|
}
|
|
208
|
-
CONFIG._dmcaInitialized = true;
|
|
209
209
|
}
|
|
210
|
+
CONFIG._dmcaInitialized = true;
|
|
210
211
|
}
|
|
211
212
|
ConfigManager2.setDmcaLists = setDmcaLists;
|
|
212
213
|
})(ConfigManager || (ConfigManager = {}));
|