From e9bf2b13c81653a1388a88ba69695d6caf7129ed Mon Sep 17 00:00:00 2001 From: kebhr <42484226+kebhr@users.noreply.github.com> Date: Tue, 19 Jul 2022 00:12:54 +0900 Subject: [PATCH 1/4] feat: update scratch desktop to v3.29.1 --- .gitignore | 11 --- README.md | 2 +- .../src/lib/libraries/extensions/index.jsx | 1 - .../src/extensions/scratch3_tello/index.js | 32 ++++---- .../scratch3_tello/telloProcessor.js | 76 +++++++++++++++++++ 5 files changed, 95 insertions(+), 27 deletions(-) create mode 100644 scratch-vm/src/extensions/scratch3_tello/telloProcessor.js diff --git a/.gitignore b/.gitignore index 88cb5f7..6687c0d 100644 --- a/.gitignore +++ b/.gitignore @@ -29,14 +29,3 @@ !/scratch-gui/src/lib/libraries/extensions/tello /scratch-desktop/* -!/scratch-desktop/LICENSE -!/scratch-desktop/src -/scratch-desktop/src/* -!/scratch-desktop/src/renderer -/scratch-desktop/src/renderer/* -!/scratch-desktop/src/renderer/app.jsx -!/scratch-desktop/src/renderer/telloProcessor.js -!/scratch-desktop/src/main/ -/scratch-desktop/src/main/* -!/scratch-desktop/src/main/index.js -!/scratch-desktop/src/main/TelloProcessor.js diff --git a/README.md b/README.md index 1e05f48..ce3bede 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # scratch3-tello -Code Tello with Scratch 3.0. +Fly Tello with Scratch 3.0. For more information such as how to download, how to build: [scratch3-tello.app](https://scratch3-tello.app/) diff --git a/scratch-gui/src/lib/libraries/extensions/index.jsx b/scratch-gui/src/lib/libraries/extensions/index.jsx index 0f956e1..01399b4 100644 --- a/scratch-gui/src/lib/libraries/extensions/index.jsx +++ b/scratch-gui/src/lib/libraries/extensions/index.jsx @@ -49,7 +49,6 @@ import gdxforConnectionSmallIconURL from './gdxfor/gdxfor-small.svg'; import telloIconURL from './tello/tello.png'; import telloInsetIconURL from './tello/tello-small.png'; - export default [ { name: ( diff --git a/scratch-vm/src/extensions/scratch3_tello/index.js b/scratch-vm/src/extensions/scratch3_tello/index.js index 4be7618..d27c3fc 100644 --- a/scratch-vm/src/extensions/scratch3_tello/index.js +++ b/scratch-vm/src/extensions/scratch3_tello/index.js @@ -1,9 +1,10 @@ const ArgumentType = require('../../extension-support/argument-type'); const BlockType = require('../../extension-support/block-type'); const Cast = require('../../util/cast'); -const log = require('../../util/log'); const formatMessage = require('format-message'); +const TelloProcessor = require('./telloProcessor'); + /** * Icon svg to be displayed at the left edge of each extension block, encoded as a data URI. * @type {string} @@ -178,6 +179,10 @@ class Scratch3Tello { * @type {Runtime} */ this.runtime = runtime; + + this.telloProcessor = new TelloProcessor(); + this.telloProcessor.initialize(); + this.state = {}; this.getState(); } @@ -376,50 +381,49 @@ class Scratch3Tello { getState () { setInterval(() => { - telloProcessor.state().then(response => { - this.state = JSON.parse(response); - }); + const state = this.telloProcessor.state(); + this.state = state; }, 100); } takeoff () { - telloProcessor.send('takeoff'); + this.telloProcessor.request('takeoff'); } land () { - telloProcessor.send('land'); + this.telloProcessor.request('land'); } up (args) { - telloProcessor.send(`up ${Cast.toString(args.X)}`); + this.telloProcessor.request(`up ${Cast.toString(args.X)}`); } down (args) { - telloProcessor.send(`down ${Cast.toString(args.X)}`); + this.telloProcessor.request(`down ${Cast.toString(args.X)}`); } left (args) { - telloProcessor.send(`left ${Cast.toString(args.X)}`); + this.telloProcessor.request(`left ${Cast.toString(args.X)}`); } right (args) { - telloProcessor.send(`right ${Cast.toString(args.X)}`); + this.telloProcessor.request(`right ${Cast.toString(args.X)}`); } forward (args) { - telloProcessor.send(`forward ${Cast.toString(args.X)}`); + this.telloProcessor.request(`forward ${Cast.toString(args.X)}`); } back (args) { - telloProcessor.send(`back ${Cast.toString(args.X)}`); + this.telloProcessor.request(`back ${Cast.toString(args.X)}`); } cw (args) { - telloProcessor.send(`cw ${Cast.toString(args.X)}`); + this.telloProcessor.request(`cw ${Cast.toString(args.X)}`); } ccw (args) { - telloProcessor.send(`ccw ${Cast.toString(args.X)}`); + this.telloProcessor.request(`ccw ${Cast.toString(args.X)}`); } pitch () { diff --git a/scratch-vm/src/extensions/scratch3_tello/telloProcessor.js b/scratch-vm/src/extensions/scratch3_tello/telloProcessor.js new file mode 100644 index 0000000..52f15cd --- /dev/null +++ b/scratch-vm/src/extensions/scratch3_tello/telloProcessor.js @@ -0,0 +1,76 @@ +const dgram = require('dgram'); + +class TelloProcessor { + initialize () { + this.queue = []; // command queue + + this.client = dgram.createSocket('udp4'); + this.server = dgram.createSocket('udp4'); + + this.client.bind({ + address: '0.0.0.0', + port: 40001, + exclusive: true + }); + + this.send('command'); + this.executing = true; + + this.client.on('message', (message, remote) => { + const readableMessage = message.toString(); + + // Previous command executed + if (readableMessage === 'error' || readableMessage === 'ok') { + this.executing = false; + + // Dequeue + this.queue.shift(); + + // Send the next element + this.inquire(); + } + }); + + // Tello State + this.server.on('message', (message, remote) => { + // remote: { address: '192.168.10.1', family: 'IPv4', port: 8889, size: 127 } + // message: + const readableMessage = message.toString(); + this.data = {}; + for (const e of readableMessage.slice(0, -1).split(';')) { + this.data[e.split(':')[0]] = e.split(':')[1]; + } + }); + + this.server.bind(8890, '0.0.0.0'); + } + + + request (cmd) { + // Enqueue + this.queue.push(cmd); + + this.inquire(); + } + + state () { + return this.data; + } + + // If executing command is nothing and waiting queue has some element, send first command to Tello + inquire () { + if (!this.executing && this.queue.length > 0) { + this.send(this.queue[0]); + } + } + + send (cmd) { + const msg = Buffer.from(cmd); + this.executing = true; + this.client.send(msg, 0, msg.length, 8889, '192.168.10.1', (err, bytes) => { + if (err) throw err; + }); + } +} + +module.exports = TelloProcessor; From 024520536018359d3d4899173a594055ea18055a Mon Sep 17 00:00:00 2001 From: kebhr <42484226+kebhr@users.noreply.github.com> Date: Tue, 19 Jul 2022 00:40:54 +0900 Subject: [PATCH 2/4] remove: files in scratch-desktop/* --- .gitignore | 11 + scratch-desktop/src/main/TelloProcessor.js | 77 ---- scratch-desktop/src/main/index.js | 333 ------------------ scratch-desktop/src/renderer/app.jsx | 106 ------ .../src/renderer/telloProcessor.js | 31 -- 5 files changed, 11 insertions(+), 547 deletions(-) delete mode 100644 scratch-desktop/src/main/TelloProcessor.js delete mode 100644 scratch-desktop/src/main/index.js delete mode 100644 scratch-desktop/src/renderer/app.jsx delete mode 100644 scratch-desktop/src/renderer/telloProcessor.js diff --git a/.gitignore b/.gitignore index 6687c0d..f9e16e9 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,14 @@ !/scratch-gui/src/lib/libraries/extensions/tello /scratch-desktop/* +!/scratch-desktop/LICENSE +!/scratch-desktop/src +/scratch-desktop/src/* +!/scratch-desktop/src/renderer +/scratch-desktop/src/renderer/* +!/scratch-desktop/src/renderer/app.jsx +!/scratch-desktop/src/renderer/telloProcessor.js +!/scratch-desktop/src/main/ +/scratch-desktop/src/main/* +!/scratch-desktop/src/main/index.js +!/scratch-desktop/src/main/TelloProcessor.js \ No newline at end of file diff --git a/scratch-desktop/src/main/TelloProcessor.js b/scratch-desktop/src/main/TelloProcessor.js deleted file mode 100644 index c20b1ef..0000000 --- a/scratch-desktop/src/main/TelloProcessor.js +++ /dev/null @@ -1,77 +0,0 @@ -const dgram = require('dgram'); - -class TelloProcessor { - initialize () { - this.queue = []; // command queue - - this.client = dgram.createSocket('udp4'); - this.server = dgram.createSocket('udp4'); - - this.client.bind({ - address: '0.0.0.0', - port: 40001, - exclusive: true - }); - - this.send('command'); - this.executing = true; - - this.client.on('message', (message, remote) => { - const readableMessage = message.toString(); - - // Previous command executed - if (readableMessage === 'error' || readableMessage === 'ok') { - this.executing = false; - - // Dequeue - this.queue.shift(); - - // Send the next element - this.inquire(); - } - }); - - // Tello State - this.server.on('message', (message, remote) => { - // remote: { address: '192.168.10.1', family: 'IPv4', port: 8889, size: 127 } - // message: - const readableMessage = message.toString(); - // console.log(readableMessage); - this.data = {}; - for (const e of readableMessage.slice(0, -1).split(';')) { - this.data[e.split(':')[0]] = e.split(':')[1]; - } - }); - - this.server.bind(8890, '0.0.0.0'); - } - - - request (cmd) { - // Enqueue - this.queue.push(cmd); - - this.inquire(); - } - - state () { - return this.data; - } - - // If executing command is nothing and waiting queue has some element, send first command to Tello - inquire () { - if (!this.executing && this.queue.length > 0) { - this.send(this.queue[0]); - } - } - - send (cmd) { - const msg = Buffer.from(cmd); - this.executing = true; - this.client.send(msg, 0, msg.length, 8889, '192.168.10.1', (err, bytes) => { - if (err) throw err; - }); - } -} - -export default TelloProcessor; diff --git a/scratch-desktop/src/main/index.js b/scratch-desktop/src/main/index.js deleted file mode 100644 index b93a8d9..0000000 --- a/scratch-desktop/src/main/index.js +++ /dev/null @@ -1,333 +0,0 @@ -import {BrowserWindow, Menu, app, dialog, ipcMain, systemPreferences} from 'electron'; -import fs from 'fs'; -import path from 'path'; -import {URL} from 'url'; - -import {getFilterForExtension} from './FileFilters'; -import telemetry from './ScratchDesktopTelemetry'; -import MacOSMenu from './MacOSMenu'; -import log from '../common/log.js'; -import TelloProcessor from './TelloProcessor'; - -// suppress deprecation warning; this will be the default in Electron 9 -app.allowRendererProcessReuse = true; - -telemetry.appWasOpened(); - -const telloProcessor = new TelloProcessor(); - -// const defaultSize = {width: 1096, height: 715}; // minimum -const defaultSize = {width: 1280, height: 800}; // good for MAS screenshots - -const isDevelopment = process.env.NODE_ENV !== 'production'; - -// global window references prevent them from being garbage-collected -const _windows = {}; - -const displayPermissionDeniedWarning = (browserWindow, permissionType) => { - let title; - let message; - switch (permissionType) { - case 'camera': - title = 'Camera Permission Denied'; - message = 'Permission to use the camera has been denied. ' + - 'Scratch will not be able to take a photo or use video sensing blocks.'; - break; - case 'microphone': - title = 'Microphone Permission Denied'; - message = 'Permission to use the microphone has been denied. ' + - 'Scratch will not be able to record sounds or detect loudness.'; - break; - default: // shouldn't ever happen... - title = 'Permission Denied'; - message = 'A permission has been denied.'; - } - - let instructions; - switch (process.platform) { - case 'darwin': - instructions = 'To change Scratch permissions, please check "Security & Privacy" in System Preferences.'; - break; - default: - instructions = 'To change Scratch permissions, please check your system settings and restart Scratch.'; - break; - } - message = `${message}\n\n${instructions}`; - - dialog.showMessageBox(browserWindow, {type: 'warning', title, message}); -}; - -/** - * Build an absolute URL from a relative one, optionally adding search query parameters. - * The base of the URL will depend on whether or not the application is running in development mode. - * @param {string} url - the relative URL, like 'index.html' - * @param {*} search - the optional "search" parameters (the part of the URL after '?'), like "route=about" - * @returns {string} - an absolute URL as a string - */ -const makeFullUrl = (url, search = null) => { - const baseUrl = (isDevelopment ? - `http://localhost:${process.env.ELECTRON_WEBPACK_WDS_PORT}/` : - `file://${__dirname}/` - ); - const fullUrl = new URL(url, baseUrl); - if (search) { - fullUrl.search = search; // automatically percent-encodes anything that needs it - } - return fullUrl.toString(); -}; - -/** - * Prompt in a platform-specific way for permission to access the microphone or camera, if Electron supports doing so. - * Any application-level checks, such as whether or not a particular frame or document should be allowed to ask, - * should be done before calling this function. - * This function may return a Promise! - * - * @param {string} mediaType - one of Electron's media types, like 'microphone' or 'camera' - * @returns {boolean|Promise.} - true if permission granted, false otherwise. - */ -const askForMediaAccess = mediaType => { - if (systemPreferences.askForMediaAccess) { - // Electron currently only implements this on macOS - // This returns a Promise - return systemPreferences.askForMediaAccess(mediaType); - } - // For other platforms we can't reasonably do anything other than assume we have access. - return true; -}; - -const handlePermissionRequest = async (webContents, permission, callback, details) => { - if (webContents !== _windows.main.webContents) { - // deny: request came from somewhere other than the main window's web contents - return callback(false); - } - if (!details.isMainFrame) { - // deny: request came from a subframe of the main window, not the main frame - return callback(false); - } - if (permission !== 'media') { - // deny: request is for some other kind of access like notifications or pointerLock - return callback(false); - } - const requiredBase = makeFullUrl(''); - if (details.requestingUrl.indexOf(requiredBase) !== 0) { - // deny: request came from a URL outside of our "sandbox" - return callback(false); - } - let askForMicrophone = false; - let askForCamera = false; - for (const mediaType of details.mediaTypes) { - switch (mediaType) { - case 'audio': - askForMicrophone = true; - break; - case 'video': - askForCamera = true; - break; - default: - // deny: unhandled media type - return callback(false); - } - } - const parentWindow = _windows.main; // if we ever allow media in non-main windows we'll also need to change this - if (askForMicrophone) { - const microphoneResult = await askForMediaAccess('microphone'); - if (!microphoneResult) { - displayPermissionDeniedWarning(parentWindow, 'microphone'); - return callback(false); - } - } - if (askForCamera) { - const cameraResult = await askForMediaAccess('camera'); - if (!cameraResult) { - displayPermissionDeniedWarning(parentWindow, 'camera'); - return callback(false); - } - } - return callback(true); -}; - -const createWindow = ({search = null, url = 'index.html', ...browserWindowOptions}) => { - const window = new BrowserWindow({ - useContentSize: true, - show: false, - webPreferences: { - nodeIntegration: true - }, - ...browserWindowOptions - }); - const webContents = window.webContents; - - webContents.session.setPermissionRequestHandler(handlePermissionRequest); - - if (isDevelopment) { - webContents.openDevTools({mode: 'detach', activate: true}); - } - - const fullUrl = makeFullUrl(url, search); - window.loadURL(fullUrl); - - return window; -}; - -const createAboutWindow = () => { - const window = createWindow({ - width: 400, - height: 400, - parent: _windows.main, - search: 'route=about', - title: 'About Scratch Desktop' - }); - return window; -}; - -const getIsProjectSave = downloadItem => { - switch (downloadItem.getMimeType()) { - case 'application/x.scratch.sb3': - return true; - } - return false; -}; - -const createMainWindow = () => { - const window = createWindow({ - width: defaultSize.width, - height: defaultSize.height, - title: 'Scratch Desktop' - }); - const webContents = window.webContents; - - webContents.session.on('will-download', (ev, item) => { - const isProjectSave = getIsProjectSave(item); - const itemPath = item.getFilename(); - const baseName = path.basename(itemPath); - const extName = path.extname(baseName); - const options = { - defaultPath: baseName - }; - if (extName) { - const extNameNoDot = extName.replace(/^\./, ''); - options.filters = [getFilterForExtension(extNameNoDot)]; - } - const userChosenPath = dialog.showSaveDialogSync(window, options); - if (userChosenPath) { - // WARNING: `setSavePath` on this item is only valid during the `will-download` event. Calling the async - // version of `showSaveDialog` means the event will finish before we get here, so `setSavePath` will be - // ignored. For that reason we need to call `showSaveDialogSync` above. - item.setSavePath(userChosenPath); - if (isProjectSave) { - const newProjectTitle = path.basename(userChosenPath, extName); - webContents.send('setTitleFromSave', {title: newProjectTitle}); - - // "setTitleFromSave" will set the project title but GUI has already reported the telemetry event - // using the old title. This call lets the telemetry client know that the save was actually completed - // and the event should be committed to the event queue with this new title. - telemetry.projectSaveCompleted(newProjectTitle); - } - } else { - item.cancel(); - if (isProjectSave) { - telemetry.projectSaveCanceled(); - } - } - }); - - webContents.on('will-prevent-unload', ev => { - const choice = dialog.showMessageBoxSync(window, { - type: 'question', - message: 'Leave Scratch?', - detail: 'Any unsaved changes will be lost.', - buttons: ['Stay', 'Leave'], - cancelId: 0, // closing the dialog means "stay" - defaultId: 0 // pressing enter or space without explicitly selecting something means "stay" - }); - const shouldQuit = (choice === 1); - if (shouldQuit) { - ev.preventDefault(); - } - }); - - window.once('ready-to-show', () => { - window.show(); - }); - - return window; -}; - -if (process.platform === 'darwin') { - const osxMenu = Menu.buildFromTemplate(MacOSMenu(app)); - Menu.setApplicationMenu(osxMenu); -} else { - // disable menu for other platforms - Menu.setApplicationMenu(null); -} - -// quit application when all windows are closed -app.on('window-all-closed', () => { - app.quit(); -}); - -app.on('will-quit', () => { - telemetry.appWillClose(); -}); - -// work around https://github.com/MarshallOfSound/electron-devtools-installer/issues/122 -// which seems to be a result of https://github.com/electron/electron/issues/19468 -if (process.platform === 'win32') { - const appUserDataPath = app.getPath('userData'); - const devToolsExtensionsPath = path.join(appUserDataPath, 'DevTools Extensions'); - try { - fs.unlinkSync(devToolsExtensionsPath); - } catch (_) { - // don't complain if the file doesn't exist - } -} - -// create main BrowserWindow when electron is ready -app.on('ready', () => { - if (isDevelopment) { - import('electron-devtools-installer').then(importedModule => { - const {default: installExtension, ...devToolsExtensions} = importedModule; - const extensionsToInstall = [ - devToolsExtensions.REACT_DEVELOPER_TOOLS, - devToolsExtensions.REACT_PERF, - devToolsExtensions.REDUX_DEVTOOLS - ]; - for (const extension of extensionsToInstall) { - // WARNING: depending on a lot of things including the version of Electron `installExtension` might - // return a promise that never resolves, especially if the extension is already installed. - installExtension(extension).then( - extensionName => log(`Installed dev extension: ${extensionName}`), - errorMessage => log.error(`Error installing dev extension: ${errorMessage}`) - ); - } - }); - } - - _windows.main = createMainWindow(); - _windows.main.on('closed', () => { - delete _windows.main; - }); - _windows.about = createAboutWindow(); - _windows.about.on('close', event => { - event.preventDefault(); - _windows.about.hide(); - }); -}); - -ipcMain.on('open-about-window', () => { - _windows.about.show(); -}); - -// scratch3-tello -ipcMain.once('tello-initialize', () => { - telloProcessor.initialize(); -}); - -ipcMain.on('send', (ev, arg) => { - telloProcessor.request(arg); -}); - -ipcMain.on('state', ev => { - const state = telloProcessor.state(); - ev.sender.send('state-reply', JSON.stringify(state)); -}); diff --git a/scratch-desktop/src/renderer/app.jsx b/scratch-desktop/src/renderer/app.jsx deleted file mode 100644 index f883b83..0000000 --- a/scratch-desktop/src/renderer/app.jsx +++ /dev/null @@ -1,106 +0,0 @@ -import {ipcRenderer, shell} from 'electron'; -import bindAll from 'lodash.bindall'; -import React from 'react'; -import ReactDOM from 'react-dom'; -import {compose} from 'redux'; -import GUI, {AppStateHOC} from 'scratch-gui'; - -import ElectronStorageHelper from '../common/ElectronStorageHelper'; - -import styles from './app.css'; - -import {TelloProcessor} from './telloProcessor'; - -const defaultProjectId = 0; - -global.telloProcessor = new TelloProcessor(); - -// override window.open so that it uses the OS's default browser, not an electron browser -window.open = function (url, target) { - if (target === '_blank') { - shell.openExternal(url); - } -}; -// Register "base" page view -// analytics.pageview('/'); - -const appTarget = document.getElementById('app'); -appTarget.className = styles.app || 'app'; // TODO -document.body.appendChild(appTarget); - -GUI.setAppElement(appTarget); - -const ScratchDesktopHOC = function (WrappedComponent) { - class ScratchDesktopComponent extends React.Component { - constructor (props) { - super(props); - bindAll(this, [ - 'handleProjectTelemetryEvent', - 'handleSetTitleFromSave', - 'handleStorageInit', - 'handleTelemetryModalOptIn', - 'handleTelemetryModalOptOut', - 'handleUpdateProjectTitle' - ]); - this.state = { - projectTitle: null - }; - } - componentDidMount () { - ipcRenderer.on('setTitleFromSave', this.handleSetTitleFromSave); - } - componentWillUnmount () { - ipcRenderer.removeListener('setTitleFromSave', this.handleSetTitleFromSave); - } - handleClickLogo () { - ipcRenderer.send('open-about-window'); - } - handleProjectTelemetryEvent (event, metadata) { - ipcRenderer.send(event, metadata); - } - handleSetTitleFromSave (event, args) { - this.handleUpdateProjectTitle(args.title); - } - handleStorageInit (storageInstance) { - storageInstance.addHelper(new ElectronStorageHelper(storageInstance)); - } - handleTelemetryModalOptIn () { - ipcRenderer.send('setTelemetryDidOptIn', true); - } - handleTelemetryModalOptOut () { - ipcRenderer.send('setTelemetryDidOptIn', false); - } - handleUpdateProjectTitle (newTitle) { - this.setState({projectTitle: newTitle}); - } - render () { - const shouldShowTelemetryModal = (typeof ipcRenderer.sendSync('getTelemetryDidOptIn') !== 'boolean'); - return (); - } - } - - return ScratchDesktopComponent; -}; - -// note that redux's 'compose' function is just being used as a general utility to make -// the hierarchy of HOC constructor calls clearer here; it has nothing to do with redux's -// ability to compose reducers. -const WrappedGui = compose( - ScratchDesktopHOC, - AppStateHOC -)(GUI); - -ReactDOM.render(, appTarget); diff --git a/scratch-desktop/src/renderer/telloProcessor.js b/scratch-desktop/src/renderer/telloProcessor.js deleted file mode 100644 index 326e225..0000000 --- a/scratch-desktop/src/renderer/telloProcessor.js +++ /dev/null @@ -1,31 +0,0 @@ -import {ipcRenderer} from 'electron'; - - -export class TelloProcessor { - constructor () { - ipcRenderer.send('tello-initialize'); - } - - connect () { - this.send('connect'); - } - - send (cmd) { - ipcRenderer.send('send', cmd); - } - - async state () { - ipcRenderer.send('state'); - - const response = await this.statePromise(); - return response; - } - - statePromise () { - return new Promise(resolve => { - ipcRenderer.once('state-reply', (ev, arg) => { - resolve(arg); - }); - }); - } -} From 0bc365a3efd6f4f712bd3afe6fc30f87ca643b71 Mon Sep 17 00:00:00 2001 From: kebhr <42484226+kebhr@users.noreply.github.com> Date: Tue, 19 Jul 2022 00:43:56 +0900 Subject: [PATCH 3/4] change: ./scratch-desktop are gitignored --- .gitignore | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.gitignore b/.gitignore index f9e16e9..6687c0d 100644 --- a/.gitignore +++ b/.gitignore @@ -29,14 +29,3 @@ !/scratch-gui/src/lib/libraries/extensions/tello /scratch-desktop/* -!/scratch-desktop/LICENSE -!/scratch-desktop/src -/scratch-desktop/src/* -!/scratch-desktop/src/renderer -/scratch-desktop/src/renderer/* -!/scratch-desktop/src/renderer/app.jsx -!/scratch-desktop/src/renderer/telloProcessor.js -!/scratch-desktop/src/main/ -/scratch-desktop/src/main/* -!/scratch-desktop/src/main/index.js -!/scratch-desktop/src/main/TelloProcessor.js \ No newline at end of file From 97d2b436700f97015e2040f554e9375b2533d2c9 Mon Sep 17 00:00:00 2001 From: kebhr <42484226+kebhr@users.noreply.github.com> Date: Tue, 19 Jul 2022 20:14:30 +0900 Subject: [PATCH 4/4] update: update scripts for scratch-desktop v3.29.1 --- build.sh | 24 +++++++++++++++--------- relink.sh | 13 ------------- scratch-desktop/LICENSE | 12 ------------ 3 files changed, 15 insertions(+), 34 deletions(-) delete mode 100755 relink.sh delete mode 100644 scratch-desktop/LICENSE diff --git a/build.sh b/build.sh index 256aebd..b171cbb 100755 --- a/build.sh +++ b/build.sh @@ -1,19 +1,25 @@ -git clone --depth 1 https://github.com/LLK/scratch-vm.git -git clone --depth 1 --branch scratch-desktop-v3.10.2 https://github.com/LLK/scratch-gui.git -git clone --depth 1 --branch v3.10.4 https://github.com/LLK/scratch-desktop.git +git clone --filter=blob:none https://github.com/LLK/scratch-vm.git -b 0.2.0-prerelease.20220222132735 +git clone --filter=blob:none https://github.com/LLK/scratch-gui.git -b scratch-desktop-v3.29.0 +git clone --filter=blob:none https://github.com/LLK/scratch-desktop.git -b v3.29.1 + cd scratch-vm npm install npm link -cd ../scratch-gui +cd .. + +cd scratch-gui npm install npm link scratch-vm npm link -cd ../scratch-desktop +cd .. + +cd scratch-desktop npm install -npm link scratch-gui -cd node_modules/scratch-gui -npm link scratch-vm -cd ../../../ +cd node_modules +rm -rf scratch-gui +ln -s ../../scratch-gui scratch-gui +cd ../../ + git clone https://github.com/kebhr/scratch3-tello cp -r scratch3-tello/. ./ rm -rf scratch3-tello/ diff --git a/relink.sh b/relink.sh deleted file mode 100755 index 0ca8819..0000000 --- a/relink.sh +++ /dev/null @@ -1,13 +0,0 @@ -cd scratch-vm -npm install -npm link -cd ../scratch-gui -npm install -npm link scratch-vm -npm link -cd ../scratch-desktop -npm install -npm link scratch-gui -cd node_modules/scratch-gui -npm link scratch-vm -cd ../../../ \ No newline at end of file diff --git a/scratch-desktop/LICENSE b/scratch-desktop/LICENSE deleted file mode 100644 index 1511e07..0000000 --- a/scratch-desktop/LICENSE +++ /dev/null @@ -1,12 +0,0 @@ -Copyright (c) 2019, Scratch Foundation, kebhr -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -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.