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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[{*.css,*.html,*.js,*.json,*.ts}]
[{*.cjs,*.css,*.html,*.js,*.json,*.ts}]
indent_style = space
indent_size = 2
6 changes: 3 additions & 3 deletions app/common/config-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {DataError} from "node-json-db/dist/lib/Errors";
import type {z} from "zod";
import {app, dialog} from "zulip:remote";

import {configSchemata} from "./config-schemata.js";
import * as EnterpriseUtil from "./enterprise-util.js";
import Logger from "./logger-util.js";
import {configSchemata} from "./config-schemata.ts";
import * as EnterpriseUtil from "./enterprise-util.ts";
import Logger from "./logger-util.ts";

export type Config = {
[Key in keyof typeof configSchemata]: z.output<(typeof configSchemata)[Key]>;
Expand Down
4 changes: 2 additions & 2 deletions app/common/dnd-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import process from "node:process";

import type {z} from "zod";

import type {dndSettingsSchemata} from "./config-schemata.js";
import * as ConfigUtil from "./config-util.js";
import type {dndSettingsSchemata} from "./config-schemata.ts";
import * as ConfigUtil from "./config-util.ts";

export type DndSettings = {
[Key in keyof typeof dndSettingsSchemata]: z.output<
Expand Down
10 changes: 2 additions & 8 deletions app/common/enterprise-util.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import {app} from "electron/main";
import fs from "node:fs";
import path from "node:path";
import process from "node:process";

import {z} from "zod";
import {dialog} from "zulip:remote";

import {enterpriseConfigSchemata} from "./config-schemata.js";
import Logger from "./logger-util.js";
import {enterpriseConfigSchemata} from "./config-schemata.ts";
import Logger from "./logger-util.ts";

type EnterpriseConfig = {
[Key in keyof typeof enterpriseConfigSchemata]: z.output<
Expand Down Expand Up @@ -48,11 +47,6 @@ function reloadDatabase(): void {
);
logger.log("Error while JSON parsing global_config.json: ");
logger.log(error);
// This function is called multiple times throughout the
// codebase, making the above dialog.showErrorBox appear
// multiple times and then leading to a non-working app.
// It might be better to quit the app instead.
app.quit();
}
} else {
configFile = false;
Expand Down
2 changes: 1 addition & 1 deletion app/common/link-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import fs from "node:fs";
import os from "node:os";
import path from "node:path";

import {html} from "./html.js";
import {html} from "./html.ts";

export async function openBrowser(url: URL): Promise<void> {
if (["http:", "https:", "mailto:"].includes(url.protocol)) {
Expand Down
2 changes: 1 addition & 1 deletion app/common/logger-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import process from "node:process";

import {app} from "zulip:remote";

import {initSetUp} from "./default-util.js";
import {initSetUp} from "./default-util.ts";

type LoggerOptions = {
file?: string;
Expand Down
4 changes: 2 additions & 2 deletions app/common/translation-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import path from "node:path";

import i18n from "i18n";

import * as ConfigUtil from "./config-util.js";
import {publicPath} from "./paths.js";
import * as ConfigUtil from "./config-util.ts";
import {publicPath} from "./paths.ts";

i18n.configure({
directory: path.join(publicPath, "translations/"),
Expand Down
4 changes: 2 additions & 2 deletions app/common/typed-ipc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {DndSettings} from "./dnd-util.js";
import type {MenuProperties, ServerConfig} from "./types.js";
import type {DndSettings} from "./dnd-util.ts";
import type {MenuProperties, ServerConfig} from "./types.ts";

export type MainMessage = {
"clear-app-settings": () => void;
Expand Down
6 changes: 3 additions & 3 deletions app/main/autoupdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import {
autoUpdater,
} from "electron-updater";

import * as ConfigUtil from "../common/config-util.js";
import * as t from "../common/translation-util.js";
import * as ConfigUtil from "../common/config-util.ts";
import * as t from "../common/translation-util.ts";

import {linuxUpdateNotification} from "./linuxupdater.js"; // Required only in case of linux
import {linuxUpdateNotification} from "./linuxupdater.ts"; // Required only in case of linux

let quitting = false;

Expand Down
4 changes: 2 additions & 2 deletions app/main/badge-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import {nativeImage} from "electron/common";
import {type BrowserWindow, app} from "electron/main";
import process from "node:process";

import * as ConfigUtil from "../common/config-util.js";
import * as ConfigUtil from "../common/config-util.ts";

import {send} from "./typed-ipc-main.js";
import {send} from "./typed-ipc-main.ts";

function showBadgeCount(messageCount: number, mainWindow: BrowserWindow): void {
if (process.platform === "win32") {
Expand Down
6 changes: 3 additions & 3 deletions app/main/handle-external-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import {
import fs from "node:fs";
import path from "node:path";

import * as ConfigUtil from "../common/config-util.js";
import * as LinkUtil from "../common/link-util.js";
import * as ConfigUtil from "../common/config-util.ts";
import * as LinkUtil from "../common/link-util.ts";

import {send} from "./typed-ipc-main.js";
import {send} from "./typed-ipc-main.ts";

function isUploadsUrl(server: string, url: URL): boolean {
return url.origin === server && url.pathname.startsWith("/user_uploads/");
Expand Down
28 changes: 14 additions & 14 deletions app/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ import process from "node:process";
import * as remoteMain from "@electron/remote/main";
import windowStateKeeper from "electron-window-state";

import * as ConfigUtil from "../common/config-util.js";
import {bundlePath, bundleUrl, publicPath} from "../common/paths.js";
import * as t from "../common/translation-util.js";
import type {RendererMessage} from "../common/typed-ipc.js";
import type {MenuProperties} from "../common/types.js";

import {appUpdater, shouldQuitForUpdate} from "./autoupdater.js";
import * as BadgeSettings from "./badge-settings.js";
import handleExternalLink from "./handle-external-link.js";
import * as AppMenu from "./menu.js";
import {_getServerSettings, _isOnline, _saveServerIcon} from "./request.js";
import {sentryInit} from "./sentry.js";
import {setAutoLaunch} from "./startup.js";
import {ipcMain, send} from "./typed-ipc-main.js";
import * as ConfigUtil from "../common/config-util.ts";
import {bundlePath, bundleUrl, publicPath} from "../common/paths.ts";
import * as t from "../common/translation-util.ts";
import type {RendererMessage} from "../common/typed-ipc.ts";
import type {MenuProperties} from "../common/types.ts";

import {appUpdater, shouldQuitForUpdate} from "./autoupdater.ts";
import * as BadgeSettings from "./badge-settings.ts";
import handleExternalLink from "./handle-external-link.ts";
import * as AppMenu from "./menu.ts";
import {_getServerSettings, _isOnline, _saveServerIcon} from "./request.ts";
import {sentryInit} from "./sentry.ts";
import {setAutoLaunch} from "./startup.ts";
import {ipcMain, send} from "./typed-ipc-main.ts";

import "gatemaker/electron-setup"; // eslint-disable-line import/no-unassigned-import

Expand Down
4 changes: 2 additions & 2 deletions app/main/linux-update-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import path from "node:path";
import {JsonDB} from "node-json-db";
import {DataError} from "node-json-db/dist/lib/Errors";

import Logger from "../common/logger-util.js";
import * as t from "../common/translation-util.js";
import Logger from "../common/logger-util.ts";
import * as t from "../common/translation-util.ts";

const logger = new Logger({
file: "linux-update-util.log",
Expand Down
6 changes: 3 additions & 3 deletions app/main/linuxupdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import {Notification, type Session, app} from "electron/main";
import * as semver from "semver";
import {z} from "zod";

import * as ConfigUtil from "../common/config-util.js";
import Logger from "../common/logger-util.js";
import * as ConfigUtil from "../common/config-util.ts";
import Logger from "../common/logger-util.ts";

import * as LinuxUpdateUtil from "./linux-update-util.js";
import * as LinuxUpdateUtil from "./linux-update-util.ts";

const logger = new Logger({
file: "linux-update-util.log",
Expand Down
14 changes: 7 additions & 7 deletions app/main/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import process from "node:process";

import AdmZip from "adm-zip";

import * as ConfigUtil from "../common/config-util.js";
import * as DNDUtil from "../common/dnd-util.js";
import * as t from "../common/translation-util.js";
import type {RendererMessage} from "../common/typed-ipc.js";
import type {MenuProperties, TabData} from "../common/types.js";
import * as ConfigUtil from "../common/config-util.ts";
import * as DNDUtil from "../common/dnd-util.ts";
import * as t from "../common/translation-util.ts";
import type {RendererMessage} from "../common/typed-ipc.ts";
import type {MenuProperties, TabData} from "../common/types.ts";

import {appUpdater} from "./autoupdater.js";
import {send} from "./typed-ipc-main.js";
import {appUpdater} from "./autoupdater.ts";
import {send} from "./typed-ipc-main.ts";

const appName = app.name;

Expand Down
6 changes: 3 additions & 3 deletions app/main/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import type {ReadableStream} from "node:stream/web";
import * as Sentry from "@sentry/electron/main";
import {z} from "zod";

import Logger from "../common/logger-util.js";
import * as Messages from "../common/messages.js";
import type {ServerConfig} from "../common/types.js";
import Logger from "../common/logger-util.ts";
import * as Messages from "../common/messages.ts";
import type {ServerConfig} from "../common/types.ts";

/* Request: domain-util */

Expand Down
2 changes: 1 addition & 1 deletion app/main/sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {app} from "electron/main";

import * as Sentry from "@sentry/electron/main";

import {getConfigItem} from "../common/config-util.js";
import {getConfigItem} from "../common/config-util.ts";

export const sentryInit = (): void => {
Sentry.init({
Expand Down
2 changes: 1 addition & 1 deletion app/main/startup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import process from "node:process";

import AutoLaunch from "auto-launch";

import * as ConfigUtil from "../common/config-util.js";
import * as ConfigUtil from "../common/config-util.ts";

export const setAutoLaunch = async (
AutoLaunchValue: boolean,
Expand Down
2 changes: 1 addition & 1 deletion app/renderer/js/clipboard-decrypter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ipcRenderer} from "./typed-ipc-renderer.js";
import {ipcRenderer} from "./typed-ipc-renderer.ts";

// This helper is exposed via electron_bridge for use in the social
// login flow.
Expand Down
2 changes: 1 addition & 1 deletion app/renderer/js/components/base.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {Html} from "../../../common/html.js";
import type {Html} from "../../../common/html.ts";

export function generateNodeFromHtml(html: Html): Element {
const wrapper = document.createElement("div");
Expand Down
2 changes: 1 addition & 1 deletion app/renderer/js/components/context-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import process from "node:process";

import {Menu} from "@electron/remote";

import * as t from "../../../common/translation-util.js";
import * as t from "../../../common/translation-util.ts";

export const contextMenu = (
webContents: WebContents,
Expand Down
8 changes: 4 additions & 4 deletions app/renderer/js/components/functional-tab.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {type Html, html} from "../../../common/html.js";
import type {TabPage} from "../../../common/types.js";
import {type Html, html} from "../../../common/html.ts";
import type {TabPage} from "../../../common/types.ts";

import {generateNodeFromHtml} from "./base.js";
import Tab, {type TabProperties} from "./tab.js";
import {generateNodeFromHtml} from "./base.ts";
import Tab, {type TabProperties} from "./tab.ts";

export type FunctionalTabProperties = {
$view: Element;
Expand Down
10 changes: 5 additions & 5 deletions app/renderer/js/components/server-tab.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import process from "node:process";

import {type Html, html} from "../../../common/html.js";
import {ipcRenderer} from "../typed-ipc-renderer.js";
import {type Html, html} from "../../../common/html.ts";
import {ipcRenderer} from "../typed-ipc-renderer.ts";

import {generateNodeFromHtml} from "./base.js";
import Tab, {type TabProperties} from "./tab.js";
import type WebView from "./webview.js";
import {generateNodeFromHtml} from "./base.ts";
import Tab, {type TabProperties} from "./tab.ts";
import type WebView from "./webview.ts";

export type ServerTabProperties = {
webview: Promise<WebView>;
Expand Down
2 changes: 1 addition & 1 deletion app/renderer/js/components/tab.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {TabPage, TabRole} from "../../../common/types.js";
import type {TabPage, TabRole} from "../../../common/types.ts";

export type TabProperties = {
role: TabRole;
Expand Down
18 changes: 9 additions & 9 deletions app/renderer/js/components/webview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import process from "node:process";
import * as remote from "@electron/remote";
import {app, dialog} from "@electron/remote";

import * as ConfigUtil from "../../../common/config-util.js";
import {type Html, html} from "../../../common/html.js";
import * as t from "../../../common/translation-util.js";
import type {RendererMessage} from "../../../common/typed-ipc.js";
import type {TabRole} from "../../../common/types.js";
import * as ConfigUtil from "../../../common/config-util.ts";
import {type Html, html} from "../../../common/html.ts";
import * as t from "../../../common/translation-util.ts";
import type {RendererMessage} from "../../../common/typed-ipc.ts";
import type {TabRole} from "../../../common/types.ts";
import preloadCss from "../../css/preload.css?raw";
import {ipcRenderer} from "../typed-ipc-renderer.js";
import * as SystemUtil from "../utils/system-util.js";
import {ipcRenderer} from "../typed-ipc-renderer.ts";
import * as SystemUtil from "../utils/system-util.ts";

import {generateNodeFromHtml} from "./base.js";
import {contextMenu} from "./context-menu.js";
import {generateNodeFromHtml} from "./base.ts";
import {contextMenu} from "./context-menu.ts";

const shouldSilentWebview = ConfigUtil.getConfigItem("silent", false);

Expand Down
6 changes: 3 additions & 3 deletions app/renderer/js/electron-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import {EventEmitter} from "node:events";
import {
type ClipboardDecrypter,
ClipboardDecrypterImplementation,
} from "./clipboard-decrypter.js";
import {type NotificationData, newNotification} from "./notification/index.js";
import {ipcRenderer} from "./typed-ipc-renderer.js";
} from "./clipboard-decrypter.ts";
import {type NotificationData, newNotification} from "./notification/index.ts";
import {ipcRenderer} from "./typed-ipc-renderer.ts";

type ListenerType = (...arguments_: any[]) => void;

Expand Down
Loading