From 88d94b1bd6e38fd2af002641298697e6689b6468 Mon Sep 17 00:00:00 2001 From: frju365 Date: Thu, 30 Aug 2018 13:24:44 +0200 Subject: [PATCH] [fix] Try something to be independent from github --- src/js/yunohost/controllers/apps.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js index b1fe4cab..3b2ab0d0 100644 --- a/src/js/yunohost/controllers/apps.js +++ b/src/js/yunohost/controllers/apps.js @@ -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) {