open popup for external links on tauri

pull/19/head
Niko PLP 1 year ago
parent a2af2676e9
commit a0e52ab465
  1. 62
      ng-app/src/routes/User.svelte
  2. 67
      ng-app/src/routes/WalletCreate.svelte
  3. 20
      ngaccount/web/src/routes/Create.svelte
  4. 2
      p2p-net/src/broker.rs

@ -78,6 +78,20 @@
$: personal_site = $active_wallet?.wallet?.V0.personal_site_id; $: personal_site = $active_wallet?.wallet?.V0.personal_site_id;
$: personal_site_status = $connections[personal_site]; $: personal_site_status = $connections[personal_site];
const displayPopup = async (url, title) => {
if (!tauri_platform || tauri_platform == "android") {
window.open(url, "_blank").focus();
} else {
await ng.open_window(url, "viewer", title);
}
};
const donate = async () => {
await displayPopup("https://nextgraph.org/donate", "Support NextGraph");
};
const about = async () => {
await displayPopup("https://nextgraph.org", "About NextGraph");
};
</script> </script>
<CenteredLayout> <CenteredLayout>
@ -219,32 +233,32 @@
{/if} {/if}
</SidebarGroup> </SidebarGroup>
<SidebarGroup border> <SidebarGroup border>
<SidebarItem <li
label="Donate to NextGraph" tabindex="0"
href="https://nextgraph.org/donate" class="flex items-center p-2 text-base font-normal text-gray-900 clickable rounded-lg dark:text-white hover:bg-gray-200 dark:hover:bg-gray-700"
target="_blank" on:keypress={donate}
class="p-2" on:click={donate}
> >
<svelte:fragment slot="icon"> <Gift
<Gift tabindex="-1"
tabindex="-1" class="w-7 h-7 text-black transition duration-75 dark:text-white group-hover:text-gray-900 dark:group-hover:text-white"
class="w-7 h-7 text-black transition duration-75 dark:text-white group-hover:text-gray-900 dark:group-hover:text-white" />
/> <span class="ml-3">Donate to NextGraph</span>
</svelte:fragment> </li>
</SidebarItem>
<SidebarItem <li
label="About NextGraph" tabindex="0"
href="https://nextgraph.org" class="flex items-center p-2 text-base font-normal text-gray-900 clickable rounded-lg dark:text-white hover:bg-gray-200 dark:hover:bg-gray-700"
target="_blank" on:keypress={about}
class="p-2" on:click={about}
> >
<svelte:fragment slot="icon"> <InformationCircle
<InformationCircle tabindex="-1"
tabindex="-1" class="w-7 h-7 text-black transition duration-75 dark:text-white group-hover:text-gray-900 dark:group-hover:text-white"
class="w-7 h-7 text-black transition duration-75 dark:text-white group-hover:text-gray-900 dark:group-hover:text-white" />
/> <span class="ml-3">About NextGraph</span>
</svelte:fragment> </li>
</SidebarItem>
<li <li
class="flex items-center p-2 text-base font-normal text-gray-900" class="flex items-center p-2 text-base font-normal text-gray-900"
> >

@ -256,30 +256,21 @@
} }
} }
async function getWallet() { // async function getWallet() {
const opts = { // const opts = {
method: "get", // method: "get",
}; // };
const response = await fetch( // const response = await fetch(
api_url + "bootstrap/I8tuoVE-LRH1wuWQpDBPivlSX8Wle39uHSL576BTxsk", // api_url + "bootstrap/I8tuoVE-LRH1wuWQpDBPivlSX8Wle39uHSL576BTxsk",
opts // opts
); // );
const result = await response.json(); // const result = await response.json();
console.log("Result:", result); // console.log("Result:", result);
} // }
onMount(async () => await bootstrap()); onMount(async () => await bootstrap());
ready = false; ready = false;
// {
// user: {
// Ed25519PubKey: [
// 141, 114, 111, 29, 59, 133, 182, 172, 177, 211, 238, 224, 62, 208, 206,
// 18, 226, 219, 118, 229, 184, 76, 204, 29, 194, 228, 248, 186, 15, 113,
// 125, 119,
// ],
// },
// };
const unsub_register = () => { const unsub_register = () => {
if (unsub_register_accepted) unsub_register_accepted(); if (unsub_register_accepted) unsub_register_accepted();
@ -375,19 +366,25 @@
}; };
const enterINVITE = (event) => {}; const enterINVITE = (event) => {};
const enterQRcode = (event) => {}; const enterQRcode = (event) => {};
const displayNGbox = async (event) => {
const displayPopup = async (url, title) => {
if (!tauri_platform || tauri_platform == "android") { if (!tauri_platform || tauri_platform == "android") {
window.open(LINK_NG_BOX, "_blank").focus(); window.open(url, "_blank").focus();
} else { } else {
await ng.open_window(LINK_NG_BOX, "viewer", "Own your NG-Box"); await ng.open_window(url, "viewer", title);
} }
}; };
const displayNGbox = async (event) => {
await displayPopup(LINK_NG_BOX, "Own your NG-Box");
};
const displaySelfHost = async (event) => { const displaySelfHost = async (event) => {
if (!tauri_platform || tauri_platform == "android") { await displayPopup(LINK_SELF_HOST, "Self-host a broker");
window.open(LINK_SELF_HOST, "_blank").focus(); };
} else { const tos = async () => {
await ng.open_window(LINK_SELF_HOST, "viewer", "Self-host a broker"); await displayPopup(
} "https://nextgraph.one/#/tos",
"Terms of Service NextGraph.one"
);
}; };
</script> </script>
@ -1364,8 +1361,11 @@
Only you will be able to download it with a special link. You would have Only you will be able to download it with a special link. You would have
to keep this link safely though. By selecting this option, you agree to keep this link safely though. By selecting this option, you agree
to the to the
<a target="_blank" href="https://nextgraph.one/#/tos" <span
>Terms of Service of our cloud</a style="font-weight: 500;cursor: pointer; color: #646cff;"
tabindex="0"
on:keypress={tos}
on:click={tos}>Terms of Service of our cloud</span
>. >.
<br /> <br />
<Toggle disabled class="mt-3" bind:checked={options.cloud} <Toggle disabled class="mt-3" bind:checked={options.cloud}
@ -1396,8 +1396,11 @@
do so, we will keep your wallet ID and some information about your do so, we will keep your wallet ID and some information about your
broker on our cloud servers. If you prefer to opt out, just uncheck broker on our cloud servers. If you prefer to opt out, just uncheck
this option. By selecting this option, you agree to the this option. By selecting this option, you agree to the
<a target="_blank" href="https://nextgraph.one/#/tos" <span
>Terms of Service of our cloud</a style="font-weight: 500;cursor: pointer; color: #646cff;"
tabindex="0"
on:keypress={tos}
on:click={tos}>Terms of Service of our cloud</span
>. >.
<br /> <br />
<Toggle disabled class="mt-3" bind:checked={options.bootstrap} <Toggle disabled class="mt-3" bind:checked={options.bootstrap}

@ -306,8 +306,9 @@
</svg> </svg>
<span> <span>
You can delete your account with us at any time by going to the You can delete your account with us at any time by going to the
link <a target="_blank" href="https://account.{domain}/#/delete" link <span
>account.{domain}/#/delete</a style="font-weight: 500;
color: #646cff;">account.{domain}/#/delete</span
> or by entering in your NextGraph application and selecting the > or by entering in your NextGraph application and selecting the
menu, then Accounts, then under broker "delete registration"</span menu, then Accounts, then under broker "delete registration"</span
> >
@ -331,12 +332,15 @@
<span <span
>Registration is free of charge. And it would be very nice of >Registration is free of charge. And it would be very nice of
you if you wanted to donate a small amount to help us cover the you if you wanted to donate a small amount to help us cover the
fees we have to pay for operating the servers. Here is the fees we have to pay for operating the servers. {#if !window.__TAURI__}
donation link: <a Here is the donation link: <a
target="_blank" target="_blank"
href="https://nextgraph.org/donate" href="https://nextgraph.org/donate"
>https://nextgraph.org/donate</a >https://nextgraph.org/donate</a
> >{:else}
You will find the link to donate in your app, by clicking on
the logo of NextGraph on the top-left corner.
{/if}
</span> </span>
</li> </li>
{#if !window.__TAURI__} {#if !window.__TAURI__}

@ -850,6 +850,8 @@ impl<'a> Broker<'a> {
// log_debug!("SOCKET RECONNECTION {:?} {:?}", result, &remote_peer_id); // log_debug!("SOCKET RECONNECTION {:?} {:?}", result, &remote_peer_id);
// TODO: deal with error and incremental backoff // TODO: deal with error and incremental backoff
// TODO: incremental reconnections: after 5sec, +10sec, +20sec, +30sec
// if all attempts fail : // if all attempts fail :
if let Some(user) = config.get_user() { if let Some(user) = config.get_user() {
disconnections_sender.send(user.to_string()).await; disconnections_sender.send(user.to_string()).await;

Loading…
Cancel
Save