mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
relay
This commit is contained in:
parent
b0879f004f
commit
6564800aa2
@ -1,7 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<ul id='list'></ul>
|
||||
<form id='form'>
|
||||
<input id='input' placeholder='say'>
|
||||
<input id='who' placeholder='name'>
|
||||
<input id='what' placeholder='say'>
|
||||
<input type='submit' value='send'>
|
||||
</form>
|
||||
<script src="../../../gun/gun.js"></script>
|
||||
@ -9,14 +10,12 @@
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/emojione@4.0.0/extras/css/emojione.min.css"/>
|
||||
<script>
|
||||
gun = Gun(location.origin + '/gun'), chat = gun.get("chat/" + location.hash.slice(1));
|
||||
form.onsubmit = (eve) => { eve.preventDefault(), chat.set(input.value), input.value = "" }
|
||||
chat.map().once((msg) => { render(msg) });
|
||||
form.onsubmit = (eve) => { chat.set(who.value+': '+what.value), eve.preventDefault(what.value = "") }
|
||||
chat.map().once((data) => { render(data) });
|
||||
function render(msg, li, beep){ // render emoji, scroll to bottom, and notify sound!
|
||||
(li = document.createElement("li")).innerText = emojione.shortnameToUnicode(msg);
|
||||
list.appendChild(li);
|
||||
window.scroll(0, list.offsetHeight);
|
||||
list.appendChild(li), window.scroll(0, list.offsetHeight);
|
||||
(beep = new SpeechSynthesisUtterance()).text = "new";
|
||||
beep.rate = 10; beep.pitch = 2;
|
||||
window.speechSynthesis.speak(beep);
|
||||
beep.rate = 10, beep.pitch = 2, window.speechSynthesis.speak(beep);
|
||||
}
|
||||
</script>
|
@ -16,7 +16,7 @@
|
||||
config.server = require('http').createServer(Gun.serve(__dirname));
|
||||
}
|
||||
|
||||
var gun = Gun({web: config.server.listen(config.port), rad: false, radisk: false, localStorage: false}); // TODO: ONLY TEMPORARILY!!! UNDO TO GET RAD ONCE TESTED!!!!
|
||||
var gun = Gun({web: config.server.listen(config.port), localStorage: false});
|
||||
console.log('Relay peer started on port ' + config.port + ' with /gun');
|
||||
|
||||
module.exports = gun;
|
||||
|
@ -11,11 +11,11 @@
|
||||
this.to.next(root);
|
||||
})
|
||||
//require('../nts');
|
||||
//require('./store');
|
||||
//require('./rfs');
|
||||
//require('./rs3');
|
||||
require('./store');
|
||||
require('./rfs');
|
||||
require('./rs3');
|
||||
require('./wire');
|
||||
//try{require('../sea');}catch(e){}
|
||||
try{require('../sea');}catch(e){}
|
||||
try{require('../axe');}catch(e){}
|
||||
//require('./file');
|
||||
//require('./evict');
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gun",
|
||||
"version": "0.2020.520",
|
||||
"version": "0.2020.1233",
|
||||
"description": "A realtime, decentralized, offline-first, graph data synchronization engine.",
|
||||
"types": "index.d.ts",
|
||||
"main": "index.js",
|
||||
|
@ -16,16 +16,16 @@
|
||||
<script>mocha.setup({ui:'bdd',globals:[]});</script>
|
||||
<script src="./expect.js"></script>
|
||||
<script></script>
|
||||
<script src="../lib/yson.js"></script>
|
||||
<script src="../gun.js"></script>
|
||||
<script src="../sea.js"></script>
|
||||
|
||||
<!-- script src="../lib/radix.js"></script>
|
||||
<script src="../lib/radix.js"></script>
|
||||
<script src="../lib/radisk.js"></script>
|
||||
<script src="../lib/store.js"></script>
|
||||
<script src="../lib/rindexed.js"></script -->
|
||||
<script src="../lib/yson.js"></script>
|
||||
<script src="../lib/rindexed.js"></script>
|
||||
|
||||
<!-- script src="./rad/rad.js"></script -->
|
||||
<script src="./rad/rad.js"></script>
|
||||
<script src="./sea/sea.js"></script>
|
||||
|
||||
<script src="./common.js"></script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user