boards now show human readable public key authors
This commit is contained in:
parent
818a716cbf
commit
311dda91d6
@ -65,7 +65,7 @@ function appendMessages(msg, blockHash, beforeHash){
|
||||
}
|
||||
else{
|
||||
humanDate.setUTCSeconds(msgDate)
|
||||
msgDate = humanDate.toDateString()
|
||||
msgDate = humanDate.toLocaleTimeString() + ' ' + humanDate.toLocaleDateString()
|
||||
}
|
||||
el.className = 'entry'
|
||||
el.innerText = msg['content']
|
||||
@ -92,8 +92,9 @@ function appendMessages(msg, blockHash, beforeHash){
|
||||
|
||||
div[0].setAttribute('data-bl', blockHash)
|
||||
div[2].textContent = msg['content']
|
||||
if (typeof msg['meta']['signer'] != 'undefined'){
|
||||
if (typeof msg['meta']['signer'] != 'undefined' && msg['meta']['signer'].length > 0){
|
||||
div[3].textContent = msg['meta']['signer'].substr(0, 5)
|
||||
setHumanReadableIDOnPost(div[3], msg['meta']['signer'])
|
||||
div[3].title = msg['meta']['signer']
|
||||
}
|
||||
div[4].textContent = msgDate
|
||||
|
@ -18,6 +18,7 @@
|
||||
<script defer src='/shared/node_modules/pnotify/dist/iife/PNotifyButtons.js'></script>
|
||||
<script defer src='/shared/navbar.js'></script>
|
||||
<script defer src='/shared/misc.js'></script>
|
||||
<script defer src='sethumanreadable.js'></script>
|
||||
<script defer src='board.js'></script>
|
||||
<script defer src='autorefresh.js'></script>
|
||||
</head>
|
||||
|
39
onionr/static-data/www/board/sethumanreadable.js
Normal file
39
onionr/static-data/www/board/sethumanreadable.js
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
Onionr - Private P2P Communication
|
||||
|
||||
Set human readable public keys onto post author elements
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
humanReadableKeys = {}
|
||||
|
||||
function setHumanReadableIDOnPost(el, key){
|
||||
if (typeof humanReadableKeys[key] == "undefined"){
|
||||
fetch('/getHumanReadable/' + key, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"token": webpass
|
||||
}})
|
||||
.then((resp) => resp.text()) // Transform the data into json
|
||||
.then(function(data) {
|
||||
if (data.includes('HTML')){
|
||||
return
|
||||
}
|
||||
humanReadableKeys[key] = data
|
||||
setHumanReadableIDOnPost(el, key)
|
||||
})
|
||||
return
|
||||
}
|
||||
el.innerText = humanReadableKeys[key].split(' ').slice(0, 3).join(' ')
|
||||
}
|
@ -2,4 +2,5 @@
|
||||
.cMsg{
|
||||
word-wrap:break-word;
|
||||
word-break:break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
@ -21,7 +21,7 @@ webpass = document.location.hash.replace('#', '')
|
||||
nowebpass = false
|
||||
myPub = ""
|
||||
|
||||
fetch('/getActivePubkey', {
|
||||
fetch('/getHumanReadable', {
|
||||
headers: {
|
||||
"token": webpass
|
||||
}})
|
||||
|
Loading…
Reference in New Issue
Block a user