Authentication to Gitea now with header

pull/1/head
MasterEvarior 2021-04-28 22:41:58 +02:00
parent 1ac87f5621
commit 09ef6f9c85
1 changed files with 3 additions and 3 deletions

View File

@ -20,7 +20,7 @@ function toRepositoryList(repositories) {
async function getGiteaUser(gitea) {
return request.get(gitea.url
+ '/api/v1/user')
.query(`access_token=${gitea.token}`)
.set('Authorization', 'token ' + gitea.token)
.then(response => {
return { id: response.body.id, name: response.body.username }
});
@ -30,14 +30,14 @@ function isAlreadyMirroredOnGitea(repository, gitea, giteaUser) {
const requestUrl = `${gitea.url}/api/v1/repos/${giteaUser.name}/${repository}`;
return request.get(
requestUrl)
.query(`access_token=${gitea.token}`)
.set('Authorization', 'token ' + gitea.token)
.then(() => true)
.catch(() => false);
}
function mirrorOnGitea(repository, gitea, giteaUser) {
request.post(`${gitea.url}/api/v1/repos/migrate`)
.query(`access_token=${gitea.token}`)
.set('Authorization', 'token ' + gitea.token)
.send({
clone_addr: repository.url,
mirror: true,