Use specified instance domain

Use specified instance domain instead of gitlab.com.
This commit is contained in:
Dušan Simić 2020-08-19 20:10:40 +02:00
parent be2cf693b1
commit 8d727607c0

View file

@ -621,8 +621,7 @@ async function verifyProof(url, fingerprint) {
match = url.match(/https:\/\/(.*)\/(.*)\/gitlab_proof/); match = url.match(/https:\/\/(.*)\/(.*)\/gitlab_proof/);
output.display = match[2]; output.display = match[2];
output.url = `https://${match[1]}/${match[2]}`; output.url = `https://${match[1]}/${match[2]}`;
output.proofUrlFetch = `https://gitlab.com/api/v4/users?username=${match[2]}`; output.proofUrlFetch = `https://${match[1]}/api/v4/users?username=${match[2]}`;
// output.proofUrlFetch = `https://gitlab.com/api/v4/projects?custom_attributes[search]=${match[2]}/gitlab_proof&custom_attributes[search_namespaces]=true`;
try { try {
const opts = { const opts = {
headers: { headers: {
@ -641,7 +640,7 @@ async function verifyProof(url, fingerprint) {
throw new Error('No user with username ' + match[2]); throw new Error('No user with username ' + match[2]);
} }
// Get project // Get project
output.proofUrlFetch = `https://gitlab.com/api/v4/users/${user.id}/projects`; output.proofUrlFetch = `https://${match[1]}/api/v4/users/${user.id}/projects`;
response = await fetch(output.proofUrlFetch, opts); response = await fetch(output.proofUrlFetch, opts);
if (!response.ok) { if (!response.ok) {
throw new Error('Response failed: ' + response.status); throw new Error('Response failed: ' + response.status);