Skip to content

[BUG] app_loader fails before Unity project can load. Discord CSP appears to block importmap because it's an inline script tag. #73

Description

@SamNChiet

Describe the bug
Given the default Dissonity template on Unity 6000.3.13f1, the app_loader will fail to launch the Unity project, because Discord's CSP prevents the importmap from running.

Reproduction

  1. Create a blank Unity project.
  2. Import Dissonity
  3. Host the project
  4. Run it in an Activity with the web console open

Expected behavior
The webpage finishes loading after the black screen.

Screenshots
Progress is arrested, with the following errors:

Content-Security-Policy: The page’s settings blocked an inline script (script-src-elem) from being executed because it violates the following directive: “script-src 'self' 'unsafe-eval' 'nonce-MjI5LDMzLDIzMSwyMDcsNTQsMjIzLDI0OSwyMDI=' blob:”. Consider using a hash ('sha256-naHJ3iD8mbIyFIstpdyq4qddqB9sZHU1Vs4KA0OdbM8=') or a nonce.
Uncaught (in promise) TypeError: The specifier “dso_proxy_bridge/dissonity_hirpc.js” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”.

Platform
Web client + Desktop client

Additional context
Removing the importmap script tag from index.html and modifying lines 22 and 23 of app_loader.js appears to resolve the error.

// updated version
const proxyBridgeImport = "./.proxy/Bridge/";
const normalBridgeImport = "./Bridge/";

(That said, after fixing this issue... and this could be my fault, I'm at a loss, but it appears that Dissonity gets stuck initializing the RPC feature and never launches the app. The authentication in my server worked on the example app, the token request path is /api/token...
Image
Really puzzling. Tried to smoke out if this had any thing to do with the importmap but I didn't come up with anything)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingscope:hirpc-interfaceThis is related to the Unity-hiRPC bridgev2Related to Dissonity v2

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions