+
+
Browse Websites
+ ${this.renderPublishButton()}
+
+
+
Search Websites
+
+
+
+
+ this.doSearch(e)}">
+
+ Search
+
+
+
+ {
+ render(html`${this.renderSearchAvatar(data.item)}`, root)
+ }}>
+
+ {
+ render(html`${this.renderSearchName(data.item)}`, root)
+ }}>
+
+ {
+ render(html`${this.renderSearchStatus(data.item)}`, root)
+ }}>
+
+ {
+ render(html`${this.renderSearchSize(data.item)}`, root)
+ }}>
+
+ {
+ render(html`${this.renderSearchFollowUnfollowButton(data.item)}`, root);
+ }}>
+
+ {
+ render(html`${this.renderSearchBlockUnblockButton(data.item)}`, root);
+ }}>
+
+
+
+
+
Websites
+
+ {
+ render(html`${this.renderAvatar(data.item)}`, root)
+ }}>
+
+ {
+ render(html`${this.renderName(data.item)}`, root)
+ }}>
+
+ {
+ render(html`${this.renderStatus(data.item)}`, root)
+ }}>
+
+ {
+ render(html`${this.renderSize(data.item)}`, root)
+ }}>
+
+ {
+ render(html`${this.renderFollowUnfollowButton(data.item)}`, root);
+ }}>
+
+ {
+ render(html`${this.renderBlockUnblockButton(data.item)}`, root);
+ }}>
+
+
+
+ ${this.isEmptyArray(this.resources) ? html`
+ No websites available
+ `: ''}
+
+ ${this.renderRelayModeText()}
+
+
+
+
Your followed Webistes
+ ${this.renderPublishButton()}
+
+
+
Followed Websites
+
+ {
+ render(html`${this.renderWebAvatar(data.item)}`, root)
+ }}>
+
+ {
+ render(html`${this.renderWebName(data.item)}`, root)
+ }}>
+
+ {
+ render(html`${this.renderWebStatus(data.item)}`, root)
+ }}>
+
+ {
+ render(html`${this.renderWebSize(data.item)}`, root)
+ }}>
+
+ {
+ render(html`${this.renderWebFollowUnfollowButton(data.item)}`, root);
+ }}>
+
+ {
+ render(html`${this.renderWebBlockUnblockButton(data.item)}`, root);
+ }}>
+
+
+ ${this.isEmptyArray(this.webResources) ? html`
+ You not follow any website
+ `: ''}
+
+ ${this.renderRelayModeText()}
+
+
+
+
Your blocked Webistes
+ ${this.renderPublishButton()}
+
+
+
Blocked Websites
+
+ {
+ render(html`${this.renderBlockAvatar(data.item)}`, root)
+ }}>
+
+ {
+ render(html`${this.renderBlockName(data.item)}`, root)
+ }}>
+
+ {
+ render(html`${this.renderBlockStatus(data.item)}`, root)
+ }}>
+
+ {
+ render(html`${this.renderBlockSize(data.item)}`, root)
+ }}>
+
+ {
+ render(html`${this.renderBlockFollowUnfollowButton(data.item)}`, root);
+ }}>
+
+ {
+ render(html`${this.renderBlockBlockUnblockButton(data.item)}`, root);
+ }}>
+
+
+ ${this.isEmptyArray(this.blockResources) ? html`
+ You have not blocked any website
+ `: ''}
+
+ ${this.renderRelayModeText()}
+
+
+
`
}
@@ -266,6 +375,10 @@ class Websites extends LitElement {
this.showWebsites()
+ setTimeout(() => {
+ this.displayTabContent('browse')
+ }, 0)
+
const getFollowedNames = async () => {
let followedNames = await parentEpml.request('apiCall', {
url: `/lists/followedNames?apiKey=${this.getApiKey()}`
@@ -284,6 +397,42 @@ class Websites extends LitElement {
setTimeout(getBlockedNames, 60000)
}
+ const getWebFollowedNames = async () => {
+ let webFollowedNames = await parentEpml.request('apiCall', {
+ url: `/lists/followedNames?apiKey=${this.getApiKey()}`
+ })
+
+ this.webFollowedNames = webFollowedNames
+ setTimeout(getWebFollowedNames, 60000)
+ }
+
+ const getWebBlockedNames = async () => {
+ let webBlockedNames = await parentEpml.request('apiCall', {
+ url: `/lists/blockedNames?apiKey=${this.getApiKey()}`
+ })
+
+ this.webBlockedNames = webBlockedNames
+ setTimeout(getWebBlockedNames, 60000)
+ }
+
+ const getBlockFollowedNames = async () => {
+ let blockFollowedNames = await parentEpml.request('apiCall', {
+ url: `/lists/followedNames?apiKey=${this.getApiKey()}`
+ })
+
+ this.blockFollowedNames = blockFollowedNames
+ setTimeout(getBlockFollowedNames, 60000)
+ }
+
+ const getBlockBlockedNames = async () => {
+ let blockBlockedNames = await parentEpml.request('apiCall', {
+ url: `/lists/blockedNames?apiKey=${this.getApiKey()}`
+ })
+
+ this.blockBlockedNames = blockBlockedNames
+ setTimeout(getBlockBlockedNames, 60000)
+ }
+
const getSearchFollowedNames = async () => {
let searchFollowedNames = await parentEpml.request('apiCall', {
url: `/lists/followedNames?apiKey=${this.getApiKey()}`
@@ -338,12 +487,20 @@ class Websites extends LitElement {
parentEpml.subscribe('config', c => {
if (!configLoaded) {
setTimeout(this.getArbitraryResources, 1)
+ setTimeout(this.getFollowedWebsites, 1)
+ setTimeout(this.getBlockedWebsites, 1)
setTimeout(getFollowedNames, 1)
setTimeout(getBlockedNames, 1)
+ setTimeout(getWebFollowedNames, 1)
+ setTimeout(getWebBlockedNames, 1)
+ setTimeout(getBlockFollowedNames, 1)
+ setTimeout(getBlockBlockedNames, 1)
setTimeout(getSearchFollowedNames, 1)
setTimeout(getSearchBlockedNames, 1)
setTimeout(getRelayMode, 1)
setInterval(this.getArbitraryResources, 120000)
+ setInterval(this.getFollowedWebsites, 60000)
+ setInterval(this.getBlockedWebsites, 60000)
configLoaded = true
}
this.config = JSON.parse(c)
@@ -357,6 +514,15 @@ class Websites extends LitElement {
parentEpml.imReady()
}
+ displayTabContent(tab) {
+ const tabBrowseContent = this.shadowRoot.getElementById('tab-browse-content')
+ const tabFollowedContent = this.shadowRoot.getElementById('tab-followed-content')
+ const tabBlockedContent = this.shadowRoot.getElementById('tab-blocked-content')
+ tabBrowseContent.style.display = (tab === 'browse') ? 'block' : 'none'
+ tabFollowedContent.style.display = (tab === 'followed') ? 'block' : 'none'
+ tabBlockedContent.style.display = (tab === 'blocked') ? 'block' : 'none'
+ }
+
searchListener(e) {
if (e.key === 'Enter') {
this.doSearch(e);
@@ -453,6 +619,330 @@ class Websites extends LitElement {
this.searchResult()
}
+ getFollowedWebsites = async () => {
+ let data = [];
+ const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
+ const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port;
+ const namesUrl = `${nodeUrl}/lists/followedNames?apiKey=${this.getApiKey()}`;
+ const jsonUrl = `${nodeUrl}/arbitrary/resources?service=WEBSITE&default=true&limit=0&reverse=false&includestatus=true`;
+
+ const jsonRes = await fetch(jsonUrl);
+ const jsonData = await jsonRes.json();
+ const response = await fetch(namesUrl);
+ const names = await response.json();
+
+ let webres = jsonData.filter((elm) => names.includes(elm.name));
+
+ this.webResources = webres;
+ }
+
+ renderWebAvatar(webObj) {
+ let name = webObj.name
+ const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
+ const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port
+ const url = `${nodeUrl}/arbitrary/THUMBNAIL/${name}/qortal_avatar?async=true&apiKey=${this.getApiKey()}`;
+ return html`