mirror of
https://github.com/Lightcord/Lightcord.git
synced 2025-04-12 00:55:40 +02:00
cleaning and sync with 0.0.306 desktop_core@2
This commit is contained in:
parent
b9131a88ac
commit
f51d445c22
@ -1,4 +1,4 @@
|
||||
const ipcRenderer = require("../discord_native/ipc")
|
||||
const ipcRenderer = require("../discord_native/renderer/ipc")
|
||||
|
||||
|
||||
if(process.platform === "win32"){
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 107 KiB |
@ -12,16 +12,12 @@ var _utils = require('./utils');
|
||||
|
||||
var _mainScreen = require('./mainScreen');
|
||||
|
||||
var _appFeatures = require('./appFeatures');
|
||||
|
||||
var _ipcMain = require('./ipcMain');
|
||||
|
||||
var _ipcMain2 = _interopRequireDefault(_ipcMain);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const features = (0, _appFeatures.getFeatures)();
|
||||
|
||||
let hasInit = exports.hasInit = false;
|
||||
|
||||
let lastIndex;
|
||||
@ -49,9 +45,6 @@ function init() {
|
||||
appIcons.push(_utils.exposeModuleResource(resourcePath, `badge-${i}.ico`));
|
||||
}
|
||||
|
||||
// TODO: remove on or after April 2018
|
||||
features.declareSupported('new_app_badge');
|
||||
|
||||
_ipcMain2.default.on('APP_BADGE_SET', (_event, count) => setAppBadge(count));
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,6 @@ var autoStart = _interopRequireWildcard(_autoStart);
|
||||
|
||||
var _appSettings = require('./appSettings');
|
||||
|
||||
var _appFeatures = require('./appFeatures');
|
||||
|
||||
var _ipcMain = require('./ipcMain');
|
||||
|
||||
var _ipcMain2 = _interopRequireDefault(_ipcMain);
|
||||
@ -22,8 +20,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
const settings = _appSettings();
|
||||
const features = (0, _appFeatures.getFeatures)();
|
||||
const settings = _appSettings.getSettings();
|
||||
const NOOP = () => {};
|
||||
|
||||
let hasInit = exports.hasInit = false;
|
||||
@ -35,9 +32,6 @@ function init() {
|
||||
}
|
||||
exports.hasInit = hasInit = true;
|
||||
|
||||
// TODO remove on or after March 2018
|
||||
features.declareSupported('app_configs');
|
||||
|
||||
_ipcMain2.default.on('TOGGLE_MINIMIZE_TO_TRAY', (_event, value) => setMinimizeOnClose(value));
|
||||
_ipcMain2.default.on('TOGGLE_OPEN_ON_STARTUP', (_event, value) => toggleRunOnStartup(value));
|
||||
_ipcMain2.default.on('TOGGLE_START_MINIMIZED', (_event, value) => toggleStartMinimized(value));
|
||||
|
@ -90,7 +90,7 @@ exports.default = [{
|
||||
click: () => {
|
||||
const window = getWindow();
|
||||
if (window) {
|
||||
window.webContents.reloadIgnoringCache()
|
||||
window.webContents.reloadIgnoringCache();
|
||||
}
|
||||
},
|
||||
accelerator: 'Command+R'
|
||||
|
@ -51,10 +51,7 @@ exports.default = [{
|
||||
label: '&View',
|
||||
submenu: [{
|
||||
label: '&Reload',
|
||||
click: () => {
|
||||
let window = _electron.BrowserWindow.getFocusedWindow()
|
||||
window.webContents.reloadIgnoringCache()
|
||||
},
|
||||
click: () => _electron.BrowserWindow.getFocusedWindow().webContents.reloadIgnoringCache(),
|
||||
accelerator: 'Control+R'
|
||||
}, {
|
||||
label: 'Toggle &Full Screen',
|
||||
|
@ -10,10 +10,6 @@ var _Constants = require('../Constants');
|
||||
|
||||
var Constants = _interopRequireWildcard(_Constants);
|
||||
|
||||
function getBackgroundColor(){
|
||||
return appSettings.get("BACKGROUND_COLOR", "#2f3136")
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
const { MenuEvents } = Constants;
|
||||
@ -34,10 +30,7 @@ exports.default = [{
|
||||
label: '&View',
|
||||
submenu: [{
|
||||
label: '&Reload',
|
||||
click: () => {
|
||||
let window = _electron.BrowserWindow.getFocusedWindow()
|
||||
window.webContents.reloadIgnoringCache()
|
||||
},
|
||||
click: () => _electron.BrowserWindow.getFocusedWindow().webContents.reloadIgnoringCache(),
|
||||
accelerator: 'Control+R'
|
||||
}, {
|
||||
label: 'Toggle &Full Screen',
|
||||
|
@ -1,29 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
// Private utilities for discordNativeAPI.
|
||||
// Don't expose to the public DiscordNative.
|
||||
|
||||
const electron = require('electron');
|
||||
const remoteProcess = electron.remote.process;
|
||||
const BrowserWindow = electron.remote.BrowserWindow;
|
||||
|
||||
function getWindow(key) {
|
||||
if (!key) return getCurrentWindow();
|
||||
return BrowserWindow.getAllWindows().find(window => window.windowKey === key);
|
||||
}
|
||||
|
||||
function getCurrentWindow() {
|
||||
return electron.remote.getCurrentWindow();
|
||||
}
|
||||
|
||||
function getElectronMajorVersion() {
|
||||
if (remoteProcess.versions.electron) {
|
||||
return parseInt(remoteProcess.versions.electron.split('.')[0]);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getCurrentWindow,
|
||||
getWindow,
|
||||
getElectronMajorVersion
|
||||
};
|
@ -1,14 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var _electron = require('electron');
|
||||
|
||||
function isAccessibilitySupportEnabled() {
|
||||
// NOTE(faulty): `isX` methods are deprecated and being replaced with
|
||||
// property accessors in Electron. However, the property accessor for this is
|
||||
// seemingly not available yet, so this check tries to accomodate both.
|
||||
return _electron.remote.app.accessibilitySupportEnabled != null ? _electron.remote.app.accessibilitySupportEnabled : _electron.remote.app.isAccessibilitySupportEnabled();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isAccessibilitySupportEnabled
|
||||
};
|
@ -1,41 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const electron = require('electron');
|
||||
const invariant = require('invariant');
|
||||
const remote = electron.remote;
|
||||
const nativeImage = electron.nativeImage;
|
||||
|
||||
function copy(text) {
|
||||
if (text) {
|
||||
remote.clipboard.writeText(text);
|
||||
} else {
|
||||
remote.getCurrentWebContents().copy();
|
||||
}
|
||||
}
|
||||
|
||||
function copyImage(imageArrayBuffer, imageSrc) {
|
||||
invariant(imageArrayBuffer != null, 'Image data is empty');
|
||||
|
||||
const nativeImg = nativeImage.createFromBuffer(imageArrayBuffer);
|
||||
electron.clipboard.write({ html: `<img src="${imageSrc}">`, image: nativeImg });
|
||||
}
|
||||
|
||||
function cut() {
|
||||
remote.getCurrentWebContents().cut();
|
||||
}
|
||||
|
||||
function paste() {
|
||||
remote.getCurrentWebContents().paste();
|
||||
}
|
||||
|
||||
function read() {
|
||||
return electron.clipboard.readText();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
copy,
|
||||
copyImage,
|
||||
cut,
|
||||
paste,
|
||||
read
|
||||
};
|
@ -1,26 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const electron = require('electron');
|
||||
const ipcRenderer = require('./ipc');
|
||||
const crashReporter = electron.crashReporter;
|
||||
|
||||
const UPDATE_CRASH_REPORT_METADATA = 'UPDATE_CRASH_REPORT_METADATA';
|
||||
const START_CRASH_REPORTER = 'START_CRASH_REPORTER';
|
||||
|
||||
ipcRenderer.on(START_CRASH_REPORTER, (event, args) => {
|
||||
crashReporter.start(args);
|
||||
});
|
||||
|
||||
function updateCrashReporter(additional_metadata) {
|
||||
ipcRenderer.send(UPDATE_CRASH_REPORT_METADATA, additional_metadata);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
updateCrashReporter
|
||||
};
|
@ -1,42 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const electron = require('electron');
|
||||
const { getElectronMajorVersion } = require('./_common');
|
||||
const desktopCapturer = electron.desktopCapturer;
|
||||
|
||||
function hasPromisifiedGetSources() {
|
||||
return getElectronMajorVersion() >= 6;
|
||||
}
|
||||
|
||||
function getDesktopCaptureSources(options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let getSourcesPromise;
|
||||
if (hasPromisifiedGetSources()) {
|
||||
getSourcesPromise = desktopCapturer.getSources(options);
|
||||
} else {
|
||||
getSourcesPromise = new Promise((resolve, reject) => {
|
||||
desktopCapturer.getSources(options, (err, sources) => {
|
||||
if (err != null) {
|
||||
return reject(err);
|
||||
}
|
||||
|
||||
return resolve(sources);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
getSourcesPromise.then(sources => {
|
||||
return resolve(sources.map(source => {
|
||||
return {
|
||||
id: source.id,
|
||||
name: source.name,
|
||||
url: source.thumbnail.toDataURL()
|
||||
};
|
||||
}));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getDesktopCaptureSources
|
||||
};
|
@ -1,179 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
let orderedFiles = (() => {
|
||||
var _ref = _asyncToGenerator(function* (folder) {
|
||||
try {
|
||||
const filenames = yield readdir(folder);
|
||||
const times = yield getTimes(filenames.map(function (filename) {
|
||||
return path.join(folder, filename);
|
||||
}));
|
||||
return times.filter(function (result) {
|
||||
return result.status === 'fulfilled';
|
||||
}).map(function (result) {
|
||||
return result.value;
|
||||
}).sort(function (a, b) {
|
||||
return b.mtime.getTime() - a.mtime.getTime();
|
||||
}).map(function (a) {
|
||||
return a.filename;
|
||||
});
|
||||
} catch (err) {
|
||||
return [];
|
||||
}
|
||||
});
|
||||
|
||||
return function orderedFiles(_x) {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
|
||||
let readLogFiles = (() => {
|
||||
var _ref2 = _asyncToGenerator(function* (maxSize, makeFile) {
|
||||
const modulePath = electron.remote.getGlobal('modulePath');
|
||||
const webrtcLog0 = path.join(modulePath, 'discord_voice', 'discord-webrtc_0');
|
||||
const webrtcLog1 = path.join(modulePath, 'discord_voice', 'discord-webrtc_1');
|
||||
const webrtcLog2 = path.join(modulePath, 'discord_voice', 'discord-last-webrtc_0');
|
||||
const webrtcLog3 = path.join(modulePath, 'discord_voice', 'discord-last-webrtc_1');
|
||||
const hookLog = path.join(modulePath, 'discord_hook', 'hook.log');
|
||||
const filesToUpload = [webrtcLog0, webrtcLog1, webrtcLog2, webrtcLog3, hookLog];
|
||||
|
||||
const crashFolder = process.platform === 'win32' ? path.join(os.tmpdir(), 'Lightcord Crashes', 'reports') : path.join(os.tmpdir(), 'Lightcord Crashes', 'completed');
|
||||
const crashFiles = yield orderedFiles(crashFolder);
|
||||
if (crashFiles.length > 0) {
|
||||
filesToUpload.push(crashFiles[0]);
|
||||
}
|
||||
|
||||
const files = yield readFiles(filesToUpload, maxSize, function (data, filename) {
|
||||
return makeFile(data, filename, 'application/octet-stream');
|
||||
});
|
||||
return files.filter(function (result) {
|
||||
return result.status === 'fulfilled';
|
||||
}).map(function (result) {
|
||||
return result.value;
|
||||
});
|
||||
});
|
||||
|
||||
return function readLogFiles(_x2, _x3) {
|
||||
return _ref2.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
|
||||
let openFiles = (() => {
|
||||
var _ref3 = _asyncToGenerator(function* (dialogOptions, maxSize, makeFile) {
|
||||
const filenames = yield showOpenDialog(dialogOptions);
|
||||
if (filenames == null) {
|
||||
return;
|
||||
}
|
||||
const files = yield readFiles(filenames, maxSize, makeFile);
|
||||
files.forEach(function (result) {
|
||||
if (result.status === 'rejected') {
|
||||
throw result.reason;
|
||||
}
|
||||
});
|
||||
return files.map(function (result) {
|
||||
return result.value;
|
||||
});
|
||||
});
|
||||
|
||||
return function openFiles(_x4, _x5, _x6) {
|
||||
return _ref3.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
|
||||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
|
||||
|
||||
const electron = require('electron');
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const originalFs = require('original-fs');
|
||||
const remoteDialog = electron.remote.dialog;
|
||||
const remoteShell = electron.remote.shell;
|
||||
const { getElectronMajorVersion } = require('./_common');
|
||||
const util = require('util');
|
||||
// TODO: Remove when moving to Electron 6
|
||||
const allSettled = require('promise.allsettled');
|
||||
|
||||
const INVALID_FILENAME_CHAR_REGEX = /[^a-zA-Z0-9-_.]/g;
|
||||
|
||||
allSettled.shim();
|
||||
const readdir = util.promisify(originalFs.readdir);
|
||||
|
||||
function remoteDialogReturnsPromises() {
|
||||
return getElectronMajorVersion() >= 6;
|
||||
}
|
||||
|
||||
function saveWithDialog(fileContents, fileName, filePath) {
|
||||
if (INVALID_FILENAME_CHAR_REGEX.test(fileName)) {
|
||||
throw new Error(`fileName has invalid characters`);
|
||||
}
|
||||
const defaultPath = filePath != null ? path.join(os.homedir(), filePath, fileName) : path.join(os.homedir(), fileName);
|
||||
|
||||
const writeFileToDisk = selectedFileName => {
|
||||
selectedFileName && fs.writeFileSync(selectedFileName, fileContents);
|
||||
};
|
||||
|
||||
if (remoteDialogReturnsPromises()) {
|
||||
remoteDialog.showSaveDialog({ defaultPath }).then(results => writeFileToDisk(results.filePath));
|
||||
} else {
|
||||
remoteDialog.showSaveDialog({ defaultPath }, writeFileToDisk);
|
||||
}
|
||||
}
|
||||
|
||||
function showOpenDialog(dialogOptions) {
|
||||
if (remoteDialogReturnsPromises()) {
|
||||
return remoteDialog.showOpenDialog(dialogOptions).then(results => results.filePaths);
|
||||
} else {
|
||||
return new Promise(resolve => remoteDialog.showOpenDialog(dialogOptions, resolve));
|
||||
}
|
||||
}
|
||||
|
||||
function getTimes(filenames) {
|
||||
return Promise.allSettled(filenames.map(filename => new Promise((resolve, reject) => {
|
||||
originalFs.stat(filename, (err, stats) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
if (!stats.isFile()) {
|
||||
return reject(new Error('Not a file'));
|
||||
}
|
||||
return resolve({ filename, mtime: stats.mtime });
|
||||
});
|
||||
})));
|
||||
}
|
||||
|
||||
function showItemInFolder(path) {
|
||||
return remoteShell.showItemInFolder(path);
|
||||
}
|
||||
|
||||
function readFiles(filenames, maxSize, makeFile) {
|
||||
return Promise.allSettled(filenames.map(filename => new Promise((resolve, reject) => {
|
||||
originalFs.stat(filename, (err, stats) => {
|
||||
if (err) return reject(err);
|
||||
|
||||
if (stats.size > maxSize) {
|
||||
const err = new Error('upload too large');
|
||||
// used to help determine why openFiles failed
|
||||
err.code = 'ETOOLARGE';
|
||||
return reject(err);
|
||||
}
|
||||
|
||||
originalFs.readFile(filename, (err, data) => {
|
||||
if (err) return reject(err);
|
||||
return resolve(makeFile(data.buffer, path.basename(filename)));
|
||||
});
|
||||
});
|
||||
})));
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
readLogFiles,
|
||||
saveWithDialog,
|
||||
openFiles,
|
||||
showOpenDialog,
|
||||
showItemInFolder,
|
||||
extname: path.extname,
|
||||
basename: path.basename,
|
||||
dirname: path.dirname,
|
||||
join: path.join,
|
||||
modulePath: electron.remote.getGlobal('modulePath')
|
||||
};
|
@ -1,19 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const electron = require('electron');
|
||||
const getGlobal = electron.remote.getGlobal;
|
||||
|
||||
module.exports = {
|
||||
get releaseChannel() {
|
||||
return getGlobal('releaseChannel');
|
||||
},
|
||||
get crashReporterMetadata() {
|
||||
return getGlobal('crashReporterMetadata');
|
||||
},
|
||||
get features() {
|
||||
return getGlobal('features');
|
||||
},
|
||||
get appSettings() {
|
||||
return getGlobal('appSettings');
|
||||
}
|
||||
};
|
@ -1,17 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const electron = require('electron');
|
||||
const remoteGPUSettings = electron.remote.require('./GPUSettings');
|
||||
|
||||
function getEnableHardwareAcceleration() {
|
||||
return remoteGPUSettings.getEnableHardwareAcceleration();
|
||||
}
|
||||
|
||||
function setEnableHardwareAcceleration(enable) {
|
||||
remoteGPUSettings.setEnableHardwareAcceleration(enable);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getEnableHardwareAcceleration,
|
||||
setEnableHardwareAcceleration
|
||||
};
|
@ -1,80 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.makeChunkedRequest = makeChunkedRequest;
|
||||
|
||||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
|
||||
|
||||
const http = require('http');
|
||||
const https = require('https');
|
||||
|
||||
function makeChunkedRequest(route, chunks, options, callback) {
|
||||
/**
|
||||
* Given an array of chunks, make a slow request, only writing chunks
|
||||
* after a specified amount of time
|
||||
*
|
||||
* route: string
|
||||
* options: object
|
||||
* method: the method of the request
|
||||
* contentType: the content type of the request
|
||||
* chunkInterval: how long to wait to upload a chunk after the last chunk was flushed
|
||||
* token: the token to make an authorized request from
|
||||
* chunks: chunked body of the request to upload
|
||||
*/
|
||||
|
||||
const { method, chunkInterval, token, contentType } = options;
|
||||
|
||||
let httpModule = http;
|
||||
if (route.startsWith('https')) {
|
||||
httpModule = https;
|
||||
}
|
||||
|
||||
const requestPromise = new Promise((() => {
|
||||
var _ref = _asyncToGenerator(function* (resolve, reject) {
|
||||
let writeTimeout;
|
||||
const req = httpModule.request(route, {
|
||||
method,
|
||||
headers: {
|
||||
authorization: token,
|
||||
'Content-Type': contentType,
|
||||
'Content-Length': Buffer.byteLength(chunks.join(''))
|
||||
}
|
||||
}, function (res) {
|
||||
let responseData = '';
|
||||
res.setEncoding('utf8');
|
||||
res.on('data', function (chunk) {
|
||||
responseData += chunk;
|
||||
});
|
||||
|
||||
res.on('end', function () {
|
||||
resolve({ status: res.statusCode, body: responseData });
|
||||
});
|
||||
});
|
||||
|
||||
req.on('error', function (e) {
|
||||
if (writeTimeout != null) {
|
||||
clearTimeout(writeTimeout);
|
||||
}
|
||||
reject(e);
|
||||
});
|
||||
|
||||
for (let i = 0; i < chunks.length; i++) {
|
||||
yield new Promise(function (resolve) {
|
||||
req.write(chunks[i], function () {
|
||||
writeTimeout = setTimeout(resolve, chunkInterval);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
req.end();
|
||||
});
|
||||
|
||||
return function (_x, _x2) {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
})());
|
||||
|
||||
requestPromise.then(body => callback(null, body)).catch(callback);
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const electron = require('electron');
|
||||
const ipcRenderer = electron.ipcRenderer;
|
||||
|
||||
// We prefix events with the `DISCORD_` string to prevent malicious use
|
||||
function send(event, ...args) {
|
||||
ipcRenderer.send(`DISCORD_${event}`, ...args);
|
||||
}
|
||||
|
||||
function on(event, callback) {
|
||||
ipcRenderer.on(`DISCORD_${event}`, callback);
|
||||
}
|
||||
|
||||
function removeListener(event, callback) {
|
||||
ipcRenderer.removeListener(`DISCORD_${event}`, callback);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
send,
|
||||
on,
|
||||
removeListener
|
||||
};
|
@ -1,96 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const electron = require('electron');
|
||||
const vm = require('vm');
|
||||
const ipcRenderer = require('./ipc');
|
||||
|
||||
// Set up global module paths in renderer's require
|
||||
const NodeModule = require('module');
|
||||
const mainAppDirname = electron.remote.getGlobal('mainAppDirname');
|
||||
|
||||
let modulePaths = [];
|
||||
|
||||
// add native module paths
|
||||
const remotePaths = electron.remote.require('module').globalPaths;
|
||||
remotePaths.forEach(path => {
|
||||
if (!path.includes('electron.asar')) {
|
||||
modulePaths.push(path);
|
||||
}
|
||||
});
|
||||
|
||||
// add main app module paths (limited to the discord_desktop_core .asar)
|
||||
const mainAppModulePaths = NodeModule._nodeModulePaths(mainAppDirname);
|
||||
modulePaths = modulePaths.concat(mainAppModulePaths.slice(0, 2));
|
||||
|
||||
// apply the module paths
|
||||
module.paths = modulePaths;
|
||||
|
||||
const MODULE_INSTALL = 'MODULE_INSTALL';
|
||||
const MODULE_QUERY = 'MODULE_QUERY';
|
||||
const MODULE_INSTALLED = 'MODULE_INSTALLED';
|
||||
|
||||
const modulePromises = {};
|
||||
|
||||
// Handle successfully installed modules, used in ensureModule
|
||||
ipcRenderer.on(MODULE_INSTALLED, (e, name, success) => {
|
||||
const promise = modulePromises[name];
|
||||
|
||||
if (promise == null || promise.callback == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
promise.callback(success);
|
||||
});
|
||||
|
||||
function ensureModule(name) {
|
||||
let modulePromise = modulePromises[name];
|
||||
if (modulePromise == null) {
|
||||
modulePromise = modulePromises[name] = {};
|
||||
modulePromise.promise = new Promise((resolve, reject) => {
|
||||
modulePromise.callback = success => {
|
||||
modulePromise.callback = null;
|
||||
success ? resolve() : reject(new Error('failed to ensure module'));
|
||||
};
|
||||
|
||||
installModule(name);
|
||||
});
|
||||
}
|
||||
|
||||
return modulePromise.promise;
|
||||
}
|
||||
|
||||
function installModule(name) {
|
||||
ipcRenderer.send(MODULE_INSTALL, name);
|
||||
}
|
||||
|
||||
function queryModule(name) {
|
||||
ipcRenderer.send(MODULE_QUERY, name);
|
||||
}
|
||||
|
||||
// sandbox this function in a new context, else it's susceptible to prototype attacks
|
||||
const context = vm.createContext(Object.create(null));
|
||||
const _requireModule = vm.runInContext(`
|
||||
function requireModule(remoteRequire, localRequire, name, remote) {
|
||||
if (!/^discord_[a-z0-9_-]+$/.test(name) && name !== 'erlpack') {
|
||||
throw new Error('"' + String(name) + '" is not a whitelisted native module');
|
||||
}
|
||||
return remote ? remoteRequire(name) : localRequire(name);
|
||||
}
|
||||
requireModule
|
||||
`, context);
|
||||
|
||||
const remoteRequire = electron.remote.require;
|
||||
const localRequire = ((id) => {
|
||||
return require("../../../../"+id)
|
||||
});
|
||||
|
||||
function requireModule(name, remote) {
|
||||
return _requireModule(remoteRequire, localRequire, name, remote);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
installModule,
|
||||
queryModule,
|
||||
ensureModule,
|
||||
requireModule
|
||||
};
|
@ -1,14 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const os = require('os');
|
||||
const process = require('process');
|
||||
|
||||
let arch = os.arch();
|
||||
if (process.platform === 'win32' && process.env['PROCESSOR_ARCHITEW6432'] != null) {
|
||||
arch = 'x64';
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
release: os.release(),
|
||||
arch
|
||||
};
|
@ -1,31 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const electron = require('electron');
|
||||
const powerSaveBlocker = electron.remote.powerSaveBlocker;
|
||||
|
||||
const powerSaveBlockerIds = new Set();
|
||||
|
||||
function blockDisplaySleep() {
|
||||
const newId = powerSaveBlocker.start('prevent-display-sleep');
|
||||
powerSaveBlockerIds.add(newId);
|
||||
return newId;
|
||||
}
|
||||
|
||||
function unblockDisplaySleep(id) {
|
||||
powerSaveBlocker.stop(id);
|
||||
powerSaveBlockerIds.delete(id);
|
||||
}
|
||||
|
||||
function cleanupDisplaySleep() {
|
||||
// cleanup all previous sleeps
|
||||
for (const id of powerSaveBlockerIds) {
|
||||
unblockDisplaySleep(id);
|
||||
}
|
||||
powerSaveBlockerIds.clear();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
blockDisplaySleep,
|
||||
unblockDisplaySleep,
|
||||
cleanupDisplaySleep
|
||||
};
|
@ -1,21 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const electron = require('electron');
|
||||
const process = require('process');
|
||||
const remoteProcess = electron.remote.require('process');
|
||||
const env = process.env;
|
||||
|
||||
module.exports = {
|
||||
platform: process.platform,
|
||||
arch: process.arch,
|
||||
env: {
|
||||
LOCALAPPDATA: env['LOCALAPPDATA'],
|
||||
'PROGRAMFILES(X86)': env['PROGRAMFILES(X86)'],
|
||||
PROGRAMFILES: env['PROGRAMFILES'],
|
||||
PROGRAMW6432: env['PROGRAMW6432'],
|
||||
PROGRAMDATA: env['PROGRAMDATA']
|
||||
},
|
||||
remote: {
|
||||
resourcesPath: remoteProcess.resourcesPath
|
||||
}
|
||||
};
|
@ -1,76 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const electron = require('electron');
|
||||
const webFrame = electron.webFrame;
|
||||
const remoteSession = electron.remote.session;
|
||||
const remoteApp = electron.remote.app;
|
||||
const process = require('process');
|
||||
const remoteProcess = electron.remote.require('process');
|
||||
const { getElectronMajorVersion } = require('./_common');
|
||||
|
||||
const MEMORY_USAGE_GATHER_INTERVAL = 5000;
|
||||
|
||||
let totalMemoryUsageKB = 0;
|
||||
|
||||
setInterval(() => {
|
||||
Promise.all([process.getProcessMemoryInfo(), remoteProcess.getProcessMemoryInfo()].map(x => x.catch(() => 0))).then(usages => {
|
||||
totalMemoryUsageKB = usages.reduce((total, usage) => total + usage.private, 0);
|
||||
});
|
||||
}, MEMORY_USAGE_GATHER_INTERVAL);
|
||||
|
||||
// [adill] "warm" the cache, as the first call to query cpu % will always be zero
|
||||
let _ = getCurrentCPUUsagePercent();
|
||||
|
||||
function flushDNSCache() {
|
||||
if (!remoteSession) return;
|
||||
const defaultSession = remoteSession.defaultSession;
|
||||
if (!defaultSession || !defaultSession.clearHostResolverCache) return;
|
||||
defaultSession.clearHostResolverCache();
|
||||
}
|
||||
|
||||
function flushCookies(callback) {
|
||||
try {
|
||||
if (getElectronMajorVersion() >= 7) {
|
||||
remoteSession.defaultSession.cookies.flushStore().then(() => callback());
|
||||
} else {
|
||||
remoteSession.defaultSession.cookies.flushStore(callback);
|
||||
}
|
||||
} catch (err) {
|
||||
callback(err);
|
||||
}
|
||||
}
|
||||
|
||||
function flushStorageData(callback) {
|
||||
try {
|
||||
remoteSession.defaultSession.flushStorageData();
|
||||
} catch (err) {
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
callback();
|
||||
}
|
||||
|
||||
function purgeMemory() {
|
||||
webFrame.clearCache();
|
||||
}
|
||||
|
||||
function getCurrentCPUUsagePercent() {
|
||||
let totalProcessorUsagePercent = 0.0;
|
||||
for (const processMetric of remoteApp.getAppMetrics()) {
|
||||
totalProcessorUsagePercent += processMetric.cpu.percentCPUUsage;
|
||||
}
|
||||
return totalProcessorUsagePercent;
|
||||
}
|
||||
|
||||
function getCurrentMemoryUsageKB() {
|
||||
return totalMemoryUsageKB;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
flushDNSCache,
|
||||
flushCookies,
|
||||
flushStorageData,
|
||||
purgeMemory,
|
||||
getCurrentCPUUsagePercent,
|
||||
getCurrentMemoryUsageKB
|
||||
};
|
@ -1,74 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const electron = require('electron');
|
||||
const moduleUpdater = electron.remote.getGlobal('moduleUpdater');
|
||||
const remoteApp = electron.remote.app;
|
||||
|
||||
function getVersion() {
|
||||
// Hardcoding HostVersion so Discord doesn't detect Lightcord by this
|
||||
return "0.0.306" //remoteApp.getVersion();
|
||||
}
|
||||
|
||||
const allowedAppPaths = new Set(['home', 'appData', 'desktop', 'documents', 'downloads']);
|
||||
|
||||
function getPath(path) {
|
||||
if (!allowedAppPaths.has(path)) {
|
||||
throw new Error(`${path} is not an allowed app path`);
|
||||
}
|
||||
return remoteApp.getPath(path);
|
||||
}
|
||||
|
||||
function setBadgeCount(count) {
|
||||
remoteApp.setBadgeCount(count);
|
||||
}
|
||||
|
||||
function dockSetBadge(badge) {
|
||||
remoteApp.dock.setBadge(badge);
|
||||
}
|
||||
|
||||
function dockBounce(type) {
|
||||
return remoteApp.dock.bounce(type);
|
||||
}
|
||||
|
||||
function dockCancelBounce(id) {
|
||||
remoteApp.dock.cancelBounce(id);
|
||||
}
|
||||
|
||||
function getModuleVersions() {
|
||||
const versions = {};
|
||||
if (!__OVERLAY__) {
|
||||
const installed = moduleUpdater.getInstalled();
|
||||
for (const name of Object.keys(installed)) {
|
||||
versions[name] = installed[name].installedVersion;
|
||||
}
|
||||
}
|
||||
return versions;
|
||||
}
|
||||
|
||||
let dockAPI;
|
||||
if (remoteApp.dock) {
|
||||
dockAPI = {
|
||||
setBadge: dockSetBadge,
|
||||
bounce: dockBounce,
|
||||
cancelBounce: dockCancelBounce
|
||||
};
|
||||
}
|
||||
|
||||
function relaunch() {
|
||||
remoteApp.relaunch();
|
||||
remoteApp.exit(0);
|
||||
}
|
||||
|
||||
function getDefaultDoubleClickAction() {
|
||||
return electron.remote.systemPreferences.getUserDefault('AppleActionOnDoubleClick', 'string');
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getVersion,
|
||||
getModuleVersions,
|
||||
getPath,
|
||||
setBadgeCount,
|
||||
dock: dockAPI,
|
||||
relaunch,
|
||||
getDefaultDoubleClickAction
|
||||
};
|
@ -1,22 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const electron = require('electron');
|
||||
const EventEmitter = require('events');
|
||||
const remotePowerMonitor = electron.remote.powerMonitor;
|
||||
|
||||
class RemotePowerMonitor extends EventEmitter {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
remotePowerMonitor.on('resume', () => {
|
||||
this.emit('resume');
|
||||
});
|
||||
}
|
||||
|
||||
removeAllListeners() {
|
||||
remotePowerMonitor.removeAllListeners();
|
||||
super.removeAllListeners();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new RemotePowerMonitor();
|
@ -1,28 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const electron = require('electron');
|
||||
const { getElectronMajorVersion } = require('./_common');
|
||||
|
||||
function requiresAsyncSpellCheckProvider() {
|
||||
return getElectronMajorVersion() >= 5;
|
||||
}
|
||||
|
||||
function setSpellCheckProvider(locale, autoCorrectWord, provider) {
|
||||
if (requiresAsyncSpellCheckProvider()) {
|
||||
const asyncProvider = {
|
||||
spellCheck: (words, callback) => callback(words.filter(word => !provider.spellCheck(word)))
|
||||
};
|
||||
electron.webFrame.setSpellCheckProvider(locale, asyncProvider);
|
||||
} else {
|
||||
electron.webFrame.setSpellCheckProvider(locale, autoCorrectWord, provider);
|
||||
}
|
||||
}
|
||||
|
||||
function replaceMisspelling(word) {
|
||||
electron.remote.getCurrentWebContents().replaceMisspelling(word);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
setSpellCheckProvider,
|
||||
replaceMisspelling
|
||||
};
|
@ -1,129 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const electron = require('electron');
|
||||
const EventEmitter = require('events');
|
||||
const process = require('process');
|
||||
const common = require('./_common');
|
||||
const remoteMenu = electron.remote.Menu;
|
||||
const webFrame = electron.webFrame;
|
||||
|
||||
function flashFrame(flag) {
|
||||
const currentWindow = common.getWindow();
|
||||
if (currentWindow == null || currentWindow.flashFrame == null) return;
|
||||
currentWindow.flashFrame(!currentWindow.isFocused() && flag);
|
||||
}
|
||||
|
||||
function minimize(key) {
|
||||
const win = common.getWindow(key);
|
||||
if (win == null) return;
|
||||
win.minimize();
|
||||
}
|
||||
|
||||
function restore(key) {
|
||||
const win = common.getWindow(key);
|
||||
if (win == null) return;
|
||||
win.restore();
|
||||
}
|
||||
|
||||
function maximize(key) {
|
||||
const win = common.getWindow(key);
|
||||
if (win == null) return;
|
||||
if (win.isMaximized()) {
|
||||
win.unmaximize();
|
||||
} else {
|
||||
win.maximize();
|
||||
}
|
||||
}
|
||||
|
||||
function focus(hack, key) {
|
||||
const win = common.getWindow(key);
|
||||
// Windows does not respect the focus call always.
|
||||
// This uses a hack defined in https://github.com/electron/electron/issues/2867
|
||||
// Should be used sparingly because it can effect window managers.
|
||||
if (hack && process.platform === 'win32') {
|
||||
win.setAlwaysOnTop(true);
|
||||
win.focus();
|
||||
win.setAlwaysOnTop(false);
|
||||
} else {
|
||||
win.focus();
|
||||
}
|
||||
}
|
||||
|
||||
function setAlwaysOnTop(key, enabled) {
|
||||
const win = common.getWindow(key);
|
||||
if (win == null) return;
|
||||
win.setAlwaysOnTop(enabled);
|
||||
}
|
||||
|
||||
function isAlwaysOnTop(key) {
|
||||
const win = common.getWindow(key);
|
||||
if (win == null) return false;
|
||||
return win.isAlwaysOnTop();
|
||||
}
|
||||
|
||||
function blur(key) {
|
||||
const win = common.getWindow(key);
|
||||
if (win != null && !win.isDestroyed()) {
|
||||
win.blur();
|
||||
}
|
||||
}
|
||||
|
||||
function setProgressBar(progress, key) {
|
||||
const win = common.getWindow(key);
|
||||
if (win == null) return;
|
||||
win.setProgressBar(progress);
|
||||
}
|
||||
|
||||
function fullscreen(key) {
|
||||
const currentWindow = common.getWindow(key);
|
||||
currentWindow.setFullScreen(!currentWindow.isFullScreen());
|
||||
}
|
||||
|
||||
function close(key) {
|
||||
if (key == null && process.platform === 'darwin') {
|
||||
remoteMenu.sendActionToFirstResponder('hide:');
|
||||
} else {
|
||||
const win = common.getWindow(key);
|
||||
if (win == null) return;
|
||||
win.close();
|
||||
}
|
||||
}
|
||||
|
||||
function setZoomFactor(factor) {
|
||||
if (!webFrame.setZoomFactor) return;
|
||||
webFrame.setZoomFactor(factor / 100);
|
||||
}
|
||||
|
||||
const webContents = common.getCurrentWindow().webContents;
|
||||
class WebContents extends EventEmitter {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
webContents.removeAllListeners('devtools-opened');
|
||||
webContents.on('devtools-opened', () => {
|
||||
this.emit('devtools-opened');
|
||||
});
|
||||
}
|
||||
|
||||
setBackgroundThrottling(enabled) {
|
||||
if (webContents.setBackgroundThrottling != null) {
|
||||
webContents.setBackgroundThrottling(enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
flashFrame,
|
||||
minimize,
|
||||
restore,
|
||||
maximize,
|
||||
focus,
|
||||
blur,
|
||||
fullscreen,
|
||||
close,
|
||||
setAlwaysOnTop,
|
||||
isAlwaysOnTop,
|
||||
setZoomFactor,
|
||||
webContents: new WebContents(),
|
||||
setProgressBar
|
||||
};
|
Binary file not shown.
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 22 KiB |
@ -325,6 +325,7 @@ function getBackgroundColor() {
|
||||
|
||||
function setBackgroundColor(color) {
|
||||
settings.set(BACKGROUND_COLOR_KEY, color);
|
||||
//mainWindow.setBackgroundColor(color);
|
||||
settings.save();
|
||||
}
|
||||
|
||||
@ -351,6 +352,7 @@ function launchMainAppWindow(isVisible) {
|
||||
blinkFeatures: 'EnumerateDevices,AudioOutputDevices',
|
||||
nativeWindowOpen: true,
|
||||
enableRemoteModule: true,
|
||||
spellcheck: true,
|
||||
...(isTabs ? {
|
||||
nodeIntegration: true,
|
||||
webviewTag: true
|
||||
@ -365,8 +367,6 @@ function launchMainAppWindow(isVisible) {
|
||||
|
||||
if (process.platform === 'linux') {
|
||||
mainWindowOptions.frame = true;
|
||||
} else {
|
||||
mainWindowOptions.frame = false;
|
||||
}
|
||||
|
||||
if(!settings.get("NO_WINDOWS_BOUND", false))applyWindowBoundsToConfig(mainWindowOptions);
|
||||
@ -463,7 +463,7 @@ function launchMainAppWindow(isVisible) {
|
||||
});
|
||||
|
||||
// Prevent navigation when links or files are dropping into the app, turning it into a browser.
|
||||
// https://github.com/discordapp/discord/pull/278
|
||||
// https://github.com/discord/discord/pull/278
|
||||
mainWindow.webContents.on('will-navigate', (evt, url) => {
|
||||
if (!insideAuthFlow && !url.startsWith(WEBAPP_ENDPOINT)) {
|
||||
evt.preventDefault();
|
||||
@ -477,6 +477,18 @@ function launchMainAppWindow(isVisible) {
|
||||
}
|
||||
});
|
||||
|
||||
mainWindow.webContents.on('context-menu', (_, params) => {
|
||||
webContentsSend('SPELLCHECK_RESULT', params.misspelledWord, params.dictionarySuggestions);
|
||||
});
|
||||
|
||||
mainWindow.webContents.on('devtools-opened', () => {
|
||||
webContentsSend('WINDOW_DEVTOOLS_OPENED');
|
||||
});
|
||||
|
||||
mainWindow.webContents.on('devtools-closed', () => {
|
||||
webContentsSend('WINDOW_DEVTOOLS_CLOSED');
|
||||
});
|
||||
|
||||
mainWindow.on('focus', () => {
|
||||
webContentsSend('MAIN_WINDOW_FOCUS');
|
||||
});
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
process.on("uncaughtException", console.error)
|
||||
|
||||
const ipcRenderer = require('./discord_native/ipc');
|
||||
const ipcRenderer = require('./discord_native/renderer/ipc');
|
||||
const electron = require("electron")
|
||||
const moduleAlias = require("./BetterDiscord/loaders/module-alias")
|
||||
const path = require("path")
|
||||
@ -40,7 +40,7 @@ const DiscordNative = {
|
||||
os: require('./discord_native/renderer/os'),
|
||||
app: require('./discord_native/renderer/app'),
|
||||
clipboard: require('./discord_native/renderer/clipboard'),
|
||||
ipc: require('./discord_native/renderer/ipc'),
|
||||
ipc: ipcRenderer,
|
||||
gpuSettings: require('./discord_native/renderer/gpuSettings'),
|
||||
window: require('./discord_native/renderer/window'),
|
||||
powerMonitor: require('./discord_native/renderer/powerMonitor'),
|
||||
@ -62,10 +62,18 @@ DiscordNative.remotePowerMonitor = DiscordNative.powerMonitor;
|
||||
|
||||
const BetterDiscord = require("./BetterDiscord")
|
||||
|
||||
const _setImmediate = setImmediate;
|
||||
const _clearImmediate = clearImmediate;
|
||||
process.once('loaded', () => {
|
||||
// Implementing DiscordNative
|
||||
global.DiscordNative = DiscordNative;
|
||||
|
||||
// We keep these two functions in global because electron doesn't put these
|
||||
// nodejs APIs in the module scope, and these two functions
|
||||
// aren't harmful at all.
|
||||
global.setImmediate = _setImmediate;
|
||||
global.clearImmediate = _clearImmediate;
|
||||
|
||||
// Since nodeIntegration has been disable
|
||||
// We're adding node propertys on window so it's easier
|
||||
// to write code / debug
|
||||
|
@ -1,3 +0,0 @@
|
||||
process.once('loaded', () => {
|
||||
console.log("sltsv")
|
||||
})
|
@ -25,7 +25,7 @@ const DEFAULT_POPOUT_OPTIONS = {
|
||||
minWidth: MIN_POPOUT_WIDTH,
|
||||
minHeight: MIN_POPOUT_HEIGHT,
|
||||
transparent: false,
|
||||
frame: false,
|
||||
frame: process.platform === 'linux',
|
||||
resizable: true,
|
||||
show: true,
|
||||
webPreferences: {
|
||||
|
@ -92,7 +92,7 @@ function initializeMenuItems() {
|
||||
const voiceConnected = currentIcon !== trayIcons.DEFAULT && currentIcon !== trayIcons.UNREAD;
|
||||
|
||||
menuItems[MenuItems.SECRET] = {
|
||||
label: `Top Secret Control Panel`,
|
||||
label: `Lightcord`,
|
||||
icon: trayIcons.DEFAULT,
|
||||
enabled: false
|
||||
};
|
||||
@ -121,13 +121,15 @@ function initializeMenuItems() {
|
||||
type: 'normal',
|
||||
visible: voiceConnected,
|
||||
click: onOpenVoiceSettings
|
||||
};/*
|
||||
};
|
||||
/*
|
||||
menuItems[MenuItems.CHECK_UPDATE] = {
|
||||
label: 'Check for Updates...',
|
||||
type: 'normal',
|
||||
visible: process.platform !== 'darwin',
|
||||
click: onCheckForUpdates
|
||||
};*/
|
||||
};
|
||||
*/
|
||||
menuItems[MenuItems.QUIT] = {
|
||||
label: `Quit ${_Constants.APP_NAME}`,
|
||||
role: 'quit'
|
||||
@ -144,7 +146,17 @@ function buildContextMenu() {
|
||||
const separator = { type: 'separator' };
|
||||
const hasApplications = applications != null && applications.length > 0;
|
||||
|
||||
contextMenu = [menuItems[MenuItems.SECRET], separator, ...(hasApplications ? [...applications, separator] : []), menuItems[MenuItems.OPEN], menuItems[MenuItems.MUTE], menuItems[MenuItems.DEAFEN], menuItems[MenuItems.VOICE_SETTINGS], /*menuItems[MenuItems.CHECK_UPDATE], */menuItems[MenuItems.ACKNOWLEDGEMENTS], separator, menuItems[MenuItems.QUIT]];
|
||||
contextMenu = [
|
||||
menuItems[MenuItems.SECRET],
|
||||
separator, ...(hasApplications ? [...applications, separator] : []),
|
||||
menuItems[MenuItems.OPEN],
|
||||
menuItems[MenuItems.MUTE],
|
||||
menuItems[MenuItems.DEAFEN],
|
||||
menuItems[MenuItems.VOICE_SETTINGS],
|
||||
/*menuItems[MenuItems.CHECK_UPDATE], */
|
||||
menuItems[MenuItems.ACKNOWLEDGEMENTS],
|
||||
separator, menuItems[MenuItems.QUIT]
|
||||
];
|
||||
}
|
||||
|
||||
function setTrayIcon(icon) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
const fs = require("fs")
|
||||
const { join } = require("path")
|
||||
const { pathToFileURL } = require("url")
|
||||
const ipc = require("../discord_native/ipc")
|
||||
const ipc = require("../discord_native/renderer/ipc")
|
||||
|
||||
let webviews = new Map()
|
||||
window.webviews = webviews
|
||||
|
@ -136,7 +136,7 @@ let processDownloadQueue = (() => {
|
||||
finishModuleDownload(queuedModule.name, queuedModule.version, moduleZipPath, receivedBytes, response.statusCode === 200);
|
||||
} catch (err) {
|
||||
logger.log(`Failed fetching module ${queuedModule.name}@${queuedModule.version}: ${String(err)}`);
|
||||
finishModuleDownload(queuedModule.name, queuedModule.version, null, false);
|
||||
finishModuleDownload(queuedModule.name, queuedModule.version, null, receivedBytes, false);
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user