diff --git a/icons/colorPalette.png b/icons/colorPalette.png new file mode 100644 index 0000000..70be68d Binary files /dev/null and b/icons/colorPalette.png differ diff --git a/icons/fullLogo.svg b/icons/fullLogo.svg new file mode 100644 index 0000000..c459704 --- /dev/null +++ b/icons/fullLogo.svg @@ -0,0 +1,43 @@ + \ No newline at end of file diff --git a/icons/logoOnly.svg b/icons/logoOnly.svg new file mode 100644 index 0000000..8e0f8de --- /dev/null +++ b/icons/logoOnly.svg @@ -0,0 +1,29 @@ + \ No newline at end of file diff --git a/index.js b/index.js index 867b381..0d4cd27 100644 --- a/index.js +++ b/index.js @@ -9,6 +9,10 @@ const { const url = require("url"); const path = require("path"); const FileType = require("file-type"); +const glob = require("glob"); +const fs = require("fs"); + + let win; const isMac = process.platform === "darwin"; @@ -96,6 +100,9 @@ function createWindow() { app.on("ready", function () { createWindow(); + + console.log(process.argv) + ipcMain.on("synchronous-message", (event, arg) => { console.log(arg); if (arg == "openFile") { @@ -104,16 +111,50 @@ app.on("ready", function () { .then(function (data) { FileType.fromFile(data.filePaths[0]).then((type) => { data.type = type["mime"].split("/")[0]; + console.info(data) win.webContents.send("FileData", data); }); }); + event.returnValue = ""; } else if (arg == "resize") { // A really ugly hack to force the window to update, so the canvas shows up win.setSize(win.getSize()[0] + 1, win.getSize()[1]); setTimeout(function () { win.setSize(win.getSize()[0] + 1, win.getSize()[1]); }, 200); + event.returnValue = ""; + } else if (arg.includes("indexFolder")) { + const fold = arg.split(";")[1]; + folder = fs.readdirSync(fold); + let result = []; + for (const file in folder) { + const myFile = folder[file]; + if (fs.statSync(fold + "/" + myFile).isFile()) { + result.push(myFile) + } + } + event.returnValue = result; + } else if (arg == "finishedLoading") { + const tryOpenFile = process.argv[1]; + + if (tryOpenFile != undefined) { + console.log("Opening file: ", process.argv[1]) + if (fs.existsSync(tryOpenFile)) { + data = { + canceled: false, + filePaths: [process.argv[1]] + }; + FileType.fromFile(data.filePaths[0]).then((type) => { + data.type = type["mime"].split("/")[0]; + console.log(data) + win.webContents.send("FileData", data); + }); + } else { + console.log("Argument file does not exist") + } + } + } - event.returnValue = ""; + }); }); diff --git a/package.json b/package.json index 4742edf..cff57d8 100644 --- a/package.json +++ b/package.json @@ -10,56 +10,24 @@ "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "start": "electron .", + "start": "electron ", "startDev": "npm run buildCss && npm run minify && electron .", "minify": "node tooling/minifyAll/minifyAllSrcs.js", "buildCss": "npx tailwindcss -i ./src/main.css -o ./dist/output.css", - "buildCssWatch": "npx tailwindcss -i ./src/main.css -o ./dist/output.css --watch", - "package": "electron-forge package", - "make": "electron-forge make" + "buildCssWatch": "npx tailwindcss -i ./src/main.css -o ./dist/output.css --watch" }, "author": "TheGreydiamond", "license": "GPL-3.0", - "config": { - "forge": { - "packagerConfig": {}, - "makers": [ - { - "name": "@electron-forge/maker-squirrel", - "config": { - "name": "open360viewer" - } - }, - { - "name": "@electron-forge/maker-zip", - "platforms": [ - "darwin" - ] - }, - { - "name": "@electron-forge/maker-deb", - "config": {} - }, - { - "name": "@electron-forge/maker-rpm", - "config": {} - } - ] - } - }, "dependencies": { "@fortawesome/fontawesome-free": "^5.15.4", "@themesberg/flowbite": "^1.2.0", "file-type": "^16.5.3", + "glob": "^7.2.0", "marzipano": "^0.10.2" }, "devDependencies": { - "@electron-forge/cli": "^6.0.0-beta.61", - "@electron-forge/maker-deb": "^6.0.0-beta.61", - "@electron-forge/maker-rpm": "^6.0.0-beta.61", - "@electron-forge/maker-squirrel": "^6.0.0-beta.61", - "@electron-forge/maker-zip": "^6.0.0-beta.61", "electron": "^16.0.6", + "electron-packager": "^15.4.0", "minify": "^8.0.3", "tailwindcss": "^3.0.11" } diff --git a/src/main.js b/src/main.js index 7e22d1c..c0418c9 100644 --- a/src/main.js +++ b/src/main.js @@ -1,5 +1,7 @@ const { ipcRenderer, ipcMain } = require("electron"); +let currentIndex = -1; + ipcRenderer.on("FileData", function (event, data) { console.log(data); if (data.canceled == false) { @@ -14,9 +16,28 @@ ipcRenderer.on("FileData", function (event, data) { } else if (data.type == "video") { loadVideoFromSource(data.filePaths[0]); } + makeFileIndex(data.filePaths[0]); } + }); +function getPathWithoutExtension(path) { + return path.substring(0, path.lastIndexOf("/")) || path.substring(0, path.lastIndexOf("\\")); +} + +function makeFileIndex(fullPath) { + fileName = fullPath.substring(fullPath.lastIndexOf("/")) || fullPath.substring(0, fullPath.lastIndexOf("\\")); + path = getPathWithoutExtension(fullPath); + const result = ipcRenderer.sendSync("synchronous-message", "indexFolder;" + path); + const finalResult = []; + for(elm in result) { + const curr = result[elm]; + finalResult.push(path + curr) + } + currentIndex = fin + console.log(finalResult) +} + function openFile() { ipcRenderer.sendSync("synchronous-message", "openFile"); } diff --git a/src/ui_templates/index.html b/src/ui_templates/index.html index 8385987..32bde81 100644 --- a/src/ui_templates/index.html +++ b/src/ui_templates/index.html @@ -8,7 +8,7 @@ -
+