Browse Source

Add Framewrork

qortal-ui-dev
AlphaX-Projects 1 year ago committed by GitHub
parent
commit
4ae0ec6a98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 82
      plugins/plugins/core/qdn/browser/browser.src.js

82
plugins/plugins/core/qdn/browser/browser.src.js

@ -35,6 +35,8 @@ class WebBrowser extends LitElement {
identifier: { type: String }, identifier: { type: String },
path: { type: String }, path: { type: String },
preview: { type: String }, preview: { type: String },
dev: { type: String },
link: { type: String },
displayUrl: { type: String }, displayUrl: { type: String },
followedNames: { type: Array }, followedNames: { type: Array },
blockedNames: { type: Array }, blockedNames: { type: Array },
@ -130,11 +132,11 @@ class WebBrowser extends LitElement {
constructor() { constructor() {
super(); super();
this.url = 'about:blank'; this.url = 'about:blank';
this.myAddress = window.parent.reduxStore.getState().app.selectedAddress; this.myAddress = window.parent.reduxStore.getState().app.selectedAddress
this._publicKey = { key: '', hasPubKey: false }; this._publicKey = { key: '', hasPubKey: false }
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search)
this.name = urlParams.get('name'); this.name = urlParams.get('name')
this.service = urlParams.get('service'); this.service = urlParams.get('service')
this.identifier = this.identifier =
urlParams.get('identifier') != null urlParams.get('identifier') != null
? urlParams.get('identifier') ? urlParams.get('identifier')
@ -145,44 +147,53 @@ class WebBrowser extends LitElement {
urlParams.get('path') urlParams.get('path')
: ''; : '';
this.preview = urlParams.get('preview'); this.preview = urlParams.get('preview');
this.followedNames = []; this.link = urlParams.get('link')
this.blockedNames = []; this.dev = urlParams.get('dev')
this.followedNames = []
this.blockedNames = []
this.theme = localStorage.getItem('qortalTheme') ? localStorage.getItem('qortalTheme') : 'light' this.theme = localStorage.getItem('qortalTheme') ? localStorage.getItem('qortalTheme') : 'light'
this.loader = new Loader(); this.loader = new Loader()
// Build initial display URL // Build initial display URL
let displayUrl = 'qortal://' + this.service + '/' + this.name; let displayUrl = ''
if (
this.identifier && this.identifier != 'null' && if (this.dev === 'FRAMEWORK') {
this.identifier != 'default' displayUrl = 'qortal://app/development'
) { } else {
displayUrl = displayUrl.concat('/' + this.identifier); displayUrl = 'qortal://' + this.service + '/' + this.name
if ( this.identifier && this.identifier != 'null' && this.identifier != 'default' ) {
displayUrl = displayUrl.concat('/' + this.identifier)
}
if (this.path != null && this.path != '/') {
displayUrl = displayUrl.concat(this.path)
}
} }
if (this.path != null && this.path != '/')
displayUrl = displayUrl.concat(this.path); this.displayUrl = displayUrl
this.displayUrl = displayUrl;
const getFollowedNames = async () => { const getFollowedNames = async () => {
let followedNames = await parentEpml.request('apiCall', { let followedNames = await parentEpml.request('apiCall', {
url: `/lists/followedNames?apiKey=${this.getApiKey()}`, url: `/lists/followedNames?apiKey=${this.getApiKey()}`,
}); })
this.followedNames = followedNames; this.followedNames = followedNames
setTimeout( setTimeout(
getFollowedNames, getFollowedNames,
this.config.user.nodeSettings.pingInterval this.config.user.nodeSettings.pingInterval
); )
}; }
const getBlockedNames = async () => { const getBlockedNames = async () => {
let blockedNames = await parentEpml.request('apiCall', { let blockedNames = await parentEpml.request('apiCall', {
url: `/lists/blockedNames?apiKey=${this.getApiKey()}`, url: `/lists/blockedNames?apiKey=${this.getApiKey()}`,
}); })
this.blockedNames = blockedNames; this.blockedNames = blockedNames;
setTimeout( setTimeout(
getBlockedNames, getBlockedNames,
this.config.user.nodeSettings.pingInterval this.config.user.nodeSettings.pingInterval
); )
}; }
const render = () => { const render = () => {
const myNode = const myNode =
@ -195,8 +206,9 @@ class WebBrowser extends LitElement {
if (this.preview != null && this.preview.length > 0) { if (this.preview != null && this.preview.length > 0) {
// In preview mode we access the preview URL path directly // In preview mode we access the preview URL path directly
this.url = `${nodeUrl}${this.preview}&theme=${this.theme}` this.url = `${nodeUrl}${this.preview}&theme=${this.theme}`
} } else if (this.dev === 'FRAMEWORK') {
else { this.url = `${this.link}`
} else {
// Normal mode // Normal mode
this.url = `${nodeUrl}/render/${this.service}/${this.name}${this.path != null ? this.path : '' this.url = `${nodeUrl}/render/${this.service}/${this.name}${this.path != null ? this.path : ''
@ -2741,15 +2753,15 @@ class WebBrowser extends LitElement {
} }
refresh() { refresh() {
const myNode = const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
window.parent.reduxStore.getState().app.nodeConfig.knownNodes[ const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port
window.parent.reduxStore.getState().app.nodeConfig.node if (this.dev === 'FRAMEWORK') {
]; this.url = `${this.link}`
const nodeUrl = } else {
myNode.protocol + '://' + myNode.domain + ':' + myNode.port; this.url = `${nodeUrl}/render/${this.service}/${this.name}${this.path != null ? this.path : ''
this.url = `${nodeUrl}/render/${this.service}/${this.name}${this.path != null ? this.path : '' }?theme=${this.theme}&identifier=${this.identifier != null ? this.identifier : ''
}?theme=${this.theme}&identifier=${this.identifier != null ? this.identifier : '' }&time=${new Date().getMilliseconds()}`
}&time=${new Date().getMilliseconds()}`; }
} }
goBackToList() { goBackToList() {

Loading…
Cancel
Save