From bcccae1c465e099e22e0906ed74db2370b4948b1 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Wed, 28 Oct 2020 18:20:06 +0000 Subject: [PATCH] added basic board name system --- index.html | 11 ++++++++++- js/hush-hush.js | 8 ++++++-- js/topic-handler.js | 6 ++++++ 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 js/topic-handler.js diff --git a/index.html b/index.html index eb190de..ad35a21 100644 --- a/index.html +++ b/index.html @@ -21,6 +21,7 @@ +
@@ -43,7 +44,7 @@

⚠️ the host of this web page has no control over posts. Browse and post at your own risk.


-
Last reached network: never
+
Last reached Onionr: never
+
+
+
+ + +
+
+
diff --git a/js/hush-hush.js b/js/hush-hush.js index e6cdad6..a48b4d5 100644 --- a/js/hush-hush.js +++ b/js/hush-hush.js @@ -18,7 +18,8 @@ var findMessageIntervalTime = 5000 var publicNodes = [ "ueawiiskhaxdhkqjvgz6drrlf7srvaifrewnb6rxf6tro3welajvlgyd", - "csb2thc5yzv2gbhoozbqrzv747irs5z2lbpd7eiyh6eivvltok76qrqd" + "csb2thc5yzv2gbhoozbqrzv747irs5z2lbpd7eiyh6eivvltok76qrqd", + "r57vs5ehxfm3inmdmxx33dbgdy4ev3wg36lynf4uma27jgikxjsx3yid.onion" ] var initialNodes = JSON.parse(JSON.stringify(publicNodes)) publicNodes = [] @@ -27,9 +28,12 @@ var blocks = [] var basicTextEncoder = new TextEncoder() var difficulty = "00000" var maxBlockAge = 2678400 -var postTopic = 'kic' // we use block types as the topic with 'kic' as the prefix +var postTopic = document.getElementById('boardID').value // we use block types as the topic with 'kic' as the prefix var lastLookup = Math.floor((Date.now() / 1000)) - maxBlockAge +if (document.location.protocol === "file:"){ + alert("Sorry, this does not support file: access. Use a localhost HTTP server or Electron.\n\n$ python3 -m http.server --bind 127.0.0.1 8080") +} function shuffleArray(array) { if (document.hidden){return} diff --git a/js/topic-handler.js b/js/topic-handler.js new file mode 100644 index 0000000..ae014df --- /dev/null +++ b/js/topic-handler.js @@ -0,0 +1,6 @@ +document.getElementById('boardID').onchange = function(e){ + postTopic = e.target.value.toLowerCase() + messageHashes = [] + blocks = [] + document.getElementsByClassName("messageFeed")[0].innerText = "" +} \ No newline at end of file