Skip to content

Latest commit

 

History

History
83 lines (64 loc) · 2.39 KB

README.md

File metadata and controls

83 lines (64 loc) · 2.39 KB

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;
               Don't include
               if not used
  • 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
  ^^      ^^     ^^
Status Filetype  Body
 code  h = Html (text/html)
       c = Css (text/css)
       t = plainText (text/plain)
       i = Image (base64 encoded) (image/*)
       d = Data (lowercase hex encoded) (*/*)
       n = Network header (application/http)
       j = Json (application/json)
       x = Xml (*/xml)

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