change some bits

This commit is contained in:
Tamius Han 2025-10-08 19:39:55 +02:00
parent accc320971
commit bf7f707ab7
3 changed files with 27 additions and 7 deletions

View File

@ -115,8 +115,19 @@ export default class EventBus {
// CommsServer's job. EventBus does not have enough data for this decision. // CommsServer's job. EventBus does not have enough data for this decision.
// We do, however, have enough data to prevent backflow of messages that // We do, however, have enough data to prevent backflow of messages that
// crossed CommsServer once already. // crossed CommsServer once already.
if (this.comms && context?.origin !== CommsOrigin.Server && !context?.borderCrossings?.commsServer) { if (
this.comms.sendMessage({command, config: commandData, context}, context); this.comms
&& context?.origin !== CommsOrigin.Server
&& !context?.borderCrossings?.commsServer
) {
try {
this.comms.sendMessage({command, config: commandData, context}, context);
} catch (e) {
if (command !== 'reload-required') {
// We shouldn't let reload-required command to trigger new reload-required commands.
this.send('reload-required', {});
}
}
}; };
// call forwarding functions if they exist // call forwarding functions if they exist
@ -161,7 +172,13 @@ export default class EventBus {
// also need to set up a detour because the tunnel is closed // also need to set up a detour because the tunnel is closed
// in the popup // in the popup
if (this.comms) { if (this.comms) {
this.comms.sendMessage({command, config, context: this.popupContext}, this.popupContext); try {
this.comms.sendMessage({command, config, context: this.popupContext}, this.popupContext);
} catch (e) {
if (command !== 'reload-required') {
this.send('reload-required', {});
}
}
} }
} }
} }

View File

@ -110,6 +110,9 @@ export class SiteSettings {
* @returns * @returns
*/ */
private getSettingsForSite(options: GetSiteSettingsOptions): {siteSettings: SiteSettingsInterface, usesSettingsFor: string | undefined} { private getSettingsForSite(options: GetSiteSettingsOptions): {siteSettings: SiteSettingsInterface, usesSettingsFor: string | undefined} {
// console.warn('getSettingsForSite: getting settings for site', options.site, ' — full options:', options);
if (!options.site) { if (!options.site) {
return { return {
siteSettings: this.settings.active.sites['@global'], siteSettings: this.settings.active.sites['@global'],
@ -441,7 +444,7 @@ export class SiteSettings {
} }
return this.site; return this.site;
} }
0
/** /**
* Sets option value. * Sets option value.
* @param optionPath path to value in object notation (dot separated) * @param optionPath path to value in object notation (dot separated)

View File

@ -61,10 +61,10 @@ class UI {
async init() { async init() {
if (!this.canRun()) { if (!this.canRun()) {
console.log('ui config: canRun returned false', this.siteSettings?.data.enableUI.fullscreen === ExtensionMode.Enabled, this.siteSettings?.data.enableUI.theater === ExtensionMode.Enabled, this.siteSettings?.data.enableUI.normal === ExtensionMode.Enabled) // console.log('ui config: canRun returned false', this.siteSettings?.data.enableUI.fullscreen === ExtensionMode.Enabled, this.siteSettings?.data.enableUI.theater === ExtensionMode.Enabled, this.siteSettings?.data.enableUI.normal === ExtensionMode.Enabled)
return; return;
} }
console.log('ui config: canRun returned truie', this.siteSettings?.data.enableUI.fullscreen === ExtensionMode.Enabled, this.siteSettings?.data.enableUI.theater === ExtensionMode.Enabled, this.siteSettings?.data.enableUI.normal === ExtensionMode.Enabled) // console.log('ui config: canRun returned truie', this.siteSettings?.data.enableUI.fullscreen === ExtensionMode.Enabled, this.siteSettings?.data.enableUI.theater === ExtensionMode.Enabled, this.siteSettings?.data.enableUI.normal === ExtensionMode.Enabled)
this.initUIContainer(); this.initUIContainer();
@ -190,6 +190,7 @@ class UI {
coords, coords,
playerDimensions: playerData.playerDimensions, playerDimensions: playerData.playerDimensions,
canShowUI: playerData.canShowUI, canShowUI: playerData.canShowUI,
isIframe: this.isIframe,
ts: +new Date() // this should be accurate enough for our purposes, ts: +new Date() // this should be accurate enough for our purposes,
}, },
uiURI uiURI
@ -253,7 +254,6 @@ class UI {
}, },
'uw-get-page-stats': { 'uw-get-page-stats': {
function: (config, routingData) => { function: (config, routingData) => {
console.log('got get page stats!');
this.eventBus.send( this.eventBus.send(
'uw-page-stats', 'uw-page-stats',
{ {