Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,3 @@ jobs:
name: Postbird.apk
path: dist/*.apk
if: ${{ runner.os == 'Linux' }}

1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://registry.npmjs.org
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.11
2 changes: 0 additions & 2 deletions app/views/history_window.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var electronRemote = require('@electron/remote');
const { BrowserWindow } = require('@electron/remote')

class HistoryWindow {
Expand All @@ -23,7 +22,6 @@ class HistoryWindow {
}
});

electronRemote.require('@electron/remote/main').enable(newWindow.webContents);
newWindow.loadURL('file://' + App.root + '/views/history_window.html');

if (process.env.POSTBIRD_DEBUG == "true") {
Expand Down
2 changes: 0 additions & 2 deletions app/views/snippets.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var electronRemote = require('@electron/remote');
const { BrowserWindow } = require('@electron/remote')

class SnippetsWindow {
Expand All @@ -22,7 +21,6 @@ class SnippetsWindow {
}
});

electronRemote.require('@electron/remote/main').enable(newWindow.webContents);
newWindow.loadURL('file://' + App.root + '/views/snippets_window.html');

newWindow.setTitle("Snippets");
Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ $(window).on('window-ready', () => {
require('./app/top_menu');

var cliArgs = electronRemote.process.argv;
if (cliArgs.length > 2 && !electronRemote.process.env.RUN_POSTBIRD_JS_TEST) {
// Skip argument parsing when running tests
var isTestMode = cliArgs.some(arg => arg.includes('electron-mocha') || arg.includes('tests/') || arg.includes('test'));
if (cliArgs.length > 2 && !isTestMode) {
var connectionStr = cliArgs[2];
if (connectionStr.startsWith("postgres://") || connectionStr.startsWith("postgresql://")) {
App.cliConnectString = connectionStr;
Expand Down
11 changes: 8 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ const windowStateKeeper = require('electron-window-state');

require('@electron/remote/main').initialize();

// Enable remote for all new web contents
app.on('web-contents-created', (event, contents) => {
require('@electron/remote/main').enable(contents);
});

electron.app.ApplicationStart = Date.now();
electron.app.MainFilename = process.mainModule.filename;

Expand Down Expand Up @@ -68,8 +73,6 @@ app.on('open-url', (event, url) => {
}
});

var gotTheLock = app.requestSingleInstanceLock();

app.on('ready', () => {
const mainWindowState = windowStateKeeper({
defaultWidth: 960,
Expand All @@ -92,8 +95,10 @@ app.on('ready', () => {

electron.app.mainWindow = mainWindow;

// and load the index.html of the app.
// Enable @electron/remote for this webContents
require("@electron/remote/main").enable(mainWindow.webContents);

// and load the index.html of the app.
mainWindow.loadURL('file://' + __dirname + '/index.html');

if (process.env.POSTBIRD_DEBUG == "true") {
Expand Down
Loading
Loading