[fix] Try something to be independent from github

This commit is contained in:
frju365 2018-08-30 13:24:44 +02:00 committed by GitHub
parent 4d6b21eae4
commit 88d94b1bd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -444,7 +444,6 @@
}
});
// Install custom app from github
app.post('#/apps/install/custom', function(c) {
var params = {
@ -461,10 +460,23 @@
// Force trailing slash
params.app = params.app.replace(/\/?$/, '/');
// Get manifest.json to get additional parameters
var rawpath = "";
if(function() {
var xhr_object = new XMLHttpRequest();
xhr_object.open("GET", params.app + "raw/master/manifest.json", false);
xhr_object.send(null);
} == true) {
rawpath = 'raw/master/manifest.json';
} // Install custom app from github
else if (params.app.indexOf("github.com") !== "-1") {
params.app = params.app.replace('github.com', 'raw.githubusercontent.com');
rawpath = 'master/manifest.json';
}
else {
console.log("You git host is not supported");
}
jQuery.ajax({
url: params.app.replace('github.com', 'raw.githubusercontent.com') + 'master/manifest.json',
url: params.app + rawpath,
type: 'GET',
})
.done(function(manifest) {