mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-16 03:41:29 +00:00
Make app window thinner fixes #332
This commit is contained in:
@@ -66,8 +66,8 @@ function createMainWindow() {
|
||||
y: mainWindowState.y,
|
||||
width: mainWindowState.width,
|
||||
height: mainWindowState.height,
|
||||
minWidth: 600,
|
||||
minHeight: 500,
|
||||
minWidth: 300,
|
||||
minHeight: 400,
|
||||
webPreferences: {
|
||||
plugins: true,
|
||||
allowDisplayingInsecureContent: true,
|
||||
|
||||
@@ -7,63 +7,63 @@ const isDev = require('electron-is-dev');
|
||||
const browserConsole = console;
|
||||
const logDir = `${app.getPath('userData')}/Logs`;
|
||||
if (!fs.existsSync(logDir)) {
|
||||
fs.mkdirSync(logDir);
|
||||
fs.mkdirSync(logDir);
|
||||
}
|
||||
|
||||
function customConsole(opts, type, ...args) {
|
||||
const { nodeConsole, timestamp } = opts;
|
||||
if (timestamp) {
|
||||
args.unshift(timestamp());
|
||||
}
|
||||
const { nodeConsole, timestamp } = opts;
|
||||
if (timestamp) {
|
||||
args.unshift(timestamp());
|
||||
}
|
||||
|
||||
if (!isDev) {
|
||||
const nodeConsoleLog = nodeConsole[type] || nodeConsole.log;
|
||||
nodeConsoleLog.apply(null, args);
|
||||
}
|
||||
browserConsole[type].apply(null, args);
|
||||
if (!isDev) {
|
||||
const nodeConsoleLog = nodeConsole[type] || nodeConsole.log;
|
||||
nodeConsoleLog.apply(null, args);
|
||||
}
|
||||
browserConsole[type].apply(null, args);
|
||||
}
|
||||
|
||||
function getTimestamp() {
|
||||
const date = new Date();
|
||||
const timestamp =
|
||||
`${date.getMonth()}/${date.getDate()} ` +
|
||||
`${date.getMinutes()}:${date.getSeconds()}`;
|
||||
return timestamp;
|
||||
const date = new Date();
|
||||
const timestamp =
|
||||
`${date.getMonth()}/${date.getDate()} ` +
|
||||
`${date.getMinutes()}:${date.getSeconds()}`;
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
function setConsoleProto(type) {
|
||||
Object.defineProperty(this, type, {
|
||||
value(...args) {
|
||||
const { timestamp, nodeConsole } = this;
|
||||
const opts = {
|
||||
timestamp,
|
||||
nodeConsole
|
||||
};
|
||||
customConsole.apply(null, [].concat(opts, type, args));
|
||||
}
|
||||
});
|
||||
Object.defineProperty(this, type, {
|
||||
value(...args) {
|
||||
const { timestamp, nodeConsole } = this;
|
||||
const opts = {
|
||||
timestamp,
|
||||
nodeConsole
|
||||
};
|
||||
customConsole.apply(null, [].concat(opts, type, args));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
class Console {
|
||||
constructor(opts = {}) {
|
||||
let { timestamp, file } = opts;
|
||||
file = `${logDir}/${file || 'console.log'}`;
|
||||
if (timestamp === true) {
|
||||
timestamp = getTimestamp;
|
||||
}
|
||||
constructor(opts = {}) {
|
||||
let { timestamp, file } = opts;
|
||||
file = `${logDir}/${file || 'console.log'}`;
|
||||
if (timestamp === true) {
|
||||
timestamp = getTimestamp;
|
||||
}
|
||||
|
||||
const fileStream = fs.createWriteStream(file);
|
||||
const nodeConsole = new NodeConsole(fileStream);
|
||||
this.nodeConsole = nodeConsole;
|
||||
this.timestamp = timestamp;
|
||||
this.setUpConsole();
|
||||
}
|
||||
const fileStream = fs.createWriteStream(file);
|
||||
const nodeConsole = new NodeConsole(fileStream);
|
||||
this.nodeConsole = nodeConsole;
|
||||
this.timestamp = timestamp;
|
||||
this.setUpConsole();
|
||||
}
|
||||
|
||||
setUpConsole() {
|
||||
for (const type in browserConsole) {
|
||||
setConsoleProto.call(this, type);
|
||||
}
|
||||
}
|
||||
setUpConsole() {
|
||||
for (const type in browserConsole) {
|
||||
setConsoleProto.call(this, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Console;
|
||||
|
||||
Reference in New Issue
Block a user