added basic board name system

This commit is contained in:
Kevin Froman 2020-10-28 18:20:06 +00:00
parent b7dc10a148
commit bcccae1c46
3 changed files with 22 additions and 3 deletions

View File

@ -21,6 +21,7 @@
<script src="js/hush-hush.js" defer></script>
<script src="js/worker-handler.js" defer></script>
<script src="js/message-creator.js" defer></script>
<script src="js/topic-handler.js" defer></script>
</head>
<body>
<section class="section">
@ -43,7 +44,7 @@
<p>⚠️ the host of this web page has no control over posts. Browse and post at your own risk.</p>
<br>
<div class="columns">
<div id="lastReached" class="column has-text-warning is-one-fifth">Last reached network: never</div>
<div id="lastReached" class="column has-text-warning is-one-fifth">Last reached Onionr: never</div>
<div class="column">
<label class="checkbox">
<input type="checkbox" id="use-markdown" checked>
@ -57,6 +58,14 @@
</section>
<section class="section">
<div class="container messageCreator">
<div class="columns">
<div class="column">
<div class="control">
<label for="boardID">Board name: </label>
<input type="text" value="global" name="boardID" id="boardID">
</div>
</div>
</div>
<div class="columns">
<div class="column is-two-fifths">
<div class="postForm">

View File

@ -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}

6
js/topic-handler.js Normal file
View File

@ -0,0 +1,6 @@
document.getElementById('boardID').onchange = function(e){
postTopic = e.target.value.toLowerCase()
messageHashes = []
blocks = []
document.getElementsByClassName("messageFeed")[0].innerText = ""
}