forked from crossutility/Quantumult-X
-
Notifications
You must be signed in to change notification settings - Fork 0
/
resource-parser.js
20 lines (15 loc) · 952 Bytes
/
resource-parser.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/**
* @fileoverview Example to parse the resource to the format of Quantumult X.
*
* @supported Quantumult X (v1.0.8-build253)
*/
// $resource, $notify(title, subtitle, message)
// HTTP reqeust and persistent storage related APIs are not supported in resource parser.
// $resource.link contains the original URL of the resource or the path if the resource is local.
// $resource.content contains the response(UTF8) from the URL .
// $done({error : "error description"});
// $done({content : "the modified content"});
var sampleA = "shadowsocks=ui-a.example.com:80, method=chacha20, password=pwd, obfs=http, obfs-host=bing.com, obfs-uri=/resource/file, fast-open=false, udp-relay=false, tag=Tag-A";
var sampleB = "shadowsocks=ui-b.example.com:80, method=chacha20, password=pwd, obfs=http, obfs-host=bing.com, obfs-uri=/resource/file, fast-open=false, udp-relay=false, tag=Tag-B";
var total = sampleA + "\n" + sampleB;
$done({content : total});