Skip to content

Commit 1062966

Browse files
committed
🐞 fix(ζ‰“εŒ…): ι€‚ι…ζ‰“εŒ…
1 parent 98b2b34 commit 1062966

7 files changed

Lines changed: 96 additions & 17 deletions

File tree

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
name: Release
22

33
on:
4-
push:
5-
tags:
6-
- 'v*'
4+
workflow_dispatch:
75

86
jobs:
97
release:
@@ -15,19 +13,46 @@ jobs:
1513

1614
steps:
1715
- uses: actions/checkout@v2
16+
with:
17+
persist-credentials: false
1818
- name: Install Node.js
1919
uses: actions/setup-node@v1
2020
with:
2121
node-version: 12.x
22+
- name: Set Personal Access Token
23+
run: git config --global url."https://${{ secrets.USER_TOKEN }}@github.com/".insteadOf ssh://git@github.com/
24+
2225
- name: Install Dependencies
23-
run: npm ci
26+
run: npm install
2427
- name: Download Library Files
2528
run: npm run fetch
29+
30+
- name: Checkout e-ducation/scratch-vm
31+
uses: actions/checkout@v2
32+
with:
33+
repository: e-ducation/scratch-vm
34+
token: ${{ secrets.USER_TOKEN }}
35+
ref: dev
36+
path: scratch-vm
37+
38+
- name: Checkout e-ducation/scratch-gui
39+
uses: actions/checkout@v2
40+
with:
41+
repository: e-ducation/scratch-gui
42+
token: ${{ secrets.USER_TOKEN }}
43+
ref: dev
44+
path: scratch-gui
45+
46+
- name: resolve extension files
47+
run: |
48+
cp -r ./scratch-vm/src/extensions ./node_modules/scratch-vm/src
49+
cp -r ./scratch-gui/src/lib/libraries/extensions ./node_modules/scratch-gui/src/lib/libraries
50+
2651
- name: Compile
2752
run: npm run compile
2853
env:
29-
NODE_OPTIONS: --max-old-space-size=4096
54+
NODE_OPTIONS: --max-old-space-size=10000
3055
- name: Package and Publish
3156
run: npx --no-install electron-builder --publish always
3257
env:
33-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
GH_TOKEN: ${{ secrets.USER_TOKEN }}

β€Žpackage.jsonβ€Ž

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "turbowarp-desktop",
2+
"name": "codelab-turbowarp-desktop",
33
"description": "Desktop app for TurboWarp",
4-
"version": "0.5.0",
4+
"version": "0.1.1",
55
"license": "GPL-3.0",
66
"author": {
77
"email": "contact@turbowarp.org",
@@ -21,6 +21,8 @@
2121
"devDependencies": {
2222
"@babel/preset-env": "^7.12.16",
2323
"@babel/preset-react": "^7.13.13",
24+
"@babel/plugin-transform-modules-commonjs": "7.14.5",
25+
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
2426
"css-loader": "^5.0.2",
2527
"electron": "^12.0.7",
2628
"electron-builder": "22.10.5",
@@ -30,7 +32,7 @@
3032
"postcss-import": "^14.0.0",
3133
"postcss-loader": "^4.2.0",
3234
"postcss-simple-vars": "^6.0.3",
33-
"scratch-gui": "github:TurboWarp/scratch-gui#desktop",
35+
"scratch-gui": "github:CodeLabClub/scratch-gui-turbowarp#desktop",
3436
"semver": "^7.3.4",
3537
"webpack": "~4.46.0",
3638
"write-file-atomic": "^3.0.3"
@@ -45,8 +47,8 @@
4547
"email": "contact@turbowarp.org"
4648
},
4749
"build": {
48-
"appId": "org.turbowarp.desktop",
49-
"productName": "TurboWarp",
50+
"appId": "org.codelab.turbowarp.desktop",
51+
"productName": "CodeLab TurboWarp",
5052
"win": {
5153
"artifactName": "${productName} Setup ${version}.${ext}",
5254
"icon": "build/icon.ico",
@@ -154,7 +156,7 @@
154156
{
155157
"provider": "github",
156158
"repo": "desktop",
157-
"owner": "TurboWarp"
159+
"owner": "CodeLabClub"
158160
}
159161
]
160162
},

β€Žsrc/main/index.jsβ€Ž

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ extensionNames.set('sprite3', 'Scratch 3 Sprite');
3434
extensionNames.set('txt', 'Text Document');
3535
extensionNames.set('webm', 'WebM Video');
3636

37+
app.commandLine.appendSwitch('ignore-certificate-errors', 'true');
38+
39+
const isSafeOpenExternal = () => true
40+
/*
3741
const isSafeOpenExternal = (url) => {
3842
try {
3943
const parsedUrl = new URL(url);
@@ -51,6 +55,7 @@ const isSafeOpenExternal = (url) => {
5155
}
5256
return false;
5357
};
58+
*/
5459

5560
if (isMac) {
5661
Menu.setApplicationMenu(Menu.buildFromTemplate([
@@ -554,7 +559,7 @@ if (acquiredLock) {
554559
});
555560

556561
app.on('ready', () => {
557-
checkForUpdate();
562+
// checkForUpdate();
558563
autoCreateEditorWindows();
559564
});
560565
} else {

β€Žsrc/main/preload.jsβ€Ž

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,16 @@ contextBridge.exposeInMainWorld('electron', {
1616
}
1717
}
1818
});
19+
20+
contextBridge.exposeInMainWorld(
21+
'preload',
22+
{
23+
init: () => {
24+
if (process.env.NODE_ENV !== 'development') {
25+
return require('path').join(__dirname, '/static').replace(/\\/g, '\\\\');
26+
} else {
27+
return '/static';
28+
}
29+
}
30+
}
31+
)

β€Žsrc/renderer/index.jsβ€Ž

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import './normalize.css';
22
import './prompt-impl';
33

4+
window.__static = window.preload.init()
5+
6+
if (!window.globalThis) {
7+
window.globalThis = window;
8+
}
9+
410
const searchParams = new URLSearchParams(location.search);
511
const route = searchParams.get('route');
612

β€Žsrc/renderer/template.htmlβ€Ž

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<html>
33
<head>
44
<meta charset="UTF-8">
5-
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'unsafe-eval' 'unsafe-inline' 'self' blob:; style-src 'unsafe-inline' 'self'; img-src 'self' data:; media-src 'self'; font-src data:; connect-src 'self' data: https://synthesis-service.scratch.mit.edu https://translate-service.scratch.mit.edu/ wss://device-manager.scratch.mit.edu:20110">
65
<!-- electron-webpack always inserts some weird scripts, stub require() to avoid errors -->
76
<script>
87
window.require = (m) => {
@@ -11,6 +10,18 @@
1110
throw new Error("That's something I can not allow.");
1211
};
1312
</script>
13+
<script id="syncload">
14+
function loadScriptAsync(url) {
15+
var head = document.getElementsByTagName("head")[0];
16+
var s = document.createElement("script");
17+
s.src = url;
18+
let referenceNode = document.querySelector('script#syncload')
19+
referenceNode.parentNode.insertBefore(s, referenceNode.nextSibling);
20+
}
21+
loadScriptAsync('./static/jquery/jquery.min.js')
22+
loadScriptAsync('./static/toio/toio.js')
23+
loadScriptAsync('./static/speech//microsoft.cognitiveservices.speech.sdk.bundle.js')
24+
</script>
1425
<style>
1526
#splash {
1627
position: absolute; width: 100%; height: 100%; top: 0; left: 0;

β€Žwebpack.renderer.jsβ€Ž

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,17 @@ module.exports = defaultConfig => {
1717
{
1818
test: /\.jsx?$/,
1919
loader: 'babel-loader',
20+
include: [
21+
path.resolve(__dirname, 'src', 'renderer'),
22+
/node_modules[\\/]scratch-[^\\/]+[\\/]src/
23+
],
2024
options: {
2125
presets: ['@babel/preset-env', '@babel/preset-react'],
22-
plugins: ['@babel/plugin-proposal-optional-chaining']
26+
plugins: [
27+
'@babel/plugin-proposal-optional-chaining',
28+
'@babel/plugin-transform-modules-commonjs',
29+
'@babel/plugin-proposal-object-rest-spread'
30+
]
2331
}
2432
},
2533
{
@@ -32,6 +40,7 @@ module.exports = defaultConfig => {
3240
},
3341
{
3442
test: /\.css$/,
43+
exclude: /\.min\.css$/,
3544
use: [
3645
{
3746
loader: 'style-loader'
@@ -57,7 +66,11 @@ module.exports = defaultConfig => {
5766
}
5867
}
5968
}
60-
]
69+
],
70+
},
71+
{
72+
test: /\.min\.css$/,
73+
use: ['style-loader', 'css-loader']
6174
}
6275
],
6376
},
@@ -70,8 +83,12 @@ module.exports = defaultConfig => {
7083
{
7184
from: libraryFilesFolder,
7285
to: 'library-files'
73-
}
86+
},
7487
// TODO: copy extension worker?
88+
{
89+
from: path.resolve(__dirname, 'node_modules', 'scratch-gui', 'static'),
90+
to: 'static'
91+
}
7592
])
7693
],
7794
resolve: {

0 commit comments

Comments
Β (0)