From c1e929beec14ce21d29a4a7757be493d0cf72ce6 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 24 Apr 2019 10:54:57 +0200 Subject: [PATCH 1/2] allow importing from different branch / commit --- src/app/compiler/compiler-imports.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/app/compiler/compiler-imports.js b/src/app/compiler/compiler-imports.js index 44d161cf02..c217d32829 100644 --- a/src/app/compiler/compiler-imports.js +++ b/src/app/compiler/compiler-imports.js @@ -11,10 +11,20 @@ module.exports = class CompilerImports { } handleGithubCall (root, path, cb) { - var accessToken = this.githubAccessToken() ? '?access_token=' + this.githubAccessToken() : '' + let param = '?' + + param += this.githubAccessToken() ? 'access_token=' + this.githubAccessToken() : '' + const regex = path.match(/blob\/([^/]+)\/(.*)/) + if (regex) { + // if we have /blob/master/+path we extract the branch name "master" and add it as a parameter to the github api + // the ref can be branch name, tag, commit id + const reference = regex[1] + param += 'ref=' + reference + path = path.replace(`blob/${reference}/`, '') + } return request.get( { - url: 'https://api.github.com/repos/' + root + '/contents/' + path + accessToken, + url: 'https://api.github.com/repos/' + root + '/contents/' + path + param, json: true }, (err, r, data) => { From 22e29e265d5a77823115dc8a615bbc22de468a0e Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 24 Apr 2019 10:57:23 +0200 Subject: [PATCH 2/2] more width --- src/app/ui/styles/modal-dialog-custom-styles.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/ui/styles/modal-dialog-custom-styles.js b/src/app/ui/styles/modal-dialog-custom-styles.js index 70209f8d44..6fb0055f2f 100644 --- a/src/app/ui/styles/modal-dialog-custom-styles.js +++ b/src/app/ui/styles/modal-dialog-custom-styles.js @@ -2,7 +2,7 @@ var csjs = require('csjs-inject') var css = csjs` .prompt_text { - width: 300px; + width: 100%; } `