Updated download paths from svrjs.org/dl to downloads.svrjs.org. Earlier versions of create-svrjs-server won't work, because of 301 redirect.
This commit is contained in:
parent
32a9efc3ba
commit
61513352d3
2 changed files with 9 additions and 8 deletions
|
@ -41,14 +41,14 @@ if(!version) {
|
||||||
}
|
}
|
||||||
var dlver = data.match(regex);
|
var dlver = data.match(regex);
|
||||||
if(!dlver) {
|
if(!dlver) {
|
||||||
console.log("Can't obtain latest version from main page");
|
console.log("Can't obtain the latest version from main page");
|
||||||
} else {
|
} else {
|
||||||
console.log("Selected SVR.JS " + dlver[1]);
|
console.log("Selected SVR.JS " + dlver[1]);
|
||||||
downloadSVRJS(dlver[1]);
|
downloadSVRJS(dlver[1]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).on("error", function() {
|
}).on("error", function() {
|
||||||
console.log("Can't connect to SVR.JS download server!");
|
console.log("Can't connect to thr SVR.JS download server!");
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
downloadSVRJS(version);
|
downloadSVRJS(version);
|
||||||
|
@ -56,11 +56,11 @@ if(!version) {
|
||||||
|
|
||||||
function downloadSVRJS(oversion) {
|
function downloadSVRJS(oversion) {
|
||||||
var version = oversion.toLowerCase().replace(/[^0-9a-z.]/g,".");
|
var version = oversion.toLowerCase().replace(/[^0-9a-z.]/g,".");
|
||||||
var path = "/dl/svr.js." + version + ".zip";
|
var path = "/svr.js." + version + ".zip";
|
||||||
if(version.indexOf("beta") != -1) path = "/dl/beta/svr.js." + version + ".zip";
|
if(version.indexOf("beta") != -1) path = "/beta/svr.js." + version + ".zip";
|
||||||
if(version.indexOf("nightly") != -1) path = "/dl/nightly/svr.js." + version + ".zip";
|
if(version.indexOf("nightly") != -1) path = "/nightly/svr.js." + version + ".zip";
|
||||||
https.get({
|
https.get({
|
||||||
hostname: "svrjs.org",
|
hostname: "downloads.svrjs.org",
|
||||||
port: 443,
|
port: 443,
|
||||||
path: path,
|
path: path,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
@ -70,6 +70,7 @@ function downloadSVRJS(oversion) {
|
||||||
}, function(res) {
|
}, function(res) {
|
||||||
if(res.statusCode != 200) {
|
if(res.statusCode != 200) {
|
||||||
console.log("Server returns " + res.statusCode + " HTTP code while trying to download SVR.JS " + oversion);
|
console.log("Server returns " + res.statusCode + " HTTP code while trying to download SVR.JS " + oversion);
|
||||||
|
console.log("Make sure you're using the latest version of the create-svrjs-server utility.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var zipFile = fs.createWriteStream("svrjs.zip");
|
var zipFile = fs.createWriteStream("svrjs.zip");
|
||||||
|
@ -102,7 +103,7 @@ function downloadSVRJS(oversion) {
|
||||||
});
|
});
|
||||||
res.pipe(zipFile);
|
res.pipe(zipFile);
|
||||||
}).on("error", function() {
|
}).on("error", function() {
|
||||||
console.log("Can't connect to SVR.JS download server!");
|
console.log("Can't connect to the SVR.JS download server!");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "svrjs",
|
"name": "svrjs",
|
||||||
"version": "3.6.4-stub1",
|
"version": "3.11.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