Skip to content

Commit

Permalink
Update url used for captcha service
Browse files Browse the repository at this point in the history
  • Loading branch information
superzordon committed Apr 3, 2024
1 parent 0b1b26a commit 715880c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ header @html Content-Security-Policy "
https://www.googleapis.com/drive/v3/files
https://www.googleapis.com/drive/v3/files/
https://www.googleapis.com/upload/drive/v3/files
https://desoverification.com/api/v0/verify-captcha
https://api.blockchain.com/mempool/fees
https://registry.walletconnect.com/
https://explorer-api.walletconnect.com/
Expand Down
17 changes: 10 additions & 7 deletions src/app/backend-api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,11 @@ export class BackendAPIService {
private globalVars: GlobalVarsService
) {}

getRoute(path: string): string {
let endpoint = this.endpoint;
getRoute(path: string, endpoint?: string): string {
// If endpoint is undefined, set to the constructor endpoint
if (endpoint === undefined) {
endpoint = this.endpoint;
}
if (
this.globalVars.network === Network.testnet &&
this.endpoint.startsWith('https://node.deso.org')
Expand All @@ -286,11 +289,11 @@ export class BackendAPIService {
return this.httpClient.get<any>(this.getRoute(path));
}

post(path: string, body: any): Observable<any> {
return this.httpClient.post<any>(this.getRoute(path), body);
post(path: string, body: any, endpoint?: string): Observable<any> {
return this.httpClient.post<any>(this.getRoute(path, endpoint), body);
}

jwtPost(path: string, publicKey: string, body: any): Observable<any> {
jwtPost(path: string, publicKey: string, body: any, endpoint?: string): Observable<any> {
const account = this.accountService.getAccountInfo(publicKey);
// NOTE: there are some cases where derived user's were not being sent phone number
// verification texts due to missing public user info. This is to log how often
Expand All @@ -305,7 +308,7 @@ export class BackendAPIService {
const isDerived = this.accountService.isMetamaskAccount(account);

const jwt = this.signingService.signJWT(account.seedHex, isDerived);
return this.post(path, { ...body, ...{ JWT: jwt } });
return this.post(path, { ...body, ...{ JWT: jwt } }, endpoint);
}

// Error parsing
Expand Down Expand Up @@ -338,7 +341,7 @@ export class BackendAPIService {
return this.jwtPost('verify-captcha', publicKey, {
Token: token,
PublicKeyBase58Check: publicKey,
});
}, 'https://desoverification.com/api/v0');
}

GetUserProfiles(
Expand Down

0 comments on commit 715880c

Please sign in to comment.