Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No more default protocol-redirect #107

Merged
merged 11 commits into from
Nov 1, 2023
25 changes: 9 additions & 16 deletions views/apps/create.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,16 @@ <h2 class="font-bold text-2xl font-headline mb-2 dark:text-white">{{.Name}}</h2>
<script type="text/javascript">
// notify the opener if present of the success full connect
window.addEventListener("load", (event) => {
// if there is no opener we redirect to the protocol link
// this fails if the user does not support it and the user sees the normal
if (!window.opener) {
// delay execution a bit to make sure the page can finish loading
setTimeout(function () {
document.location = "{{.PairingUri}}";
}, 250);
return;

if (window.opener) {
window.opener.postMessage(
{
type: "nwc:success",
payload: {success: true},
},
"*"
);
}
window.opener.postMessage(
{
type: "nwc:success",
payload: { success: true },
},
"*"
);
});

window.addEventListener("DOMContentLoaded", (event) => {
Expand Down