Skip to content

Commit bfa4593

Browse files
committed
collaboration addon source code + switch to JWT based API
1 parent 6342045 commit bfa4593

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+7875
-701
lines changed

.vscode/settings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"files.watcherExclude": {
3+
"**/.git/objects/**": true,
4+
"**/.git/subtree-cache/**": true,
5+
"**/.hg/store/**": true,
6+
"**/.dart_tool": true,
7+
"**/.git/**": true,
8+
"**/node_modules/**": true,
9+
"**/.vscode/**": true
10+
}
11+
}

LICENSING_CLARIFICATION.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Licensing Clarification for TurboWarp Fork
2+
3+
## Plain-English Explanation
4+
5+
* **Open-Source Frontend (GPLv3):** The modified TurboWarp code in this repository is fully open source under **GNU GPL version 3**. We provide the complete source and license text here, so we are in full compliance with GPLv3. All changes to the TurboWarp frontend are also released under GPLv3.
6+
7+
* **Separate Proprietary Backend:** Our system also has a proprietary backend API (for saving/loading projects) and a proprietary main frontend (on another domain). **These are not included or distributed in this repository.** They remain private and closed-source.
8+
9+
* **Normal Web Communication:** The TurboWarp frontend (served from `blockcompiler.codetorch.net`) runs in the browser and talks to our backend over regular HTTP/REST calls. This is just like any two separate programs talking over the network. According to the Free Software Foundation’s GPL FAQ, communication via sockets/HTTP is a **normal arms‑length interface** between independent programs. In other words, embedding the GPL frontend in an iframe and calling the backend API does **not** fuse them into one combined program.
10+
11+
* **No “GPL Infection” Across Network:** Because the frontend and backend only communicate over the network, the backend remains independent. The GPL’s copyleft only “infects” derived works that are distributed together as one program. Since our backend is neither combined into the GPL code nor distributed with it, the GPL does not require the backend’s source to be disclosed.
12+
13+
* **No Distribution of Backend Code:** Crucially, we never distribute the proprietary backend code (nor the proprietary frontend code). The GPL’s requirements kick in only when you “convey” or distribute the software. Running the software on our servers and letting users interact with it does **not** count as distributing it under GPLv3. The GPL FAQ explicitly says a company can run a modified GPL program on a website **without** releasing its source, because it was never actually conveyed to users.
14+
15+
* **Bottom Line for Developers:** In simple terms, **we comply fully with GPLv3 for the TurboWarp frontend**, and we clarify that the closed-source backend/main frontend are entirely separate. Calling our API from the GPL frontend does not impose GPL obligations on the backend. This setup (open GPL frontend + closed proprietary backend) is a common approach: it allows everyone to use and improve the open client code while keeping the private server code proprietary.
16+
17+
## Formal Legal Notice
18+
19+
1. **GPLv3 Frontend Compliance:** The TurboWarp-derived code in this repository is licensed under the **GNU General Public License version 3 (GPLv3)**. All source code for the modified frontend is made available here under GPLv3, in accordance with Section 6 of the GPLv3. This ensures full compliance with the license terms for any distributed or modified copies of the frontend.
20+
21+
2. **Separate Proprietary Components:** The proprietary backend API and the proprietary main frontend (hosted on a separate domain) are independent programs. They communicate with the GPL-licensed frontend solely via standard web protocols (HTTP/REST). As the Free Software Foundation’s GPL FAQ explains, communication by sockets or HTTP “is normally used between two separate programs”. Therefore, these proprietary components are **not combined** into the GPL-covered work, but merely **aggregated** with it in an arms‑length fashion.
22+
23+
3. **No Derivative Work or GPL Extension:** Because the frontend and backend remain separate programs, the proprietary backend and frontend code are **not derivative works** of the GPL code. Consequently, the GPLv3 copyleft obligations do not extend to those proprietary components. This is consistent with GPL guidance that distributing GPL software alongside proprietary software with only network-level communication does **not** force the proprietary code to become GPL.
24+
25+
4. **Non-Distribution of Backend Code:** The proprietary backend code is **never distributed** in binary or source form to users of this project. Under GPLv3, obligations to provide source apply only to conveyed copies. As noted in the GPL FAQ, running or serving a GPL program on a server (“making it available over a network”) does not count as distribution of the program itself. Thus, since the backend is only accessed remotely and not conveyed, GPLv3 imposes no requirement to disclose its source. (Had a network distribution trigger been desired, an Affero GPL would be required; see FSF explanation.)
26+
27+
5. **Conclusion:** In summary, all code in this repository remains under GPLv3 and fully complies with that license. The proprietary backend and proprietary main frontend are independent and closed-source, and their interaction with the GPL frontend via HTTP/iframe does not violate GPLv3. This structure is legally permissible under GPLv3 as interpreted by the FSF. Users are free to use, modify, and redistribute the TurboWarp frontend code under GPLv3, and the proprietary components remain exempt from GPL source-disclosure obligations because they are not derived from or distributed with the GPL-covered code.
28+
29+
**Sources:** This notice is based on the GNU GPLv3 license text and the FSF’s GNU GPL FAQ guidance, including clarifications that networked communication (sockets/HTTP) between GPL and non-GPL software generally does not create a single combined work, and that running a modified GPL program on a server without distributing it does not require publishing its source. These principles ensure that our use of the proprietary API and frontend does not extend GPL obligations beyond the open TurboWarp code.

README.md

Lines changed: 20 additions & 294 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,33 @@
11
## CodeTorch Block Compiler
22

3-
Modified version of TurboWarp (a modified version of Scratch) for use in the `CodeTorch Block Compiler Parent` project. ([CodeTorch Block Compiler Parent](https://github.com/CodeTorchNET/Block-Compiler-Parent))
3+
This repository contains a modified version of **TurboWarp** (itself a modified version of Scratch) adapted for the CodeTorch project.
44

5-
For setup instructions, follow [these steps](https://github.com/CodeTorchNET/Block-Compiler-Parent?tab=readme-ov-file#step-4-install-the-compiler) to install the compiler. If you'd like to set up the entire project, refer to the complete [installation guide](https://github.com/CodeTorchNET/Block-Compiler-Parent?tab=readme-ov-file#installation-guide).
5+
### Licensing
66

7+
* **GPLv3 Code**
8+
All code modifications to TurboWarp/Scratch are licensed under the GNU General Public License version 3 (GPLv3), per the original license terms.
79

8-
NOTE: The SVG assets located at src/lib/default-project/frame1.svg and src/lib/default-project/frame2.svg are not distributed under the GNU Affero General Public License (AGPL). These specific assets are proprietary and are governed by separate licensing terms. They are provided solely for use within the context of the CodeTorch organization and website. Redistribution, modification, or use in derivative works is strictly prohibited without the express written consent of the copyright holder.
10+
* **Proprietary Assets**
11+
The SVG files located at:
912

10-
<br>
11-
<br>
12-
<br>
13-
<br>
14-
<br>
15-
<br>
16-
<br>
17-
<br>
18-
<br>
19-
<br>
20-
<br>
21-
<br>
22-
<br>
23-
<br>
24-
<br>
25-
<br>
26-
<br>
27-
<br>
28-
<br>
13+
- `src/lib/default-project/frame1.svg`
14+
- `src/lib/default-project/frame2.svg`
15+
16+
are **not** covered by AGPL. They are proprietary to CodeTorch and licensed only for use within the CodeTorch ecosystem. Redistribution or modification outside CodeTorch is prohibited without express written consent.
2917

3018
---
3119

32-
scratch-gui modified for use in [TurboWarp](https://turbowarp.org/)
20+
# Why is the rest of CodeTorch closed-source?
21+
22+
For a detailed explanation of our licensing approach and how we comply with open-source requirements, please see [LICENSING_CLARIFICATION.md](./LICENSING_CLARIFICATION.md).
23+
24+
---
25+
26+
27+
<br>
28+
<br>
3329

30+
README from original turbowarp repository:
3431
## Setup
3532

3633
See https://docs.turbowarp.org/development/getting-started to setup the complete TurboWarp environment.
@@ -57,274 +54,3 @@ Redistribution and use in source and binary forms, with or without modification,
5754
5855
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5956
```
60-
61-
src/lib/default-project/dango.svg is based on [Twemoji](https://twemoji.twitter.com/) and is licensed under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
62-
63-
<!--
64-
65-
# scratch-gui
66-
#### Scratch GUI is a set of React components that comprise the interface for creating and running Scratch 3.0 projects
67-
68-
## Installation
69-
This requires you to have Git and Node.js installed.
70-
71-
In your own node environment/application:
72-
```bash
73-
npm install https://github.com/LLK/scratch-gui.git
74-
```
75-
If you want to edit/play yourself:
76-
```bash
77-
git clone https://github.com/LLK/scratch-gui.git
78-
cd scratch-gui
79-
npm install
80-
```
81-
82-
**You may want to add `--depth=1` to the `git clone` command because there are some [large files in the git repository history](https://github.com/LLK/scratch-gui/issues/5140).**
83-
84-
## Getting started
85-
Running the project requires Node.js to be installed.
86-
87-
## Running
88-
Open a Command Prompt or Terminal in the repository and run:
89-
```bash
90-
npm start
91-
```
92-
Then go to [http://localhost:8601/](http://localhost:8601/) - the playground outputs the default GUI component
93-
94-
## Developing alongside other Scratch repositories
95-
96-
### Getting another repo to point to this code
97-
98-
99-
If you wish to develop `scratch-gui` alongside other scratch repositories that depend on it, you may wish
100-
to have the other repositories use your local `scratch-gui` build instead of fetching the current production
101-
version of the scratch-gui that is found by default using `npm install`.
102-
103-
Here's how to link your local `scratch-gui` code to another project's `node_modules/scratch-gui`.
104-
105-
#### Configuration
106-
107-
1. In your local `scratch-gui` repository's top level:
108-
1. Make sure you have run `npm install`
109-
2. Build the `dist` directory by running `BUILD_MODE=dist npm run build`
110-
3. Establish a link to this repository by running `npm link`
111-
112-
2. From the top level of each repository (such as `scratch-www`) that depends on `scratch-gui`:
113-
1. Make sure you have run `npm install`
114-
2. Run `npm link scratch-gui`
115-
3. Build or run the repository
116-
117-
#### Using `npm run watch`
118-
119-
Instead of `BUILD_MODE=dist npm run build`, you can use `BUILD_MODE=dist npm run watch` instead. This will watch for changes to your `scratch-gui` code, and automatically rebuild when there are changes. Sometimes this has been unreliable; if you are having problems, try going back to `BUILD_MODE=dist npm run build` until you resolve them.
120-
121-
#### Oh no! It didn't work!
122-
123-
If you can't get linking to work right, try:
124-
* Follow the recipe above step by step and don't change the order. It is especially important to run `npm install` _before_ `npm link` as installing after the linking will reset the linking.
125-
* Make sure the repositories are siblings on your machine's file tree, like `.../.../MY_SCRATCH_DEV_DIRECTORY/scratch-gui/` and `.../.../MY_SCRATCH_DEV_DIRECTORY/scratch-www/`.
126-
* Consistent node.js version: If you have multiple Terminal tabs or windows open for the different Scratch repositories, make sure to use the same node version in all of them.
127-
* If nothing else works, unlink the repositories by running `npm unlink` in both, and start over.
128-
129-
## Testing
130-
### Documentation
131-
132-
You may want to review the documentation for [Jest](https://facebook.github.io/jest/docs/en/api.html) and [Enzyme](http://airbnb.io/enzyme/docs/api/) as you write your tests.
133-
134-
See [jest cli docs](https://facebook.github.io/jest/docs/en/cli.html#content) for more options.
135-
136-
### Running tests
137-
138-
*NOTE: If you're a Windows user, please run these scripts in Windows `cmd.exe` instead of Git Bash/MINGW64.*
139-
140-
Before running any tests, make sure you have run `npm install` from this (scratch-gui) repository's top level.
141-
142-
#### Main testing command
143-
144-
To run linter, unit tests, build, and integration tests, all at once:
145-
```bash
146-
npm test
147-
```
148-
149-
#### Running unit tests
150-
151-
To run unit tests in isolation:
152-
```bash
153-
npm run test:unit
154-
```
155-
156-
To run unit tests in watch mode (watches for code changes and continuously runs tests):
157-
```bash
158-
npm run test:unit -- --watch
159-
```
160-
161-
You can run a single file of integration tests (in this example, the `button` tests):
162-
163-
```bash
164-
$(npm bin)/jest --runInBand test/unit/components/button.test.jsx
165-
```
166-
167-
#### Running integration tests
168-
169-
Integration tests use a headless browser to manipulate the actual HTML and javascript that the repo
170-
produces. You will not see this activity (though you can hear it when sounds are played!).
171-
172-
Note that integration tests require you to first create a build that can be loaded in a browser:
173-
174-
```bash
175-
npm run build
176-
```
177-
178-
Then, you can run all integration tests:
179-
180-
```bash
181-
npm run test:integration
182-
```
183-
184-
Or, you can run a single file of integration tests (in this example, the `backpack` tests):
185-
186-
```bash
187-
$(npm bin)/jest --runInBand test/integration/backpack.test.js
188-
```
189-
190-
If you want to watch the browser as it runs the test, rather than running headless, use:
191-
192-
```bash
193-
USE_HEADLESS=no $(npm bin)/jest --runInBand test/integration/backpack.test.js
194-
```
195-
196-
_Note: If you are seeing failed tests related to `chromedriver` being incompatible with your version of Chrome, you may need to update `chromedriver` with:_
197-
198-
```bash
199-
npm install chromedriver@{version}
200-
```
201-
202-
## Troubleshooting
203-
204-
### Ignoring optional dependencies
205-
206-
When running `npm install`, you can get warnings about optional dependencies:
207-
208-
```
209-
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
210-
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.2.7
211-
```
212-
213-
You can suppress them by adding the `no-optional` switch:
214-
215-
```
216-
npm install --no-optional
217-
```
218-
219-
Further reading: [Stack Overflow](https://stackoverflow.com/questions/36725181/not-compatible-with-your-operating-system-or-architecture-fsevents1-0-11)
220-
221-
### Resolving dependencies
222-
223-
When installing for the first time, you can get warnings that need to be resolved:
224-
225-
```
226-
npm WARN eslint-config-scratch@5.0.0 requires a peer of babel-eslint@^8.0.1 but none was installed.
227-
npm WARN eslint-config-scratch@5.0.0 requires a peer of eslint@^4.0 but none was installed.
228-
npm WARN scratch-paint@0.2.0-prerelease.20190318170811 requires a peer of react-intl-redux@^0.7 but none was installed.
229-
npm WARN scratch-paint@0.2.0-prerelease.20190318170811 requires a peer of react-responsive@^4 but none was installed.
230-
```
231-
232-
You can check which versions are available:
233-
234-
```
235-
npm view react-intl-redux@0.* version
236-
```
237-
238-
You will need to install the required version:
239-
240-
```
241-
npm install --no-optional --save-dev react-intl-redux@^0.7
242-
```
243-
244-
The dependency itself might have more missing dependencies, which will show up like this:
245-
246-
```
247-
user@machine:~/sources/scratch/scratch-gui (491-translatable-library-objects)$ npm install --no-optional --save-dev react-intl-redux@^0.7
248-
scratch-gui@0.1.0 /media/cuideigin/Linux/sources/scratch/scratch-gui
249-
├── react-intl-redux@0.7.0
250-
└── UNMET PEER DEPENDENCY react-responsive@5.0.0
251-
```
252-
253-
You will need to install those as well:
254-
255-
```
256-
npm install --no-optional --save-dev react-responsive@^5.0.0
257-
```
258-
259-
Further reading: [Stack Overflow](https://stackoverflow.com/questions/46602286/npm-requires-a-peer-of-but-all-peers-are-in-package-json-and-node-modules)
260-
261-
## Troubleshooting
262-
263-
If you run into npm install errors, try these steps:
264-
1. run `npm cache clean --force`
265-
2. Delete the node_modules directory
266-
3. Delete package-lock.json
267-
4. run `npm install` again
268-
269-
## Publishing to GitHub Pages
270-
You can publish the GUI to github.io so that others on the Internet can view it.
271-
[Read the wiki for a step-by-step guide.](https://github.com/LLK/scratch-gui/wiki/Publishing-to-GitHub-Pages)
272-
273-
## Understanding the project state machine
274-
275-
Since so much code throughout scratch-gui depends on the state of the project, which goes through many different phases of loading, displaying and saving, we created a "finite state machine" to make it clear which state it is in at any moment. This is contained in the file src/reducers/project-state.js .
276-
277-
It can be hard to understand the code in src/reducers/project-state.js . There are several types of data and functions used, which relate to each other:
278-
279-
### Loading states
280-
281-
These include state constant strings like:
282-
283-
* `NOT_LOADED` (the default state),
284-
* `ERROR`,
285-
* `FETCHING_WITH_ID`,
286-
* `LOADING_VM_WITH_ID`,
287-
* `REMIXING`,
288-
* `SHOWING_WITH_ID`,
289-
* `SHOWING_WITHOUT_ID`,
290-
* etc.
291-
292-
### Transitions
293-
294-
These are names for the action which causes a state change. Some examples are:
295-
296-
* `START_FETCHING_NEW`,
297-
* `DONE_FETCHING_WITH_ID`,
298-
* `DONE_LOADING_VM_WITH_ID`,
299-
* `SET_PROJECT_ID`,
300-
* `START_AUTO_UPDATING`,
301-
302-
### How transitions relate to loading states
303-
304-
Like this diagram of the project state machine shows, various transition actions can move us from one loading state to another:
305-
306-
![Project state diagram](docs/project_state_diagram.svg)
307-
308-
_Note: for clarity, the diagram above excludes states and transitions relating to error handling._
309-
310-
#### Example
311-
312-
Here's an example of how states transition.
313-
314-
Suppose a user clicks on a project, and the page starts to load with URL https://scratch.mit.edu/projects/123456 .
315-
316-
Here's what will happen in the project state machine:
317-
318-
![Project state example](docs/project_state_example.png)
319-
320-
1. When the app first mounts, the project state is `NOT_LOADED`.
321-
2. The `SET_PROJECT_ID` redux action is dispatched (from src/lib/project-fetcher-hoc.jsx), with `projectId` set to `123456`. This transitions the state from `NOT_LOADED` to `FETCHING_WITH_ID`.
322-
3. The `FETCHING_WITH_ID` state. In src/lib/project-fetcher-hoc.jsx, the `projectId` value `123456` is used to request the data for that project from the server.
323-
4. When the server responds with the data, src/lib/project-fetcher-hoc.jsx dispatches the `DONE_FETCHING_WITH_ID` action, with `projectData` set. This transitions the state from `FETCHING_WITH_ID` to `LOADING_VM_WITH_ID`.
324-
5. The `LOADING_VM_WITH_ID` state. In src/lib/vm-manager-hoc.jsx, we load the `projectData` into Scratch's virtual machine ("the vm").
325-
6. When loading is done, src/lib/vm-manager-hoc.jsx dispatches the `DONE_LOADING_VM_WITH_ID` action. This transitions the state from `LOADING_VM_WITH_ID` to `SHOWING_WITH_ID`
326-
7. The `SHOWING_WITH_ID` state. Now the project appears normally and is playable and editable.
327-
328-
## Donate
329-
We provide [Scratch](https://scratch.mit.edu) free of charge, and want to keep it that way! Please consider making a [donation](https://www.scratchfoundation.org/donate) to support our continued engineering, design, community, and resource development efforts. Donations of any size are appreciated. Thank you!
330-
-->

0 commit comments

Comments
 (0)