diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2025-07-21 16:43:41 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2025-07-21 16:43:41 +0300 |
commit | 81c170c99f58e28270fb5306b759b231578e36a9 (patch) | |
tree | 9e442cc6baa98cda0566493e40f7c4491cda1873 /src/js | |
parent | 8ad73165db077ced4d9ced285eb5371ac746c5cc (diff) | |
download | arching-kaos-web-ui-81c170c99f58e28270fb5306b759b231578e36a9.tar.gz arching-kaos-web-ui-81c170c99f58e28270fb5306b759b231578e36a9.tar.bz2 arching-kaos-web-ui-81c170c99f58e28270fb5306b759b231578e36a9.zip |
AKNS records resolver + Donations page
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/app.js | 6 | ||||
-rw-r--r-- | src/js/arching-kaos-fetch.js | 1 | ||||
-rw-r--r-- | src/js/arching-kaos-stellar-network.js | 29 | ||||
-rw-r--r-- | src/js/arching-kaos-tools.js | 47 | ||||
-rw-r--r-- | src/js/arching-kaos-web-ui-settings.js | 5 | ||||
-rw-r--r-- | src/js/ui/header.js | 2 | ||||
-rw-r--r-- | src/js/ui/main.js | 2 | ||||
-rw-r--r-- | src/js/ui/menu.js | 1 | ||||
-rw-r--r-- | src/js/ui/sections/aboutSection.js | 4 | ||||
-rw-r--r-- | src/js/ui/sections/welcomeSection.js | 3 | ||||
-rw-r--r-- | src/js/url-generators.js | 10 | ||||
-rw-r--r-- | src/js/utils.js | 13 |
12 files changed, 100 insertions, 23 deletions
diff --git a/src/js/app.js b/src/js/app.js index b42cbf0..fee3cd9 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -8,11 +8,15 @@ import { locationHashOnChange } from "./arching-kaos-spa-router.js"; import { doubleFloorMenu, menuinit, menusel, stellarSubToggle, modulesSubToggle, exploreSubToggle } from './ui/menu.js'; import { mainLayoutSpawn } from "./ui/mainLayout.js"; -import { scanStellarNetworkForPeers } from "./arching-kaos-stellar-network.js"; +import { scanStellarNetworkForPeers, connect } from "./arching-kaos-stellar-network.js"; import { checkLocalNodeInfo, checkLocalPeers, checkLocalSchain, seekPeer, seekZblock, showResult } from "./arching-kaos-tools.js"; import { refreshChat, refreshRadio, setDebug } from "./utils.js"; import { akfsGetMap, akfsWorkOnChunks } from "./arching-kaos-file-system.js"; +import { freighterWalletConnect, triggerDonation } from "./ui/sections/donationSection.js"; +window.triggerDonation = triggerDonation; +window.freighterWalletConnect = freighterWalletConnect; +window.connect = connect; window.menusel = menusel; window.locationHashOnChange = locationHashOnChange; window.stellarSubToggle = stellarSubToggle; diff --git a/src/js/arching-kaos-fetch.js b/src/js/arching-kaos-fetch.js index 6cf1b76..25a22c1 100644 --- a/src/js/arching-kaos-fetch.js +++ b/src/js/arching-kaos-fetch.js @@ -63,6 +63,7 @@ export async function archingKaosFetchText( url, callback, params ){ debugLog("Request aborted."); }); request.open("GET", url); + request.responseType = ""; request.send(); } diff --git a/src/js/arching-kaos-stellar-network.js b/src/js/arching-kaos-stellar-network.js index a20365c..85ea8af 100644 --- a/src/js/arching-kaos-stellar-network.js +++ b/src/js/arching-kaos-stellar-network.js @@ -66,13 +66,22 @@ function renderStellarAddressesAndProceed(json){ if (json._links.next) getHolders(json._links.next.href); } -function renderConfigurationIPNSLinkAndProceed(json, stellarAddress){ +function renderConfigurationLinkAndProceed(json, stellarAddress){ renderStellarAddress(stellarAddress); document.querySelector('#'+stellarAddress).style="color: #3dbb3d;" increaseStellarNetworkConfiguredAddresses(); debugLog(atob(json.value)); debugLog(stellarAddress); - getConfiguration(atob(json.value),stellarAddress); + var key = json.value + const base64Regex = /^[A-Z0-9+\/=]{28}/i; + if (base64Regex.test(atob(key))) + { + getConfiguration(atob(key), stellarAddress); + } + else + { + getConfiguration(atob(key),stellarAddress); + } } function getTrustlines(){ @@ -106,7 +115,7 @@ function getHolders(a=0){ function checkAddressForConfigurationVariable(stellarAddress) { archingKaosLog("Checking configuration for "+ stellarAddress+ "..."); - archingKaosFetchJSON(getStellarConfigurationVariableURL(stellarAddress), renderConfigurationIPNSLinkAndProceed, stellarAddress); + archingKaosFetchJSON(getStellarConfigurationVariableURL(stellarAddress), renderConfigurationLinkAndProceed, stellarAddress); progressPlaceholder().value++; } @@ -155,7 +164,17 @@ async function fetchNodeInfoFromClientWallet(stellarAddress){ makeElement(cnf, document.querySelector('#stellar-data-config')); progressPlaceholder().max++; progressPlaceholder().value++; - getConfiguration(atob(json.value),stellarAddress); + key = json.value + regex= /[a-zA-Z0-9+\/=]{29}/ + const base64Regex = /^[A-Z0-9+\/=]{28}/i; + if (base64Regex.test(atob(key))) + { + getConfiguration(atob(key), stellarAddress); + } + else + { + getConfiguration(atob(key),stellarAddress); + } }); } }); @@ -186,7 +205,7 @@ const retrievePublicKey = async () => { return publicKey; }; -function connect(){ +export function connect(){ // if ( stellar_connection_status === 1 ){ // showStellar(); // } else { diff --git a/src/js/arching-kaos-tools.js b/src/js/arching-kaos-tools.js index c8ebfb9..1b147a7 100644 --- a/src/js/arching-kaos-tools.js +++ b/src/js/arching-kaos-tools.js @@ -9,7 +9,7 @@ import { archingKaosLog } from "./arching-kaos-log.js"; import { makeElement } from "./arching-kaos-generator.js"; import { progressPlaceholder, resultsArea, aknet } from "./app.js"; import { archingKaosFetchJSON } from "./arching-kaos-fetch.js"; -import { getIPFSURL, getIPNSURL } from "./url-generators.js"; +import { getIPFSURL, getIPNSURL, aknsGetFromBaseURL } from "./url-generators.js"; import { stellarParticipantInfo, getStellarParticipantsScanned, @@ -136,18 +136,24 @@ function nodeInfoRender(json, stellarAddress, parentTag=null) function nodeInfoRenderAndProceed(json, stellarAddress) { - nodeInfoRender(json, stellarAddress); - stellarParticipantInfo(stellarAddress, json); - if ( getStellarParticipantsScanned() === 0 ) + if ( json.key && json.resolved ) { - archingKaosLog('Scanned all Stellar participants'); + archingKaosFetchJSON(getIPFSURL(json.resolved), nodeInfoRenderAndProceed, stellarAddress); } - progressPlaceholder().value++; - if (json.zlatest) + else { - seekZblock(json.zlatest, [json.gpg, json]); + nodeInfoRender(json, stellarAddress); + stellarParticipantInfo(stellarAddress, json); + if ( getStellarParticipantsScanned() === 0 ) + { + archingKaosLog('Scanned all Stellar participants'); + } + progressPlaceholder().value++; + if (json.zlatest) + { + seekZblock(json.zlatest, [json.gpg, json]); + } } - //seekZchain(json.zchain,stellarAddress,json); } function renderZblockAndProceed(json, params) @@ -252,6 +258,16 @@ function blockRenderAndProceed(json, params) exe(json.action,json.data,json,zblockIPFSHash,group,zblockObject,recursive); if ( checkIfGenesis(json.previous) ) { + if(typeof(group) === "object") + { + archingKaosLog("Done loading " + group.fingerprint + " zchain!") + console.log(group.fingerprint); + } + else + { + archingKaosLog("Done loading " + group + " zchain!") + console.log(group); + } archingKaosLog("Done loading " + group + " zchain!") progressPlaceholder().value++; setZchainLoadingStatus(group, {loading: "completed"}); @@ -281,11 +297,19 @@ function blockRenderAndProceed(json, params) } } -export function getConfiguration(nodeInfoIPNSLink,stellarAddress) +export function getConfiguration(nodeInfoNSLink,stellarAddress) { progressPlaceholder().max++; archingKaosLog("Parsing the configuration..."); - archingKaosFetchJSON(getIPNSURL(nodeInfoIPNSLink), nodeInfoRenderAndProceed, stellarAddress); + const base64Regex = /^[A-Z0-9+\/=]{28}/i; + if ( !(nodeInfoNSLink.startsWith("k51qzi5uqu")) && base64Regex.test(nodeInfoNSLink) ) + { + archingKaosFetchJSON(aknsGetFromBaseURL(nodeInfoNSLink), nodeInfoRenderAndProceed, stellarAddress); + } + else + { + archingKaosFetchJSON(getIPNSURL(nodeInfoNSLink), nodeInfoRenderAndProceed, stellarAddress); + } } function seekZchain(zchainIPNSLink,stellarAddress,json) @@ -395,7 +419,6 @@ function renderGroupOnDataSection(group) } else { - //debugLog('Else got hit in seekZchain'); return 0; } } diff --git a/src/js/arching-kaos-web-ui-settings.js b/src/js/arching-kaos-web-ui-settings.js index b4c62ac..694c5af 100644 --- a/src/js/arching-kaos-web-ui-settings.js +++ b/src/js/arching-kaos-web-ui-settings.js @@ -33,6 +33,7 @@ var default_settings = { 'https://ipfs.arching-kaos.com/', 'http://gw.ipfs.z.kaotisk-hund.com/', 'http://127.0.0.1:8080/', + 'http://z.kaotisk-hund.com:8610/v0/', 'http://127.0.0.1:8082/' ], active: 3 @@ -118,12 +119,12 @@ window.localStorage.removeItem("ak-settings"); if (( location.origin === "http://z.kaotisk-hund.com") || ( location.origin === "http://gw.ipfs.z.kaotisk-hund.com") || ( location.origin === "http://[fc59:6076:6299:6776:c13d:fbb2:1226:ead0]")) { - settings.ipfs.gateway.active = 1; + settings.ipfs.gateway.active = 3; settings.stellar.horizon.active = 1; settings.ak.connect.active = 1; settings.ak.radio.active = 1; } else if ( location.origin === "http://127.0.0.1" ) { - settings.ipfs.gateway.active = 3; + settings.ipfs.gateway.active = 4; } else { settings.ipfs.gateway.active = 0; } diff --git a/src/js/ui/header.js b/src/js/ui/header.js index 03b2332..8059419 100644 --- a/src/js/ui/header.js +++ b/src/js/ui/header.js @@ -15,7 +15,7 @@ export function headerSpawn() className: 'header', innerHTML: [ { element: "a", id:"logo-button", innerHTML:[ - {element: "img", src:"./img/header-logo.png" } + {element: "img", src:"./img/logo.png" } ]}, { element: "h1", style:"text-align: center;", innerText: "Arching Kaos"} ], diff --git a/src/js/ui/main.js b/src/js/ui/main.js index f38bb16..209781f 100644 --- a/src/js/ui/main.js +++ b/src/js/ui/main.js @@ -22,6 +22,7 @@ import { stellarDataConfigSection } from "./sections/stellarDataConfigSection.js import { stellarSection } from "./sections/stellarSection.js"; import { welcomeSection } from "./sections/welcomeSection.js"; import { zchainDataSection } from "./sections/zchainDataSection.js"; +import { donationSection } from "./sections/donationSection.js"; import { markdownSection } from "./sections/markdownSection.js"; export function mainSpawn() @@ -30,6 +31,7 @@ export function mainSpawn() akNodeInfoSection(); chatSection(); commentsSection(); + donationSection() markdownSection() filesSection(); mixtapesSection(); diff --git a/src/js/ui/menu.js b/src/js/ui/menu.js index 91be65f..0810dc9 100644 --- a/src/js/ui/menu.js +++ b/src/js/ui/menu.js @@ -153,6 +153,7 @@ export function menuids() return [ '#welcome-section', '#about-section', + '#donation-section', '#zchain-data-section', '#news-section', '#comments-section', diff --git a/src/js/ui/sections/aboutSection.js b/src/js/ui/sections/aboutSection.js index 6a01c44..7c77f46 100644 --- a/src/js/ui/sections/aboutSection.js +++ b/src/js/ui/sections/aboutSection.js @@ -35,7 +35,9 @@ export function aboutSection() { element:"li", innerText:"Your zchain (...)"}, { element:"li", innerText:"Your posted newsfeed (...)"} ]}, - { element:"p", innerText:"Finally, on the stats page you can find people that are participating over the Stellar Network, using the ARCHINGKAOS token/asset/coin."} + { element:"p", innerText:"Also, on the stats page you can find people that are participating over the Stellar Network, using the ARCHINGKAOS token/asset/coin."}, + { element:"p", innerText:"If you like what you see or you think the project has potential, you can use the button below to donate."}, + { element: "button", onclick:'menusel({id:"#/donation-section"})', innerText:"Donation"} ] }; diff --git a/src/js/ui/sections/welcomeSection.js b/src/js/ui/sections/welcomeSection.js index 873063b..cfa6816 100644 --- a/src/js/ui/sections/welcomeSection.js +++ b/src/js/ui/sections/welcomeSection.js @@ -59,7 +59,8 @@ var homeGrid = { className:"menu-clickable", id:"#/stats-section", onclick:"menusel(this)", - innerText:"Stats" + // innerText:"Stats", + style:"background-image: url(img/stats-logo.png); background-repeat: round; background-size: cover;" } ] }; diff --git a/src/js/url-generators.js b/src/js/url-generators.js index 465de59..034399e 100644 --- a/src/js/url-generators.js +++ b/src/js/url-generators.js @@ -70,5 +70,15 @@ export function akfsGetChunkURL(hash=null) { return settings.ak.connect.list[settings.ak.connect.active]+'/v0/chunk/'+hash; } + +export function aknsGetURL(hash=null) +{ + return settings.ak.connect.list[settings.ak.connect.active]+'/v0/ns_get/'+hash; +} + +export function aknsGetFromBaseURL(hash=null) +{ + return settings.ak.connect.list[settings.ak.connect.active]+'/v0/ns_get_base/'+hash; +} // vim: tabstop=4 shiftwidth=4 expandtab softtabstop=4 // @license-end diff --git a/src/js/utils.js b/src/js/utils.js index a952328..6a355a8 100644 --- a/src/js/utils.js +++ b/src/js/utils.js @@ -35,4 +35,17 @@ export function offerDownloadableData(data) link.href = window.URL.createObjectURL(blob); link.click(); } + +export function decodeBase64ToHex(base64String) { + const binaryString = atob(base64String); + // Convert the binary string to a byte array + const byteArray = new Uint8Array(binaryString.length); + for (let i = 0; i < binaryString.length; i++) { + byteArray[i] = binaryString.charCodeAt(i); + } + // Convert the byte array to a hex string representation + return Array.from(byteArray) + .map(byte => byte.toString(16).padStart(2, '0')) // Convert to hex and pad with zeros + .join(''); // Join with spaces for readability +} // @license-end |