Skip to content

About

Web requests in vanilla Scratch 3.0

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

41 Commits

Folders and files

Repository files navigation

ScratchWeb

Web requests in vanilla Scratch 3.0

Setup

  • Create a certificate. Name it server.crt with the key file named server.key.
  • Install the requirements.txt dependencies
  • Simply add 127.0.0.1 translate-service.scratch.mit.edu to your hosts file (on windows - untested on linux Linux works too - untested on macOS)
  • Run server.py
  • Add a security exception for translate-service.scratch.mit.edu in your browser; the certificate is self-signed, and therefore, insecure

How it works

translate

When the translate feature is used in Scratch, It sends an HTTP GET request to translate-service.scratch.mit.edu. inspect

Route the translate-service.scratch.mit.edu to localhost in the Hosts File. hosts-file

Create a custom script to interpret the text and language to make a web request. script

Usage (HTTP)

  • Import the translate extension to the project.
  • Translate text in the following format:
https://example.com|body
        ^^          ^^
        URL        Body
               If applicable;
                 Leave empty
                 if not used
                (Keep the |)
  • To one of these languages:
Language Method Uses Body?
Amharic GET No
Arabic POST Yes
Azerbaijani PUT Yes
Basque DELETE No
Bulgarian PATCH Yes
Catalan OPTIONS No
  • The response will be in this format:
status|filetype|body <- Body
  ^^      ^^<< Filetype
Status code    h = Html
               c = Css
               t = plainText
               i = Image (base64 encoded)
               d = Data (lowercase hex encoded)
               n = http (Network) header
               j = Json

Usage (WebSocket)

  • Translate text in the following format:
wss://example.com|data
       ^^          ^^
       URL        Data to send
  • Language is irrelevant.
  • The response will be in this format:
response
   ^^
Server response

About

Web requests in vanilla Scratch 3.0

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages