gas-github icon indicating copy to clipboard operation
gas-github copied to clipboard

How to use with self-hosted GitLab?

Open imthenachoman opened this issue 6 years ago • 8 comments

Is it possible to use this extension/add-on with self-hosted GitLab?

imthenachoman avatar Dec 08 '19 21:12 imthenachoman

Currently not supported since it will ask too ambitious permission, if you really need that, you can clone this repo, add permission to the manifest file and build the extension by yourself

leonhartX avatar Dec 12 '19 11:12 leonhartX

I have never written an extension but would like to look into it.

When you say permission, what do you mean by that? What file do I need to look at? I saw in the code where you specify the GitLab URL so think adding a custom URL option is straight forward. Just not sure what the permission is for?

imthenachoman avatar Dec 12 '19 18:12 imthenachoman

Scratch that. I see where you mean. I need to read up on what this setting is and what it means. Thank you!

imthenachoman avatar Dec 12 '19 18:12 imthenachoman

So I cloned the repo and uncommented the <input id="gitlab-url" type="text" value="https://gitlab.com"/> line in options.html. I was able to login. But when I open a new script it says "Unknow Error" in the top, in a red box.

The spelling mistake helped because I only see two files with "Unknow": gas-api.js and gas-hub.js.

I modified both of them to narrow down and determined it is erroring on line 35 of gas-hub.js. I changed that line to include err.message:

Cannot read property 'forEach' of undefined

I am going to try to narrow down which forEach it is, unless you happen to have an idea where it might be failing?

imthenachoman avatar Dec 17 '19 17:12 imthenachoman

Bleh. I figured it out.

jquery.min.js:6 Cross-Origin Read Blocking (CORB) blocked cross-origin response https://[internal gitlab URL]/api/v4/groups?per_page=25&private_token=[redacted] with MIME type application/json. See https://www.chromestatus.com/feature/5629709824032768 for more details.

Script editor is on https://script.google.com/ (internet) and it's trying to access our internal (intranet) gitlab environment.

Bollocks!

imthenachoman avatar Dec 17 '19 17:12 imthenachoman

@imthenachoman can you post the steps you followed to make it work with your gitlab server? Thanks!

Jlcasado avatar Jun 04 '20 09:06 Jlcasado

I never got it working but that is because of my company's firewall rules.

I don't remember exactly what I did now but essentially:

  1. Cloned the repo and uncommented the <input id="gitlab-url" type="text" value="https://gitlab.com"/> line in options.html.
  2. Added my GitLab's URL to permissions in the manifest.json file
  3. Loaded an unpacked extension in Chrome using the developer mode

imthenachoman avatar Jun 04 '20 13:06 imthenachoman

@imthenachoman thanks!!

Jlcasado avatar Jun 08 '20 08:06 Jlcasado