-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
config.js
98 lines (84 loc) · 2.41 KB
/
config.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
var Config = require("electron-config");
var instance,
path = "";
if (typeof __dirname !== "undefined") {
path = __dirname;
}
// PATH TO CONFIG:
// /Users/<name>/Library/Application\ Support/MenuTube/
/*
* Configs that should be saved locally must be listed here,
* also settings that user can implicitly change
* NOT VALID ANYMORE - NO LOCAL SETTINGS NO PREFERENCES PAGE!
* */
var userPreferences = {
adBlock: false,
alwaysOnTop: true,
windowResize: true,
windowDraggable: true,
windowPosition: "trayCenter",
globalShortcuts: true,
PIPModeByDefault: false,
highlightTray: true,
rememberBounds: true,
theme: "red-theme",
desktopMode: false,
};
var defaults = {
showOnRightClick: false,
userAgent:
"MMozilla/5.0 (Linux; Android 9; SM-G960F Build/PPR1.180610.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.157 Mobile Safari/537.36",
desktopUserAgent:
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36",
externalLinks: false,
icon: path + "/icons/logo-icon-black-and-white/icon.iconset/icon_16x16.png",
iconPressed:
path +
"/icons/logo-icon-black-and-white-inverse/icon.iconset/icon_16x16.png",
preloadWindow: true,
showDockIcon: false,
showOnAllWorkspaces: false,
browserWindow: {
width: 500,
height: 500,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
webviewTag: true,
},
},
};
function AppConfig() {
var config = new Config();
if (typeof config.store === "object") {
/*
* Ignore all local configs from now on
* */
// This is another hack
userPreferences.adBlock = config.store.adBlock;
config.set(Object.assign(userPreferences, {}));
}
this.config = config;
Object.defineProperty(this, "store", {
get: function () {
// Small hack to avoid issues with versioning and changes to preferences page
defaults.browserWindow.alwaysOnTop = userPreferences.alwaysOnTop;
return {
all: Object.assign(defaults, userPreferences),
userPreferences: userPreferences,
defaults: defaults,
};
},
});
}
AppConfig.prototype = {
update: function (config) {
// This is another hack
this.config.set(config);
},
};
var getInstance = function () {
instance = instance || new AppConfig();
return instance;
};
module.exports = getInstance();