Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Try something to be independent from github #207

Merged
merged 10 commits into from
Nov 16, 2019
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions src/js/yunohost/controllers/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,6 @@
}
});

// Install custom app from github
app.post('#/apps/install/custom', function(c) {

var params = {
Expand All @@ -461,10 +460,26 @@

// Force trailing slash
params.app = params.app.replace(/\/?$/, '/');

// Get manifest.json to get additional parameters
var rawpath = "";
var giturl = params.app;
if(function() {
var xhr_object = new XMLHttpRequest();
xhr_object.open("GET", params.app + "raw/master/manifest.json", false);
xhr_object.send(null);
return xhr_object.status;
} === 200) {
rawpath = 'raw/master/manifest.json';
giturl = params.app + rawpath;
} // Install custom app from github
else if (params.app.indexOf("github.com") !== -1) {
rawpath = 'master/manifest.json';
giturl = params.app.replace('github.com', 'raw.githubusercontent.com') + rawpath;
}
else {
console.log("You git host is not supported");
}
jQuery.ajax({
url: params.app.replace('github.com', 'raw.githubusercontent.com') + 'master/manifest.json',
url: giturl,
type: 'GET',
})
.done(function(manifest) {
Expand Down
2 changes: 1 addition & 1 deletion src/views/app/app_list_install.ms
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<div class="form-group has-feedback">
<label for="url" class="col-sm-12">{{t 'url'}}</label>
<div class="col-sm-12">
<input type="url" id="url" name="url" class="form-control" value="" placeholder="https://github.com/USER/REPOSITORY" required pattern="^https://github.com/[a-zA-Z0-9-_.]+/[a-zA-Z0-9-_.]+[/]?$">
<input type="url" id="url" name="url" class="form-control" value="" placeholder="https://GITHOST.TLD/USER/REPOSITORY" required pattern="^https?://.+/[a-zA-Z0-9-_.]+/[a-zA-Z0-9-_.]+[/]?$">
frju365 marked this conversation as resolved.
Show resolved Hide resolved
<p class="text-warning">
<span class="fa-github"></span> {{t 'custom_app_url_only_github'}}
</p>
Expand Down