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