nodelistparser 0.1.2 → 0.1.3
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/cjs/index.d.ts +3 -1
- package/dist/cjs/index.js +9 -3
- package/dist/es/index.d.mts +3 -1
- package/dist/es/index.mjs +9 -3
- package/package.json +1 -1
package/dist/cjs/index.d.ts
CHANGED
|
@@ -260,12 +260,14 @@ declare namespace index$1 {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
declare function decodeOne(sip002: string): ShadowSocksConfig;
|
|
263
|
+
declare function decodeBase64Multiline(text: string): string[];
|
|
263
264
|
declare function decodeMultiline(text: string): ShadowSocksConfig[];
|
|
264
265
|
|
|
266
|
+
declare const index_decodeBase64Multiline: typeof decodeBase64Multiline;
|
|
265
267
|
declare const index_decodeMultiline: typeof decodeMultiline;
|
|
266
268
|
declare const index_decodeOne: typeof decodeOne;
|
|
267
269
|
declare namespace index {
|
|
268
|
-
export { index_decodeMultiline as decodeMultiline, index_decodeOne as decodeOne };
|
|
270
|
+
export { index_decodeBase64Multiline as decodeBase64Multiline, index_decodeMultiline as decodeMultiline, index_decodeOne as decodeOne };
|
|
269
271
|
}
|
|
270
272
|
|
|
271
273
|
export { type HttpProxyConfig, type Hysteria2Config, type ShadowSocksConfig, type SharedConfigBase, type SnellConfig, type Socks5Config, type SupportedConfig, type TrojanBasicConfig, type TrojanConfig, type TuicConfig, type VmessConfig, index$1 as clash, index as ss, index$2 as surge };
|
package/dist/cjs/index.js
CHANGED
|
@@ -476,7 +476,10 @@ var index$1 = {
|
|
|
476
476
|
|
|
477
477
|
function decodeOne(sip002) {
|
|
478
478
|
// ss://YWVzLTEyOC1nY206YzMxNWFhOGMtNGU1NC00MGRjLWJkYzctYzFjMjEwZjIxYTNi@ss1.meslink.xyz:10009#%F0%9F%87%AD%F0%9F%87%B0%20HK1%20HKT
|
|
479
|
-
const [
|
|
479
|
+
const [type, payload] = sip002.split('://');
|
|
480
|
+
if (type !== 'ss') {
|
|
481
|
+
throw new Error(`[ss.decodeOne] Unsupported type: ${type}`);
|
|
482
|
+
}
|
|
480
483
|
const [userInfo, server] = payload.split('@');
|
|
481
484
|
let cipher, password;
|
|
482
485
|
if (userInfo.includes(':')) {
|
|
@@ -499,13 +502,16 @@ function decodeOne(sip002) {
|
|
|
499
502
|
udp: true
|
|
500
503
|
};
|
|
501
504
|
}
|
|
505
|
+
function decodeBase64Multiline(text) {
|
|
506
|
+
return atob(text).replaceAll('\r\n', '\n').split('\n').filter(Boolean);
|
|
507
|
+
}
|
|
502
508
|
function decodeMultiline(text) {
|
|
503
|
-
|
|
504
|
-
return lines.filter(Boolean).map((line)=>decodeOne(line));
|
|
509
|
+
return decodeBase64Multiline(text).map((line)=>decodeOne(line));
|
|
505
510
|
}
|
|
506
511
|
|
|
507
512
|
var index = {
|
|
508
513
|
__proto__: null,
|
|
514
|
+
decodeBase64Multiline: decodeBase64Multiline,
|
|
509
515
|
decodeMultiline: decodeMultiline,
|
|
510
516
|
decodeOne: decodeOne
|
|
511
517
|
};
|
package/dist/es/index.d.mts
CHANGED
|
@@ -260,12 +260,14 @@ declare namespace index$1 {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
declare function decodeOne(sip002: string): ShadowSocksConfig;
|
|
263
|
+
declare function decodeBase64Multiline(text: string): string[];
|
|
263
264
|
declare function decodeMultiline(text: string): ShadowSocksConfig[];
|
|
264
265
|
|
|
266
|
+
declare const index_decodeBase64Multiline: typeof decodeBase64Multiline;
|
|
265
267
|
declare const index_decodeMultiline: typeof decodeMultiline;
|
|
266
268
|
declare const index_decodeOne: typeof decodeOne;
|
|
267
269
|
declare namespace index {
|
|
268
|
-
export { index_decodeMultiline as decodeMultiline, index_decodeOne as decodeOne };
|
|
270
|
+
export { index_decodeBase64Multiline as decodeBase64Multiline, index_decodeMultiline as decodeMultiline, index_decodeOne as decodeOne };
|
|
269
271
|
}
|
|
270
272
|
|
|
271
273
|
export { type HttpProxyConfig, type Hysteria2Config, type ShadowSocksConfig, type SharedConfigBase, type SnellConfig, type Socks5Config, type SupportedConfig, type TrojanBasicConfig, type TrojanConfig, type TuicConfig, type VmessConfig, index$1 as clash, index as ss, index$2 as surge };
|
package/dist/es/index.mjs
CHANGED
|
@@ -476,7 +476,10 @@ var index$1 = {
|
|
|
476
476
|
|
|
477
477
|
function decodeOne(sip002) {
|
|
478
478
|
// ss://YWVzLTEyOC1nY206YzMxNWFhOGMtNGU1NC00MGRjLWJkYzctYzFjMjEwZjIxYTNi@ss1.meslink.xyz:10009#%F0%9F%87%AD%F0%9F%87%B0%20HK1%20HKT
|
|
479
|
-
const [
|
|
479
|
+
const [type, payload] = sip002.split('://');
|
|
480
|
+
if (type !== 'ss') {
|
|
481
|
+
throw new Error(`[ss.decodeOne] Unsupported type: ${type}`);
|
|
482
|
+
}
|
|
480
483
|
const [userInfo, server] = payload.split('@');
|
|
481
484
|
let cipher, password;
|
|
482
485
|
if (userInfo.includes(':')) {
|
|
@@ -499,13 +502,16 @@ function decodeOne(sip002) {
|
|
|
499
502
|
udp: true
|
|
500
503
|
};
|
|
501
504
|
}
|
|
505
|
+
function decodeBase64Multiline(text) {
|
|
506
|
+
return atob(text).replaceAll('\r\n', '\n').split('\n').filter(Boolean);
|
|
507
|
+
}
|
|
502
508
|
function decodeMultiline(text) {
|
|
503
|
-
|
|
504
|
-
return lines.filter(Boolean).map((line)=>decodeOne(line));
|
|
509
|
+
return decodeBase64Multiline(text).map((line)=>decodeOne(line));
|
|
505
510
|
}
|
|
506
511
|
|
|
507
512
|
var index = {
|
|
508
513
|
__proto__: null,
|
|
514
|
+
decodeBase64Multiline: decodeBase64Multiline,
|
|
509
515
|
decodeMultiline: decodeMultiline,
|
|
510
516
|
decodeOne: decodeOne
|
|
511
517
|
};
|