microsoft / jacdac

Device and service catalogs for Jacdac.
https://aka.ms/jacdac
Creative Commons Attribution 4.0 International
66 stars 25 forks source link

Customizable simulator iframe #1262

Closed ross-inksmith closed 1 year ago

ross-inksmith commented 1 year ago

We would like to customize the makecode-editor-extension and makecode-simulator as provided by jacdac-docs, but we are having trouble making these changes work outside the local environment. The issue seems to be that there isn't yet a way to make the simulator iframe source from a different url.

What changes I have made so far do work locally when using ?localeditorextensions=1&localhostmessagesims=1. Hosting our jacdac-docs fork on github.io in the same manner as [microsoft.github.io/jacdac-docs]() works locally with pxt-microbit when targetconfig.json and simulator.messageSimulators.jacdac.url in pxtarget.json were updated with the fork's url.

Obviously changing the current jacdac url in pxtarget in production for us is out of the question, but there doesn't appear to be an existing way to configure it from the package.

So far I've also tried creating a new item in simulator.messageSimulators and updating our fork of pxt-jacdac to use that as the type/channel, but sendCustomEventAsync checks specifically for a "jacdac" type and therefore throws an error. Given that the simulator is spawned based on the "channel" of the message, I've tried making the extension emmit "jacdac" type messages on a differently named channel but I'm not sure if there's an actual distinction between these fields since they get used Interchangeably.

I'm looking on some guidance on how best make the iframe simulator configurable.

pelikhan commented 1 year ago

By design, all injected iframe need to be allowed through the pxttarget.json configuration and vetted by the MakeCode team. I would recommend moving this question to the https://github.com/microsoft/pxt-microbit repo.

ross-inksmith commented 1 year ago

https://github.com/microsoft/pxt-microbit/issues/4993