From b51f562de457d6958cc7546237bdde140ff22076 Mon Sep 17 00:00:00 2001 From: damp11113 Date: Fri, 23 Aug 2024 23:28:39 +0700 Subject: [PATCH] update 1.4 add better splash screen and update Advanced Peripherals module 9/13 --- .gitignore | 4 +- TestProject/geoscanner (example 4).ccp | 1 + assets/dpsoftware.png | Bin 0 -> 2442 bytes blocks/Advanced_Peripherals/block_design.json | 309 ++++++++++++++++++ blocks/Advanced_Peripherals/generator.js | 119 +++++++ blocks/Advanced_Peripherals/index.json | 4 +- blocks/Advanced_Peripherals/toolbox.xml | 45 +++ blocks/CCPeripheral/block_design.json | 3 +- blocks/CCPeripheral/toolbox.xml | 48 ++- blocks/CCRedstone/block_design.json | 4 +- index.js | 125 ++++++- package-lock.json | 263 ++++++++++++++- package.json | 7 +- readme.md | 2 +- src/codegen.js | 4 - src/index.html | 1 - src/index.js | 5 +- src/splash.html | 230 +++++++++---- src/splash_old.html | 90 +++++ 19 files changed, 1171 insertions(+), 93 deletions(-) create mode 100644 TestProject/geoscanner (example 4).ccp create mode 100644 assets/dpsoftware.png create mode 100644 src/splash_old.html diff --git a/.gitignore b/.gitignore index 28d9e23..6a50bc2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ node_modules/ .mcattributes package-lock.json -dist/ \ No newline at end of file +dist/ +dist_debug/ +ccIDE.wheel \ No newline at end of file diff --git a/TestProject/geoscanner (example 4).ccp b/TestProject/geoscanner (example 4).ccp new file mode 100644 index 0000000..532299b --- /dev/null +++ b/TestProject/geoscanner (example 4).ccp @@ -0,0 +1 @@ +{"usedlibrary":["Advanced_Peripherals","CCPeripheral","CCTextutils","NativeIO"],"content":{"blocks":{"languageVersion":0,"blocks":[{"type":"ide_start","id":"_s{i,SzdnGk`iz}V{Ef,","x":30,"y":150,"inputs":{"DO":{"block":{"type":"variables_set","id":"4`t0A~mi9udqazuPFltl","fields":{"VAR":{"id":"b!G3HI*3Su-;s=l@m`{C"}},"inputs":{"VALUE":{"block":{"type":"io_open","id":"{s9Q{?YzVj[IT}u~g52k","fields":{"MODE":"w"},"inputs":{"FILENAME":{"block":{"type":"text","id":"}r@r{xS9G6@i@C{jDAOG","fields":{"TEXT":"test.json"}}}}}}},"next":{"block":{"type":"variables_set","id":"la(`]]2fjOy@W3|#H+j5","fields":{"VAR":{"id":"!60`+fJsl+LMzF5L;((_"}},"inputs":{"VALUE":{"block":{"type":"peripheral_wrap","id":"#gIy8pYRI5r;|Gpt((6D","inputs":{"NAME":{"shadow":{"type":"text","id":"s1SZ;+Ll-[Dn*[yCTh4^","fields":{"TEXT":"geoScanner_1"}}}}}}},"next":{"block":{"type":"io_write","id":"cXQ`rD/MHKTs*S:asoq`","inputs":{"DATA":{"shadow":{"type":"text","id":"j_Am~Q@Lu.p2e[cVK%_+","fields":{"TEXT":"Hello, world!"}},"block":{"type":"textutils_serialize_json","id":"7D;X/4FI7*aP+^+JG]w~","fields":{"NBT":false,"UNICODE":false,"ALLOWREPETI":false},"inputs":{"OBJECT":{"block":{"type":"advanced_peripherals_geo_scanner_scan","id":"=uxVRL!ZaUB=t@-]@;`4","inputs":{"RADIUS":{"shadow":{"type":"math_number","id":"e5oF_eP.dd+gJ@3YxYYJ","fields":{"NUM":2}}},"SCANNER":{"block":{"type":"variables_get","id":"Y`peao|kXro)ax|@x8v*","fields":{"VAR":{"id":"!60`+fJsl+LMzF5L;((_"}}}}}}}}}},"FILE":{"block":{"type":"variables_get","id":"-iS.RqK;e21F_P4Psbm+","fields":{"VAR":{"id":"b!G3HI*3Su-;s=l@m`{C"}}}}}}}}}}}}}]},"variables":[{"name":"scanner","id":"!60`+fJsl+LMzF5L;((_"},{"name":"file","id":"b!G3HI*3Su-;s=l@m`{C"}]}} \ No newline at end of file diff --git a/assets/dpsoftware.png b/assets/dpsoftware.png new file mode 100644 index 0000000000000000000000000000000000000000..6d523949b262148e360584e0cf23cc433ddfe9aa GIT binary patch literal 2442 zcmeAS@N?(olHy`uVBq!ia0y~yU;;9k7&zE~)R&4YzZe)e13g_FLn`LHyOXCcECaoyzRA=EyOnRtckroSQqp zKd??`{eDh1&FshPeXgzb{_Del6)^ICs9hd`Nivp08DN|8cY} z{44%~b!3D9zKCA%^y=}WH z20h5O?6IZ2PLb$a~JNi(uuRn{Qs|-ab)E!^k4#& zF&RJKT+Gsu|M&X)ed8HPR=028zIxR>PtQNy;AlzQ{$C-$fctZMJt*J`eg6N^pJ#t> z{y~w;AAv@VloAPBsDVo63mb09-jQ8&Z?C=A{C|HwqyY2c^Kaj_?fP}>@6~fW%VzY6 zkMN=#6mZkbr!QZ8nAxFwG%!X)^^GgDAU9*O#JZ2x2OhTeUH;?!5nvmO!PC{xWt~$( F697C + + + + + + + + + + + 1 + + + + + + + 1 + + + + + + + + + + + + + + + + 15 + + + + + + + + + + + diff --git a/blocks/CCPeripheral/block_design.json b/blocks/CCPeripheral/block_design.json index 5fadd0f..fdd6bdd 100644 --- a/blocks/CCPeripheral/block_design.json +++ b/blocks/CCPeripheral/block_design.json @@ -10,7 +10,8 @@ "args0": [ { "type": "input_value", - "name": "NAME" + "name": "NAME", + "check": "String" } ], "output": "Boolean", diff --git a/blocks/CCPeripheral/toolbox.xml b/blocks/CCPeripheral/toolbox.xml index 9adc0e3..ea9bb6b 100644 --- a/blocks/CCPeripheral/toolbox.xml +++ b/blocks/CCPeripheral/toolbox.xml @@ -1,13 +1,47 @@ diff --git a/blocks/CCRedstone/block_design.json b/blocks/CCRedstone/block_design.json index 7997665..2893de4 100644 --- a/blocks/CCRedstone/block_design.json +++ b/blocks/CCRedstone/block_design.json @@ -6,8 +6,8 @@ "type": "field_dropdown", "name": "STATE", "options": [ - ["On", "OFF"], - ["Off", "ON"] + ["On", "ON"], + ["Off", "OFF"] ] }, { diff --git a/index.js b/index.js index 01afbe6..dcbdd75 100644 --- a/index.js +++ b/index.js @@ -5,10 +5,12 @@ const prompt = require('electron-prompt'); const path = require('path'); const pino = require('pino') const pretty = require('pino-pretty'); -const { log } = require('console'); +const https = require('node:https'); +const LocalStorage = require('node-localstorage').LocalStorage const ipc = ipcMain const logger = pino(pretty()) +const localStorage = new LocalStorage('.'); process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'; @@ -22,6 +24,7 @@ var isopennewproject = false; var appstarted = false; var version; +var gitver; try { // Read package.json synchronously @@ -32,18 +35,55 @@ try { // Get project version version = packageJson.version; - - console.log("Project version:", version); } catch (err) { console.error("Error reading package.json:", err); } -app.whenReady().then(() => { +function checkupdate() { + return new Promise((resolve, reject) => { + const req = https.request({ + hostname: 'api.github.com', + port: 443, + path: '/repos/DPSoftware-Foundation/ccIDE/releases/latest', + method: 'GET', + headers: { + 'User-Agent': 'ccIDE-Check-Update-Service', // GitHub API requires a User-Agent header + } + }, (res) => { + let data = ''; + res.setEncoding('utf8'); + res.on('data', (chunk) => { + data += chunk; + }); + res.on('end', () => { + try { + const json = JSON.parse(data); + resolve(json.tag_name); // Return the tag_name or other relevant data + } catch (e) { + reject('Error parsing JSON: ' + e.message); + } + }); + }); + + req.on('error', (e) => { + reject('Error fetching release: ' + e.message); + }); + + req.end(); + }); +} + +function normalizeVersion(version, length = 4) { + // Split the version string into parts and pad with zeros if necessary + return version.split('.').map(part => part.padStart(2, '0')).concat(Array(length).fill('00')).slice(0, length).join('.'); +} + +app.whenReady().then(async () => { logger.info("Initializing splash window...") reloadall(false); var splash = new BrowserWindow({ - width: 600, - height: 300, + width: 720, + height: 400, icon: path.join(__dirname, 'assets', 'ccIDEIcon.ico'), transparent: true, frame: false, @@ -51,12 +91,72 @@ app.whenReady().then(() => { webPreferences: { nodeIntegration: true, contextIsolation: false, - } + }, + resizable: false }); splash.loadFile('src/splash.html'); + while (!splash.isVisible()) {} + + // checkupdate + logger.info("Checking for new update...") + splash.webContents.send("change-status", "Checking for new update...") + + try { + const latestRelease = await checkupdate(); + // Store the version or use it as needed + gitver = latestRelease; + } catch (error) { + logger.error('Error in update check:', error); + } + + logger.info("Version in github: " + gitver) + logger.info("Current version: " + version) + + const normalizedAppVersion = normalizeVersion(version); + const normalizedReleaseVersion = normalizeVersion(gitver); + + if (normalizedAppVersion >= normalizedReleaseVersion) { + logger.info("Software is up-to-date."); + } else { + logger.info("A new update is available: " + gitver) + var is_not_skip_update = localStorage.getItem('skip_update_version') != normalizedAppVersion; + var is_ignore = localStorage.getItem('ignore_update'); + if (is_ignore || is_not_skip_update) { + const result = dialog.showMessageBoxSync({ + type: 'question', + buttons: ['Update', 'Ignore', 'Skip'], + defaultId: 0, + title: 'Update Available', + message: `A new version (${gitver}) is available. Do you want to update now?`, + detail: 'Click "Update" to go to the release page, "Ignore" to ignore this update, or "Skip" to skip this version.' + }); + switch (result.response) { + case 0: // 'Update' + (async () => { + try { + const { default: open } = await import('open'); + + await open('https://github.com/DPSoftware-Foundation/ccIDE/releases/latest'); + console.log('URL opened in default browser'); + } catch (err) { + console.error('Error opening URL:', err); + } + })(); + break; + case 1: // 'Ignore' + localStorage.setItem('ignore_update', true); + break; + case 2: // 'Skip' + localStorage.setItem('skip_update_version', normalizedReleaseVersion); + break; + } + } + } + logger.info("Initializing main windows...") + splash.webContents.send("change-status", "Initializing main windows...") const win = new BrowserWindow({ width: 1280, @@ -96,6 +196,15 @@ app.whenReady().then(() => { appstarted = true; }); + ipc.on("splash-close", (event) => { + if (appstarted) { + splash.hide(); + } else { + splash.close(); + win.close(); + } + }) + ipc.on('erroronstart', (event, errormessage) => { logger.error(errormessage) dialog.showErrorBox("Error on startup", errormessage); @@ -508,7 +617,7 @@ app.whenReady().then(() => { win.on("closed", () => { logger.info("Exiting...") - if (splash) { + if (!splash.isDestroyed()) { splash.close() } }) diff --git a/package-lock.json b/package-lock.json index 7c47c61..598ba0d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ccide", - "version": "1.1", + "version": "1.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ccide", - "version": "1.1", + "version": "1.4", "license": "GPL-3.0-or-later", "dependencies": { "@blockly/plugin-workspace-search": "^9.0.5", @@ -14,6 +14,8 @@ "blockly": "^11.1.1", "bootstrap": "^5.3.3", "electron-prompt": "^1.7.0", + "node-localstorage": "^3.0.5", + "open": "^10.1.0", "pino": "^9.3.2", "pino-pretty": "^11.2.2", "xmldom": "^0.6.0" @@ -262,6 +264,20 @@ "node": "*" } }, + "node_modules/bundle-name": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz", + "integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==", + "dependencies": { + "run-applescript": "^7.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/cacheable-lookup": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", @@ -391,6 +407,32 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/default-browser": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.2.1.tgz", + "integrity": "sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg==", + "dependencies": { + "bundle-name": "^4.1.0", + "default-browser-id": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser-id": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.0.tgz", + "integrity": "sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA==", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/defer-to-connect": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", @@ -416,6 +458,17 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/define-lazy-prop": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/define-properties": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", @@ -885,11 +938,64 @@ } ] }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "dependencies": { + "is-docker": "^3.0.0" + }, + "bin": { + "is-inside-container": "cli.js" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-potential-custom-element-name": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==" }, + "node_modules/is-wsl": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", + "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", + "dependencies": { + "is-inside-container": "^1.0.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/joycon": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", @@ -1024,6 +1130,17 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "node_modules/node-localstorage": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/node-localstorage/-/node-localstorage-3.0.5.tgz", + "integrity": "sha512-GCwtK33iwVXboZWYcqQHu3aRvXEBwmPkAMRBLeaX86ufhqslyUkLGsi4aW3INEfdQYpUB5M9qtYf3eHvAk2VBg==", + "dependencies": { + "write-file-atomic": "^5.0.1" + }, + "engines": { + "node": ">=0.12" + } + }, "node_modules/normalize-url": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", @@ -1065,6 +1182,23 @@ "wrappy": "1" } }, + "node_modules/open": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/open/-/open-10.1.0.tgz", + "integrity": "sha512-mnkeQ1qP5Ue2wd+aivTD3NHd/lZ96Lu0jgf0pwktLPtx6cTZiH7tyeGRRHs0zX0rbrahXPnXlUnbeXyaBBuIaw==", + "dependencies": { + "default-browser": "^5.2.1", + "define-lazy-prop": "^3.0.0", + "is-inside-container": "^1.0.0", + "is-wsl": "^3.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/p-cancelable": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", @@ -1278,6 +1412,17 @@ "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz", "integrity": "sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==" }, + "node_modules/run-applescript": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz", + "integrity": "sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A==", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -1355,6 +1500,17 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/sonic-boom": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.0.1.tgz", @@ -1542,6 +1698,18 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, + "node_modules/write-file-atomic": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.1.tgz", + "integrity": "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==", + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/ws": { "version": "8.17.1", "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", @@ -1754,6 +1922,14 @@ "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==" }, + "bundle-name": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz", + "integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==", + "requires": { + "run-applescript": "^7.0.0" + } + }, "cacheable-lookup": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", @@ -1844,6 +2020,20 @@ } } }, + "default-browser": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.2.1.tgz", + "integrity": "sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg==", + "requires": { + "bundle-name": "^4.1.0", + "default-browser-id": "^5.0.0" + } + }, + "default-browser-id": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.0.tgz", + "integrity": "sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA==" + }, "defer-to-connect": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", @@ -1860,6 +2050,11 @@ "gopd": "^1.0.1" } }, + "define-lazy-prop": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==" + }, "define-properties": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", @@ -2185,11 +2380,37 @@ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==" + }, + "is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==" + }, + "is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "requires": { + "is-docker": "^3.0.0" + } + }, "is-potential-custom-element-name": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==" }, + "is-wsl": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", + "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", + "requires": { + "is-inside-container": "^1.0.0" + } + }, "joycon": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", @@ -2292,6 +2513,14 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "node-localstorage": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/node-localstorage/-/node-localstorage-3.0.5.tgz", + "integrity": "sha512-GCwtK33iwVXboZWYcqQHu3aRvXEBwmPkAMRBLeaX86ufhqslyUkLGsi4aW3INEfdQYpUB5M9qtYf3eHvAk2VBg==", + "requires": { + "write-file-atomic": "^5.0.1" + } + }, "normalize-url": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", @@ -2321,6 +2550,17 @@ "wrappy": "1" } }, + "open": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/open/-/open-10.1.0.tgz", + "integrity": "sha512-mnkeQ1qP5Ue2wd+aivTD3NHd/lZ96Lu0jgf0pwktLPtx6cTZiH7tyeGRRHs0zX0rbrahXPnXlUnbeXyaBBuIaw==", + "requires": { + "default-browser": "^5.2.1", + "define-lazy-prop": "^3.0.0", + "is-inside-container": "^1.0.0", + "is-wsl": "^3.1.0" + } + }, "p-cancelable": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", @@ -2495,6 +2735,11 @@ "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz", "integrity": "sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==" }, + "run-applescript": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz", + "integrity": "sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A==" + }, "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -2543,6 +2788,11 @@ "type-fest": "^0.13.1" } }, + "signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==" + }, "sonic-boom": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.0.1.tgz", @@ -2687,6 +2937,15 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, + "write-file-atomic": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.1.tgz", + "integrity": "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==", + "requires": { + "imurmurhash": "^0.1.4", + "signal-exit": "^4.0.1" + } + }, "ws": { "version": "8.17.1", "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", diff --git a/package.json b/package.json index fff7bbd..5d719cd 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,12 @@ { "name": "ccide", - "version": "1.3", + "version": "1.4", "description": "ComputerCraft mod virtual lua IDE", "main": "index.js", "scripts": { "dev": "electron .", - "build": "electron-packager . ccIDE --platform=win32 --arch=x64 --icon=assets/ccIDEIcon.ico --out=dist --overwrite" + "build": "electron-packager . ccIDE --platform=win32 --arch=x64 --icon=assets/ccIDEIcon.ico --out=dist --overwrite && for /d %i in (dist\\ccIDE-*) do copy package.json %i\\", + "build_debug": "electron-packager . ccIDE --platform=win32 --arch=x64 --icon=assets/ccIDEIcon.ico --out=dist_debug --overwrite --debug && for /d %i in (dist_debug\\ccIDE-*) do copy package.json %i\\" }, "author": "DPSoftware Foundation", "license": "GPL-3.0-or-later", @@ -18,6 +19,8 @@ "blockly": "^11.1.1", "bootstrap": "^5.3.3", "electron-prompt": "^1.7.0", + "node-localstorage": "^3.0.5", + "open": "^10.1.0", "pino": "^9.3.2", "pino-pretty": "^11.2.2", "xmldom": "^0.6.0" diff --git a/readme.md b/readme.md index e7d689e..4f8d04d 100644 --- a/readme.md +++ b/readme.md @@ -91,7 +91,7 @@ Event: https://tweaked.cc/event/alarm.html | Mod | Status |------------|-------- |[Create Additions](https://www.curseforge.com/minecraft/mc-mods/createaddition) | 🟩 Supported all -|[Advanced Peripherals](https://www.curseforge.com/minecraft/mc-mods/advanced-peripherals) | 🟨 Unfinished 3/13 +|[Advanced Peripherals](https://www.curseforge.com/minecraft/mc-mods/advanced-peripherals) | 🟨 Partially Supported (9/13 Peripheral) |[Create](https://www.curseforge.com/minecraft/mc-mods/create) | 🟨 Third support |[CC:C Bridge](https://www.curseforge.com/minecraft/mc-mods/cccbridge) | 🟥 Unsupport |[Extreme Reactors](https://www.curseforge.com/minecraft/mc-mods/extreme-reactors) ([Command](https://ftbwiki.org/Reactor_Computer_Port)) | 🟥 Unsupport diff --git a/src/codegen.js b/src/codegen.js index 3d097d3..deef436 100644 --- a/src/codegen.js +++ b/src/codegen.js @@ -1,7 +1,3 @@ -function delay(time) { - return new Promise(resolve => setTimeout(resolve, time)); -} - const { luaGenerator } = require('blockly/lua'); // Use require syntax for Blockly module const { CCRemote } = require("./ccRemote") diff --git a/src/index.html b/src/index.html index caaeb6b..d0d7aed 100644 --- a/src/index.html +++ b/src/index.html @@ -5,7 +5,6 @@ diff --git a/src/index.js b/src/index.js index d5fe3f8..05b5378 100644 --- a/src/index.js +++ b/src/index.js @@ -11,6 +11,10 @@ window.onerror = function (message, source, lineno, colno, error) { return true; // Prevents the default browser error handling }; +function delay(time) { + return new Promise(resolve => setTimeout(resolve, time)); +} + console.originalLog = console.log; console.log = function (...args) { @@ -18,7 +22,6 @@ console.log = function (...args) { console.originalLog(...args) }; - console.log("Importing module...") const fs = require('fs'); const path = require('path'); diff --git a/src/splash.html b/src/splash.html index a285dc4..e1f35e3 100644 --- a/src/splash.html +++ b/src/splash.html @@ -2,87 +2,195 @@ - Splash Screen + + Product Page -
- ccIDE Icon -

Loading ccIDE...

-
-
+
+ + + +
+ ccIDE Icon +

ccIDE

-
Initializing...
-
- diff --git a/src/splash_old.html b/src/splash_old.html new file mode 100644 index 0000000..a285dc4 --- /dev/null +++ b/src/splash_old.html @@ -0,0 +1,90 @@ + + + + + Splash Screen + + + +
+ ccIDE Icon +

Loading ccIDE...

+
+
+
+
Initializing...
+
+ + + +