@ecency/sdk 1.5.8 → 1.5.9
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 +33 -8
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +15 -3
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +15 -3
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -43,6 +43,20 @@ function useBroadcastMutation(mutationKey = [], username, operations, onSuccess
|
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
+
var isDevelopment = (() => {
|
|
47
|
+
try {
|
|
48
|
+
return false;
|
|
49
|
+
} catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
})();
|
|
53
|
+
var getHeliusApiKey = () => {
|
|
54
|
+
try {
|
|
55
|
+
return "fb1e2935-f911-4b1d-8e1c-3863f6879d42";
|
|
56
|
+
} catch {
|
|
57
|
+
return void 0;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
46
60
|
var CONFIG = {
|
|
47
61
|
privateApiHost: "https://ecency.com",
|
|
48
62
|
imageHost: "https://images.ecency.com",
|
|
@@ -66,7 +80,7 @@ var CONFIG = {
|
|
|
66
80
|
consoleOnFailover: true
|
|
67
81
|
}
|
|
68
82
|
),
|
|
69
|
-
heliusApiKey:
|
|
83
|
+
heliusApiKey: getHeliusApiKey(),
|
|
70
84
|
queryClient: new QueryClient(),
|
|
71
85
|
plausibleHost: "https://pl.ecency.com",
|
|
72
86
|
spkNode: "https://spk.good-karma.xyz",
|
|
@@ -158,35 +172,47 @@ var ConfigManager;
|
|
|
158
172
|
return { safe: true };
|
|
159
173
|
}
|
|
160
174
|
function safeCompileRegex(pattern, maxLength = 200) {
|
|
161
|
-
const isDevelopment = typeof process !== "undefined" && false;
|
|
162
175
|
try {
|
|
163
176
|
if (!pattern) {
|
|
164
|
-
if (isDevelopment)
|
|
177
|
+
if (isDevelopment) {
|
|
178
|
+
console.warn(`[SDK] DMCA pattern rejected: empty pattern`);
|
|
179
|
+
}
|
|
165
180
|
return null;
|
|
166
181
|
}
|
|
167
182
|
if (pattern.length > maxLength) {
|
|
168
|
-
if (isDevelopment)
|
|
183
|
+
if (isDevelopment) {
|
|
184
|
+
console.warn(`[SDK] DMCA pattern rejected: length ${pattern.length} exceeds max ${maxLength} - pattern: ${pattern.substring(0, 50)}...`);
|
|
185
|
+
}
|
|
169
186
|
return null;
|
|
170
187
|
}
|
|
171
188
|
const staticAnalysis = analyzeRedosRisk(pattern);
|
|
172
189
|
if (!staticAnalysis.safe) {
|
|
173
|
-
if (isDevelopment)
|
|
190
|
+
if (isDevelopment) {
|
|
191
|
+
console.warn(`[SDK] DMCA pattern rejected: static analysis failed (${staticAnalysis.reason}) - pattern: ${pattern.substring(0, 50)}...`);
|
|
192
|
+
}
|
|
174
193
|
return null;
|
|
175
194
|
}
|
|
176
195
|
let regex;
|
|
177
196
|
try {
|
|
178
197
|
regex = new RegExp(pattern);
|
|
179
198
|
} catch (compileErr) {
|
|
180
|
-
if (isDevelopment)
|
|
199
|
+
if (isDevelopment) {
|
|
200
|
+
console.warn(`[SDK] DMCA pattern rejected: compilation failed - pattern: ${pattern.substring(0, 50)}...`, compileErr);
|
|
201
|
+
}
|
|
181
202
|
return null;
|
|
182
203
|
}
|
|
183
204
|
const runtimeTest = testRegexPerformance(regex);
|
|
184
205
|
if (!runtimeTest.safe) {
|
|
185
|
-
if (isDevelopment)
|
|
206
|
+
if (isDevelopment) {
|
|
207
|
+
console.warn(`[SDK] DMCA pattern rejected: runtime test failed (${runtimeTest.reason}) - pattern: ${pattern.substring(0, 50)}...`);
|
|
208
|
+
}
|
|
186
209
|
return null;
|
|
187
210
|
}
|
|
188
211
|
return regex;
|
|
189
212
|
} catch (err) {
|
|
213
|
+
if (isDevelopment) {
|
|
214
|
+
console.warn(`[SDK] DMCA pattern rejected: unexpected error - pattern: ${pattern.substring(0, 50)}...`, err);
|
|
215
|
+
}
|
|
190
216
|
return null;
|
|
191
217
|
}
|
|
192
218
|
}
|
|
@@ -197,7 +223,6 @@ var ConfigManager;
|
|
|
197
223
|
CONFIG.dmcaTagRegexes = tags.map((pattern) => safeCompileRegex(pattern)).filter((r) => r !== null);
|
|
198
224
|
CONFIG.dmcaPatternRegexes = [];
|
|
199
225
|
const rejectedTagCount = tags.length - CONFIG.dmcaTagRegexes.length;
|
|
200
|
-
const isDevelopment = typeof process !== "undefined" && false;
|
|
201
226
|
if (!CONFIG._dmcaInitialized && isDevelopment) {
|
|
202
227
|
console.log(`[SDK] DMCA configuration loaded:`);
|
|
203
228
|
console.log(` - Accounts: ${accounts.length}`);
|