Sticker Creator
This commit is contained in:
parent
2df1ba6e61
commit
11d47a8eb9
123 changed files with 11287 additions and 1714 deletions
|
@ -1,11 +1,10 @@
|
|||
const path = require('path');
|
||||
|
||||
const electronIsDev = require('electron-is-dev');
|
||||
const { app } = require('electron');
|
||||
|
||||
let environment;
|
||||
|
||||
// In production mode, NODE_ENV cannot be customized by the user
|
||||
if (electronIsDev) {
|
||||
if (!app.isPackaged) {
|
||||
environment = process.env.NODE_ENV || 'development';
|
||||
} else {
|
||||
environment = 'production';
|
||||
|
@ -24,12 +23,14 @@ if (environment === 'production') {
|
|||
process.env.ALLOW_CONFIG_MUTATIONS = '';
|
||||
process.env.SUPPRESS_NO_CONFIG_WARNING = '';
|
||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '';
|
||||
process.env.SIGNAL_ENABLE_HTTP = '';
|
||||
}
|
||||
|
||||
// We load config after we've made our modifications to NODE_ENV
|
||||
const config = require('config');
|
||||
|
||||
config.environment = environment;
|
||||
config.enableHttp = process.env.SIGNAL_ENABLE_HTTP;
|
||||
|
||||
// Log resulting env vars in use by config
|
||||
[
|
||||
|
@ -40,6 +41,7 @@ config.environment = environment;
|
|||
'HOSTNAME',
|
||||
'NODE_APP_INSTANCE',
|
||||
'SUPPRESS_NO_CONFIG_WARNING',
|
||||
'SIGNAL_ENABLE_HTTP',
|
||||
].forEach(s => {
|
||||
console.log(`${s} ${config.util.getEnv(s)}`);
|
||||
});
|
||||
|
|
58
app/menu.js
58
app/menu.js
|
@ -19,12 +19,17 @@ exports.createTemplate = (options, messages) => {
|
|||
showDebugLog,
|
||||
showKeyboardShortcuts,
|
||||
showSettings,
|
||||
showStickerCreator,
|
||||
} = options;
|
||||
|
||||
const template = [
|
||||
{
|
||||
label: messages.mainMenuFile.message,
|
||||
submenu: [
|
||||
{
|
||||
label: messages.mainMenuCreateStickers.message,
|
||||
click: showStickerCreator,
|
||||
},
|
||||
{
|
||||
label: messages.mainMenuSettings.message,
|
||||
accelerator: 'CommandOrControl+,',
|
||||
|
@ -199,49 +204,18 @@ exports.createTemplate = (options, messages) => {
|
|||
};
|
||||
|
||||
function updateForMac(template, messages, options) {
|
||||
const {
|
||||
includeSetup,
|
||||
setupAsNewDevice,
|
||||
setupAsStandalone,
|
||||
setupWithImport,
|
||||
showAbout,
|
||||
showSettings,
|
||||
showWindow,
|
||||
} = options;
|
||||
const { showAbout, showSettings, showWindow } = options;
|
||||
|
||||
// Remove About item and separator from Help menu, since it's on the first menu
|
||||
// Remove About item and separator from Help menu, since they're in the app menu
|
||||
template[4].submenu.pop();
|
||||
template[4].submenu.pop();
|
||||
|
||||
// Remove File menu
|
||||
template.shift();
|
||||
|
||||
if (includeSetup) {
|
||||
// Add a File menu just for these setup options. Because we're using unshift(), we add
|
||||
// the file menu first, though it ends up to the right of the Signal Desktop menu.
|
||||
const fileMenu = {
|
||||
label: messages.mainMenuFile.message,
|
||||
submenu: [
|
||||
{
|
||||
label: messages.menuSetupWithImport.message,
|
||||
click: setupWithImport,
|
||||
},
|
||||
{
|
||||
label: messages.menuSetupAsNewDevice.message,
|
||||
click: setupAsNewDevice,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
if (options.development) {
|
||||
fileMenu.submenu.push({
|
||||
label: messages.menuSetupAsStandalone.message,
|
||||
click: setupAsStandalone,
|
||||
});
|
||||
}
|
||||
|
||||
template.unshift(fileMenu);
|
||||
}
|
||||
// Remove preferences, separator, and quit from the File menu, since they're
|
||||
// in the app menu
|
||||
const fileMenu = template[0];
|
||||
fileMenu.submenu.pop();
|
||||
fileMenu.submenu.pop();
|
||||
fileMenu.submenu.pop();
|
||||
|
||||
// Add the OSX-specific Signal Desktop menu at the far left
|
||||
template.unshift({
|
||||
|
@ -285,8 +259,7 @@ function updateForMac(template, messages, options) {
|
|||
});
|
||||
|
||||
// Add to Edit menu
|
||||
const editIndex = includeSetup ? 2 : 1;
|
||||
template[editIndex].submenu.push(
|
||||
template[2].submenu.push(
|
||||
{
|
||||
type: 'separator',
|
||||
},
|
||||
|
@ -306,9 +279,8 @@ function updateForMac(template, messages, options) {
|
|||
);
|
||||
|
||||
// Replace Window menu
|
||||
const windowMenuTemplateIndex = includeSetup ? 4 : 3;
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
template[windowMenuTemplateIndex].submenu = [
|
||||
template[4].submenu = [
|
||||
{
|
||||
label: messages.windowMenuClose.message,
|
||||
accelerator: 'CmdOrCtrl+W',
|
||||
|
|
|
@ -75,7 +75,7 @@ function _disabledHandler(request, callback) {
|
|||
return callback();
|
||||
}
|
||||
|
||||
function installWebHandler({ protocol }) {
|
||||
function installWebHandler({ protocol, enableHttp }) {
|
||||
protocol.interceptFileProtocol('about', _disabledHandler);
|
||||
protocol.interceptFileProtocol('content', _disabledHandler);
|
||||
protocol.interceptFileProtocol('chrome', _disabledHandler);
|
||||
|
@ -84,12 +84,15 @@ function installWebHandler({ protocol }) {
|
|||
protocol.interceptFileProtocol('filesystem', _disabledHandler);
|
||||
protocol.interceptFileProtocol('ftp', _disabledHandler);
|
||||
protocol.interceptFileProtocol('gopher', _disabledHandler);
|
||||
protocol.interceptFileProtocol('http', _disabledHandler);
|
||||
protocol.interceptFileProtocol('https', _disabledHandler);
|
||||
protocol.interceptFileProtocol('javascript', _disabledHandler);
|
||||
protocol.interceptFileProtocol('mailto', _disabledHandler);
|
||||
protocol.interceptFileProtocol('ws', _disabledHandler);
|
||||
protocol.interceptFileProtocol('wss', _disabledHandler);
|
||||
|
||||
if (!enableHttp) {
|
||||
protocol.interceptFileProtocol('http', _disabledHandler);
|
||||
protocol.interceptFileProtocol('https', _disabledHandler);
|
||||
protocol.interceptFileProtocol('ws', _disabledHandler);
|
||||
protocol.interceptFileProtocol('wss', _disabledHandler);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue