feat: base url for Gitea instances

Refs: #21
This commit is contained in:
IJustDev 2020-12-26 18:34:52 +01:00
parent 139bf0f3d7
commit afc792f554
2 changed files with 25 additions and 2 deletions

View File

@ -82,6 +82,16 @@
"description": "The remote gitea instance's url. Should not end with a slash.",
"pattern": "^(https|http)://"
},
"gitea.baseURL": {
"scope": "resource",
"type": "string",
"default": "",
"examples": [
"/gitea"
],
"description": "The base url of the Gitea instance.",
"pattern": ""
},
"gitea.owner": {
"scope": "resource",
"type": "string",

View File

@ -6,6 +6,7 @@ interface ConfigStorage {
owner: string;
repo: string;
sslVerify: boolean;
baseURL: string;
}
export interface ConfigTypes extends ConfigStorage {
@ -51,6 +52,14 @@ export class Config implements ConfigTypes {
return this.loadConfigValue('instanceURL', 'string');
}
public get baseURL(): string {
return this.loadConfigValue('baseURL', 'string');
}
public set baseURL(value) {
this.storage.update('baseURL', 'string');
}
public get owner() {
return this.loadConfigValue('owner', 'string');
}
@ -67,8 +76,12 @@ export class Config implements ConfigTypes {
this.storage.update('repo', value);
}
public get repoApiUrl() {
return this.instanceURL.replace(/\/$/, "") + '/api/v1/repos/' + this.owner + '/' + this.repo + '/issues';
public get repoApiUrl(): string {
return this.instanceURL.replace(/\/$/, "") +
this.baseURL.replace(/\/$/, "") +
'/api/v1/repos/' +
this.owner +
'/' + this.repo + '/issues';
}
public set sslVerify(value) {