mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
add subplebbit pages to feed state string
This commit is contained in:
@@ -24,6 +24,16 @@ const useFeedStateString = (subplebbits) => {
|
|||||||
addClientUrl(subplebbit.clients.chainProviders[chainTicker][clientUrl], clientUrl)
|
addClientUrl(subplebbit.clients.chainProviders[chainTicker][clientUrl], clientUrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// find subplebbit pages states
|
||||||
|
if (subplebbit?.posts?.clients) {
|
||||||
|
for (const clientType in subplebbit.posts.clients) {
|
||||||
|
for (const sortType in subplebbit.posts.clients[clientType]) {
|
||||||
|
for (const clientUrl in subplebbit.posts.clients[clientType][sortType]) {
|
||||||
|
addClientUrl(subplebbit.posts.clients[clientType][sortType][clientUrl], clientUrl)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return [...clientUrls]
|
return [...clientUrls]
|
||||||
}
|
}
|
||||||
@@ -35,6 +45,15 @@ const useFeedStateString = (subplebbits) => {
|
|||||||
const states = {}
|
const states = {}
|
||||||
for (const subplebbit of subplebbits) {
|
for (const subplebbit of subplebbits) {
|
||||||
states[subplebbit?.updatingState] = (states[subplebbit?.updatingState] || 0) + 1
|
states[subplebbit?.updatingState] = (states[subplebbit?.updatingState] || 0) + 1
|
||||||
|
// find subplebbit pages states
|
||||||
|
for (const clientType in subplebbit?.posts?.clients) {
|
||||||
|
for (const sortType in subplebbit.posts.clients[clientType]) {
|
||||||
|
for (const clientUrl in subplebbit.posts.clients[clientType][sortType]) {
|
||||||
|
const state = subplebbit.posts.clients[clientType][sortType][clientUrl].state
|
||||||
|
states[state] = (states[state] || 0) + 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// e.g. Resolving 2 addresses from infura.io, fetching 2 IPNS, 1 IPFS from cloudflare-ipfs.com, ipfs.io
|
// e.g. Resolving 2 addresses from infura.io, fetching 2 IPNS, 1 IPFS from cloudflare-ipfs.com, ipfs.io
|
||||||
@@ -58,7 +77,7 @@ const useFeedStateString = (subplebbits) => {
|
|||||||
if (states['fetching-ipns']) {
|
if (states['fetching-ipns']) {
|
||||||
stateString += ', '
|
stateString += ', '
|
||||||
}
|
}
|
||||||
stateString += `${states['fetching-ipfs']} IPNS`
|
stateString += `${states['fetching-ipfs']} IPFS`
|
||||||
}
|
}
|
||||||
const clientUrls = getClientUrls(/ipfs|ipns/)
|
const clientUrls = getClientUrls(/ipfs|ipns/)
|
||||||
if (clientUrls.length) {
|
if (clientUrls.length) {
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ const useStateString = (commentOrSubplebbit) => {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
state += `-page-${sortType}`
|
state += `-page-${sortType}`
|
||||||
console.log(clientType, sortType, clientUrl, state)
|
|
||||||
if (!states[state]) {
|
if (!states[state]) {
|
||||||
states[state] = []
|
states[state] = []
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user