From 8c477a8ae5a11b61264aec2f905745b2472b4b24 Mon Sep 17 00:00:00 2001 From: Giel Cobben Date: Sun, 24 Dec 2017 15:53:55 +0100 Subject: [PATCH] Removed open-with functionallity --- main/index.js | 40 -------- package.json | 269 +++----------------------------------------------- 2 files changed, 14 insertions(+), 295 deletions(-) diff --git a/main/index.js b/main/index.js index 7d361f1..c7bce31 100644 --- a/main/index.js +++ b/main/index.js @@ -1,5 +1,3 @@ -const fs = require("fs"); -const path = require("path"); const Store = require("electron-store"); const prepareNext = require("electron-next"); const { app, ipcMain, dialog } = require("electron"); @@ -22,8 +20,6 @@ const { closeProgressWindow, } = require("./windows/progress"); -let openFilesOnLaunch = []; // eslint-disable-line prefer-const - const store = new Store(); // Window variables @@ -47,25 +43,6 @@ const showErrorDialog = online => { } }; -const openFile = filePath => { - const { mainWindow } = global.windows; - - fs.stat(filePath, (error, stats) => { - if (error) { - console.log(error); - return; - } - - const file = { - name: path.basename(filePath), - size: stats.size, - path: filePath, - }; - - mainWindow.webContents.send("openFile", file); - }); -}; - // App Events app.on("before-quit", () => { global.windows.checkWindow = null; @@ -86,18 +63,6 @@ app.on("activate", () => { } }); -app.on("will-finish-launching", () => { - app.on("open-file", (event, filePath) => { - event.preventDefault(); - - if (global.windows && global.windows.mainWindow) { - openFile(filePath); - } else { - openFilesOnLaunch.push(filePath); - } - }); -}); - app.on("ready", async () => { await prepareNext("./renderer"); @@ -127,11 +92,6 @@ app.on("ready", async () => { progressWindow, } = global.windows; - mainWindow.on("show", () => { - openFilesOnLaunch.map(file => openFile(file)); - openFilesOnLaunch = []; - }); - mainWindow.on("close", () => { global.windows = null; app.exit(); diff --git a/package.json b/package.json index 3f32592..688bf79 100644 --- a/package.json +++ b/package.json @@ -19,17 +19,21 @@ } ], "productName": "Caption", - "version": "2.0.0-beta.5", + "version": "2.0.0", "main": "main/index.js", "license": "MIT", "repository": "gielcobben/Caption", "scripts": { "start": "electron --inspect=5858 .", "build": "npm run test && next build renderer && next export renderer", - "dist:mac": "export CSC_IDENTITY_AUTO_DISCOVERY=\"true\"; node -r dotenv/config node_modules/.bin/build --mac -p always", - "dist:windows": "export CSC_NAME=\"Defringe\"; export CSC_IDENTITY_AUTO_DISCOVERY=\"false\"; export CSC_LINK=\"~/Defringe.p12\"; node -r dotenv/config node_modules/.bin/build --windows -p always", - "dist:linux": "node -r dotenv/config node_modules/.bin/build --linux -p always", - "dist": "npm run build && npm run dist:mac && npm run dist:windows && npm run dist:linux", + "dist:mac": + "export CSC_IDENTITY_AUTO_DISCOVERY=\"true\"; node -r dotenv/config node_modules/.bin/build --mac -p always", + "dist:windows": + "export CSC_NAME=\"Defringe\"; export CSC_IDENTITY_AUTO_DISCOVERY=\"false\"; export CSC_LINK=\"~/Defringe.p12\"; node -r dotenv/config node_modules/.bin/build --windows -p always", + "dist:linux": + "node -r dotenv/config node_modules/.bin/build --linux -p always", + "dist": + "npm run build && npm run dist:mac && npm run dist:windows && npm run dist:linux", "test": "jest", "test:watch": "jest --watch", "postinstall": "opencollective postinstall" @@ -82,262 +86,17 @@ "repo": "Caption" } ], - "files": [ - "**/*", - "!.env", - "!renderer", - "renderer/out" - ], + "files": ["**/*", "!.env", "!renderer", "renderer/out"], "mac": { - "target": [ - "dmg", - "zip" - ], - "icon": "./renderer/static/icon.icns", - "fileAssociations": [ - { - "ext": "3g2" - }, - { - "ext": "3gp" - }, - { - "ext": "3gp2" - }, - { - "ext": "3gpp" - }, - { - "ext": "60d" - }, - { - "ext": "ajp" - }, - { - "ext": "asf" - }, - { - "ext": "asx" - }, - { - "ext": "avchd" - }, - { - "ext": "avi" - }, - { - "ext": "bik" - }, - { - "ext": "bix" - }, - { - "ext": "box" - }, - { - "ext": "cam" - }, - { - "ext": "dat" - }, - { - "ext": "divx" - }, - { - "ext": "dmf" - }, - { - "ext": "dv" - }, - { - "ext": "dvr-ms" - }, - { - "ext": "evo" - }, - { - "ext": "flc" - }, - { - "ext": "fli" - }, - { - "ext": "flic" - }, - { - "ext": "flv" - }, - { - "ext": "flx" - }, - { - "ext": "gvi" - }, - { - "ext": "gvp" - }, - { - "ext": "h264" - }, - { - "ext": "m1v" - }, - { - "ext": "m2p" - }, - { - "ext": "m2ts" - }, - { - "ext": "m2v" - }, - { - "ext": "m4e" - }, - { - "ext": "m4v" - }, - { - "ext": "mjp" - }, - { - "ext": "mjpeg" - }, - { - "ext": "mjpg" - }, - { - "ext": "mkv" - }, - { - "ext": "moov" - }, - { - "ext": "mov" - }, - { - "ext": "movhd" - }, - { - "ext": "movie" - }, - { - "ext": "movx" - }, - { - "ext": "mp4" - }, - { - "ext": "mpe" - }, - { - "ext": "mpeg" - }, - { - "ext": "mpg" - }, - { - "ext": "mpv" - }, - { - "ext": "mpv2" - }, - { - "ext": "mxf" - }, - { - "ext": "nsv" - }, - { - "ext": "nut" - }, - { - "ext": "ogg" - }, - { - "ext": "ogm" - }, - { - "ext": "omf" - }, - { - "ext": "ps" - }, - { - "ext": "qt" - }, - { - "ext": "ram" - }, - { - "ext": "rm" - }, - { - "ext": "rmvb" - }, - { - "ext": "swf" - }, - { - "ext": "ts" - }, - { - "ext": "vfw" - }, - { - "ext": "vid" - }, - { - "ext": "video" - }, - { - "ext": "viv" - }, - { - "ext": "vivo" - }, - { - "ext": "vob" - }, - { - "ext": "vro" - }, - { - "ext": "wm" - }, - { - "ext": "wmv" - }, - { - "ext": "wmx" - }, - { - "ext": "wrap" - }, - { - "ext": "wvx" - }, - { - "ext": "wx" - }, - { - "ext": "x264" - }, - { - "ext": "xvi" - } - ] + "target": ["dmg", "zip"], + "icon": "./renderer/static/icon.icns" }, "linux": { - "target": [ - "deb" - ], + "target": ["deb"], "icon": "./renderer/static/icon.iconset/" }, "win": { - "target": [ - "nsis" - ], + "target": ["nsis"], "icon": "./renderer/static/icon.ico", "publisherName": "Defringe" }