Remove GitLab support

This commit is contained in:
Buu Nguyen 2017-03-10 10:51:02 -08:00
parent 720ea593a9
commit 0aa79cd472
13 changed files with 8 additions and 781 deletions

View File

@ -6,7 +6,7 @@ Browser extension (Chrome, Firefox, Opera and Safari) to show a code tree on Git
* Support private repositories (see [instructions](#access-token))
* Support GitHub Enterprise (Chrome and Opera only, see [instructions](#enterprise-urls))
__Deprecated GitLab support__: I will no longer actively support GitLab. The reason is GitLab has changed so much recently and it would take too much effort to keep up. In addition, the GitLab team has [told me](https://github.com/buunguyen/octotree/issues/265) they would include Octotree-like feature in GitLab itself, so there's little reason to continue investing in GitLab support in Octotree. That being said, I'll gladly accept PRs to benefit those who are using Octotree for GitLab.
__Deprecated GitLab support__: since version 2.1.0, Octotree no longer supports GitLab. There are 2 reasons for this. First, GitLab has changed so much recently that it would take a lot of effort to make Octotree even usable. Second, the GitLab team has [told me](https://github.com/buunguyen/octotree/issues/265) they would build a tree feature in GitLab itself. I can't keep investing effort in making Octotree work on GitLab while knowing it will be irrelevant any time. That being said, if anyone wants to work on supporting the new GitLab, I'll gladly accept contributions.
![Octotree on GitHub](docs/chrome-github.png)

View File

@ -174,7 +174,6 @@ function buildJs(overrides, ctx) {
'./src/constants.js',
'./src/adapters/adapter.js',
'./src/adapters/github.js',
'./src/adapters/gitlab.js',
'./src/view.help.js',
'./src/view.error.js',
'./src/view.tree.js',

View File

@ -1,423 +0,0 @@
// Generated by CoffeeScript 1.6.3
(function() {
var CSRFToken, anchoredLink, browserCompatibleDocumentParser, browserIsntBuggy, browserSupportsPushState, cacheCurrentPage, cacheSize, changePage, constrainPageCacheTo, createDocument, crossOriginLink, currentState, executeScriptTags, extractLink, extractTitleAndBody, fetchHistory, fetchReplacement, handleClick, ignoreClick, initializeTurbolinks, installClickHandlerLast, loadedAssets, noTurbolink, nonHtmlLink, nonStandardClick, pageCache, pageChangePrevented, pagesCached, processResponse, recallScrollPosition, referer, reflectNewUrl, reflectRedirectedUrl, rememberCurrentState, rememberCurrentUrl, removeHash, removeNoscriptTags, requestMethod, requestMethodIsSafe, resetScrollPosition, targetLink, triggerEvent, visit, xhr, _ref,
__hasProp = {}.hasOwnProperty,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
cacheSize = 10;
currentState = null;
referer = null;
loadedAssets = null;
pageCache = {};
createDocument = null;
requestMethod = ((_ref = document.cookie.match(/request_method=(\w+)/)) != null ? _ref[1].toUpperCase() : void 0) || '';
xhr = null;
fetchReplacement = function(url) {
var safeUrl;
triggerEvent('page:fetch');
safeUrl = removeHash(url);
if (xhr != null) {
xhr.abort();
}
xhr = new XMLHttpRequest;
xhr.open('GET', safeUrl, true);
xhr.setRequestHeader('Accept', 'text/html, application/xhtml+xml, application/xml');
xhr.setRequestHeader('X-XHR-Referer', referer);
xhr.onload = function() {
var doc;
triggerEvent('page:receive');
if (doc = processResponse()) {
reflectNewUrl(url);
changePage.apply(null, extractTitleAndBody(doc));
reflectRedirectedUrl();
if (document.location.hash) {
document.location.href = document.location.href;
} else {
resetScrollPosition();
}
return triggerEvent('page:load');
} else {
return document.location.href = url;
}
};
xhr.onloadend = function() {
return xhr = null;
};
xhr.onabort = function() {
return rememberCurrentUrl();
};
xhr.onerror = function() {
return document.location.href = url;
};
return xhr.send();
};
fetchHistory = function(position) {
var page;
cacheCurrentPage();
page = pageCache[position];
if (xhr != null) {
xhr.abort();
}
changePage(page.title, page.body);
recallScrollPosition(page);
return triggerEvent('page:restore');
};
cacheCurrentPage = function() {
pageCache[currentState.position] = {
url: document.location.href,
body: document.body,
title: document.title,
positionY: window.pageYOffset,
positionX: window.pageXOffset
};
return constrainPageCacheTo(cacheSize);
};
pagesCached = function(size) {
if (size == null) {
size = cacheSize;
}
if (/^[\d]+$/.test(size)) {
return cacheSize = parseInt(size);
}
};
constrainPageCacheTo = function(limit) {
var key, value;
for (key in pageCache) {
if (!__hasProp.call(pageCache, key)) continue;
value = pageCache[key];
if (key <= currentState.position - limit) {
pageCache[key] = null;
}
}
};
changePage = function(title, body, csrfToken, runScripts) {
document.title = title;
document.documentElement.replaceChild(body, document.body);
if (csrfToken != null) {
CSRFToken.update(csrfToken);
}
removeNoscriptTags();
if (runScripts) {
executeScriptTags();
}
currentState = window.history.state;
return triggerEvent('page:change');
};
executeScriptTags = function() {
var attr, copy, nextSibling, parentNode, script, scripts, _i, _j, _len, _len1, _ref1, _ref2;
scripts = Array.prototype.slice.call(document.body.querySelectorAll('script:not([data-turbolinks-eval="false"])'));
for (_i = 0, _len = scripts.length; _i < _len; _i++) {
script = scripts[_i];
if (!((_ref1 = script.type) === '' || _ref1 === 'text/javascript')) {
continue;
}
copy = document.createElement('script');
_ref2 = script.attributes;
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
attr = _ref2[_j];
copy.setAttribute(attr.name, attr.value);
}
copy.appendChild(document.createTextNode(script.innerHTML));
parentNode = script.parentNode, nextSibling = script.nextSibling;
parentNode.removeChild(script);
parentNode.insertBefore(copy, nextSibling);
}
};
removeNoscriptTags = function() {
var noscript, noscriptTags, _i, _len;
noscriptTags = Array.prototype.slice.call(document.body.getElementsByTagName('noscript'));
for (_i = 0, _len = noscriptTags.length; _i < _len; _i++) {
noscript = noscriptTags[_i];
noscript.parentNode.removeChild(noscript);
}
};
reflectNewUrl = function(url) {
if (url !== referer) {
return window.history.pushState({
turbolinks: true,
position: currentState.position + 1
}, '', url);
}
};
reflectRedirectedUrl = function() {
var location, preservedHash;
if (location = xhr.getResponseHeader('X-XHR-Redirected-To')) {
preservedHash = removeHash(location) === location ? document.location.hash : '';
return window.history.replaceState(currentState, '', location + preservedHash);
}
};
rememberCurrentUrl = function() {
return window.history.replaceState({
turbolinks: true,
position: Date.now()
}, '', document.location.href);
};
rememberCurrentState = function() {
return currentState = window.history.state;
};
recallScrollPosition = function(page) {
return window.scrollTo(page.positionX, page.positionY);
};
resetScrollPosition = function() {
return window.scrollTo(0, 0);
};
removeHash = function(url) {
var link;
link = url;
if (url.href == null) {
link = document.createElement('A');
link.href = url;
}
return link.href.replace(link.hash, '');
};
triggerEvent = function(name) {
var event;
event = document.createEvent('Events');
event.initEvent(name, true, true);
return document.dispatchEvent(event);
};
pageChangePrevented = function() {
return !triggerEvent('page:before-change');
};
processResponse = function() {
var assetsChanged, clientOrServerError, doc, extractTrackAssets, intersection, validContent;
clientOrServerError = function() {
var _ref1;
return (400 <= (_ref1 = xhr.status) && _ref1 < 600);
};
validContent = function() {
return xhr.getResponseHeader('Content-Type').match(/^(?:text\/html|application\/xhtml\+xml|application\/xml)(?:;|$)/);
};
extractTrackAssets = function(doc) {
var node, _i, _len, _ref1, _results;
_ref1 = doc.head.childNodes;
_results = [];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
node = _ref1[_i];
if ((typeof node.getAttribute === "function" ? node.getAttribute('data-turbolinks-track') : void 0) != null) {
_results.push(node.src || node.href);
}
}
return _results;
};
assetsChanged = function(doc) {
var fetchedAssets;
loadedAssets || (loadedAssets = extractTrackAssets(document));
fetchedAssets = extractTrackAssets(doc);
return fetchedAssets.length !== loadedAssets.length || intersection(fetchedAssets, loadedAssets).length !== loadedAssets.length;
};
intersection = function(a, b) {
var value, _i, _len, _ref1, _results;
if (a.length > b.length) {
_ref1 = [b, a], a = _ref1[0], b = _ref1[1];
}
_results = [];
for (_i = 0, _len = a.length; _i < _len; _i++) {
value = a[_i];
if (__indexOf.call(b, value) >= 0) {
_results.push(value);
}
}
return _results;
};
if (!clientOrServerError() && validContent()) {
doc = createDocument(xhr.responseText);
if (doc && !assetsChanged(doc)) {
return doc;
}
}
};
extractTitleAndBody = function(doc) {
var title;
title = doc.querySelector('title');
return [title != null ? title.textContent : void 0, doc.body, CSRFToken.get(doc).token, 'runScripts'];
};
CSRFToken = {
get: function(doc) {
var tag;
if (doc == null) {
doc = document;
}
return {
node: tag = doc.querySelector('meta[name="csrf-token"]'),
token: tag != null ? typeof tag.getAttribute === "function" ? tag.getAttribute('content') : void 0 : void 0
};
},
update: function(latest) {
var current;
current = this.get();
if ((current.token != null) && (latest != null) && current.token !== latest) {
return current.node.setAttribute('content', latest);
}
}
};
browserCompatibleDocumentParser = function() {
var createDocumentUsingDOM, createDocumentUsingParser, createDocumentUsingWrite, e, testDoc, _ref1;
createDocumentUsingParser = function(html) {
return (new DOMParser).parseFromString(html, 'text/html');
};
createDocumentUsingDOM = function(html) {
var doc;
doc = document.implementation.createHTMLDocument('');
doc.documentElement.innerHTML = html;
return doc;
};
createDocumentUsingWrite = function(html) {
var doc;
doc = document.implementation.createHTMLDocument('');
doc.open('replace');
doc.write(html);
doc.close();
return doc;
};
try {
if (window.DOMParser) {
testDoc = createDocumentUsingParser('<html><body><p>test');
return createDocumentUsingParser;
}
} catch (_error) {
e = _error;
testDoc = createDocumentUsingDOM('<html><body><p>test');
return createDocumentUsingDOM;
} finally {
if ((testDoc != null ? (_ref1 = testDoc.body) != null ? _ref1.childNodes.length : void 0 : void 0) !== 1) {
return createDocumentUsingWrite;
}
}
};
installClickHandlerLast = function(event) {
if (!event.defaultPrevented) {
document.removeEventListener('click', handleClick, false);
return document.addEventListener('click', handleClick, false);
}
};
handleClick = function(event) {
var link;
if (!event.defaultPrevented) {
link = extractLink(event);
if (link.nodeName === 'A' && !ignoreClick(event, link)) {
if (!pageChangePrevented()) {
visit(link.href);
}
return event.preventDefault();
}
}
};
extractLink = function(event) {
var link;
link = event.target;
while (!(!link.parentNode || link.nodeName === 'A')) {
link = link.parentNode;
}
return link;
};
crossOriginLink = function(link) {
return location.protocol !== link.protocol || location.host !== link.host;
};
anchoredLink = function(link) {
return ((link.hash && removeHash(link)) === removeHash(location)) || (link.href === location.href + '#');
};
nonHtmlLink = function(link) {
var url;
url = removeHash(link);
return url.match(/\.[a-z]+(\?.*)?$/g) && !url.match(/\.html?(\?.*)?$/g);
};
noTurbolink = function(link) {
var ignore;
while (!(ignore || link === document)) {
ignore = link.getAttribute('data-no-turbolink') != null;
link = link.parentNode;
}
return ignore;
};
targetLink = function(link) {
return link.target.length !== 0;
};
nonStandardClick = function(event) {
return event.which > 1 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;
};
ignoreClick = function(event, link) {
return crossOriginLink(link) || anchoredLink(link) || nonHtmlLink(link) || noTurbolink(link) || targetLink(link) || nonStandardClick(event);
};
initializeTurbolinks = function() {
rememberCurrentUrl();
rememberCurrentState();
createDocument = browserCompatibleDocumentParser();
document.addEventListener('click', installClickHandlerLast, true);
return window.addEventListener('popstate', function(event) {
var state;
state = event.state;
if (state != null ? state.turbolinks : void 0) {
if (pageCache[state.position]) {
return fetchHistory(state.position);
} else {
return visit(event.target.location.href);
}
}
}, false);
};
browserSupportsPushState = window.history && window.history.pushState && window.history.replaceState && window.history.state !== void 0;
browserIsntBuggy = !navigator.userAgent.match(/CriOS\//);
requestMethodIsSafe = requestMethod === 'GET' || requestMethod === '';
if (browserSupportsPushState && browserIsntBuggy && requestMethodIsSafe) {
visit = function(url) {
referer = document.location.href;
cacheCurrentPage();
return fetchReplacement(url);
};
initializeTurbolinks();
} else {
visit = function(url) {
return document.location.href = url;
};
}
this.Turbolinks = {
visit: visit,
pagesCached: pagesCached
};
}).call(this);

View File

@ -1,188 +0,0 @@
const GL_RESERVED_USER_NAMES = [
'u', 'dashboard', 'projects', 'users', 'help',
'explore', 'profile', 'public', 'groups', 'abuse_reports'
]
const GL_RESERVED_REPO_NAMES = []
const GL_RESERVED_TYPES = ['raw']
class GitLab extends Adapter {
constructor(store) {
super(['turbolinks.js'])
// GitLab (for now) embeds access token in the page of a logged-in user.
// Use it to set the token if one isn't available.
const token = store.get(STORE.TOKEN)
if (!token) {
const match = $('head').text().match(/gon.api_token\s*=\s*"(.*?)"/m)
if (match && match[1]) {
store.set(STORE.TOKEN, match[1])
}
}
}
// @override
init($sidebar) {
super.init($sidebar)
// Trigger layout when the GL sidebar is toggled
$('.toggle-nav-collapse').click(() => {
setTimeout(() => {
$(document).trigger(EVENT.LAYOUT_CHANGE)
}, 10)
})
// GitLab disables our submit buttons, re-enable them
$('.octotree_view_body button[type="submit"]').click((event) => {
setTimeout(() => {
$(event.target).prop('disabled', false).removeClass('disabled')
}, 100)
})
// Reuse GitLab styles for inputs
$('.octotree_view_body input[type="text"], .octotree_view_body textarea')
.addClass('form-control')
// GitLab uses Turbolinks to handle page load
$(document)
.on('page:fetch', () => $(document).trigger(EVENT.REQ_START))
.on('page:load', () => {
// GitLab removes DOM, let's add back
$sidebar.appendTo('body')
// Trigger location change since the new page might not a repo page
$(document).trigger(EVENT.LOC_CHANGE)
$(document).trigger(EVENT.REQ_END)
})
}
// @override
getCssClass() {
return 'octotree_gitlab_sidebar'
}
// @override
getMinWidth() {
return 220 // just enough to hide the GitLab sidebar
}
// @override
getCreateTokenUrl() {
return `${location.protocol}//${location.host}/profile/personal_access_tokens`
}
// @override
updateLayout(togglerVisible, sidebarVisible, sidebarWidth) {
const glSidebarPinned = $('.page-with-sidebar').hasClass('page-sidebar-pinned')
$('.octotree_toggle').css('right', sidebarVisible ? '' : -40)
$('.side-nav-toggle, h1.title').css('margin-left', (glSidebarPinned || sidebarVisible) ? '' : 36)
$('.navbar-gitlab').css({'margin-left': sidebarVisible ? (sidebarWidth - (glSidebarPinned ? 220 : 0)) : ''})
$('.page-with-sidebar').css('padding-left', sidebarVisible ? (sidebarWidth - (glSidebarPinned ? 220 : 0)) : '')
}
// @override
getRepoFromPath(showInNonCodePage, currentRepo, token, cb) {
// 404 page, skip - GitLab doesn't have specific element for Not Found page
if ($(document).find('title').text() === 'The page you\'re looking for could not be found (404)') {
return cb()
}
// (username)/(reponame)[/(type)]
const match = window.location.pathname.match(/([^\/]+)\/([^\/]+)(?:\/([^\/]+))?/)
if (!match) {
return cb()
}
const username = match[1]
const reponame = match[2]
const type = match[3]
// Not a repository, skip
if (~GL_RESERVED_USER_NAMES.indexOf(username) ||
~GL_RESERVED_REPO_NAMES.indexOf(reponame) ||
~GL_RESERVED_TYPES.indexOf(type)) {
return cb()
}
// Skip non-code page unless showInNonCodePage is true
// with GitLab /username/repo is non-code page
if (!showInNonCodePage &&
(!match[3] || (match[3] && !~['tree', 'blob'].indexOf(match[3])))) {
return cb()
}
// Get branch by inspecting page, quite fragile so provide multiple fallbacks
const GL_BRANCH_SEL_1 = '#repository_ref'
const GL_BRANCH_SEL_2 = '.select2-container.project-refs-select.select2 .select2-chosen'
// .nav.nav-sidebar is for versions below 8.8
const GL_BRANCH_SEL_3 = '.nav.nav-sidebar .shortcuts-tree, .nav-links .shortcuts-tree'
const branch =
// Code page
$(GL_BRANCH_SEL_1).val() || $(GL_BRANCH_SEL_2).text() ||
// Non-code page
// A space ' ' is a failover to make match() always return an array
($(GL_BRANCH_SEL_3).attr('href') || ' ').match(/([^\/]+)/g)[3] ||
// Assume same with previously
(currentRepo.username === username && currentRepo.reponame === reponame && currentRepo.branch) ||
// Default from cache
this._defaultBranch[username + '/' + reponame]
const repo = {username: username, reponame: reponame, branch: branch}
if (repo.branch) {
cb(null, repo)
}
else {
this._get(null, {token}, (err, data) => {
if (err) return cb(err)
repo.branch = this._defaultBranch[username + '/' + reponame] = data.default_branch || 'master'
cb(null, repo)
})
}
}
// @override
selectFile(path) {
Turbolinks.visit(path)
}
// @override
loadCodeTree(opts, cb) {
opts.path = opts.node.path
this._loadCodeTree(opts, (item) => {
item.sha = item.id
item.path = item.name
}, cb)
}
// @override
_getTree(path, opts, cb) {
this._get(`/tree?path=${path}&ref_name=${opts.encodedBranch}`, opts, cb)
}
// @override
_getSubmodules(tree, opts, cb) {
const item = tree.filter((item) => /^\.gitmodules$/i.test(item.name))[0]
if (!item) return cb()
this._get(`/blobs/${opts.encodedBranch}?filepath=${item.name}`, opts, (err, data) => {
if (err) return cb(err)
cb(null, parseGitmodules(data))
})
}
_get(path, opts, cb) {
const repo = opts.repo
const host = `${location.protocol}//${location.host}/api/v3`
const project = $('#search_project_id').val() || $('#project_id').val() || `${repo.username}%2f${repo.reponame}`
const url = `${host}/projects/${project}/repository${path}&private_token=${opts.token}`
const cfg = { url, method: 'GET', cache: false }
$.ajax(cfg)
.done((data) => cb(null, data))
.fail((jqXHR) => this._handleError(jqXHR, cb))
}
}

View File

@ -1,141 +0,0 @@
.octotree-show {
.octotree_gitlab_only {
display: none;
}
.octotree_gitlab_sidebar {
a.octotree_toggle {
top: 11px;
right: 5px;
&:not(.octotree_loading) > span:after {
content: '\f104';
}
}
}
.content-wrapper {
transition-duration: 0.3s;
margin-top: 0;
}
.layout-nav {
position: static;
}
}
.octotree_gitlab_sidebar {
transition-duration: .3s;
padding-top: 58px;
background-color: white;
.octotree_gitlab_only {
display: block;
}
.octotree_views {
.octotree_view {
.octotree_view_header {
height: 50px;
font-size: 20px;
background-image: none;
background-color: #f7f8fa;
border-bottom: 1px solid #dce0e6;
}
.octotree_help {
& > span {
font: normal normal 15px FontAwesome;
color: black;
}
& > span:before {
content: '\f059';
}
}
}
.octotree_treeview {
.octotree_header_repo {
font-size: 15px;
margin-top: -3px;
}
.octotree_header_repo:before {
font-family: FontAwesome;
content: '\f015';
color: #333c48;
}
.octotree_header_branch {
font-size: 13px;
}
.octotree_header_branch:before {
font-family: FontAwesome;
content: '\f126';
}
.jstree-icon.tree:before {
content: '\f07b';
color: #333c48;
}
.jstree-icon.blob:before {
content: '\f0f6';
color: #333c48;
}
.jstree-node.jstree-leaf:hover {
.jstree-icon.blob:before {
content: '\f019';
color: #333c48;
}
}
.jstree-icon.commit:before {
content: '\f187';
color: #333c48;
}
.jstree-anchor {
color: #333c48 !important;
& > span {
color: black;
}
}
.jstree-default {
.jstree-wholerow-hovered {
background: #f8eec7;
}
.jstree-wholerow-clicked {
background: #e7e9ed;
}
}
.jstree-icon.tree, .jstree-icon.blob, .jstree-icon.commit {
font: normal normal 16px FontAwesome;
}
}
}
a.octotree_toggle, a.octotree_opts {
color: #313236 !important;
}
a.octotree_opts {
top: 17px;
right: 38px;
& > span {
font: normal normal 16px FontAwesome;
}
& > span:before {
content: '\f013';
}
&:hover, &.selected {
color: #4183C4 !important;
}
}
a.octotree_toggle {
top: 10px;
& > span {
font: normal normal 16px FontAwesome;
font-weight: bold;
}
&:not(.octotree_loading) > span:after {
content: '\f105';
}
}
}

View File

@ -61,8 +61,7 @@ chrome.runtime.onMessage.addListener((req, sender, sendRes) => {
function removeUnnecessaryPermissions() {
const whitelist = urls.concat([
'https://github.com/*',
'https://gitlab.com/*'
'https://github.com/*'
])
chrome.permissions.getAll((permissions) => {
const toBeRemovedUrls = permissions.origins.filter((url) => {

View File

@ -3,14 +3,13 @@
"version": "$VERSION",
"manifest_version": 2,
"author": "Buu Nguyen",
"description": "Code tree for GitHub and GitLab",
"description": "Code tree for GitHub",
"homepage_url": "https://github.com/buunguyen/octotree",
"icons": {
"128": "icons/icon128.png"
},
"permissions": [
"https://github.com/*",
"https://gitlab.com/*",
"storage"
],
"optional_permissions": [

View File

@ -2,7 +2,7 @@ const data = require('sdk/self').data
const pageMod = require('sdk/page-mod')
pageMod.PageMod({
include: ['https://github.com/*', 'https://gitlab.com/*'],
include: ['https://github.com/*'],
contentScriptFile : [data.url('jquery.js'),
data.url('jquery-ui.js'),
data.url('jstree.js'),

View File

@ -2,7 +2,7 @@
"name": "octotree",
"title": "Octotree",
"id": "jid1-Om7eJGwA1U8Akg@jetpack",
"description": "Code tree for GitHub and GitLab",
"description": "Code tree for GitHub",
"author": "Buu Nguyen",
"homepage": "https://github.com/buunguyen/octotree",
"main": "lib/firefox",
@ -13,8 +13,7 @@
"permissions": {
"cross-domain-content": [
"https://api.github.com",
"https://github.com",
"https://gitlab.com"
"https://github.com"
],
"private-browsing": true,
"multiprocess": true

View File

@ -40,11 +40,10 @@
<key>Whitelist</key>
<array>
<string>https://github.com/*</string>
<string>https://gitlab.com/*</string>
</array>
</dict>
<key>Description</key>
<string>Code tree for GitHub and GitLab</string>
<string>Code tree for GitHub</string>
<key>ExtensionInfoDictionaryVersion</key>
<string>1.0</string>
<key>Permissions</key>
@ -54,7 +53,6 @@
<key>Allowed Domains</key>
<array>
<string>github.com</string>
<string>gitlab.com</string>
</array>
<key>Include Secure Pages</key>
<true/>

View File

@ -11,13 +11,7 @@ $(document).ready(() => {
}
function createAdapter() {
const githubUrls = store.get(STORE.GHEURLS).split(/\n/)
.map((url) => url.replace(/(.*?:\/\/[^/]+)(.*)/, '$1'))
.concat('https://github.com')
return ~githubUrls.indexOf(`${location.protocol}//${location.host}`)
? new GitHub(store)
: new GitLab(store)
return new GitHub(store)
}
function loadExtension() {

View File

@ -1,3 +1,2 @@
@import "base";
@import "../adapters/github";
@import "../adapters/gitlab";

View File

@ -65,14 +65,6 @@
<textarea data-store="GHEURLS" placeholder="https://github.mysite1.com__SPACES__https://github.mysite2.com">
</textarea>
</div>
<div class="octotree_gitlab_only">
<div>
<label>GitLab Enterprise URLs</label>
</div>
<textarea data-store="GLEURLS" placeholder="https://gitlab.mysite1.com__SPACES__https://gitlab.mysite2.com">
</textarea>
</div>
<!-- @endif -->
<div>