mirror of
https://github.com/logos-messaging/examples.waku.org.git
synced 2026-01-09 00:03:11 +00:00
Updates
This commit is contained in:
parent
87d47cd857
commit
263967a926
@ -1,7 +1,7 @@
|
||||
{
|
||||
"files": {
|
||||
"main.css": "/eth-pm/static/css/main.0350996a.css",
|
||||
"main.js": "/eth-pm/static/js/main.15205ba0.js",
|
||||
"main.js": "/eth-pm/static/js/main.9b0a27d3.js",
|
||||
"static/media/roboto-all-400-normal.woff": "/eth-pm/static/media/roboto-all-400-normal.b5a0a0df312d3423493b.woff",
|
||||
"static/media/rpc.cjs": "/eth-pm/static/media/rpc.93e8f6196bd2c425bf03.cjs",
|
||||
"static/media/roboto-latin-400-normal.woff2": "/eth-pm/static/media/roboto-latin-400-normal.176f8f5bd5f02b3abfcf.woff2",
|
||||
@ -13,10 +13,10 @@
|
||||
"static/media/roboto-greek-ext-400-normal.woff2": "/eth-pm/static/media/roboto-greek-ext-400-normal.bc7ace6e50c7d9d4d959.woff2",
|
||||
"index.html": "/eth-pm/index.html",
|
||||
"main.0350996a.css.map": "/eth-pm/static/css/main.0350996a.css.map",
|
||||
"main.15205ba0.js.map": "/eth-pm/static/js/main.15205ba0.js.map"
|
||||
"main.9b0a27d3.js.map": "/eth-pm/static/js/main.9b0a27d3.js.map"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/css/main.0350996a.css",
|
||||
"static/js/main.15205ba0.js"
|
||||
"static/js/main.9b0a27d3.js"
|
||||
]
|
||||
}
|
||||
@ -1 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/eth-pm/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/eth-pm/logo192.png"/><link rel="manifest" href="/eth-pm/manifest.json"/><title>React App</title><script defer="defer" src="/eth-pm/static/js/main.15205ba0.js"></script><link href="/eth-pm/static/css/main.0350996a.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/eth-pm/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/eth-pm/logo192.png"/><link rel="manifest" href="/eth-pm/manifest.json"/><title>React App</title><script defer="defer" src="/eth-pm/static/js/main.9b0a27d3.js"></script><link href="/eth-pm/static/css/main.0350996a.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
126
light-js/index.html
Normal file
126
light-js/index.html
Normal file
@ -0,0 +1,126 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang='en'>
|
||||
|
||||
<head>
|
||||
<meta charset='UTF-8'/>
|
||||
<meta content='width=device-width, initial-scale=1.0' name='viewport'/>
|
||||
<title>JS-Waku light node example</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div><h2>Status</h2></div>
|
||||
<div id='status'></div>
|
||||
|
||||
<div><h2>Local Peer Id</h2></div>
|
||||
<div id='peer-id'></div>
|
||||
|
||||
<div><h2>Remote Peer Id</h2></div>
|
||||
<div id='remote-peer-id'></div>
|
||||
|
||||
<input id='remote-multiaddr'
|
||||
type='text'
|
||||
value="/dns4/node-01.ac-cn-hongkong-c.wakuv2.test.statusim.net/tcp/443/wss/p2p/16Uiu2HAkvWiyFsgRhuJEb9JfjYxEkoHLgnUQmr1N5mKWnYjxYRVm">
|
||||
<button id='dial' type='button'>Dial</button>
|
||||
<br/>
|
||||
<button id='subscribe' type='button'>Subscribe</button>
|
||||
<button id='unsubscribe' type='button'>Unsubscribe</button>
|
||||
<br/>
|
||||
<input id='textInput' placeholder='Type your message here' type='text'>
|
||||
<button id='sendButton' type='button'>Send Message</button>
|
||||
<br/>
|
||||
<div id="messages"></div>
|
||||
|
||||
<script type='module'>
|
||||
import {
|
||||
utils,
|
||||
WakuMessage
|
||||
} from 'https://unpkg.com/js-waku@next/bundle/index.js';
|
||||
import {
|
||||
createLightNode
|
||||
} from 'https://unpkg.com/js-waku@next/bundle/lib/create_waku.js'
|
||||
import {
|
||||
waitForRemotePeer
|
||||
} from 'https://unpkg.com/js-waku@next/bundle/lib/wait_for_remote_peer.js'
|
||||
|
||||
const peerIdDiv = document.getElementById('peer-id');
|
||||
const remotePeerIdDiv = document.getElementById('remote-peer-id');
|
||||
const statusDiv = document.getElementById('status');
|
||||
const remoteMultiAddrDiv = document.getElementById('remote-multiaddr');
|
||||
const dialButton = document.getElementById('dial')
|
||||
const subscribeButton = document.getElementById('subscribe')
|
||||
const unsubscribeButton = document.getElementById('unsubscribe')
|
||||
const messagesDiv = document.getElementById('messages')
|
||||
const textInput = document.getElementById('textInput');
|
||||
const sendButton = document.getElementById('sendButton');
|
||||
|
||||
const ContentTopic = "/light-js/0/message/utf8";
|
||||
let messages = []
|
||||
let unsubscribe;
|
||||
|
||||
subscribeButton.disabled = true
|
||||
textInput.disabled = true;
|
||||
sendButton.disabled = true;
|
||||
unsubscribeButton.disabled = true;
|
||||
|
||||
const updateMessages = (msgs, div) => {
|
||||
div.innerHTML = "<ul>"
|
||||
messages.forEach(msg => div.innerHTML += "<li>" + msg + "</li>")
|
||||
div.innerHTML += "</ul>"
|
||||
}
|
||||
|
||||
statusDiv.innerHTML = '<p>Creating Waku node.</p>';
|
||||
const node = await createLightNode();
|
||||
|
||||
statusDiv.innerHTML = '<p>Starting Waku node.</p>';
|
||||
await node.start();
|
||||
statusDiv.innerHTML = '<p>Waku node started.</p>';
|
||||
peerIdDiv.innerHTML = '<p>' + node.libp2p.peerId.toString() + '</p>'
|
||||
|
||||
dialButton.onclick = async () => {
|
||||
const ma = remoteMultiAddrDiv.value
|
||||
if (!ma) {
|
||||
statusDiv.innerHTML = '<p>Error: No multiaddr provided.</p>';
|
||||
return;
|
||||
}
|
||||
statusDiv.innerHTML = '<p>Dialing peer.</p>';
|
||||
await node.dial(ma, ["filter", "lightpush"])
|
||||
await waitForRemotePeer(node, ["filter", "lightpush"]);
|
||||
const peers = await node.libp2p.peerStore.all();
|
||||
statusDiv.innerHTML = '<p>Peer dialed.</p>';
|
||||
remotePeerIdDiv.innerHTML = '<p>' + peers[0].id.toString() + '</p>'
|
||||
textInput.disabled = false;
|
||||
sendButton.disabled = false;
|
||||
subscribeButton.disabled = false;
|
||||
}
|
||||
|
||||
const callback = (wakuMessage) => {
|
||||
const text = utils.bytesToUtf8(wakuMessage.payload)
|
||||
const timestamp = wakuMessage.timestamp.toString()
|
||||
messages.push(text + " - " + timestamp)
|
||||
updateMessages(messages, messagesDiv)
|
||||
}
|
||||
|
||||
subscribeButton.onclick = async () => {
|
||||
unsubscribe = await node.filter.subscribe(callback, [ContentTopic])
|
||||
unsubscribeButton.disabled = false;
|
||||
}
|
||||
|
||||
unsubscribeButton.onclick = async () => {
|
||||
await unsubscribe();
|
||||
unsubscribe = undefined
|
||||
unsubscribeButton.disabled = true;
|
||||
}
|
||||
|
||||
sendButton.onclick = async () => {
|
||||
const text = textInput.value;
|
||||
|
||||
const wakuMessage = await WakuMessage.fromUtf8String(text, ContentTopic);
|
||||
await node.lightPush.push(wakuMessage);
|
||||
console.log('Message sent!');
|
||||
textInput.value = null;
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -7,6 +7,6 @@
|
||||
<link rel="stylesheet" href="styles.ef46db3751d8e999.css"></head>
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
<script src="runtime.85abfe8aa64fdd33.js" type="module"></script><script src="main.12089dc23166e9e6.js" type="module"></script>
|
||||
<script src="runtime.85abfe8aa64fdd33.js" type="module"></script><script src="main.a547a30903e5d413.js" type="module"></script>
|
||||
|
||||
</body></html>
|
||||
File diff suppressed because one or more lines are too long
1
relay-angular-chat/main.a547a30903e5d413.js
Normal file
1
relay-angular-chat/main.a547a30903e5d413.js
Normal file
File diff suppressed because one or more lines are too long
@ -28,13 +28,13 @@
|
||||
|
||||
import {
|
||||
WakuMessage
|
||||
} from 'https://unpkg.com/js-waku@next/bundle/index.js';
|
||||
} from 'https://unpkg.com/js-waku@0.26.0/bundle/index.js';
|
||||
import {
|
||||
createWaku
|
||||
} from 'https://unpkg.com/js-waku@next/bundle/lib/create_waku.js'
|
||||
} from 'https://unpkg.com/js-waku@0.26.0/bundle/lib/create_waku.js'
|
||||
import {
|
||||
waitForRemotePeer
|
||||
} from 'https://unpkg.com/js-waku@next/bundle/lib/wait_for_remote_peer.js'
|
||||
} from 'https://unpkg.com/js-waku@0.26.0/bundle/lib/wait_for_remote_peer.js'
|
||||
|
||||
const statusDiv = document.getElementById('status');
|
||||
const messagesDiv = document.getElementById('messages');
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
{
|
||||
"files": {
|
||||
"main.css": "/relay-reactjs-chat/static/css/main.e6c13ad2.css",
|
||||
"main.js": "/relay-reactjs-chat/static/js/main.d422f314.js",
|
||||
"main.js": "/relay-reactjs-chat/static/js/main.9f10525c.js",
|
||||
"index.html": "/relay-reactjs-chat/index.html",
|
||||
"main.e6c13ad2.css.map": "/relay-reactjs-chat/static/css/main.e6c13ad2.css.map",
|
||||
"main.d422f314.js.map": "/relay-reactjs-chat/static/js/main.d422f314.js.map"
|
||||
"main.9f10525c.js.map": "/relay-reactjs-chat/static/js/main.9f10525c.js.map"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/css/main.e6c13ad2.css",
|
||||
"static/js/main.d422f314.js"
|
||||
"static/js/main.9f10525c.js"
|
||||
]
|
||||
}
|
||||
@ -1 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/relay-reactjs-chat/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/relay-reactjs-chat/logo192.png"/><link rel="manifest" href="/relay-reactjs-chat/manifest.json"/><title>React App</title><script defer="defer" src="/relay-reactjs-chat/static/js/main.d422f314.js"></script><link href="/relay-reactjs-chat/static/css/main.e6c13ad2.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/relay-reactjs-chat/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/relay-reactjs-chat/logo192.png"/><link rel="manifest" href="/relay-reactjs-chat/manifest.json"/><title>React App</title><script defer="defer" src="/relay-reactjs-chat/static/js/main.9f10525c.js"></script><link href="/relay-reactjs-chat/static/css/main.e6c13ad2.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
||||
3
relay-reactjs-chat/static/js/main.9f10525c.js
Normal file
3
relay-reactjs-chat/static/js/main.9f10525c.js
Normal file
File diff suppressed because one or more lines are too long
1
relay-reactjs-chat/static/js/main.9f10525c.js.map
Normal file
1
relay-reactjs-chat/static/js/main.9f10525c.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -15,13 +15,13 @@
|
||||
<script type='module'>
|
||||
import {
|
||||
Protocols
|
||||
} from 'https://unpkg.com/js-waku@next/bundle/index.js';
|
||||
} from 'https://unpkg.com/js-waku@0.26.0/bundle/index.js';
|
||||
import {
|
||||
createWaku
|
||||
} from 'https://unpkg.com/js-waku@next/bundle/lib/create_waku.js'
|
||||
} from 'https://unpkg.com/js-waku@0.26.0/bundle/lib/create_waku.js'
|
||||
import {
|
||||
waitForRemotePeer
|
||||
} from 'https://unpkg.com/js-waku@next/bundle/lib/wait_for_remote_peer.js'
|
||||
} from 'https://unpkg.com/js-waku@0.26.0/bundle/lib/wait_for_remote_peer.js'
|
||||
|
||||
/**
|
||||
* This example demonstrates how to use the js-waku minified bundle
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
{
|
||||
"files": {
|
||||
"main.css": "/store-reactjs-chat/static/css/main.e6c13ad2.css",
|
||||
"main.js": "/store-reactjs-chat/static/js/main.dce8435a.js",
|
||||
"main.js": "/store-reactjs-chat/static/js/main.4fcd715b.js",
|
||||
"static/media/rpc.cjs": "/store-reactjs-chat/static/media/rpc.93e8f6196bd2c425bf03.cjs",
|
||||
"index.html": "/store-reactjs-chat/index.html",
|
||||
"main.e6c13ad2.css.map": "/store-reactjs-chat/static/css/main.e6c13ad2.css.map",
|
||||
"main.dce8435a.js.map": "/store-reactjs-chat/static/js/main.dce8435a.js.map"
|
||||
"main.4fcd715b.js.map": "/store-reactjs-chat/static/js/main.4fcd715b.js.map"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/css/main.e6c13ad2.css",
|
||||
"static/js/main.dce8435a.js"
|
||||
"static/js/main.4fcd715b.js"
|
||||
]
|
||||
}
|
||||
@ -1 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/store-reactjs-chat/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/store-reactjs-chat/logo192.png"/><link rel="manifest" href="/store-reactjs-chat/manifest.json"/><title>React App</title><script defer="defer" src="/store-reactjs-chat/static/js/main.dce8435a.js"></script><link href="/store-reactjs-chat/static/css/main.e6c13ad2.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/store-reactjs-chat/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/store-reactjs-chat/logo192.png"/><link rel="manifest" href="/store-reactjs-chat/manifest.json"/><title>React App</title><script defer="defer" src="/store-reactjs-chat/static/js/main.4fcd715b.js"></script><link href="/store-reactjs-chat/static/css/main.e6c13ad2.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
||||
3
store-reactjs-chat/static/js/main.4fcd715b.js
Normal file
3
store-reactjs-chat/static/js/main.4fcd715b.js
Normal file
File diff suppressed because one or more lines are too long
1
store-reactjs-chat/static/js/main.4fcd715b.js.map
Normal file
1
store-reactjs-chat/static/js/main.4fcd715b.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,14 +1,14 @@
|
||||
{
|
||||
"files": {
|
||||
"main.css": "/web-chat/static/css/main.b267dcda.css",
|
||||
"main.js": "/web-chat/static/js/main.1d6d6520.js",
|
||||
"main.js": "/web-chat/static/js/main.e866a149.js",
|
||||
"static/media/rpc.cjs": "/web-chat/static/media/rpc.93e8f6196bd2c425bf03.cjs",
|
||||
"index.html": "/web-chat/index.html",
|
||||
"main.b267dcda.css.map": "/web-chat/static/css/main.b267dcda.css.map",
|
||||
"main.1d6d6520.js.map": "/web-chat/static/js/main.1d6d6520.js.map"
|
||||
"main.e866a149.js.map": "/web-chat/static/js/main.e866a149.js.map"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/css/main.b267dcda.css",
|
||||
"static/js/main.1d6d6520.js"
|
||||
"static/js/main.e866a149.js"
|
||||
]
|
||||
}
|
||||
@ -1 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"/><meta name="description" content="Chat app powered by js-waku"/><link rel="manifest" href="/web-chat/manifest.json"/><title>Waku v2 chat app</title><script defer="defer" src="/web-chat/static/js/main.1d6d6520.js"></script><link href="/web-chat/static/css/main.b267dcda.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"/><meta name="description" content="Chat app powered by js-waku"/><link rel="manifest" href="/web-chat/manifest.json"/><title>Waku v2 chat app</title><script defer="defer" src="/web-chat/static/js/main.e866a149.js"></script><link href="/web-chat/static/css/main.b267dcda.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
3
web-chat/static/js/main.e866a149.js
Normal file
3
web-chat/static/js/main.e866a149.js
Normal file
File diff suppressed because one or more lines are too long
1
web-chat/static/js/main.e866a149.js.map
Normal file
1
web-chat/static/js/main.e866a149.js.map
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user