fixed invitation from localhost

pull/19/head
Niko PLP 8 months ago
parent 73dbf1933a
commit e0e5738eda
  1. 2
      ng-app/src/App.svelte
  2. 18
      ng-app/src/routes/Invitation.svelte
  3. 7
      ng-app/src/routes/WalletCreate.svelte
  4. 16
      ngd/README.md
  5. 5
      ngone/web/src/routes/WalletCreate.svelte
  6. 4
      p2p-net/src/utils.rs

@ -27,6 +27,7 @@
import URI from "./routes/URI.svelte";
import NotFound from "./routes/NotFound.svelte";
import WalletCreate from "./routes/WalletCreate.svelte";
import Invitation from "./routes/Invitation.svelte";
import WalletLogin from "./routes/WalletLogin.svelte";
import User from "./routes/User.svelte";
import UserRegistered from "./routes/UserRegistered.svelte";
@ -39,6 +40,7 @@
routes.set("/test", Test);
routes.set("/wallet/login", WalletLogin);
routes.set("/wallet/create", WalletCreate);
routes.set("/i/:invitation", Invitation);
routes.set("/user", User);
routes.set("/user/registered", UserRegistered);
if (import.meta.env.NG_APP_WEB) routes.set("/install", Install);

@ -0,0 +1,18 @@
<!--
// Copyright (c) 2022-2024 Niko Bonnieure, Par le Peuple, NextGraph.org developers
// All rights reserved.
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE2 or http://www.apache.org/licenses/LICENSE-2.0>
// or the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be copied, modified, or distributed except
// according to those terms.
-->
<script lang="ts">
export let params = {};
import { onMount } from "svelte";
onMount(
() => (window.location.href = "/#/wallet/create?i=" + params.invitation)
);
</script>

@ -156,7 +156,7 @@
invitation = await ng.decode_invitation(param.get("i"));
window.location.replace(window.location.href.split("?")[0]);
} else if (param.get("i")) {
invitation = await ng.get_local_bootstrap_with_public(
invitation = await ng.get_local_bootstrap(
location.href,
param.get("i")
);
@ -473,8 +473,9 @@
<div class=" max-w-6xl lg:px-8 mx-auto px-4">
<p class="max-w-xl md:mx-auto lg:max-w-2xl">
A <b>NextGraph Wallet</b> is unique to each person. It stores your
credentials and authorizations to access documents. <br /><br />If
you already have a wallet, you should not create a new one, instead,
credentials and authorizations to access documents. You need one in
order to start using NextGraph.<br /><br />If you already have a
wallet, you should not create a new one, instead,
<a href="/wallet/login" use:link
>login here with your existing wallet.</a
>

@ -13,7 +13,7 @@ If you prefer to change the base directory, use the argument `--base [PATH]` whe
```
ngcli gen-key
ngd -v --save-key -d <DOMAIN_NAME> -l 1440 --admin <THE_USER_ID_YOU_JUST_CREATED>
ngd -v --save-key -l 1440 --admin <THE_USER_ID_YOU_JUST_CREATED>
// note the server peerID from the logs
```
@ -36,6 +36,18 @@ should return your userId
you can now save the configs of both the server and client
```
ngd -d <DOMAIN_NAME> -l 1440 --save-config
ngd -l 1440 --save-config
ngcli -s 127.0.0.1,1440,<PEER_ID_OF_SERVER> -u <THE_PRIVATE_KEY_OF_THE_USER_YOU_JUST_CREATED> --save-config
```
### Create an invitation for yourself so you can create your wallet
```
ngcli admin add-invitation
```
this will give you a link that you should open in your web browser. If there are many links, choose the one that starts with `http://localhost:`.
The computer you use to open the link should have direct access to the ngd server on localhost. In most of the cases, it will work, as you are running ngd on localhost. If you are running ngd in a docker container, then you need to give access to the container to the local network of the host by using `docker run --network="host"`. https://docs.docker.com/network/drivers/host/
Follow the steps on the screen :)

@ -49,8 +49,9 @@
<p class="max-w-sm">
A <b>NextGraph Wallet</b> is unique to each person.<br /> It stores your
credentials to access documents. <br />If you already have a wallet, you
should not create a new one, instead,
credentials to access documents. You need one in order to start using
NextGraph.<br />If you already have a wallet, you should not create a new
one, instead,
{#if display_note_on_local_wallets}
<a href="/" use:link>login here with your existing wallet.</a>
{:else}

@ -10,12 +10,16 @@
*/
use crate::types::*;
#[cfg(target_arch = "wasm32")]
use crate::NG_BOOTSTRAP_LOCAL_PATH;
use async_std::task;
use ed25519_dalek::*;
use futures::{channel::mpsc, Future};
use noise_protocol::U8Array;
use noise_protocol::DH;
use noise_rust_crypto::sensitive::Sensitive;
#[cfg(target_arch = "wasm32")]
use p2p_repo::errors::*;
use p2p_repo::types::PubKey;
use p2p_repo::{log::*, types::PrivKey};
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};

Loading…
Cancel
Save