Skip to content
Closed
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
42 changes: 22 additions & 20 deletions docs/CLI_FLAGS.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
# CLI Options

Options:
| Flag | Effect |
|------|--------|
|`--minimized` | Start deltachat in minimized mode with trayicon (trayicon will be activated for this session regardless whether it's disabled) |
| **Development Options** | |
| `--translation-watch` | enable auto-reload for `_locales/_untranslated_en.json`, when that file changes the current language is reloaded |
| `--devmode` | opens electron devtools and activates `--log-debug` & `--log-to-console` |
| `--allow-unsafe-core-replacement` | allow changing core with `DELTA_CHAT_RPC_SERVER` and looking for it in `PATH` instead of forcing the use of the prebuilds |
| **Theme** | |
| `--theme <themeid>` | set a specific theme (see [THEMES.md](./THEMES.md)) |
| `--theme-watch` | enable auto-reload for the active theme |
| **Logging** | |
| `--log-debug` | Log debug messages |
| `--log-to-console` | Output the log to stdout / Chrome dev console |
| `--machine-readable-stacktrace` | Enable JSON stack trace |
| `--no-color` | Disable colors in the output of main process |

| Flag | Effect |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `--minimized` | Start deltachat in minimized mode with trayicon (trayicon will be activated for this session regardless whether it's disabled) |
| **Development Options** | |
| `--translation-watch` | enable auto-reload for `_locales/_untranslated_en.json`, when that file changes the current language is reloaded |
| `--devmode` | opens electron devtools and activates `--log-debug` & `--log-to-console` |
| `--allow-unsafe-core-replacement` | allow changing core with `DELTA_CHAT_RPC_SERVER` and looking for it in `PATH` instead of forcing the use of the prebuilds |
| **Theme** | |
| `--theme <themeid>` | set a specific theme (see [THEMES.md](./THEMES.md)) |
| `--theme-watch` | enable auto-reload for the active theme |
| **Logging** | |
| `--log-debug` | Log debug messages |
| `--log-to-console` | Output the log to stdout / Chrome dev console |
| `--machine-readable-stacktrace` | Enable JSON stack trace |
| `--no-color` | Disable colors in the output of main process |

For more info on logging see [LOGGING.md](./LOGGING.md).

## Env vars

useful env vars you can set:
| Variable (sometimes with value) | Effect |
|---------------------------------|--------|
|`NODE_OPTIONS=--enable-source-maps`| Make stacktraces in errors useful by enabling source map support in the main process |
|`DC_TEST_DIR=<dir>`| specify an alternative data directory |
| `DELTACHAT_LOCALE_DIR=<path>` | allows to specify an alternative translation data directory in development, the intended purpose is to be used together with `--translation-watch` [^1] |

| Variable (sometimes with value) | Effect |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NODE_OPTIONS=--enable-source-maps` | Make stacktraces in errors useful by enabling source map support in the main process |
| `DC_TEST_DIR=<dir>` | specify an alternative data directory |
| `DELTACHAT_LOCALE_DIR=<path>` | allows to specify an alternative translation data directory in development, the intended purpose is to be used together with `--translation-watch` [^1] |

Most env vars can be set in .env files, read by dotenv. Look fo a env.example in the related package for more info.

Expand Down
2 changes: 1 addition & 1 deletion docs/LOGGING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Debug messages are disabled by default, enable them with the `--log-debug` flag.
| `--no-color` | Disable colors in the output of main process |

> as of 1.21.0 `--devmode` enables both `--log-debug` and `--log-to-console` (formerly `--debug`)
> ~as of 1.3.0 `--debug` enables both `--log-debug` and `--log-to-console`~
> ~~as of 1.3.0 `--debug` enables both `--log-debug` and `--log-to-console`~~

#### Log locations

Expand Down
3 changes: 2 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export default defineConfig(
'react-hooks': pluginReactHooks,
},
rules: {
...pluginReactHooks.configs.recommended.rules,
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { getLogger } from '@deltachat-desktop/shared/logger'
const log = getLogger('renderer/AudioRecorder')

export enum AudioErrorType {
'NO_INPUT',
'OTHER_ERROR',
NO_INPUT,
OTHER_ERROR,
}

export class AudioRecorderError extends Error {
Expand Down Expand Up @@ -105,7 +105,7 @@ export const AudioRecorder = ({
}, [openDialog, tx])

const onRecordingStart = async () => {
let access = 'unknown'
let access: string
try {
access = await runtime.checkMediaAccess('microphone')
log.debug('checkMediaAccess', { access })
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/Reactions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function Reactions(props: Props) {
const { reactionsByContact, reactions } = props.reactions

useEffect(() => {
let emojiSpaces = 0
let emojiSpaces: number
if (messageWidth <= 234) {
emojiSpaces = 1
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export default function FullscreenMedia(props: Props & DialogProps) {
},
])

let elm = null
let elm: React.ReactNode

if (isImage(fileMime)) {
const imageHeight =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const log = getLogger('renderer/dialogs/ViewProfile')

function LastSeen({ timestamp }: { timestamp: number }) {
const tx = useTranslationFunction()
let lastSeenString = ''
let lastSeenString: string
let lastSeenAbsolute: string | undefined = undefined

// Dates from 1970 mean that contact has never been seen
Expand Down
14 changes: 3 additions & 11 deletions packages/frontend/src/components/message/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ async function fetchPrivittyBubbleState(
}

const filePath = normalizePrivittyFilePath(file)
let status: PrivittyStatus = 'none'
let status: PrivittyStatus
let expiryTime: number | null = null
let waitingCount = 0
let isPrivittyForwarded = false
Expand Down Expand Up @@ -1184,7 +1184,7 @@ export default function Message(props: {
useEffect(() => {
const resizeHandler = () => {
if (messageContainerRef.current) {
let messageWidth = 0
let messageWidth: number
// set message width which is used by reaction component
// to adapt the number of visible reactions
if (fileMime || window.innerWidth < 900) {
Expand Down Expand Up @@ -1297,8 +1297,6 @@ export default function Message(props: {
openViewProfileDialog(accountId, contact.id)
}

let onClickMessageBody

// Check if the message is saved or has a saved message
// in both cases we display the bookmark icon
const isOrHasSavedMessage = message.originalMsgId
Expand Down Expand Up @@ -1605,13 +1603,7 @@ export default function Message(props: {
</div>
)}
{/* <p>Document File</p> */}
<div
className={classNames('msg-body', {
'msg-body--clickable': onClickMessageBody,
})}
onClick={onClickMessageBody}
tabIndex={onClickMessageBody ? tabindexForInteractiveContents : -1}
>
<div className='msg-body' tabIndex={-1}>
{message.quote !== null && (
<Quote
quote={message.quote}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export async function openAttachmentInShell(
notificationType: 0,
})

throw new Error('File is no longer available')
throw new Error('File is no longer available', { cause: error })
}

let filePathName = tmpFile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default function ImportLicenseScreen({ onBack, onDone }: Props) {

const handlePasteUrl = useCallback(async () => {
if (processingRef.current) return
let text = ''
let text: string
try {
text = await navigator.clipboard.readText()
} catch {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/hooks/chat/useMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default function useMessage() {
message: Partial<T.MessageData>
) => {
log.debug('filePathName', message)
let msgId = 0
let msgId: number
if (message.file && message.filename) {
msgId = await BackendRemote.rpc.sendMsg(accountId, chatId, {
...MESSAGE_DEFAULT,
Expand Down
6 changes: 3 additions & 3 deletions packages/frontend/src/stores/messagelist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ class MessageListStore extends Store<MessageListState> {
false,
true
)
let indexEnd = -1
let indexEnd: number
const last_item: Type.MessageListItem | undefined =
this.state.messageListItems[this.state.messageListItems.length - 1]

Expand Down Expand Up @@ -883,9 +883,9 @@ class MessageListStore extends Store<MessageListState> {
// However, let's keep the code that supports arbitrary chatId,
// which can be "enabled" by setting `chatIdPreset = undefined`.
const chatIdPreset: number | undefined = this.chatId
let chatId: number | undefined = undefined
let chatId: number | undefined

let jumpToMessageStack: number[] = []
let jumpToMessageStack: number[]
if (jumpToMessageId === undefined) {
// jump down
const jumpToMessageStackLength = this.state.jumpToMessageStack.length
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function translate(
raw_opts?: 'other' | getMessageOptions
) {
const translationKey = key as string
let opts: getMessageOptions = {}
let opts: getMessageOptions
if (typeof raw_opts === 'string') opts = { quantity: raw_opts }
else opts = Object.assign({}, raw_opts)

Expand Down
2 changes: 1 addition & 1 deletion packages/target-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"private": true,
"name": "@deltachat-desktop/target-browser",
"type": "module",
"version": "1.6.0",
"version": "1.7.0",
"license": "GPL-3.0-or-later",
"scripts": {
"check:types": "tsc --noEmit && tsc --noEmit -p runtime-browser",
Expand Down
4 changes: 2 additions & 2 deletions packages/target-browser/runtime-browser/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ class BrowserRuntime implements Runtime {
).json()
} else {
throw new Error(
'language load failed, even alternative of base language failed.'
'language load failed, even alternative of base language failed.',
{ cause: error1 }
)
}
} catch (error2) {
Expand All @@ -299,7 +300,6 @@ class BrowserRuntime implements Runtime {
error1,
error2
)
locale = 'en'
localeMessages = messagesEnglish
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/target-browser/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,14 @@ app.get('/themes.json', async (_req, res) => {
res.json(await readThemeDir())
})

let certificate = ''
let certificate: string
if (process.env.PRIVATE_CERTIFICATE_CERT) {
certificate = process.env.PRIVATE_CERTIFICATE_CERT
} else {
certificate = await readFile(PRIVATE_CERTIFICATE_CERT, 'utf8')
}

let certificateKey = ''
let certificateKey: string
if (process.env.PRIVATE_CERTIFICATE_KEY) {
certificateKey = process.env.PRIVATE_CERTIFICATE_KEY
} else {
Expand Down
5 changes: 3 additions & 2 deletions packages/target-electron/src/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function systemDefault() {
export function resolveThemeAddress(address: string): string {
const addressParts =
address != 'system' ? address.split(':') : systemDefault()
let realPath = ''
let realPath: string
if (addressParts.length != 2)
throw 'not an theme address, must have the format [location]:[themename]'
if (addressParts[0] == 'dc') {
Expand Down Expand Up @@ -127,7 +127,8 @@ If you did not specify this, ask the person which installed deltachat for you to

If they are not available find the shortcut/.desktop file yourself and edit it to not contain the "--theme" argument.
Using --theme is for developers and theme creators ONLY and should not be used by normal users
If you have question or need help, feel free to ask in our forum https://support.delta.chat.`
If you have question or need help, feel free to ask in our forum https://support.delta.chat.`,
{ cause: error }
)
}
DesktopSettings.update({ activeTheme: app.rc['theme'] })
Expand Down
2 changes: 1 addition & 1 deletion packages/target-tauri/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "deltachat-tauri"
version = "1.6.0"
version = "1.7.0"
description = "Privitty Chat Desktop: Tauri Edition. Secure, cross-platform, decentralized super-app messenger."
authors = ["DeltaChat Contributors"]
edition = "2021"
Expand Down
Loading