Commit Graph
507 Commits
Author SHA1 Message Date
Muffin d3d3cfe6e3 Allow controlling addon block return shape 2023-07-26 20:39:23 -05:00
Muffin 0d857e4019 Make arguments optional in addAddonBlock 2023-07-26 20:12:13 -05:00
GarboMuffin c4561c2f1c Support custom buttons in extensions (#137) 2023-05-26 20:52:52 -05:00
GarboMuffin 584e3452a3 Add BEFORE_EXECUTE and AFTER_EXECUTE events in _step
These are for extensions.
2023-05-22 20:00:22 -05:00
True FantømandGarboMuffin 8a7ae3f774 Add LABEL BlockType (#132)
Co-authored-by: GarboMuffin <muffin@mailbox.org>
2023-05-17 23:54:03 -05:00
GarboMuffin 6124ba8b1e Allow name of addon blocks category to be translated
A bit overdue
2023-03-26 02:13:05 -05:00
GarboMuffin 50b42f9415 Update tw.blocks.openDocs message
Our l10n scripts now parse this dynamically
2023-03-26 02:12:04 -05:00
GarboMuffin c73f821abf Add ArgumentType.COSTUME and ArgumentType.SOUND 2023-03-25 14:33:57 -05:00
GarboMuffin 1ab111b7ca Fix using empty defaultValue for NUMBER arguments
Closes https://github.com/TurboWarp/extensions/issues/119
2023-03-25 13:54:44 -05:00
GarboMuffin 92a91f156a Consistently escape attributes in extension and block XML
While this is not believed to cause security bugs as this is not
interpeted as HTML, the inconsistent/no escaping causes bugs such as:
https://github.com/TurboWarp/extensions/issues/241

To resolve this, we now fully escape (hopefully) every value from
extensions that makes its way into XML, so now the characters:
    " ' < > &
can be used anywhere in extensions without issues, even opcodes,
argument names, field names, etc. Just not the extension ID.

Some parts of Scratch such as ExtensionManager._sanitizeID and
Runtime._convertPlaceholders tried to explicitly remove XML characters,
however the code was broken (they only removed the first occurrence) and
this seems like the wrong fix anyways. We can use XML characters, they just
need to be escaped.

Also includes a very comprehensive test.
2023-03-08 20:02:08 -06:00
GarboMuffin 6044a05139 Silence ESLint warning in runtime.js 2023-02-11 16:11:59 -06:00
GarboMuffin 4d4bea83e8 Use URI encoding instead of base64 for addon blocks icon
Fixes test errors as Node.js does not have btoa()
2022-12-11 17:05:20 -06:00
GarboMuffin 905f9b5434 Add proper icon for addon blocks 2022-12-04 12:18:55 -06:00
GarboMuffin c288c49837 No-op privacy enforcement if using a vanilla renderer
also fixes tests
2022-11-16 21:00:24 -06:00
GarboMuffin 2b265e55a0 Disable private skin access when cloud variables or custom extensions are used
This is a breaking change.
Replaces logic that was previously in our scratch-gui fork.
Upstream does the opposite; they disable cloud variables when video
sensing is used. We can't do the same because of custom extensions.
Disabling all custom extensions when video sensing is used would be too
limiting. The concern with custom extensions is not that they will steal
private skins, but that a project could use their blocks to fetch()
color information to a remote server similar to cloud variables.
The end result is not dissimilar: Cloud variables and video sensing
shouldn't be used together.
2022-11-16 20:52:31 -06:00
GarboMuffin 30a47a2b39 Allow addon blocks to be hidden 2022-11-12 01:09:25 -06:00
GarboMuffin c7309b96ab Remove addon block color parameters
The parameters didn't work in the way that you would expect. Only the
values provided in the first call to addAddonBlock would do anything,
and this gives a false impression that this will color the blocks in the
editor. Color options may be re-added in the future as part of a more
significant API update.
2022-11-12 01:08:09 -06:00
GarboMuffin 0fd98a6ac5 Allow addon block callback to return a Promise 2022-11-12 01:08:09 -06:00
GarboMuffin ab6d10f929 Remove tw-experimental-audio-optimizations
This now lives in TurboWarp/scratch-audio
2022-09-17 18:53:19 -05:00
GarboMuffin eb600cfcf8 Replace local extended JSON parser with @turbowarp/json 2022-08-14 19:45:30 -05:00
GarboMuffin 6db9599f2e Do not use md5 to generate asset IDs in packaged runtime mode
md5 unnecessary in this mode and slows project load by ~10%.
2022-08-05 00:18:09 -05:00
GarboMuffin b78dc53c8e Set runtime.isPackaged=true when convertToPackagedRuntime is called 2022-08-05 00:17:47 -05:00
GarboMuffin 9045311a98 Revert "Fix custom extension inputs with default value "" being converted to undefined"
This reverts commit 3afb16c831.
2022-08-02 13:05:17 -05:00
GarboMuffin 3afb16c831 Fix custom extension inputs with default value "" being converted to undefined 2022-07-27 16:09:39 -05:00
Thomas Weber c4fa4a84a8 Set Runtime.currentStepTime to a number by default instead of null 2022-07-09 16:28:28 -05:00
Thomas Weber f8ec0084ad Add Runtime#getNumberOfCloudVariables 2022-06-27 22:57:18 -05:00
Thomas Weber 930caca9de Don't allow negative framerates 2022-06-03 16:57:06 -05:00
Thomas Weber 27291b1c1f Make sure custom stage size is a round number and at least 1 2022-05-28 18:17:59 -05:00
Thomas Weber 2bbb32d759 Do not round monitor offset when resizing stage
Reduces error after many resizes
2022-03-13 14:12:35 -05:00
Thomas Weber 25e91e735c Preserve monitor position relative to center of stage when resizing stage 2022-03-12 20:36:37 -06:00
Thomas Weber 65304b59a6 Fix storing custom stage size when only one of width or height are stored 2022-03-01 22:22:22 -06:00
Thomas Weber 24cd822aa4 Only store project settings that don't match the default 2022-02-18 21:36:50 -06:00
Thomas Weber bf1156dd3f Add convertToPackagedRuntime stub 2022-02-12 15:59:43 -06:00
Thomas Weber b208444d93 Only resize renderer if stage size changed 2022-01-22 13:28:55 -06:00
Thomas Weber f833277201 Add stage size to stored project options 2022-01-16 17:31:26 -06:00
Thomas Weber 208b0818c2 Add Runtime.setStageSize helper and STAGE_SIZE_CHANGED event 2022-01-16 17:31:25 -06:00
Thomas Weber 5907ab0103 Reset cloud variable limit to 10 for compatibility reasons
We don't want people to make a project in TW with 20 cloud variables and then have issues importing it to Scratch.
The packager, which has no limit, will convert any variable that starts with ☁ to a cloud variable, so this can be worked around.
2021-12-30 16:26:16 -06:00
Thomas Weber 77945b9a04 Convert inEditor compiler option to separate setInEditor 2021-12-29 11:32:27 -06:00
Thomas Weber e1d0a70216 Add unused compiler option inEditor 2021-12-28 17:43:46 -06:00
Thomas Weber 87dc87c648 Fix a couple frame loop regressions 2021-12-13 20:45:49 -06:00
Thomas Weber 41eceef19b Refactor frame loop logic and make "0 FPS" use requestAnimationFrame instead of setInterval 2021-12-13 16:22:16 -06:00
Thomas Weber 521e7257d3 Set renderer.offscreenTouching if fencing is disabled 2021-11-09 18:35:44 -06:00
Thomas Weber 24d0b69bff Runtime-configurable cloud variable limit 2021-11-06 16:29:32 -05:00
Thomas Weber 084540630f Add more detailed message to stored settings comment 2021-09-15 18:14:13 -05:00
Thomas Weber 1c7c85a89d Move tw-emit-fast and tw-extended-json to util 2021-08-15 12:23:23 -05:00
Thomas Weber 3342b38ef2 Increase cloud variable limit to 100 2021-08-03 16:04:49 -05:00
Thomas Weber c1387a1e36 Remove trailing whitespace 2021-08-03 15:54:01 -05:00
Thomas Weber f03d397936 Revert "Allow name of addon blocks category to be translated"
This reverts commit e2fdfc5bf5.

It may be causing crashes.
2021-07-20 13:02:18 -05:00
Thomas Weber e2fdfc5bf5 Allow name of addon blocks category to be translated 2021-07-13 22:10:27 -05:00
Thomas Weber 573ce9dc1c Addon blocks should always be the top extension 2021-07-13 22:06:39 -05:00