Fix bug GitLab when not log in
This commit is contained in:
parent
b3d0088903
commit
26da61ebb9
|
@ -13,13 +13,13 @@ class GitLab extends Adapter {
|
|||
constructor(store) {
|
||||
super()
|
||||
|
||||
// GitLab (for now) embeds access token in the page.
|
||||
// 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.
|
||||
let token = store.get(STORE.TOKEN)
|
||||
const token = store.get(STORE.TOKEN)
|
||||
if (!token) {
|
||||
token = $('head').text().match(/gon.api_token\s*=\s*"(.*?)"/m)[1]
|
||||
if (token) {
|
||||
store.set(STORE.TOKEN, token, true)
|
||||
const match = $('head').text().match(/gon.api_token\s*=\s*"(.*?)"/m)
|
||||
if (match && match[1]) {
|
||||
store.set(STORE.TOKEN, match[1])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,7 @@ $(document).ready(() => {
|
|||
}
|
||||
|
||||
function createAdapter() {
|
||||
var githubUrls = store.get(STORE.GHEURLS).split(/\n/).concat('github.com')
|
||||
|
||||
const githubUrls = store.get(STORE.GHEURLS).split(/\n/).concat('github.com')
|
||||
return ~githubUrls.indexOf(location.host)
|
||||
? new GitHub(store)
|
||||
: new GitLab(store)
|
||||
|
|
Loading…
Reference in New Issue