-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
40 lines (32 loc) · 913 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
'use strict';
const childProcess = require('child_process');
const {dialog, shell} = require('electron');
const appExists = require('app-exists');
const gifskiBundleId = 'com.sindresorhus.Gifski';
const action = async context => {
const isGifskiInstalled = await appExists(gifskiBundleId);
if (!isGifskiInstalled) {
const {response: buttonIndex} = await dialog.showMessageBox({
message: 'The kap-gifski plugin requires the Gifski app, but the app was not found.',
buttons: [
'Get Gifski',
'Cancel'
]
});
if (buttonIndex === 0) {
await shell.openExternal('https://github.com/sindresorhus/Gifski');
}
context.cancel();
return;
}
const filePath = await context.filePath({fileType: 'mp4'});
childProcess.spawn('open', ['-b', gifskiBundleId, filePath]);
};
const gifski = {
title: 'Export With Gifski',
formats: [
'gif'
],
action
};
exports.shareServices = [gifski];