Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud variable kill switch #7877

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DNin01
Copy link
Member

@DNin01 DNin01 commented Oct 22, 2024

Resolves #5111

Changes

Added a new addon called "Cloud variable kill switch". This addon adds an on/off switch next to the Cloud Variables extension chip.

A toggle button on the Cloud Variables extension chip

Clicking it to turn it off disconnects Cloud variables from the Cloud Data server, making them act like normal variables.

To turn them on again, the page must be reloaded. This is because you could exploit the ability to re-enable Cloud variables dynamically to do things you wouldn't normally be able to do like claim occupied player slots in multiplayer games.

Reason for changes

There are a few reasons a user may want to opt out of Cloud variables on a specific project:

  • Debugging: Sometimes you want to check for behavior when not connected to Cloud Data.
  • Single player: Sometimes you might not want to join multiplayer games.
  • Privacy: Some people don't like Cloud variables that purely record your activity.

Most users also want to still be able to use Cloud variables in general, so the switch is on by default.

Tests

I have tested this on scratch.mit.edu with Edge 130 / Windows 11.

Things to check

  • The toggle appears after the Cloud provider has connected
  • The toggle does not appear if Cloud Data is unavailable (e.g., you're signed out)
  • The toggle is OFF after entering the editor
    • (I think in its current state it just doesn't appear after leaving the editor, close enough)
  • Cloud variables work when the switch is ON and don't work when the switch is OFF

@DNin01 DNin01 added type: enhancement New feature for the project new addon Related to new addons to this extension. `scope: addons` should still be added. scope: addon Related to one or multiple addons labels Oct 22, 2024

if (addon.tab.traps.vm.runtime.hasCloudData()) {
let checkCnt = 0;
while (cloud.provider?.connection.readyState !== WebSocket.OPEN) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible optimization: do not enter while loop when signed out and for New Scratchers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new addon Related to new addons to this extension. `scope: addons` should still be added. scope: addon Related to one or multiple addons type: enhancement New feature for the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cloud variables kill switch
1 participant