fix: use "latest-lts.svrjs" or "latest.svrjs" file from SVR.JS downloads server instead of scraping the SVR.JS website
This commit is contained in:
parent
8563c69268
commit
5fbf844aee
2 changed files with 7 additions and 11 deletions
|
@ -18,9 +18,9 @@ if(!version) {
|
||||||
console.log(" '3.6.4' -> SVR.JS 3.6.4");
|
console.log(" '3.6.4' -> SVR.JS 3.6.4");
|
||||||
} else if(version == "latest" || version == "lts") {
|
} else if(version == "latest" || version == "lts") {
|
||||||
https.get({
|
https.get({
|
||||||
hostname: "svrjs.org",
|
hostname: "downloads.svrjs.org",
|
||||||
port: 443,
|
port: 443,
|
||||||
path: "/",
|
path: version == "lts" ? "/latest-lts.svrjs" : "/latest.svrjs",
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"User-Agent": "create-svrjs-server"
|
"User-Agent": "create-svrjs-server"
|
||||||
|
@ -35,16 +35,12 @@ if(!version) {
|
||||||
data += chunk;
|
data += chunk;
|
||||||
});
|
});
|
||||||
res.on("end", function() {
|
res.on("end", function() {
|
||||||
var regex = />Download SVR\.JS ([^ <]+)<\/a>/;
|
var dlver = data.trim();
|
||||||
if(version == "lts") {
|
|
||||||
regex = />Download SVR\.JS ([^ <]+) LTS<\/a>/;
|
|
||||||
}
|
|
||||||
var dlver = data.match(regex);
|
|
||||||
if(!dlver) {
|
if(!dlver) {
|
||||||
console.log("Can't obtain the latest version from main page");
|
console.log("Can't obtain the latest version from downloads server");
|
||||||
} else {
|
} else {
|
||||||
console.log("Selected SVR.JS " + dlver[1]);
|
console.log("Selected SVR.JS " + dlver);
|
||||||
downloadSVRJS(dlver[1]);
|
downloadSVRJS(dlver);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).on("error", function() {
|
}).on("error", function() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "svrjs",
|
"name": "svrjs",
|
||||||
"version": "3.14.5-stub1",
|
"version": "4.0.0-stub1",
|
||||||
"description": "A web server running on Node.JS",
|
"description": "A web server running on Node.JS",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Reference in a new issue