Discuss Scratch

showierdata9978
Scratcher
100+ posts

Creating *Unsandboxed* extensions for Scratch 3.0


About unsandboxed extensions
unsandboxed extensions are scratch extensions that have full access to the scratch VM

benifits to unsandboxed mode

  1. Your extension has access to the scratch VM
  2. Your extension runs faster (usually)
  3. You have access to all browser api's


Some Examples
Everything in Scratch 3.0 *Unsandboxed* Extension Directory


The Guide itself

Precursor
The Creating extensions for Scratch 3.0 thread by NitroCipher is a precursor to this thread, and shows how to make scratch extentons that are sandboxed. but also does into detail on how to set your environment and extension class up


How to load unsandboxed extentions
        // major credit to CST for this (I did modify it some to allow sandboxed if you only want the speed boost (:
	const extensionClass = YourExt;
	if (Scratch) {
		if (Scratch.extensions.unsandboxed) {
			Scratch.extensions.register(new extensionClass(Scratch.vm));
		} else {
                        // comment out if you use VM things
			Scratch.extensions.register(new extensionClass());
                        // throw new Error("YourExt cannot run in sandboxed mode.");
		} 
	} else if (globalThis.vm) {
		// Support loading the extension "the old way"
		// (running the code in something like the browser console
		// or E羊icques' load_plugin URL parameter)
		const extensionInstance = new extensionClass(globalThis.vm);
		const serviceName = globalThis.vm.extensionManager._registerInternalExtension(
			extensionInstance
		);
		globalThis.vm.extensionManager._loadedExtensions.set(
			extensionInstance.getInfo().id, serviceName
		); 
	} else {
		throw new Error("Scratch Not detected"); // no idea if there is anything else i can do here
	};


Scratch VM Docs
There Is currently documentation of the Scratch VM, but it uses jsdoc. The Docs are not helpful. The url is here
Warning: it is on github pages, which is blocked by most schools

another good source of documentation is Turbowarp's type repo . Its helpful because you can load it into your TypeScript aware IDE and see all the vm's types and internals in intelisense.

Browser API Docs

The Most trusted Browser API docs are made by Mozilla. (the company that owns firefox). here are some useful links for making scratch extentions.

  1. https://developer.mozilla.org/en-US/docs/Web/API
  2. https://developer.mozilla.org/en-US/docs/Web/JavaScript
  3. https://developer.mozilla.org/en-US/docs/Web

The name of the web documentation is mdn (mozilla developer network) web docs. it has a github and a website.


FAQ


  1. jaxon_baxon wrote:

    this is incredibly interesting, unsandboxed extensions seem really useful. why haven't i heard of this??

    Because before a few weeks ago, you had to use internal Scratch.extentions.* methods

Last edited by showierdata9978 (Jan. 17, 2023 15:31:30)


High School Sophomore

I DO NOT CHECK SCRATCH UNLESS I AM EXTREMELY BOARD.
You can find me in a lot of places under the same username

https://github.com/showierdata9978

Problem ST?
know0your0true0color
Scratcher
100+ posts

Creating *Unsandboxed* extensions for Scratch 3.0

Suggestion: add example blocks for all block types that will do something(idk what)

Hi! I'm know0your0true0color, you can also call me Fresh
jaxon_baxon
Scratcher
11 posts

Creating *Unsandboxed* extensions for Scratch 3.0

this is incredibly interesting, unsandboxed extensions seem really useful. why haven't i heard of this??
showierdata9978
Scratcher
100+ posts

Creating *Unsandboxed* extensions for Scratch 3.0

– outdated information used to be here –

Last edited by showierdata9978 (Dec. 15, 2022 17:48:37)


High School Sophomore

I DO NOT CHECK SCRATCH UNLESS I AM EXTREMELY BOARD.
You can find me in a lot of places under the same username

https://github.com/showierdata9978

Problem ST?
CST1229
Scratcher
1000+ posts

Creating *Unsandboxed* extensions for Scratch 3.0

I have also made an extension (st: not a browser extension!) that can only run unsandboxed by the way (to load images from URL and stamp them onto the stage).
(does this count as advertising?)

Last edited by CST1229 (Oct. 4, 2022 17:12:01)


This is a signature. It's a piece of text that appears below every post I write. Click here to learn more, including how to make your own.
RIP assets image hosting. 2013?-2023



know0your0true0color
Scratcher
100+ posts

Creating *Unsandboxed* extensions for Scratch 3.0

Bump!
Great to see some recognition!

Hi! I'm know0your0true0color, you can also call me Fresh
showierdata9978
Scratcher
100+ posts

Creating *Unsandboxed* extensions for Scratch 3.0

CST1229 wrote:

I have also made an extension (st: not a browser extension!) that can only run unsandboxed by the way (to load images from URL and stamp them onto the stage).
(does this count as advertising?)

il just add it as an example!

and no its does not (for me atleast)

High School Sophomore

I DO NOT CHECK SCRATCH UNLESS I AM EXTREMELY BOARD.
You can find me in a lot of places under the same username

https://github.com/showierdata9978

Problem ST?
DifferentDance8
Scratcher
1000+ posts

Creating *Unsandboxed* extensions for Scratch 3.0

showierdata9978 wrote:

They have to be injected with nono word
Wait a second, nono word allows you to load unsandboxed extensions?

R.I.P Zydrolic, 2023-2024
know0your0true0color
Scratcher
100+ posts

Creating *Unsandboxed* extensions for Scratch 3.0

DifferentDance8 wrote:

showierdata9978 wrote:

They have to be injected with nono word
Wait a second, nono word allows you to load unsandboxed extensions?
no i dont think so
you have to load them with a bookmarklet(bookmark that runs js) or
https://sheeptester.github.io/scratch-gui/?load_plugin=(url)
i dont think bookmarklet is a nono word on here

Last edited by know0your0true0color (Oct. 6, 2022 13:56:10)


Hi! I'm know0your0true0color, you can also call me Fresh
showierdata9978
Scratcher
100+ posts

Creating *Unsandboxed* extensions for Scratch 3.0

– outdated information used to be here –

Last edited by showierdata9978 (Dec. 15, 2022 17:49:25)


High School Sophomore

I DO NOT CHECK SCRATCH UNLESS I AM EXTREMELY BOARD.
You can find me in a lot of places under the same username

https://github.com/showierdata9978

Problem ST?
know0your0true0color
Scratcher
100+ posts

Creating *Unsandboxed* extensions for Scratch 3.0

showierdata9978 wrote:

DifferentDance8 wrote:

showierdata9978 wrote:

They have to be injected with nono word
Wait a second, nono word allows you to load unsandboxed extensions?

Ye, using one that can inject javascript into pages
you can also use sheeptesters scratch GUI
i made a bookmarklet that can inject scratch extensions
javascript:(function()%7Bfetch(prompt('url%3F')).then(r%3D>r.text()).then(t%3D>eval(t))%7D)()%3B
make a bookmark in your browser with this as the url
click on it to use

Last edited by know0your0true0color (Oct. 6, 2022 18:11:35)


Hi! I'm know0your0true0color, you can also call me Fresh
CST1229
Scratcher
1000+ posts

Creating *Unsandboxed* extensions for Scratch 3.0

know0your0true0color wrote:

(#11)

showierdata9978 wrote:

DifferentDance8 wrote:

showierdata9978 wrote:

They have to be injected with nono word
Wait a second, nono word allows you to load unsandboxed extensions?

Ye, using one that can inject javascript into pages
you can also use sheeptesters scratch GUI
i made a bookmarklet that can inject scratch extensions
javascriptfunction()%7Bfetch(prompt('url%3F')).then(r%3D>r.text()).then(t%3D>eval(t))%7D)()%3B
replace the sad face with a : and a ( combined
make a bookmark in your browser with this as the url
click on it to use
Use [code][/code] tags:
javascript:(function()%7Bfetch(prompt('url%3F')).then(r%3D>r.text()).then(t%3D>eval(t))%7D)()%3B

This is a signature. It's a piece of text that appears below every post I write. Click here to learn more, including how to make your own.
RIP assets image hosting. 2013?-2023



know0your0true0color
Scratcher
100+ posts

Creating *Unsandboxed* extensions for Scratch 3.0

CST1229 wrote:

know0your0true0color wrote:

(#11)

showierdata9978 wrote:

DifferentDance8 wrote:

showierdata9978 wrote:

They have to be injected with nono word
Wait a second, nono word allows you to load unsandboxed extensions?

Ye, using one that can inject javascript into pages
you can also use sheeptesters scratch GUI
i made a bookmarklet that can inject scratch extensions
javascriptfunction()%7Bfetch(prompt('url%3F')).then(r%3D>r.text()).then(t%3D>eval(t))%7D)()%3B
replace the sad face with a : and a ( combined
make a bookmark in your browser with this as the url
click on it to use
Use [code][/code] tags:
javascript:(function()%7Bfetch(prompt('url%3F')).then(r%3D>r.text()).then(t%3D>eval(t))%7D)()%3B
thx

Hi! I'm know0your0true0color, you can also call me Fresh
showierdata9978
Scratcher
100+ posts

Creating *Unsandboxed* extensions for Scratch 3.0

Scriptlets do not work on firefox it seems like

High School Sophomore

I DO NOT CHECK SCRATCH UNLESS I AM EXTREMELY BOARD.
You can find me in a lot of places under the same username

https://github.com/showierdata9978

Problem ST?
know0your0true0color
Scratcher
100+ posts

Creating *Unsandboxed* extensions for Scratch 3.0

Suggestion: add GameUtils as a example(also include the topic link)

Hi! I'm know0your0true0color, you can also call me Fresh
showierdata9978
Scratcher
100+ posts

Creating *Unsandboxed* extensions for Scratch 3.0

– outdated information used to be here –

Last edited by showierdata9978 (Dec. 15, 2022 17:50:01)


High School Sophomore

I DO NOT CHECK SCRATCH UNLESS I AM EXTREMELY BOARD.
You can find me in a lot of places under the same username

https://github.com/showierdata9978

Problem ST?
CST1229
Scratcher
1000+ posts

Creating *Unsandboxed* extensions for Scratch 3.0

showierdata9978 wrote:

(#16)

DifferentDance8 wrote:

showierdata9978 wrote:

They have to be injected with nono word
Wait a second, nono word allows you to load unsandboxed extensions?

yes there are nonoword js, html, css injectors that you can use to run JavaScript in a tab
On Scratch, “nono word” usually refers to a specific browser extension for Scratch and not any browser extension.

This is a signature. It's a piece of text that appears below every post I write. Click here to learn more, including how to make your own.
RIP assets image hosting. 2013?-2023



know0your0true0color
Scratcher
100+ posts

Creating *Unsandboxed* extensions for Scratch 3.0

Imagine if this got stickied

Hi! I'm know0your0true0color, you can also call me Fresh
know0your0true0color
Scratcher
100+ posts

Creating *Unsandboxed* extensions for Scratch 3.0

bump!

Hi! I'm know0your0true0color, you can also call me Fresh
ohman_soonsoon
Scratcher
27 posts

Creating *Unsandboxed* extensions for Scratch 3.0

i wanna make admireblocks+ with this, but do i need to require ‘async’ and ‘try’ when making the block functions?

Drannamongtime, the creator of the scratch extension “Admireblocks”.

[Admireblocks] to BASE64  :: reporter :: #8b7fc9
BASE64 [QWRtaXJlYmxvY2tz] To text :: reporter :: #8b7fc9

(item [last v] of [this v] :: list)

Powered by DjangoBB