League-of-Foundry-Developers / fvtt-module-theatre

GNU General Public License v3.0
32 stars 41 forks source link

Theatre Inserts does not work well with Forge-VTT #114

Closed ZwS closed 1 year ago

ZwS commented 1 year ago

I'm hosting game at Forge-VTT and found that module doesn't work well there. When I'm trying to activate actor on the scene pixi crashes with the following errors:

Uncaught DOMException: Failed to execute 'texImage2D' on 'WebGL2RenderingContext': The image element contains cross-origin data, and may not be loaded.
    at r.upload (https://<cut>.forge-vtt.com/scripts/pixi.min.js:8:109415)
    at r.upload (https://<cut>.forge-vtt.com/scripts/pixi.min.js:8:113123)
    at e.updateTexture (https://<cut>.forge-vtt.com/scripts/pixi.min.js:8:215193)
    at e.bind (https://<cut>.forge-vtt.com/scripts/pixi.min.js:8:213523)
    at r.bindAndClearTexArray (https://<cut>.forge-vtt.com/scripts/pixi.min.js:8:232029)
    at r.drawBatches (https://<cut>.forge-vtt.com/scripts/pixi.min.js:8:232873)
    at r.flush (https://<cut>.forge-vtt.com/scripts/pixi.min.js:8:233262)
    at r.render (https://<cut>.forge-vtt.com/scripts/pixi.min.js:8:225107)
    at e.render (https://<cut>.forge-vtt.com/scripts/pixi.min.js:8:461021)
    at t.emit (https://<cut>.forge-vtt.com/scripts/pixi.min.js:8:93749)
    at e.update (https://<cut>.forge-vtt.com/scripts/pixi.min.js:8:96639)
    at Theatre._renderTheatre (https://<cut>.forge-vtt.com/modules/theatre/app/js/Theatre.js:2112:23)

core.min.mjs:8 Uncaught TypeError: Cannot read properties of null (reading '_batchLocation')
[No packages detected]
    at t.boundArray (core.min.mjs:8:49215)
    at r.buildTexturesAndDrawCalls (core.min.mjs:8:131487)
    at r.flush (core.min.mjs:8:133464)
    at r.stop (core.min.mjs:8:133884)
    at t.setObjectRenderer (core.min.mjs:8:48744)
    at t.flush (core.min.mjs:8:48839)
    at e.renderAdvanced (display.min.mjs:8:21008)
    at e.render (display.min.mjs:8:20205)
    at PrimaryCanvasGroup.render (foundry.js:26362:11)
    at e.render (display.min.mjs:8:20353)
    at e.render (display.min.mjs:8:20353)
    at e.render (display.min.mjs:8:20353)
    at r.render (core.min.mjs:8:125375)
    at e.render (app.min.mjs:8:1453)
    at t.emit (ticker.min.mjs:8:622)
    at e.update (ticker.min.mjs:8:3473)
    at _tick (ticker.min.mjs:8:1482)

I guess this happens because pixi thinks that module resources and portrait image are served from different domains. Forge serves all assets from the assets.forge-vtt.com domain, and module assumes that it loads it's own images (e.g. typing.png) from the game domain (it will be something like my-cool-game.eu.forge-vtt.com). Forge redirects all assets requests from the game domain to the assets.forge-vtt.com , but this seems not enough.