From f5b59ea29cacdc4ad7451068daa0020da055b0ec Mon Sep 17 00:00:00 2001 From: Mike Kershaw / Dragorn Date: Thu, 19 May 2022 17:52:55 -0400 Subject: [PATCH] ApiService: Fix static reference --- .../MACInfo/src/lib/services/api.service.ts | 20 +++++++++---------- .../src/lib/services/api.service.ts | 20 +++++++++---------- .../cabinet/src/lib/services/api.service.ts | 20 +++++++++---------- .../src/lib/services/api.service.ts | 20 +++++++++---------- .../httpeek/src/lib/services/api.service.ts | 20 +++++++++---------- .../locate/src/lib/services/api.service.ts | 20 +++++++++---------- .../mdk4/src/lib/services/api.service.ts | 20 +++++++++---------- .../mtr/src/lib/services/api.service.ts | 20 +++++++++---------- .../nmap/src/lib/services/api.service.ts | 20 +++++++++---------- .../tcpdump/src/lib/services/api.service.ts | 20 +++++++++---------- 10 files changed, 100 insertions(+), 100 deletions(-) diff --git a/MACInfo/projects/MACInfo/src/lib/services/api.service.ts b/MACInfo/projects/MACInfo/src/lib/services/api.service.ts index 9838abb..fd4d0cd 100644 --- a/MACInfo/projects/MACInfo/src/lib/services/api.service.ts +++ b/MACInfo/projects/MACInfo/src/lib/services/api.service.ts @@ -44,7 +44,7 @@ export class ApiService { this.setBusy(); let resp; - this.http.post(`${this.extractBaseHref()}/api/module/request`, payload).subscribe((r: any) => { + this.http.post(`${ApiService.extractBaseHref()}/api/module/request`, payload).subscribe((r: any) => { if (r === undefined || r === null) { resp = this.emptyResponse; } else if (r.error) { @@ -72,7 +72,7 @@ export class ApiService { let resp; - this.http.get(`${this.extractBaseHref()}${path}`).subscribe((r) => { + this.http.get(`${ApiService.extractBaseHref()}${path}`).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -91,7 +91,7 @@ export class ApiService { async APIGetAsync(path: string): Promise { ApiService.totalRequests++; - return await this.http.get(`${this.extractBaseHref()}${path}`).toPromise(); + return await this.http.get(`${ApiService.extractBaseHref()}${path}`).toPromise(); } APIPut(path: string, body: any, callback: (any) => void): any { @@ -99,7 +99,7 @@ export class ApiService { let resp; - this.http.put(`${this.extractBaseHref()}${path}`, body).subscribe((r) => { + this.http.put(`${ApiService.extractBaseHref()}${path}`, body).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -116,7 +116,7 @@ export class ApiService { } async APIPutAsync(path: string, body: any): Promise { - return await this.http.put(`${this.extractBaseHref()}/${path}`, body).toPromise(); + return await this.http.put(`${ApiService.extractBaseHref()}/${path}`, body).toPromise(); } APIPost(path: string, body: any, callback: (any) => void): any { @@ -124,7 +124,7 @@ export class ApiService { let resp; - this.http.post(`${this.extractBaseHref()}${path}`, body).subscribe((r) => { + this.http.post(`${ApiService.extractBaseHref()}${path}`, body).subscribe((r) => { if (r === undefined || r === null) { resp = this.emptyResponse; } @@ -141,7 +141,7 @@ export class ApiService { } async APIPostAsync(path: string, body: any): Promise { - return await this.http.post(`${this.extractBaseHref()}/${path}`, body).toPromise(); + return await this.http.post(`${ApiService.extractBaseHref()}/${path}`, body).toPromise(); } APIDelete(path: string, body: any, callback: (any) => void): any { @@ -154,7 +154,7 @@ export class ApiService { let resp; - this.http.delete(`${this.extractBaseHref()}/${path}`, opts).subscribe((r) => { + this.http.delete(`${ApiService.extractBaseHref()}/${path}`, opts).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -171,7 +171,7 @@ export class ApiService { } async APIDeleteAsync(path: string, body: any): Promise { - return await this.http.delete(`${this.extractBaseHref()}${path}`, body).toPromise(); + return await this.http.delete(`${ApiService.extractBaseHref()}${path}`, body).toPromise(); } APIDownload(fullpath: string, filename: string): void { @@ -181,7 +181,7 @@ export class ApiService { filename: fullpath }; - this.http.post(`${this.extractBaseHref()}/api/download`, body, {responseType: 'blob'}).subscribe((r) => { + this.http.post(`${ApiService.extractBaseHref()}/api/download`, body, {responseType: 'blob'}).subscribe((r) => { const url = window.URL.createObjectURL(r); const a = document.createElement('a'); document.body.appendChild(a); diff --git a/Misc/module-template/projects/examplemodule/src/lib/services/api.service.ts b/Misc/module-template/projects/examplemodule/src/lib/services/api.service.ts index 9838abb..fd4d0cd 100644 --- a/Misc/module-template/projects/examplemodule/src/lib/services/api.service.ts +++ b/Misc/module-template/projects/examplemodule/src/lib/services/api.service.ts @@ -44,7 +44,7 @@ export class ApiService { this.setBusy(); let resp; - this.http.post(`${this.extractBaseHref()}/api/module/request`, payload).subscribe((r: any) => { + this.http.post(`${ApiService.extractBaseHref()}/api/module/request`, payload).subscribe((r: any) => { if (r === undefined || r === null) { resp = this.emptyResponse; } else if (r.error) { @@ -72,7 +72,7 @@ export class ApiService { let resp; - this.http.get(`${this.extractBaseHref()}${path}`).subscribe((r) => { + this.http.get(`${ApiService.extractBaseHref()}${path}`).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -91,7 +91,7 @@ export class ApiService { async APIGetAsync(path: string): Promise { ApiService.totalRequests++; - return await this.http.get(`${this.extractBaseHref()}${path}`).toPromise(); + return await this.http.get(`${ApiService.extractBaseHref()}${path}`).toPromise(); } APIPut(path: string, body: any, callback: (any) => void): any { @@ -99,7 +99,7 @@ export class ApiService { let resp; - this.http.put(`${this.extractBaseHref()}${path}`, body).subscribe((r) => { + this.http.put(`${ApiService.extractBaseHref()}${path}`, body).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -116,7 +116,7 @@ export class ApiService { } async APIPutAsync(path: string, body: any): Promise { - return await this.http.put(`${this.extractBaseHref()}/${path}`, body).toPromise(); + return await this.http.put(`${ApiService.extractBaseHref()}/${path}`, body).toPromise(); } APIPost(path: string, body: any, callback: (any) => void): any { @@ -124,7 +124,7 @@ export class ApiService { let resp; - this.http.post(`${this.extractBaseHref()}${path}`, body).subscribe((r) => { + this.http.post(`${ApiService.extractBaseHref()}${path}`, body).subscribe((r) => { if (r === undefined || r === null) { resp = this.emptyResponse; } @@ -141,7 +141,7 @@ export class ApiService { } async APIPostAsync(path: string, body: any): Promise { - return await this.http.post(`${this.extractBaseHref()}/${path}`, body).toPromise(); + return await this.http.post(`${ApiService.extractBaseHref()}/${path}`, body).toPromise(); } APIDelete(path: string, body: any, callback: (any) => void): any { @@ -154,7 +154,7 @@ export class ApiService { let resp; - this.http.delete(`${this.extractBaseHref()}/${path}`, opts).subscribe((r) => { + this.http.delete(`${ApiService.extractBaseHref()}/${path}`, opts).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -171,7 +171,7 @@ export class ApiService { } async APIDeleteAsync(path: string, body: any): Promise { - return await this.http.delete(`${this.extractBaseHref()}${path}`, body).toPromise(); + return await this.http.delete(`${ApiService.extractBaseHref()}${path}`, body).toPromise(); } APIDownload(fullpath: string, filename: string): void { @@ -181,7 +181,7 @@ export class ApiService { filename: fullpath }; - this.http.post(`${this.extractBaseHref()}/api/download`, body, {responseType: 'blob'}).subscribe((r) => { + this.http.post(`${ApiService.extractBaseHref()}/api/download`, body, {responseType: 'blob'}).subscribe((r) => { const url = window.URL.createObjectURL(r); const a = document.createElement('a'); document.body.appendChild(a); diff --git a/cabinet/projects/cabinet/src/lib/services/api.service.ts b/cabinet/projects/cabinet/src/lib/services/api.service.ts index 9838abb..fd4d0cd 100644 --- a/cabinet/projects/cabinet/src/lib/services/api.service.ts +++ b/cabinet/projects/cabinet/src/lib/services/api.service.ts @@ -44,7 +44,7 @@ export class ApiService { this.setBusy(); let resp; - this.http.post(`${this.extractBaseHref()}/api/module/request`, payload).subscribe((r: any) => { + this.http.post(`${ApiService.extractBaseHref()}/api/module/request`, payload).subscribe((r: any) => { if (r === undefined || r === null) { resp = this.emptyResponse; } else if (r.error) { @@ -72,7 +72,7 @@ export class ApiService { let resp; - this.http.get(`${this.extractBaseHref()}${path}`).subscribe((r) => { + this.http.get(`${ApiService.extractBaseHref()}${path}`).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -91,7 +91,7 @@ export class ApiService { async APIGetAsync(path: string): Promise { ApiService.totalRequests++; - return await this.http.get(`${this.extractBaseHref()}${path}`).toPromise(); + return await this.http.get(`${ApiService.extractBaseHref()}${path}`).toPromise(); } APIPut(path: string, body: any, callback: (any) => void): any { @@ -99,7 +99,7 @@ export class ApiService { let resp; - this.http.put(`${this.extractBaseHref()}${path}`, body).subscribe((r) => { + this.http.put(`${ApiService.extractBaseHref()}${path}`, body).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -116,7 +116,7 @@ export class ApiService { } async APIPutAsync(path: string, body: any): Promise { - return await this.http.put(`${this.extractBaseHref()}/${path}`, body).toPromise(); + return await this.http.put(`${ApiService.extractBaseHref()}/${path}`, body).toPromise(); } APIPost(path: string, body: any, callback: (any) => void): any { @@ -124,7 +124,7 @@ export class ApiService { let resp; - this.http.post(`${this.extractBaseHref()}${path}`, body).subscribe((r) => { + this.http.post(`${ApiService.extractBaseHref()}${path}`, body).subscribe((r) => { if (r === undefined || r === null) { resp = this.emptyResponse; } @@ -141,7 +141,7 @@ export class ApiService { } async APIPostAsync(path: string, body: any): Promise { - return await this.http.post(`${this.extractBaseHref()}/${path}`, body).toPromise(); + return await this.http.post(`${ApiService.extractBaseHref()}/${path}`, body).toPromise(); } APIDelete(path: string, body: any, callback: (any) => void): any { @@ -154,7 +154,7 @@ export class ApiService { let resp; - this.http.delete(`${this.extractBaseHref()}/${path}`, opts).subscribe((r) => { + this.http.delete(`${ApiService.extractBaseHref()}/${path}`, opts).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -171,7 +171,7 @@ export class ApiService { } async APIDeleteAsync(path: string, body: any): Promise { - return await this.http.delete(`${this.extractBaseHref()}${path}`, body).toPromise(); + return await this.http.delete(`${ApiService.extractBaseHref()}${path}`, body).toPromise(); } APIDownload(fullpath: string, filename: string): void { @@ -181,7 +181,7 @@ export class ApiService { filename: fullpath }; - this.http.post(`${this.extractBaseHref()}/api/download`, body, {responseType: 'blob'}).subscribe((r) => { + this.http.post(`${ApiService.extractBaseHref()}/api/download`, body, {responseType: 'blob'}).subscribe((r) => { const url = window.URL.createObjectURL(r); const a = document.createElement('a'); document.body.appendChild(a); diff --git a/evilportal/projects/evilportal/src/lib/services/api.service.ts b/evilportal/projects/evilportal/src/lib/services/api.service.ts index 9838abb..fd4d0cd 100644 --- a/evilportal/projects/evilportal/src/lib/services/api.service.ts +++ b/evilportal/projects/evilportal/src/lib/services/api.service.ts @@ -44,7 +44,7 @@ export class ApiService { this.setBusy(); let resp; - this.http.post(`${this.extractBaseHref()}/api/module/request`, payload).subscribe((r: any) => { + this.http.post(`${ApiService.extractBaseHref()}/api/module/request`, payload).subscribe((r: any) => { if (r === undefined || r === null) { resp = this.emptyResponse; } else if (r.error) { @@ -72,7 +72,7 @@ export class ApiService { let resp; - this.http.get(`${this.extractBaseHref()}${path}`).subscribe((r) => { + this.http.get(`${ApiService.extractBaseHref()}${path}`).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -91,7 +91,7 @@ export class ApiService { async APIGetAsync(path: string): Promise { ApiService.totalRequests++; - return await this.http.get(`${this.extractBaseHref()}${path}`).toPromise(); + return await this.http.get(`${ApiService.extractBaseHref()}${path}`).toPromise(); } APIPut(path: string, body: any, callback: (any) => void): any { @@ -99,7 +99,7 @@ export class ApiService { let resp; - this.http.put(`${this.extractBaseHref()}${path}`, body).subscribe((r) => { + this.http.put(`${ApiService.extractBaseHref()}${path}`, body).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -116,7 +116,7 @@ export class ApiService { } async APIPutAsync(path: string, body: any): Promise { - return await this.http.put(`${this.extractBaseHref()}/${path}`, body).toPromise(); + return await this.http.put(`${ApiService.extractBaseHref()}/${path}`, body).toPromise(); } APIPost(path: string, body: any, callback: (any) => void): any { @@ -124,7 +124,7 @@ export class ApiService { let resp; - this.http.post(`${this.extractBaseHref()}${path}`, body).subscribe((r) => { + this.http.post(`${ApiService.extractBaseHref()}${path}`, body).subscribe((r) => { if (r === undefined || r === null) { resp = this.emptyResponse; } @@ -141,7 +141,7 @@ export class ApiService { } async APIPostAsync(path: string, body: any): Promise { - return await this.http.post(`${this.extractBaseHref()}/${path}`, body).toPromise(); + return await this.http.post(`${ApiService.extractBaseHref()}/${path}`, body).toPromise(); } APIDelete(path: string, body: any, callback: (any) => void): any { @@ -154,7 +154,7 @@ export class ApiService { let resp; - this.http.delete(`${this.extractBaseHref()}/${path}`, opts).subscribe((r) => { + this.http.delete(`${ApiService.extractBaseHref()}/${path}`, opts).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -171,7 +171,7 @@ export class ApiService { } async APIDeleteAsync(path: string, body: any): Promise { - return await this.http.delete(`${this.extractBaseHref()}${path}`, body).toPromise(); + return await this.http.delete(`${ApiService.extractBaseHref()}${path}`, body).toPromise(); } APIDownload(fullpath: string, filename: string): void { @@ -181,7 +181,7 @@ export class ApiService { filename: fullpath }; - this.http.post(`${this.extractBaseHref()}/api/download`, body, {responseType: 'blob'}).subscribe((r) => { + this.http.post(`${ApiService.extractBaseHref()}/api/download`, body, {responseType: 'blob'}).subscribe((r) => { const url = window.URL.createObjectURL(r); const a = document.createElement('a'); document.body.appendChild(a); diff --git a/httpeek/projects/httpeek/src/lib/services/api.service.ts b/httpeek/projects/httpeek/src/lib/services/api.service.ts index 9838abb..fd4d0cd 100644 --- a/httpeek/projects/httpeek/src/lib/services/api.service.ts +++ b/httpeek/projects/httpeek/src/lib/services/api.service.ts @@ -44,7 +44,7 @@ export class ApiService { this.setBusy(); let resp; - this.http.post(`${this.extractBaseHref()}/api/module/request`, payload).subscribe((r: any) => { + this.http.post(`${ApiService.extractBaseHref()}/api/module/request`, payload).subscribe((r: any) => { if (r === undefined || r === null) { resp = this.emptyResponse; } else if (r.error) { @@ -72,7 +72,7 @@ export class ApiService { let resp; - this.http.get(`${this.extractBaseHref()}${path}`).subscribe((r) => { + this.http.get(`${ApiService.extractBaseHref()}${path}`).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -91,7 +91,7 @@ export class ApiService { async APIGetAsync(path: string): Promise { ApiService.totalRequests++; - return await this.http.get(`${this.extractBaseHref()}${path}`).toPromise(); + return await this.http.get(`${ApiService.extractBaseHref()}${path}`).toPromise(); } APIPut(path: string, body: any, callback: (any) => void): any { @@ -99,7 +99,7 @@ export class ApiService { let resp; - this.http.put(`${this.extractBaseHref()}${path}`, body).subscribe((r) => { + this.http.put(`${ApiService.extractBaseHref()}${path}`, body).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -116,7 +116,7 @@ export class ApiService { } async APIPutAsync(path: string, body: any): Promise { - return await this.http.put(`${this.extractBaseHref()}/${path}`, body).toPromise(); + return await this.http.put(`${ApiService.extractBaseHref()}/${path}`, body).toPromise(); } APIPost(path: string, body: any, callback: (any) => void): any { @@ -124,7 +124,7 @@ export class ApiService { let resp; - this.http.post(`${this.extractBaseHref()}${path}`, body).subscribe((r) => { + this.http.post(`${ApiService.extractBaseHref()}${path}`, body).subscribe((r) => { if (r === undefined || r === null) { resp = this.emptyResponse; } @@ -141,7 +141,7 @@ export class ApiService { } async APIPostAsync(path: string, body: any): Promise { - return await this.http.post(`${this.extractBaseHref()}/${path}`, body).toPromise(); + return await this.http.post(`${ApiService.extractBaseHref()}/${path}`, body).toPromise(); } APIDelete(path: string, body: any, callback: (any) => void): any { @@ -154,7 +154,7 @@ export class ApiService { let resp; - this.http.delete(`${this.extractBaseHref()}/${path}`, opts).subscribe((r) => { + this.http.delete(`${ApiService.extractBaseHref()}/${path}`, opts).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -171,7 +171,7 @@ export class ApiService { } async APIDeleteAsync(path: string, body: any): Promise { - return await this.http.delete(`${this.extractBaseHref()}${path}`, body).toPromise(); + return await this.http.delete(`${ApiService.extractBaseHref()}${path}`, body).toPromise(); } APIDownload(fullpath: string, filename: string): void { @@ -181,7 +181,7 @@ export class ApiService { filename: fullpath }; - this.http.post(`${this.extractBaseHref()}/api/download`, body, {responseType: 'blob'}).subscribe((r) => { + this.http.post(`${ApiService.extractBaseHref()}/api/download`, body, {responseType: 'blob'}).subscribe((r) => { const url = window.URL.createObjectURL(r); const a = document.createElement('a'); document.body.appendChild(a); diff --git a/locate/projects/locate/src/lib/services/api.service.ts b/locate/projects/locate/src/lib/services/api.service.ts index 9838abb..fd4d0cd 100644 --- a/locate/projects/locate/src/lib/services/api.service.ts +++ b/locate/projects/locate/src/lib/services/api.service.ts @@ -44,7 +44,7 @@ export class ApiService { this.setBusy(); let resp; - this.http.post(`${this.extractBaseHref()}/api/module/request`, payload).subscribe((r: any) => { + this.http.post(`${ApiService.extractBaseHref()}/api/module/request`, payload).subscribe((r: any) => { if (r === undefined || r === null) { resp = this.emptyResponse; } else if (r.error) { @@ -72,7 +72,7 @@ export class ApiService { let resp; - this.http.get(`${this.extractBaseHref()}${path}`).subscribe((r) => { + this.http.get(`${ApiService.extractBaseHref()}${path}`).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -91,7 +91,7 @@ export class ApiService { async APIGetAsync(path: string): Promise { ApiService.totalRequests++; - return await this.http.get(`${this.extractBaseHref()}${path}`).toPromise(); + return await this.http.get(`${ApiService.extractBaseHref()}${path}`).toPromise(); } APIPut(path: string, body: any, callback: (any) => void): any { @@ -99,7 +99,7 @@ export class ApiService { let resp; - this.http.put(`${this.extractBaseHref()}${path}`, body).subscribe((r) => { + this.http.put(`${ApiService.extractBaseHref()}${path}`, body).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -116,7 +116,7 @@ export class ApiService { } async APIPutAsync(path: string, body: any): Promise { - return await this.http.put(`${this.extractBaseHref()}/${path}`, body).toPromise(); + return await this.http.put(`${ApiService.extractBaseHref()}/${path}`, body).toPromise(); } APIPost(path: string, body: any, callback: (any) => void): any { @@ -124,7 +124,7 @@ export class ApiService { let resp; - this.http.post(`${this.extractBaseHref()}${path}`, body).subscribe((r) => { + this.http.post(`${ApiService.extractBaseHref()}${path}`, body).subscribe((r) => { if (r === undefined || r === null) { resp = this.emptyResponse; } @@ -141,7 +141,7 @@ export class ApiService { } async APIPostAsync(path: string, body: any): Promise { - return await this.http.post(`${this.extractBaseHref()}/${path}`, body).toPromise(); + return await this.http.post(`${ApiService.extractBaseHref()}/${path}`, body).toPromise(); } APIDelete(path: string, body: any, callback: (any) => void): any { @@ -154,7 +154,7 @@ export class ApiService { let resp; - this.http.delete(`${this.extractBaseHref()}/${path}`, opts).subscribe((r) => { + this.http.delete(`${ApiService.extractBaseHref()}/${path}`, opts).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -171,7 +171,7 @@ export class ApiService { } async APIDeleteAsync(path: string, body: any): Promise { - return await this.http.delete(`${this.extractBaseHref()}${path}`, body).toPromise(); + return await this.http.delete(`${ApiService.extractBaseHref()}${path}`, body).toPromise(); } APIDownload(fullpath: string, filename: string): void { @@ -181,7 +181,7 @@ export class ApiService { filename: fullpath }; - this.http.post(`${this.extractBaseHref()}/api/download`, body, {responseType: 'blob'}).subscribe((r) => { + this.http.post(`${ApiService.extractBaseHref()}/api/download`, body, {responseType: 'blob'}).subscribe((r) => { const url = window.URL.createObjectURL(r); const a = document.createElement('a'); document.body.appendChild(a); diff --git a/mdk4/projects/mdk4/src/lib/services/api.service.ts b/mdk4/projects/mdk4/src/lib/services/api.service.ts index 9838abb..fd4d0cd 100644 --- a/mdk4/projects/mdk4/src/lib/services/api.service.ts +++ b/mdk4/projects/mdk4/src/lib/services/api.service.ts @@ -44,7 +44,7 @@ export class ApiService { this.setBusy(); let resp; - this.http.post(`${this.extractBaseHref()}/api/module/request`, payload).subscribe((r: any) => { + this.http.post(`${ApiService.extractBaseHref()}/api/module/request`, payload).subscribe((r: any) => { if (r === undefined || r === null) { resp = this.emptyResponse; } else if (r.error) { @@ -72,7 +72,7 @@ export class ApiService { let resp; - this.http.get(`${this.extractBaseHref()}${path}`).subscribe((r) => { + this.http.get(`${ApiService.extractBaseHref()}${path}`).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -91,7 +91,7 @@ export class ApiService { async APIGetAsync(path: string): Promise { ApiService.totalRequests++; - return await this.http.get(`${this.extractBaseHref()}${path}`).toPromise(); + return await this.http.get(`${ApiService.extractBaseHref()}${path}`).toPromise(); } APIPut(path: string, body: any, callback: (any) => void): any { @@ -99,7 +99,7 @@ export class ApiService { let resp; - this.http.put(`${this.extractBaseHref()}${path}`, body).subscribe((r) => { + this.http.put(`${ApiService.extractBaseHref()}${path}`, body).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -116,7 +116,7 @@ export class ApiService { } async APIPutAsync(path: string, body: any): Promise { - return await this.http.put(`${this.extractBaseHref()}/${path}`, body).toPromise(); + return await this.http.put(`${ApiService.extractBaseHref()}/${path}`, body).toPromise(); } APIPost(path: string, body: any, callback: (any) => void): any { @@ -124,7 +124,7 @@ export class ApiService { let resp; - this.http.post(`${this.extractBaseHref()}${path}`, body).subscribe((r) => { + this.http.post(`${ApiService.extractBaseHref()}${path}`, body).subscribe((r) => { if (r === undefined || r === null) { resp = this.emptyResponse; } @@ -141,7 +141,7 @@ export class ApiService { } async APIPostAsync(path: string, body: any): Promise { - return await this.http.post(`${this.extractBaseHref()}/${path}`, body).toPromise(); + return await this.http.post(`${ApiService.extractBaseHref()}/${path}`, body).toPromise(); } APIDelete(path: string, body: any, callback: (any) => void): any { @@ -154,7 +154,7 @@ export class ApiService { let resp; - this.http.delete(`${this.extractBaseHref()}/${path}`, opts).subscribe((r) => { + this.http.delete(`${ApiService.extractBaseHref()}/${path}`, opts).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -171,7 +171,7 @@ export class ApiService { } async APIDeleteAsync(path: string, body: any): Promise { - return await this.http.delete(`${this.extractBaseHref()}${path}`, body).toPromise(); + return await this.http.delete(`${ApiService.extractBaseHref()}${path}`, body).toPromise(); } APIDownload(fullpath: string, filename: string): void { @@ -181,7 +181,7 @@ export class ApiService { filename: fullpath }; - this.http.post(`${this.extractBaseHref()}/api/download`, body, {responseType: 'blob'}).subscribe((r) => { + this.http.post(`${ApiService.extractBaseHref()}/api/download`, body, {responseType: 'blob'}).subscribe((r) => { const url = window.URL.createObjectURL(r); const a = document.createElement('a'); document.body.appendChild(a); diff --git a/mtr/projects/mtr/src/lib/services/api.service.ts b/mtr/projects/mtr/src/lib/services/api.service.ts index 9838abb..fd4d0cd 100644 --- a/mtr/projects/mtr/src/lib/services/api.service.ts +++ b/mtr/projects/mtr/src/lib/services/api.service.ts @@ -44,7 +44,7 @@ export class ApiService { this.setBusy(); let resp; - this.http.post(`${this.extractBaseHref()}/api/module/request`, payload).subscribe((r: any) => { + this.http.post(`${ApiService.extractBaseHref()}/api/module/request`, payload).subscribe((r: any) => { if (r === undefined || r === null) { resp = this.emptyResponse; } else if (r.error) { @@ -72,7 +72,7 @@ export class ApiService { let resp; - this.http.get(`${this.extractBaseHref()}${path}`).subscribe((r) => { + this.http.get(`${ApiService.extractBaseHref()}${path}`).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -91,7 +91,7 @@ export class ApiService { async APIGetAsync(path: string): Promise { ApiService.totalRequests++; - return await this.http.get(`${this.extractBaseHref()}${path}`).toPromise(); + return await this.http.get(`${ApiService.extractBaseHref()}${path}`).toPromise(); } APIPut(path: string, body: any, callback: (any) => void): any { @@ -99,7 +99,7 @@ export class ApiService { let resp; - this.http.put(`${this.extractBaseHref()}${path}`, body).subscribe((r) => { + this.http.put(`${ApiService.extractBaseHref()}${path}`, body).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -116,7 +116,7 @@ export class ApiService { } async APIPutAsync(path: string, body: any): Promise { - return await this.http.put(`${this.extractBaseHref()}/${path}`, body).toPromise(); + return await this.http.put(`${ApiService.extractBaseHref()}/${path}`, body).toPromise(); } APIPost(path: string, body: any, callback: (any) => void): any { @@ -124,7 +124,7 @@ export class ApiService { let resp; - this.http.post(`${this.extractBaseHref()}${path}`, body).subscribe((r) => { + this.http.post(`${ApiService.extractBaseHref()}${path}`, body).subscribe((r) => { if (r === undefined || r === null) { resp = this.emptyResponse; } @@ -141,7 +141,7 @@ export class ApiService { } async APIPostAsync(path: string, body: any): Promise { - return await this.http.post(`${this.extractBaseHref()}/${path}`, body).toPromise(); + return await this.http.post(`${ApiService.extractBaseHref()}/${path}`, body).toPromise(); } APIDelete(path: string, body: any, callback: (any) => void): any { @@ -154,7 +154,7 @@ export class ApiService { let resp; - this.http.delete(`${this.extractBaseHref()}/${path}`, opts).subscribe((r) => { + this.http.delete(`${ApiService.extractBaseHref()}/${path}`, opts).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -171,7 +171,7 @@ export class ApiService { } async APIDeleteAsync(path: string, body: any): Promise { - return await this.http.delete(`${this.extractBaseHref()}${path}`, body).toPromise(); + return await this.http.delete(`${ApiService.extractBaseHref()}${path}`, body).toPromise(); } APIDownload(fullpath: string, filename: string): void { @@ -181,7 +181,7 @@ export class ApiService { filename: fullpath }; - this.http.post(`${this.extractBaseHref()}/api/download`, body, {responseType: 'blob'}).subscribe((r) => { + this.http.post(`${ApiService.extractBaseHref()}/api/download`, body, {responseType: 'blob'}).subscribe((r) => { const url = window.URL.createObjectURL(r); const a = document.createElement('a'); document.body.appendChild(a); diff --git a/nmap/projects/nmap/src/lib/services/api.service.ts b/nmap/projects/nmap/src/lib/services/api.service.ts index 9838abb..fd4d0cd 100644 --- a/nmap/projects/nmap/src/lib/services/api.service.ts +++ b/nmap/projects/nmap/src/lib/services/api.service.ts @@ -44,7 +44,7 @@ export class ApiService { this.setBusy(); let resp; - this.http.post(`${this.extractBaseHref()}/api/module/request`, payload).subscribe((r: any) => { + this.http.post(`${ApiService.extractBaseHref()}/api/module/request`, payload).subscribe((r: any) => { if (r === undefined || r === null) { resp = this.emptyResponse; } else if (r.error) { @@ -72,7 +72,7 @@ export class ApiService { let resp; - this.http.get(`${this.extractBaseHref()}${path}`).subscribe((r) => { + this.http.get(`${ApiService.extractBaseHref()}${path}`).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -91,7 +91,7 @@ export class ApiService { async APIGetAsync(path: string): Promise { ApiService.totalRequests++; - return await this.http.get(`${this.extractBaseHref()}${path}`).toPromise(); + return await this.http.get(`${ApiService.extractBaseHref()}${path}`).toPromise(); } APIPut(path: string, body: any, callback: (any) => void): any { @@ -99,7 +99,7 @@ export class ApiService { let resp; - this.http.put(`${this.extractBaseHref()}${path}`, body).subscribe((r) => { + this.http.put(`${ApiService.extractBaseHref()}${path}`, body).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -116,7 +116,7 @@ export class ApiService { } async APIPutAsync(path: string, body: any): Promise { - return await this.http.put(`${this.extractBaseHref()}/${path}`, body).toPromise(); + return await this.http.put(`${ApiService.extractBaseHref()}/${path}`, body).toPromise(); } APIPost(path: string, body: any, callback: (any) => void): any { @@ -124,7 +124,7 @@ export class ApiService { let resp; - this.http.post(`${this.extractBaseHref()}${path}`, body).subscribe((r) => { + this.http.post(`${ApiService.extractBaseHref()}${path}`, body).subscribe((r) => { if (r === undefined || r === null) { resp = this.emptyResponse; } @@ -141,7 +141,7 @@ export class ApiService { } async APIPostAsync(path: string, body: any): Promise { - return await this.http.post(`${this.extractBaseHref()}/${path}`, body).toPromise(); + return await this.http.post(`${ApiService.extractBaseHref()}/${path}`, body).toPromise(); } APIDelete(path: string, body: any, callback: (any) => void): any { @@ -154,7 +154,7 @@ export class ApiService { let resp; - this.http.delete(`${this.extractBaseHref()}/${path}`, opts).subscribe((r) => { + this.http.delete(`${ApiService.extractBaseHref()}/${path}`, opts).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -171,7 +171,7 @@ export class ApiService { } async APIDeleteAsync(path: string, body: any): Promise { - return await this.http.delete(`${this.extractBaseHref()}${path}`, body).toPromise(); + return await this.http.delete(`${ApiService.extractBaseHref()}${path}`, body).toPromise(); } APIDownload(fullpath: string, filename: string): void { @@ -181,7 +181,7 @@ export class ApiService { filename: fullpath }; - this.http.post(`${this.extractBaseHref()}/api/download`, body, {responseType: 'blob'}).subscribe((r) => { + this.http.post(`${ApiService.extractBaseHref()}/api/download`, body, {responseType: 'blob'}).subscribe((r) => { const url = window.URL.createObjectURL(r); const a = document.createElement('a'); document.body.appendChild(a); diff --git a/tcpdump/projects/tcpdump/src/lib/services/api.service.ts b/tcpdump/projects/tcpdump/src/lib/services/api.service.ts index 9838abb..fd4d0cd 100644 --- a/tcpdump/projects/tcpdump/src/lib/services/api.service.ts +++ b/tcpdump/projects/tcpdump/src/lib/services/api.service.ts @@ -44,7 +44,7 @@ export class ApiService { this.setBusy(); let resp; - this.http.post(`${this.extractBaseHref()}/api/module/request`, payload).subscribe((r: any) => { + this.http.post(`${ApiService.extractBaseHref()}/api/module/request`, payload).subscribe((r: any) => { if (r === undefined || r === null) { resp = this.emptyResponse; } else if (r.error) { @@ -72,7 +72,7 @@ export class ApiService { let resp; - this.http.get(`${this.extractBaseHref()}${path}`).subscribe((r) => { + this.http.get(`${ApiService.extractBaseHref()}${path}`).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -91,7 +91,7 @@ export class ApiService { async APIGetAsync(path: string): Promise { ApiService.totalRequests++; - return await this.http.get(`${this.extractBaseHref()}${path}`).toPromise(); + return await this.http.get(`${ApiService.extractBaseHref()}${path}`).toPromise(); } APIPut(path: string, body: any, callback: (any) => void): any { @@ -99,7 +99,7 @@ export class ApiService { let resp; - this.http.put(`${this.extractBaseHref()}${path}`, body).subscribe((r) => { + this.http.put(`${ApiService.extractBaseHref()}${path}`, body).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -116,7 +116,7 @@ export class ApiService { } async APIPutAsync(path: string, body: any): Promise { - return await this.http.put(`${this.extractBaseHref()}/${path}`, body).toPromise(); + return await this.http.put(`${ApiService.extractBaseHref()}/${path}`, body).toPromise(); } APIPost(path: string, body: any, callback: (any) => void): any { @@ -124,7 +124,7 @@ export class ApiService { let resp; - this.http.post(`${this.extractBaseHref()}${path}`, body).subscribe((r) => { + this.http.post(`${ApiService.extractBaseHref()}${path}`, body).subscribe((r) => { if (r === undefined || r === null) { resp = this.emptyResponse; } @@ -141,7 +141,7 @@ export class ApiService { } async APIPostAsync(path: string, body: any): Promise { - return await this.http.post(`${this.extractBaseHref()}/${path}`, body).toPromise(); + return await this.http.post(`${ApiService.extractBaseHref()}/${path}`, body).toPromise(); } APIDelete(path: string, body: any, callback: (any) => void): any { @@ -154,7 +154,7 @@ export class ApiService { let resp; - this.http.delete(`${this.extractBaseHref()}/${path}`, opts).subscribe((r) => { + this.http.delete(`${ApiService.extractBaseHref()}/${path}`, opts).subscribe((r) => { if (r === undefined || r === null) { r = this.emptyResponse; } @@ -171,7 +171,7 @@ export class ApiService { } async APIDeleteAsync(path: string, body: any): Promise { - return await this.http.delete(`${this.extractBaseHref()}${path}`, body).toPromise(); + return await this.http.delete(`${ApiService.extractBaseHref()}${path}`, body).toPromise(); } APIDownload(fullpath: string, filename: string): void { @@ -181,7 +181,7 @@ export class ApiService { filename: fullpath }; - this.http.post(`${this.extractBaseHref()}/api/download`, body, {responseType: 'blob'}).subscribe((r) => { + this.http.post(`${ApiService.extractBaseHref()}/api/download`, body, {responseType: 'blob'}).subscribe((r) => { const url = window.URL.createObjectURL(r); const a = document.createElement('a'); document.body.appendChild(a);