Skip to content

Commit

Permalink
Merge pull request #81 from gielcobben/giel/bugs
Browse files Browse the repository at this point in the history
Removed open-with functionallity
  • Loading branch information
Giel authored Dec 26, 2017
2 parents 2ee7cb1 + 8c477a8 commit c1b7771
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 295 deletions.
40 changes: 0 additions & 40 deletions main/index.js
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -22,8 +20,6 @@ const {
closeProgressWindow,
} = require("./windows/progress");

let openFilesOnLaunch = []; // eslint-disable-line prefer-const

const store = new Store();

// Window variables
Expand All @@ -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;
Expand All @@ -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");

Expand Down Expand Up @@ -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();
Expand Down
269 changes: 14 additions & 255 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
}
Expand Down

0 comments on commit c1b7771

Please sign in to comment.