diff --git a/package.json b/package.json index 6904590..aeeac7a 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/config.ts b/src/config.ts index 03ea521..0bd5792 100644 --- a/src/config.ts +++ b/src/config.ts @@ -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) {