Skip to content

Commit a6eef4d

Browse files
committed
fix: pass urlProtocol as query parameter to sucess.html page
Signed-off-by: Denis Golovin <dgolovin@redhat.com>
1 parent ad1f036 commit a6eef4d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/authentication-service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ export class RedHatAuthenticationService {
377377
if ('err' in redirectReq) {
378378
const { err, res } = redirectReq;
379379
res.writeHead(302, {
380-
Location: `/?service=${this.config.serviceId}&error=${encodeURIComponent((err as Error)?.message || 'Unknown error')}`,
380+
Location: `/?service=${this.config.serviceId}&error=${encodeURIComponent((err as Error)?.message || 'Unknown error')}&protocol=${env.urlProtocol}`,
381381
});
382382
res.end();
383383
throw err;
@@ -437,7 +437,7 @@ export class RedHatAuthenticationService {
437437
const token = this.convertToken(tokenSet!, scope);
438438

439439
callbackResult.res.writeHead(302, {
440-
Location: `/?service=${this.config.serviceId}&login=${encodeURIComponent(token.account.label)}`,
440+
Location: `/?service=${this.config.serviceId}&login=${encodeURIComponent(token.account.label)}&protocol=${env.urlProtocol}`,
441441
});
442442
callbackResult.res.end();
443443

@@ -453,7 +453,7 @@ export class RedHatAuthenticationService {
453453

454454
public error(response: ServerResponse, error: unknown): void {
455455
response.writeHead(302, {
456-
Location: `/?error=${encodeURIComponent((error as Error)?.message || 'Unknown error')}`,
456+
Location: `/?error=${encodeURIComponent((error as Error)?.message || 'Unknown error')}&protocol=${env.urlProtocol}`,
457457
});
458458
response.end();
459459
}

www/success.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
/>
1313
<script lang="javascript">
1414
function onLoad() {
15-
window.location.href = 'podman-desktop://'
15+
var protocol = (/[?&]protocol=([^&]+)/.exec(window.location.search) || [])[1];
16+
window.location.href = (protocol || 'podman-desktop') + '://';
1617
};
1718
window.onload = onLoad;
1819
</script>

0 commit comments

Comments
 (0)