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
20 changes: 11 additions & 9 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"url": "git+https://github.com/opencor/webapp.git"
},
"type": "module",
"version": "0.20260116.0",
"version": "0.20260117.0",
"scripts": {
"archive:web": "bun src/renderer/scripts/archive.web.js",
"build": "electron-vite build",
Expand Down Expand Up @@ -55,7 +55,7 @@
"primeicons": "^7.0.0",
"primevue": "4.2.5",
"quill": "^2.0.3",
"systeminformation": "^5.30.4",
"systeminformation": "^5.30.5",
"ua-parser-js": "^2.0.8",
"vue": "3.4.21",
"vue-tippy": "^6.7.1"
Expand All @@ -74,7 +74,7 @@
"@wasm-fmt/clang-format": "^21.1.8",
"autoprefixer": "^10.4.23",
"cmake-js": "^7.4.0",
"electron": "^39.2.7",
"electron": "^40.0.0",
"electron-builder": "^26.4.0",
"electron-conf": "^1.3.0",
"electron-updater": "^6.7.3",
Expand All @@ -84,7 +84,7 @@
"stylelint-config-standard": "^40.0.0",
"tailwindcss": "^4.1.18",
"tailwindcss-primeui": "^0.6.1",
"tar": "^7.5.2",
"tar": "^7.5.3",
"unplugin-vue-components": "^31.0.0",
"vite": "7.2.7"
}
Expand Down
2 changes: 1 addition & 1 deletion src/extern/corsProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
const url = new URL(request.url);
const targetUrl = url.searchParams.get('url');

if (targetUrl === null) {
if (!targetUrl) {
return new Response('Missing "url" query parameter.', { status: 400 });
}

Expand Down
14 changes: 7 additions & 7 deletions src/main/MainMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ let hasFiles = false;
export function enableDisableMainMenu(enable: boolean): void {
// Build our menu, if needed.

if (enable && enabledMenu !== null) {
if (enable && enabledMenu) {
electron.Menu.setApplicationMenu(enabledMenu);
} else if (!enable && disabledMenu !== null) {
} else if (!enable && disabledMenu) {
electron.Menu.setApplicationMenu(disabledMenu);
} else {
// Some common menu items.
Expand Down Expand Up @@ -58,7 +58,7 @@ export function enableDisableMainMenu(enable: boolean): void {
if (enable) {
appSubMenu.push(aboutOpencorMenuItem);

if (checkForUpdatesMenuItem !== null) {
if (checkForUpdatesMenuItem) {
appSubMenu.push({ type: 'separator' });
appSubMenu.push(checkForUpdatesMenuItem);
}
Expand Down Expand Up @@ -129,7 +129,7 @@ export function enableDisableMainMenu(enable: boolean): void {
enabled: recentFilePaths.length > 0
});

if (recentFilePaths.length > 0) {
if (recentFilePaths.length) {
fileReopenSubMenu.push({ type: 'separator' });

recentFilePaths.forEach((filePath: string) => {
Expand Down Expand Up @@ -258,7 +258,7 @@ export function enableDisableMainMenu(enable: boolean): void {
});

if (!isMacOs()) {
if (checkForUpdatesMenuItem !== null) {
if (checkForUpdatesMenuItem) {
helpSubMenu.push({ type: 'separator' });
helpSubMenu.push(checkForUpdatesMenuItem);
}
Expand Down Expand Up @@ -298,13 +298,13 @@ export function enableDisableMainMenu(enable: boolean): void {
}

export function enableDisableFileCloseAndCloseAllMenuItems(enable: boolean): void {
if (enabledMenu !== null) {
if (enabledMenu) {
hasFiles = enable;

const fileCloseMenu = enabledMenu.getMenuItemById('fileClose');
const fileCloseAllMenu = enabledMenu.getMenuItemById('fileCloseAll');

if (fileCloseMenu !== null && fileCloseAllMenu !== null) {
if (fileCloseMenu && fileCloseAllMenu) {
fileCloseMenu.enabled = hasFiles;
fileCloseAllMenu.enabled = hasFiles;
}
Expand Down
16 changes: 8 additions & 8 deletions src/main/MainWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ let openedFilePaths: string[] = [];
export function filesOpened(filePaths: string[]): void {
openedFilePaths = filePaths;

if (filePaths.length === 0) {
if (!filePaths.length) {
selectedFilePath = null;
}
}
Expand Down Expand Up @@ -201,7 +201,7 @@ export class MainWindow extends ApplicationWindow {
// case we filter out all null entries.

recentFilePaths = (electronConf.get('app.files.recent') as string[]).filter(
(filePath: string | null) => filePath !== null
(filePath: string | null) => filePath
);

updateReopenMenu(recentFilePaths);
Expand All @@ -222,7 +222,7 @@ export class MainWindow extends ApplicationWindow {

commandLine.shift();

if (!isPackaged() && commandLine.length > 0) {
if (!isPackaged() && commandLine.length) {
commandLine.shift();
}
}
Expand Down Expand Up @@ -352,19 +352,19 @@ export class MainWindow extends ApplicationWindow {
// reopen. So, we need to wait for the file to be reopened before reopening the next one.

reopenFilePathsAndSelectFilePath(): void {
if (this._openedFilePaths.length > 0) {
if (this._openedFilePaths.length) {
const filePath = this._openedFilePaths[0];

this.webContents.send('open', filePath);

this._openedFilePaths = this._openedFilePaths.slice(1);

if (this._openedFilePaths.length > 0) {
if (this._openedFilePaths.length) {
return;
}
}

if (this._selectedFilePath !== '') {
if (this._selectedFilePath) {
this.webContents.send('select', this._selectedFilePath);

this._selectedFilePath = '';
Expand All @@ -374,15 +374,15 @@ export class MainWindow extends ApplicationWindow {
// Handle our command line arguments.

isAction(argument: string | undefined): boolean {
if (argument === undefined) {
if (!argument) {
return false;
}

return argument.startsWith(FULL_URI_SCHEME);
}

handleArguments(commandLine: string[]): void {
if (commandLine.length === 0) {
if (!commandLine.length) {
return;
}

Expand Down
10 changes: 4 additions & 6 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ if (!electron.app.requestSingleInstanceLock()) {
export let mainWindow: MainWindow | null = null;

electron.app.on('second-instance', (_event, argv) => {
if (mainWindow !== null) {
if (mainWindow) {
if (mainWindow.isMinimized()) {
mainWindow.restore();
}
Expand Down Expand Up @@ -123,7 +123,7 @@ MimeType=x-scheme-handler/${URI_SCHEME}`
// Update the desktop database.

nodeChildProcess.exec('update-desktop-database ~/.local/share/applications', (error) => {
if (error !== null) {
if (error) {
console.error('Failed to update the desktop database:', error);
}
});
Expand Down Expand Up @@ -271,11 +271,9 @@ electron.app
// triggering URL.

mainWindow = new MainWindow(
triggeringUrl !== null ? [triggeringUrl] : process.argv,
triggeringUrl ? [triggeringUrl] : process.argv,
splashScreenWindow,
process.env.ELECTRON_RENDERER_URL !== undefined
? process.env.ELECTRON_RENDERER_URL
: await startRendererServer()
process.env.ELECTRON_RENDERER_URL ?? (await startRendererServer())
);
}, SHORT_DELAY);
});
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"./style.css": "./dist/opencor.css"
},
"version": "0.20260116.0",
"version": "0.20260117.0",
"scripts": {
"build": "vite build",
"build:lib": "vite build --config vite.lib.config.ts && cp index.d.ts dist/index.d.ts",
Expand Down
20 changes: 10 additions & 10 deletions src/renderer/src/common/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,24 +79,24 @@ export function formatTime(time: number): string {
const d = Math.floor((time / (1000 * 60 * 60 * 24)) % 24);
let res = '';

if (d !== 0 || ((h !== 0 || m !== 0 || s !== 0 || ms !== 0) && res !== '')) {
res += `${res === '' ? '' : ' '}${String(d)}d`;
if (d) {
res = `${String(d)}d`;
}

if (h !== 0 || ((m !== 0 || s !== 0 || ms !== 0) && res !== '')) {
res += `${res === '' ? '' : ' '}${String(h)}h`;
if (h || ((m || s || ms) && res)) {
res += `${res ? ' ' : ''}${String(h)}h`;
}

if (m !== 0 || ((s !== 0 || ms !== 0) && res !== '')) {
res += `${res === '' ? '' : ' '}${String(m)}m`;
if (m || ((s || ms) && res)) {
res += `${res ? ' ' : ''}${String(m)}m`;
}

if (s !== 0 || (ms !== 0 && res !== '')) {
res += `${res === '' ? '' : ' '}${String(s)}s`;
if (s || (ms && res)) {
res += `${res ? ' ' : ''}${String(s)}s`;
}

if (ms !== 0 || res === '') {
res += `${res === '' ? '' : ' '}${String(ms)}ms`;
if (ms || !res) {
res += `${res ? ' ' : ''}${String(ms)}ms`;
}

return res;
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/common/firebaseConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const firebaseEnvVarMap = {

export function missingFirebaseKeys(): string[] {
function missingFirebaseKey(firebaseValue: unknown): boolean {
return firebaseValue === undefined || firebaseValue === null || firebaseValue === '';
return !firebaseValue;
}

return (Object.entries(firebaseEnvVarMap) as Array<[keyof typeof firebaseEnvVarMap, string]>)
Expand Down
8 changes: 4 additions & 4 deletions src/renderer/src/common/gitHubIntegration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function gitHubAccessTokenEntry(): AsyncEntry | null {
export async function deleteGitHubAccessToken(): Promise<boolean> {
const entry = gitHubAccessTokenEntry();

if (entry === null) {
if (!entry) {
return false;
}

Expand All @@ -60,7 +60,7 @@ export async function deleteGitHubAccessToken(): Promise<boolean> {
export async function loadGitHubAccessToken(): Promise<string | null> {
const entry = gitHubAccessTokenEntry();

if (entry === null) {
if (!entry) {
return null;
}

Expand All @@ -76,15 +76,15 @@ export async function loadGitHubAccessToken(): Promise<string | null> {
}

export async function saveGitHubAccessToken(token: string): Promise<boolean> {
if (token.trim() === '') {
if (!token.trim()) {
console.warn('Ignoring request to store an empty GitHub access token.');

return false;
}

const entry = gitHubAccessTokenEntry();

if (entry === null) {
if (!entry) {
return false;
}

Expand Down
Loading
Loading