-
Notifications
You must be signed in to change notification settings - Fork 15
/
index.js
39 lines (29 loc) · 944 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
var fs = require('fs');
var path = require('path');
var SafariBrowser = function(baseBrowserDecorator) {
baseBrowserDecorator(this);
this._start = function(url) {
var HTML_TPL = path.normalize(__dirname + '/safari.html');
var self = this;
fs.readFile(HTML_TPL, function(err, data) {
var content = data.toString().replace('%URL%', url);
var staticHtmlPath = self._tempDir + '/redirect.html';
fs.writeFile(staticHtmlPath, content, function(err) {
self._execCommand(self._getCommand(), [staticHtmlPath]);
});
});
};
};
SafariBrowser.prototype = {
name: 'Safari',
DEFAULT_CMD: {
darwin: '/Applications/Safari.app/Contents/MacOS/Safari',
win32: process.env['ProgramFiles(x86)'] + '\\Safari\\Safari.exe'
},
ENV_CMD: 'SAFARI_BIN'
};
SafariBrowser.$inject = ['baseBrowserDecorator'];
// PUBLISH DI MODULE
module.exports = {
'launcher:Safari': ['type', SafariBrowser]
};