Compare commits
232 Commits
no-need-cr
...
master
Author | SHA1 | Date |
---|---|---|
|
a9ddf9ad32 | 15 hours ago |
|
6fe3624ba0 | 1 day ago |
|
ef93afe4cb | 2 days ago |
|
0022643342 | 3 days ago |
|
16dbfa5139 | 3 days ago |
|
074a2b3c81 | 3 days ago |
|
4b06847038 | 3 days ago |
|
fb345aec05 | 3 days ago |
|
7b1d2f50c2 | 2 weeks ago |
|
990fec1869 | 2 weeks ago |
|
814aa22fd4 | 2 weeks ago |
|
e3faf39ade | 3 weeks ago |
|
04ad4b47c5 | 3 weeks ago |
|
e659e6e6bf | 3 weeks ago |
|
70391e93e0 | 3 weeks ago |
|
e36610c0b1 | 3 weeks ago |
|
ac30abfa6a | 3 weeks ago |
|
6d1cd8aefa | 4 weeks ago |
|
1b30a215b8 | 4 weeks ago |
|
db706b1af3 | 4 weeks ago |
|
f638832dc8 | 4 weeks ago |
|
49aed791c0 | 4 weeks ago |
|
d8f63fa186 | 4 weeks ago |
|
ea021aa198 | 4 weeks ago |
|
f107b5726d | 4 weeks ago |
|
b1e76c20af | 4 weeks ago |
|
a81692cd80 | 4 weeks ago |
|
5c98e8f532 | 4 weeks ago |
|
79c2d2fa46 | 4 weeks ago |
|
ba7ef29c42 | 4 weeks ago |
|
c7efa08ae3 | 1 month ago |
|
19123c97bf | 2 months ago |
|
9ecbbb49e7 | 2 months ago |
|
d1635e2dd2 | 2 months ago |
|
9d817a3d23 | 2 months ago |
|
63f49d2260 | 3 months ago |
|
64013d4220 | 3 months ago |
|
460464e79a | 3 months ago |
|
802d199354 | 3 months ago |
|
5994e007bd | 3 months ago |
|
73881ac204 | 3 months ago |
|
0bae686095 | 3 months ago |
|
e6fc1a3813 | 3 months ago |
|
8ef4c35af9 | 3 months ago |
|
9a6610edb1 | 3 months ago |
|
e6aedd396c | 3 months ago |
|
09652db42f | 3 months ago |
|
3a2cb3b63f | 3 months ago |
|
a99b53652a | 3 months ago |
|
4d163dec9a | 3 months ago |
|
379b656237 | 3 months ago |
|
c6000e16eb | 4 months ago |
|
6f20d4177c | 4 months ago |
|
9e381117f6 | 4 months ago |
|
bc28d85a23 | 4 months ago |
|
b095c28e7f | 5 months ago |
|
8910ed27cd | 6 months ago |
|
62f3638aa4 | 6 months ago |
|
516ab0f0a9 | 6 months ago |
|
119565bc21 | 6 months ago |
|
cc028766f4 | 8 months ago |
|
d3d24f5976 | 8 months ago |
|
68ef3b234c | 9 months ago |
|
31c7a1e21b | 9 months ago |
|
771dd8ad0c | 9 months ago |
|
b752f58846 | 9 months ago |
|
a58309defa | 9 months ago |
|
2e13cfa11f | 9 months ago |
|
e077c47b2d | 9 months ago |
|
9641552a71 | 9 months ago |
|
2ec3acb8ee | 9 months ago |
|
d82f3da336 | 9 months ago |
|
ab503fcfc7 | 9 months ago |
|
3dcd2eff7c | 9 months ago |
|
106989265b | 9 months ago |
|
c0b58b7666 | 9 months ago |
|
cb6b391c08 | 9 months ago |
|
4d97ad8fe8 | 9 months ago |
|
948747d448 | 9 months ago |
|
8e77863bce | 9 months ago |
|
6f8ab70a3f | 9 months ago |
|
7c1ff6ed2b | 9 months ago |
|
c9efbe3a3e | 9 months ago |
|
c7ca4c926b | 9 months ago |
|
fcc1a63a7b | 9 months ago |
|
a502a4a5e1 | 9 months ago |
|
d1c87e56c5 | 9 months ago |
|
58824c8e82 | 9 months ago |
|
aa1a15f625 | 9 months ago |
|
55f09c26ea | 9 months ago |
|
c2b75e9df1 | 9 months ago |
|
3ef9016e94 | 9 months ago |
|
f37b4be493 | 9 months ago |
|
8420c18ca3 | 9 months ago |
|
04bb3452fc | 9 months ago |
|
7df7961eb3 | 9 months ago |
|
f22692db0b | 9 months ago |
|
3511d604c0 | 9 months ago |
|
a45dfd9249 | 9 months ago |
|
37fad2f605 | 9 months ago |
|
cef2c4fd0e | 9 months ago |
|
b349c732c6 | 9 months ago |
|
d30888cfc0 | 9 months ago |
|
fb034a2b9e | 9 months ago |
|
f838aa6a6d | 9 months ago |
|
190e905769 | 9 months ago |
|
ba55bbc455 | 9 months ago |
|
131d85e000 | 9 months ago |
|
ceed3c29d0 | 9 months ago |
|
6842c3e841 | 9 months ago |
|
c677ed3d70 | 9 months ago |
|
f8f787ddf8 | 9 months ago |
|
d13b2b4962 | 10 months ago |
|
c5b405dbd7 | 10 months ago |
|
eac723d50d | 10 months ago |
|
b93a3b006a | 10 months ago |
|
75c4b8df5e | 10 months ago |
|
f13a0978b2 | 10 months ago |
|
58891456ac | 10 months ago |
|
1b06c9d901 | 10 months ago |
|
5d16583f70 | 10 months ago |
|
3f0f2fa626 | 10 months ago |
|
238121f2f6 | 10 months ago |
|
621c7cfefb | 10 months ago |
|
4fc106ce25 | 10 months ago |
|
c6069dccac | 10 months ago |
|
cda5291bec | 10 months ago |
![]() |
45b2a72742 | 10 months ago |
|
a8b6b8b346 | 10 months ago |
|
9e1174314b | 10 months ago |
|
3f28b35f79 | 10 months ago |
|
ae167528ac | 10 months ago |
|
5bf0dd9d13 | 10 months ago |
|
a56755f1b3 | 10 months ago |
|
a30a04832e | 10 months ago |
|
349796dba7 | 10 months ago |
|
8621f1719a | 10 months ago |
|
1e8984fa6e | 10 months ago |
|
fbbadbe1f0 | 10 months ago |
|
0939ed4645 | 10 months ago |
|
6e204f4015 | 10 months ago |
|
09a2df4727 | 10 months ago |
|
82fc3ac9d6 | 10 months ago |
|
09b8e2eef2 | 10 months ago |
|
1e9640e225 | 10 months ago |
|
39a7a9ec7c | 10 months ago |
|
d84497d0f1 | 10 months ago |
|
88a39e3ee0 | 10 months ago |
|
c7bc70963c | 10 months ago |
|
b57c76e6b5 | 10 months ago |
|
2624555230 | 10 months ago |
|
0af11c422d | 10 months ago |
|
97c6b6eb6d | 10 months ago |
|
da12be5c87 | 10 months ago |
|
428ce35fad | 10 months ago |
|
efeca69c89 | 10 months ago |
|
58df462ea1 | 10 months ago |
|
547380e811 | 10 months ago |
|
8de384aeab | 10 months ago |
|
8bd6d0dd0c | 10 months ago |
|
fcf5f6eade | 10 months ago |
|
96da230e33 | 10 months ago |
|
201c5161a7 | 10 months ago |
|
93231e3bf8 | 10 months ago |
|
ae56926238 | 10 months ago |
![]() |
016d065158 | 10 months ago |
![]() |
26bf2b2668 | 10 months ago |
|
4dca802cca | 10 months ago |
|
e8fdf0b1d2 | 10 months ago |
![]() |
0bf6e1bcab | 10 months ago |
![]() |
2ee9079ce4 | 10 months ago |
|
df99d4196f | 10 months ago |
|
c97f9def8c | 10 months ago |
|
b8f56017d0 | 10 months ago |
|
3d9e9c018e | 10 months ago |
|
b1327b4141 | 10 months ago |
![]() |
8862a738fa | 10 months ago |
|
09251afd51 | 10 months ago |
![]() |
113636c48a | 10 months ago |
![]() |
bdde816983 | 10 months ago |
![]() |
3dce86bd94 | 10 months ago |
![]() |
65b0e7b31b | 10 months ago |
|
c64c1373f6 | 10 months ago |
|
b5b90d8310 | 10 months ago |
![]() |
94d2845a23 | 10 months ago |
|
4a1f165396 | 10 months ago |
![]() |
7f0ec8f718 | 10 months ago |
|
5acd01ec40 | 11 months ago |
|
0cfdc3cab3 | 11 months ago |
|
31f709941e | 11 months ago |
![]() |
e7518f1f19 | 11 months ago |
![]() |
20d09f3520 | 11 months ago |
![]() |
ba2d112d47 | 11 months ago |
![]() |
0e0b8fc8f1 | 11 months ago |
|
d852258434 | 11 months ago |
![]() |
40eb17f38f | 11 months ago |
![]() |
97709507ed | 11 months ago |
|
9a9e17f6bf | 11 months ago |
|
4c10b27538 | 11 months ago |
|
5216a3601d | 11 months ago |
|
1db75a7ed4 | 11 months ago |
|
ecf5569835 | 11 months ago |
|
08b793a1f1 | 11 months ago |
|
f17de77e23 | 11 months ago |
|
aa2dcc7fc6 | 11 months ago |
![]() |
5bcbf9dd5a | 11 months ago |
![]() |
a47a185b3a | 11 months ago |
![]() |
ef2548cd27 | 11 months ago |
![]() |
328f0d4864 | 11 months ago |
![]() |
8685ec3027 | 11 months ago |
![]() |
3bbe7a0f57 | 11 months ago |
![]() |
abe66ef8ba | 11 months ago |
![]() |
724f175851 | 11 months ago |
![]() |
bb4dba013f | 11 months ago |
![]() |
d2dec5a037 | 11 months ago |
![]() |
7879919570 | 11 months ago |
![]() |
fb8435ad3b | 11 months ago |
![]() |
7609d85878 | 11 months ago |
![]() |
6e15b6f715 | 11 months ago |
![]() |
8b590cde38 | 11 months ago |
![]() |
ae41d4523c | 11 months ago |
|
ea98d7a6db | 11 months ago |
![]() |
b103bf2f29 | 11 months ago |
![]() |
acd01c8dcb | 11 months ago |
![]() |
c0ef3ae885 | 11 months ago |
![]() |
9a5f03a9f3 | 11 months ago |
![]() |
217fd92921 | 11 months ago |
![]() |
b576a1b2e1 | 11 months ago |
![]() |
d73674dffc | 11 months ago |
![]() |
022b2829b1 | 11 months ago |
![]() |
3ee7fd857c | 11 months ago |
![]() |
25415646c8 | 11 months ago |
@ -0,0 +1,28 @@ |
||||
# Logs |
||||
logs |
||||
*.log |
||||
npm-debug.log* |
||||
yarn-debug.log* |
||||
yarn-error.log* |
||||
pnpm-debug.log* |
||||
lerna-debug.log* |
||||
|
||||
index.html |
||||
|
||||
node_modules |
||||
dist |
||||
dist-web |
||||
dist-file |
||||
dist-ssr |
||||
*.local |
||||
|
||||
# Editor directories and files |
||||
.vscode/* |
||||
!.vscode/extensions.json |
||||
.idea |
||||
.DS_Store |
||||
*.suo |
||||
*.ntvs* |
||||
*.njsproj |
||||
*.sln |
||||
*.sw? |
@ -0,0 +1,6 @@ |
||||
{ |
||||
"recommendations": [ |
||||
"svelte.svelte-vscode", |
||||
"rust-lang.rust-analyzer" |
||||
] |
||||
} |
@ -0,0 +1,2 @@ |
||||
# NextGraph common Svelte components |
||||
|
@ -0,0 +1,68 @@ |
||||
{ |
||||
"name": "@nextgraph-monorepo/common", |
||||
"private": true, |
||||
"version": "0.1.1-alpha", |
||||
"type": "module", |
||||
"scripts": { |
||||
"dev": "vite", |
||||
"preview": "vite preview", |
||||
"check": "svelte-check --tsconfig ./tsconfig.json" |
||||
}, |
||||
"main": "src/main.ts", |
||||
"exports": { |
||||
".": "./src/main.ts", |
||||
"./store": "./src/store.ts", |
||||
"./api": "./src/api.ts", |
||||
"./routes": "./src/routes/index.ts", |
||||
"./lib": "./src/lib/index.ts", |
||||
"./lang": "./src/lang.ts", |
||||
"./components": "./src/lib/component.ts" |
||||
}, |
||||
"dependencies": { |
||||
"@sindresorhus/is": "4.6.0", |
||||
"@tailwindcss/typography": "^0.5.13", |
||||
"async-proxy": "^0.4.1", |
||||
"char-regex": "1.0.2", |
||||
"classnames": "^2.3.2", |
||||
"debug": "^4.3.6", |
||||
"emojilib": "2.4.0", |
||||
"extend": "3.0.2", |
||||
"flowbite": "^1.6.5", |
||||
"flowbite-svelte": "^0.43.3", |
||||
"html5-qrcode": "^2.3.8", |
||||
"immutable-json-patch": "^6.0.1", |
||||
"lodash.debounce": "4.0.8", |
||||
"skin-tone": "2.0.0", |
||||
"style-mod": "^4.1.2", |
||||
"svelte-i18n": "^4.0.0", |
||||
"svelte-inview": "^4.0.2", |
||||
"svelte-spa-router": "^3.3.0", |
||||
"vite-plugin-top-level-await": "1.3.1", |
||||
"xml-beautifier": "^0.5.0" |
||||
}, |
||||
"devDependencies": { |
||||
"@sveltejs/vite-plugin-svelte": "2.0.0", |
||||
"@swc/core": "~1.6.0", |
||||
"@tsconfig/svelte": "^3.0.0", |
||||
"@types/node": "^18.7.10", |
||||
"autoprefixer": "^10.4.14", |
||||
"dayjs": "^1.11.10", |
||||
"internal-ip": "^7.0.0", |
||||
"postcss": "^8.4.23", |
||||
"postcss-load-config": "^4.0.1", |
||||
"prettier": "^3.3.2", |
||||
"prettier-plugin-svelte": "^3.2.5", |
||||
"shx": "^0.3.4", |
||||
"svelte": "^3.54.0", |
||||
"svelte-check": "^3.0.0", |
||||
"svelte-heros-v2": "^0.10.12", |
||||
"svelte-preprocess": "^5.0.3", |
||||
"svelte-time": "^0.8.0", |
||||
"tailwindcss": "^3.3.1", |
||||
"tslib": "^2.4.1", |
||||
"typescript": "^4.9.5", |
||||
"vite": "4.2.1", |
||||
"vite-plugin-svelte-svg": "2.2.1", |
||||
"vite-plugin-wasm": "3.2.2" |
||||
} |
||||
} |
@ -0,0 +1,310 @@ |
||||
<!-- |
||||
// Copyright (c) 2022-2025 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"> |
||||
import { push, default as Router } from "svelte-spa-router"; |
||||
import { isLoading } from "svelte-i18n"; |
||||
|
||||
import { onMount, tick, onDestroy } from "svelte"; |
||||
import { |
||||
wallets, |
||||
active_wallet, |
||||
opened_wallets, |
||||
close_active_session, |
||||
disconnections_subscribe, |
||||
} from "./store"; |
||||
|
||||
import { select_default_lang } from "./lang"; |
||||
|
||||
import Home from "./routes/Home.svelte"; |
||||
import Test from "./routes/Test.svelte"; |
||||
|
||||
import NURI from "./routes/NURI.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 WalletInfo from "./routes/WalletInfo.svelte"; |
||||
import User from "./routes/User.svelte"; |
||||
import UserRegistered from "./routes/UserRegistered.svelte"; |
||||
import Install from "./routes/Install.svelte"; |
||||
import ScanQR from "./routes/ScanQR.svelte"; |
||||
import Shared from "./routes/Shared.svelte"; |
||||
import Site from "./routes/Site.svelte"; |
||||
|
||||
import ng from "./api"; |
||||
import AccountInfo from "./routes/AccountInfo.svelte"; |
||||
import WalletLoginUsername from "./routes/WalletLoginUsername.svelte"; |
||||
import WalletLoginQr from "./routes/WalletLoginQr.svelte"; |
||||
import WalletLoginTextCode from "./routes/WalletLoginTextCode.svelte"; |
||||
|
||||
const routes = new Map(); |
||||
routes.set("/", Home); |
||||
routes.set("/test", Test); |
||||
routes.set("/wallet/login", WalletLogin); |
||||
routes.set("/wallet/username", WalletLoginUsername); |
||||
routes.set("/wallet/login-qr", WalletLoginQr); |
||||
routes.set("/wallet/login-text-code", WalletLoginTextCode); |
||||
routes.set("/wallet/create", WalletCreate); |
||||
routes.set("/i/:invitation", Invitation); |
||||
routes.set("/user", User); |
||||
routes.set("/user/registered", UserRegistered); |
||||
routes.set("/wallet", WalletInfo); |
||||
routes.set("/user/accounts", AccountInfo); |
||||
routes.set("/wallet/scanqr", ScanQR); |
||||
routes.set("/install", Install); |
||||
routes.set("/shared", Shared); |
||||
routes.set("/site", Site); |
||||
routes.set(/^\/did:ng:(.*)/i, NURI); |
||||
routes.set("*", NotFound); |
||||
|
||||
let unsubscribe = () => {}; |
||||
|
||||
let wallet_channel; |
||||
let unsub_main_close; |
||||
|
||||
// window.refresh_wallets = async () => { |
||||
// let walls = await ng.get_wallets(); |
||||
// wallets.set(walls); |
||||
// }; |
||||
|
||||
onMount(async () => { |
||||
|
||||
//console.log("hide splash", window.supported); |
||||
if (window.supported) { |
||||
window.document.getElementById("splash").className="noshow"; |
||||
window.document.getElementById("app").className=""; |
||||
} |
||||
|
||||
//window.document.getElementById("splash").className="splash-loaded"; |
||||
try { |
||||
await disconnections_subscribe(); |
||||
await select_default_lang(); |
||||
} catch (e) { |
||||
console.warn(e); |
||||
//console.log("called disconnections_subscribe twice"); |
||||
} |
||||
let tauri_platform = import.meta.env.TAURI_PLATFORM; |
||||
//console.log(await ng.test()); |
||||
if (tauri_platform) { |
||||
let walls = await ng.get_wallets(); |
||||
wallets.set(walls); |
||||
|
||||
unsubscribe = active_wallet.subscribe(async (value) => { |
||||
if (value) { |
||||
if (value.wallet) { |
||||
opened_wallets.update((w) => { |
||||
w[value.id] = value.wallet; |
||||
return w; |
||||
}); |
||||
} else { |
||||
await ng.wallet_close(value.id); |
||||
active_wallet.set(undefined); |
||||
opened_wallets.update((w) => { |
||||
delete w[value.id]; |
||||
return w; |
||||
}); |
||||
push("#/wallet/login"); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
let window_api = await import("@tauri-apps/plugin-window"); |
||||
let event_api = await import("@tauri-apps/api/event"); |
||||
let main = window_api.Window.getByLabel("main"); |
||||
unsub_main_close = await main.onCloseRequested(async (event) => { |
||||
//console.log("onCloseRequested main"); |
||||
await event_api.emit("close_all", {}); |
||||
let registration = window_api.Window.getByLabel("registration"); |
||||
if (registration) { |
||||
await registration.close(); |
||||
} |
||||
let viewer = window_api.Window.getByLabel("viewer"); |
||||
if (viewer) { |
||||
await viewer.close(); |
||||
} |
||||
}); |
||||
} else { |
||||
// ON WEB CLIENTS |
||||
window.addEventListener("storage", async (event) => { |
||||
//console.log("localStorage event", event); |
||||
if (event.storageArea != localStorage) return; |
||||
if (event.key === "ng_wallets") { |
||||
//console.log("localStorage", JSON.stringify($wallets)); |
||||
await ng.wallets_reload(); |
||||
wallets.set(await ng.get_wallets()); |
||||
//console.log("localStorage after", JSON.stringify($wallets)); |
||||
} |
||||
}); |
||||
wallets.set(await ng.get_wallets()); |
||||
// TODO: check the possibility of XS-Leaks. I don't see any, but it should be checked |
||||
// https://github.com/privacycg/storage-partitioning |
||||
// https://github.com/whatwg/html/issues/5803 |
||||
// https://w3cping.github.io/privacy-threat-model/ |
||||
// https://chromium.googlesource.com/chromium/src/+/fa17a6142f99d58de533d65cd8f3cd0e9a8ee58e |
||||
// https://bugs.webkit.org/show_bug.cgi?id=229814 |
||||
wallet_channel = new BroadcastChannel("ng_wallet"); |
||||
window.wallet_channel = wallet_channel; |
||||
wallet_channel.postMessage({ cmd: "startup" }, location.href); |
||||
wallet_channel.onmessage = async (event) => { |
||||
// console.log(event.data.cmd, event.data); |
||||
if (!location.href.startsWith(event.origin)) return; |
||||
switch (event.data.cmd) { |
||||
case "startup": |
||||
for (let saved_id of Object.keys($wallets)) { |
||||
if ($wallets[saved_id].in_memory) { |
||||
wallet_channel.postMessage( |
||||
{ |
||||
cmd: "new_in_mem", |
||||
name: saved_id, |
||||
lws: $wallets[saved_id], |
||||
}, |
||||
location.href |
||||
); |
||||
} |
||||
} |
||||
// if ($active_wallet && $active_wallet.wallet) { |
||||
// wallet_channel.postMessage( |
||||
// { cmd: "opened", wallet: $active_wallet }, |
||||
// location.href |
||||
// ); |
||||
// } |
||||
for (let opened of Object.keys($opened_wallets)) { |
||||
wallet_channel.postMessage( |
||||
{ |
||||
cmd: "opened", |
||||
wallet: { wallet: $opened_wallets[opened], id: opened }, |
||||
}, |
||||
location.href |
||||
); |
||||
} |
||||
|
||||
break; |
||||
case "opened": |
||||
if (!$opened_wallets[event.data.wallet.id]) { |
||||
//await tick(); |
||||
// console.log( |
||||
// "ADDING TO OPENED", |
||||
// event.data.wallet.id, |
||||
// JSON.stringify($opened_wallets), |
||||
// event.data.wallet.wallet |
||||
// ); |
||||
if (event.data.ng_wallets) { |
||||
localStorage.setItem("ng_wallets", event.data.ng_wallets); |
||||
await ng.wallets_reload(); |
||||
wallets.set(await ng.get_wallets()); |
||||
} |
||||
try { |
||||
await ng.wallet_was_opened(event.data.wallet.wallet); |
||||
} catch (e) { |
||||
console.error(e); |
||||
} |
||||
opened_wallets.update((w) => { |
||||
w[event.data.wallet.id] = event.data.wallet.wallet; |
||||
return w; |
||||
}); |
||||
} |
||||
break; |
||||
case "new_in_mem": |
||||
//console.log("GOT new_in_mem", event.data); |
||||
if (event.data.lws) { |
||||
if (!$wallets[event.data.name]) { |
||||
await ng.add_in_memory_wallet(event.data.lws); |
||||
wallets.update((w) => { |
||||
w[event.data.name] = event.data.lws; |
||||
return w; |
||||
}); |
||||
} |
||||
} |
||||
if (event.data.opened) { |
||||
if (!$opened_wallets[event.data.name]) { |
||||
await ng.wallet_was_opened(event.data.opened); |
||||
opened_wallets.update((w) => { |
||||
w[event.data.name] = event.data.opened; |
||||
return w; |
||||
}); |
||||
} |
||||
} |
||||
break; |
||||
case "closed": |
||||
opened_wallets.update((w) => { |
||||
delete w[event.data.walletid]; |
||||
return w; |
||||
}); |
||||
await ng.wallet_close(event.data.walletid); |
||||
if ($active_wallet && $active_wallet.id == event.data.walletid) { |
||||
await close_active_session(); |
||||
active_wallet.set(undefined); |
||||
push("#/wallet/login"); |
||||
} |
||||
break; |
||||
} |
||||
}; |
||||
unsubscribe = active_wallet.subscribe(async (value) => { |
||||
if (value) { |
||||
if (value.wallet) { |
||||
opened_wallets.update((w) => { |
||||
w[value.id] = value.wallet; |
||||
return w; |
||||
}); |
||||
//await tick(); |
||||
//console.log("posting opened"); |
||||
wallet_channel.postMessage( |
||||
{ |
||||
cmd: "opened", |
||||
wallet: value, |
||||
ng_wallets: localStorage.getItem("ng_wallets"), |
||||
}, |
||||
location.href |
||||
); |
||||
} else { |
||||
wallet_channel.postMessage( |
||||
{ cmd: "closed", walletid: value.id }, |
||||
location.href |
||||
); |
||||
active_wallet.set(undefined); |
||||
await ng.wallet_close(value.id); |
||||
//active_session.set(undefined); |
||||
opened_wallets.update((w) => { |
||||
delete w[value.id]; |
||||
return w; |
||||
}); |
||||
push("#/wallet/login"); |
||||
} |
||||
} else { |
||||
} |
||||
}); |
||||
} |
||||
|
||||
}); |
||||
|
||||
onDestroy(() => { |
||||
unsubscribe(); |
||||
if (unsub_main_close) unsub_main_close(); |
||||
}); |
||||
|
||||
// import { to_debug } from "./wallet_emojis"; |
||||
// to_debug(); |
||||
</script> |
||||
|
||||
<!-- <p> |
||||
{!$active_session} |
||||
{JSON.stringify(Object.keys($wallets))} |
||||
{JSON.stringify($active_wallet)} |
||||
{JSON.stringify(Object.keys($opened_wallets))} |
||||
{JSON.stringify($active_session)} |
||||
</p> --> |
||||
|
||||
{#if $isLoading} |
||||
<p class="text-center">Loading translations...</p> |
||||
{:else} |
||||
<Router {routes} /> |
||||
{/if} |
@ -0,0 +1,44 @@ |
||||
// Copyright (c) 2022-2025 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.
|
||||
import {createAsyncProxy} from "async-proxy"; |
||||
|
||||
let proxy = null; |
||||
|
||||
let api = createAsyncProxy({},{ |
||||
async apply(target, path, caller, args) { |
||||
if (proxy) { |
||||
//console.log("calling ",path, args);
|
||||
return Reflect.apply(proxy[path], caller, args) |
||||
} |
||||
else |
||||
throw new Error("You must call init_api() before using the API. load an API from @nextgraph-monorepo/app_api_tauri or @nextgraph-monorepo/app_api_web"); |
||||
} |
||||
}); |
||||
|
||||
export default api; |
||||
|
||||
export const NG_EU_BSP = "https://nextgraph.eu"; |
||||
export const NG_EU_BSP_REGISTER = import.meta.env.PROD |
||||
? "https://account.nextgraph.eu/#/create" |
||||
: "http://account-dev.nextgraph.eu:5173/#/create"; |
||||
|
||||
export const NG_NET_BSP = "https://nextgraph.net"; |
||||
export const NG_NET_BSP_REGISTER = import.meta.env.PROD |
||||
? "https://account.nextgraph.net/#/create" |
||||
: "http://account-dev.nextgraph.net:5173/#/create"; |
||||
|
||||
export const APP_ACCOUNT_REGISTERED_SUFFIX = "/#/user/registered"; |
||||
export const APP_WALLET_CREATE_SUFFIX = "/#/wallet/create"; |
||||
|
||||
export const LINK_NG_BOX = "https://nextgraph.org/ng-box/"; |
||||
export const LINK_SELF_HOST = "https://nextgraph.org/self-host/"; |
||||
|
||||
export const init_api = function (a) { |
||||
proxy = a; |
||||
} |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 786 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.6 KiB |