aboutsummaryrefslogtreecommitdiff
path: root/src/js/arching-kaos-tools.js
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-12-22 04:49:34 +0200
committerkaotisk <kaotisk@arching-kaos.org>2024-12-22 04:49:34 +0200
commita84f6765711e92c668ecb3becd2b1ee12b36abe7 (patch)
tree6c2aa0935f01f5f8eab6e3bcfb7e3c8aba049eee /src/js/arching-kaos-tools.js
parent91e2aeb7c65bd2cd49982bd7161ecfedd707c0d6 (diff)
downloadarching-kaos-web-ui-a84f6765711e92c668ecb3becd2b1ee12b36abe7.tar.gz
arching-kaos-web-ui-a84f6765711e92c668ecb3becd2b1ee12b36abe7.tar.bz2
arching-kaos-web-ui-a84f6765711e92c668ecb3becd2b1ee12b36abe7.zip
Peering look up
Diffstat (limited to 'src/js/arching-kaos-tools.js')
-rw-r--r--src/js/arching-kaos-tools.js52
1 files changed, 41 insertions, 11 deletions
diff --git a/src/js/arching-kaos-tools.js b/src/js/arching-kaos-tools.js
index 310ca62..e0d9eb4 100644
--- a/src/js/arching-kaos-tools.js
+++ b/src/js/arching-kaos-tools.js
@@ -35,24 +35,35 @@ import { debugLog } from "./utils.js";
var settings = getSettings();
-function showResult(id)
+export function showResult(id)
{
const found = document.querySelector(`#${id}`).cloneNode(true);
- const overlay = document.createElement('div');
- overlay.id = 'unique-overlay';
const title = {
element:'h3',
innerText : "Result"
};
- makeElement(title, overlay);
var closeButton = {
element:'button',
innerHTML: 'x',
id:"buttonCloseResult"
};
- makeElement(closeButton, overlay);
- makeElement(found, overlay);
+ var resultsHeader = {
+ element: 'div',
+ id: 'results-header',
+ innerHTML:[
+ title,
+ closeButton
+ ]
+ };
+ const overlay = {
+ element:'div',
+ id:'unique-overlay',
+ innerHTML:[
+ resultsHeader
+ ]
+ };
makeElement(overlay, resultsArea());
+ document.querySelector('#unique-overlay').appendChild(found);
closeButton = document.querySelector('#buttonCloseResult');
closeButton.addEventListener("click", ()=>{
document.querySelector('#unique-overlay').remove();
@@ -466,15 +477,21 @@ function exe(action,dataIPFSHash,blockObject,zblockIPFSHash,group,zblockObject,r
export function getPreviewText(text, params)
{
- var [ articleid ] = params;
+ var [ articleid, button ] = params;
var divs = document.querySelector(articleid);
if(text)
{
var newtext = text.substring(0, 500);
var pre = {
element:"div",
- className:"news-text",
- innerHTML:DOMPurify.sanitize(marked.parse(newtext))
+ innerHTML:[
+ {
+ element:"div",
+ className:"news-text",
+ innerHTML:DOMPurify.sanitize(marked.parse(newtext))
+ },
+ button
+ ]
};
makeElement(pre, divs);
}
@@ -574,11 +591,24 @@ function checkPeers(json)
{
for ( var peer = 0; peer < json.length; peer++)
{
- archingKaosLog("Checking peer: "+json[peer].cjdns.ip);
- checkIfZchainAndProceed(json[peer].node_info, [json[peer].node_info.gpg]);
+ if ( json[peer].cjdns !== undefined )
+ {
+ archingKaosLog("Checking peer: "+json[peer].cjdns.ip);
+ checkIfZchainAndProceed(json[peer].node_info, [json[peer].node_info.gpg]);
+ }
+ if ( json[peer].yggdrasil !== undefined )
+ {
+ archingKaosLog("Checking peer: "+json[peer].yggdrasil.ip);
+ checkIfZchainAndProceed(json[peer].node_info, [json[peer].node_info.gpg]);
+ }
}
}
+export function seekPeer(value)
+{
+ archingKaosFetchJSON(`http://[${value}]:8610/v0/node_info`, checkIfZchainAndProceed, ["custom"]);
+}
+
export function checkLocalPeers()
{
archingKaosLog("🔎 Querying for peers...");