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.
// We do, however, have enough data to prevent backflow of messages that
// crossed CommsServer once already.
if (this.comms && context?.origin !== CommsOrigin.Server && !context?.borderCrossings?.commsServer) {
this.comms.sendMessage({command, config: commandData, context}, context);
if (
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
@ -161,7 +172,13 @@ export default class EventBus {
// also need to set up a detour because the tunnel is closed
// in the popup
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
*/
private getSettingsForSite(options: GetSiteSettingsOptions): {siteSettings: SiteSettingsInterface, usesSettingsFor: string | undefined} {
// console.warn('getSettingsForSite: getting settings for site', options.site, ' — full options:', options);
if (!options.site) {
return {
siteSettings: this.settings.active.sites['@global'],
@ -441,7 +444,7 @@ export class SiteSettings {
}
return this.site;
}
0
/**
* Sets option value.
* @param optionPath path to value in object notation (dot separated)

View File

@ -61,10 +61,10 @@ class UI {
async init() {
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;
}
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();
@ -190,6 +190,7 @@ class UI {
coords,
playerDimensions: playerData.playerDimensions,
canShowUI: playerData.canShowUI,
isIframe: this.isIframe,
ts: +new Date() // this should be accurate enough for our purposes,
},
uiURI
@ -253,7 +254,6 @@ class UI {
},
'uw-get-page-stats': {
function: (config, routingData) => {
console.log('got get page stats!');
this.eventBus.send(
'uw-page-stats',
{