Fix bad backend URL on generated Qr Code for tokens authentication
This commit is contained in:
@ -31,12 +31,21 @@ export class APIClient {
|
|||||||
return URL;
|
return URL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the full URL at which the backend can be contacted
|
||||||
|
*/
|
||||||
|
static ActualBackendURL(): string {
|
||||||
|
const backendURL = this.backendURL();
|
||||||
|
if (backendURL.startsWith("/")) return `${location.origin}${backendURL}`;
|
||||||
|
else return backendURL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check out whether the backend is accessed through
|
* Check out whether the backend is accessed through
|
||||||
* HTTPS or not
|
* HTTPS or not
|
||||||
*/
|
*/
|
||||||
static IsBackendSecure(): boolean {
|
static IsBackendSecure(): boolean {
|
||||||
return this.backendURL().startsWith("https");
|
return this.ActualBackendURL().startsWith("https");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -268,7 +268,7 @@ function CreatedToken(p: { token: TokenWithSecret }): React.ReactElement {
|
|||||||
<div style={{ padding: "15px", backgroundColor: "white" }}>
|
<div style={{ padding: "15px", backgroundColor: "white" }}>
|
||||||
<QRCodeCanvas
|
<QRCodeCanvas
|
||||||
value={`moneymgr://api=${encodeURIComponent(
|
value={`moneymgr://api=${encodeURIComponent(
|
||||||
APIClient.backendURL()
|
APIClient.ActualBackendURL()
|
||||||
)}&id=${p.token.id}&secret=${p.token.token}`}
|
)}&id=${p.token.id}&secret=${p.token.token}`}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user