microsoft / pxt-arcade

Arcade game editor based on Microsoft MakeCode
https://arcade.makecode.com
MIT License
481 stars 209 forks source link

Kiosk: ternary statement may be inverted in sim url construction #6083

Closed eanders-ms closed 1 year ago

eanders-ms commented 1 year ago

The logic seems inverted here. Would it make more sense to pass sendBuilt if we have the build cached locally? Needs investigation:

            const playQueryParam = kiosk.builtGamesCache[gameId]
                ? "&server=1"
                : "&sendBuilt=1";

At: https://github.com/microsoft/pxt/blob/5b4bd1c29082eb39c30c798f199d6f25039f258f/kiosk/src/Components/PlayingGame.tsx#L13

jwunderl commented 1 year ago

server=1 is the parameter used to say "just wait for us to send you the code in a msg once you're loaded, don't do anything yet"

sendBuilt=1 is used to make the it so run.html posts up the built game binary.js / etc from simulator to parent frame so it can be stored there. For ref https://github.com/microsoft/pxt/blob/master/webapp/public/run.html#L123

So for now this should be fine, just a little confusing param name. (I would expect this logic to get removed eventually if we move it over to be closer to multiplayer where there's intermediary run.html iframe for better control / minor perf)