mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-02 08:13:37 +01:00
Enable tsconfig noUncheckedIndexedAccess
This commit is contained in:
@@ -791,13 +791,15 @@ function handleRangeRequest({
|
||||
}
|
||||
|
||||
// Chromium only sends open-ended ranges: "start-"
|
||||
type Match = RegExpMatchArray & { 1: string };
|
||||
const match = range.match(/^bytes=(\d+)-$/);
|
||||
if (match == null) {
|
||||
log.error(`invalid range header: ${range}`);
|
||||
return create200Response();
|
||||
}
|
||||
|
||||
const startParam = safeParseInteger(match[1]);
|
||||
const [startInput] = match as Match;
|
||||
const startParam = safeParseInteger(startInput);
|
||||
if (startParam == null) {
|
||||
log.error(`invalid range header: ${range}`);
|
||||
return create200Response();
|
||||
|
||||
@@ -819,10 +819,14 @@ async function createWindow() {
|
||||
maximized: mainWindow.isMaximized(),
|
||||
autoHideMenuBar: mainWindow.autoHideMenuBar,
|
||||
fullscreen: mainWindow.isFullScreen(),
|
||||
width: size[0],
|
||||
height: size[1],
|
||||
x: position[0],
|
||||
y: position[1],
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
width: size[0]!,
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
height: size[1]!,
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
x: position[0]!,
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
y: position[1]!,
|
||||
};
|
||||
|
||||
if (
|
||||
@@ -1565,8 +1569,10 @@ function showPermissionsPopupWindow(forCalling: boolean, forCamera: boolean) {
|
||||
|
||||
const size = mainWindow.getSize();
|
||||
const options = {
|
||||
width: Math.min(400, size[0]),
|
||||
height: Math.min(150, size[1]),
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
width: Math.min(400, size[0]!),
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
height: Math.min(150, size[1]!),
|
||||
resizable: false,
|
||||
title: getResolvedMessagesLocale().i18n('icu:allowAccess'),
|
||||
titleBarStyle: nonMainTitleBarStyle,
|
||||
|
||||
@@ -9,6 +9,7 @@ import type {
|
||||
MenuOptionsType,
|
||||
MenuActionsType,
|
||||
} from '../ts/types/menu.std.js';
|
||||
import { strictAssert } from '../ts/util/assert.std.js';
|
||||
|
||||
const { isString } = lodash;
|
||||
|
||||
@@ -220,6 +221,7 @@ export const createTemplate = (
|
||||
|
||||
if (includeSetup) {
|
||||
const fileMenu = template[0];
|
||||
strictAssert(fileMenu, 'Missing fileMenu');
|
||||
|
||||
if (Array.isArray(fileMenu.submenu)) {
|
||||
// These are in reverse order, since we're prepending them one at a time
|
||||
@@ -265,6 +267,7 @@ function updateForMac(
|
||||
|
||||
// Remove About item and separator from Help menu, since they're in the app menu
|
||||
const aboutMenu = template[4];
|
||||
strictAssert(aboutMenu, 'Missing aboutMenu');
|
||||
if (Array.isArray(aboutMenu.submenu)) {
|
||||
aboutMenu.submenu.pop();
|
||||
aboutMenu.submenu.pop();
|
||||
@@ -275,6 +278,7 @@ function updateForMac(
|
||||
// Remove preferences, separator, and quit from the File menu, since they're
|
||||
// in the app menu
|
||||
const fileMenu = template[0];
|
||||
strictAssert(fileMenu, 'Missing fileMenu');
|
||||
if (Array.isArray(fileMenu.submenu)) {
|
||||
fileMenu.submenu.pop();
|
||||
fileMenu.submenu.pop();
|
||||
@@ -343,6 +347,7 @@ function updateForMac(
|
||||
});
|
||||
|
||||
const editMenu = template[2];
|
||||
strictAssert(editMenu, 'Missing editMenu');
|
||||
if (Array.isArray(editMenu.submenu)) {
|
||||
editMenu.submenu.push(
|
||||
{
|
||||
@@ -366,9 +371,11 @@ function updateForMac(
|
||||
throw new Error('updateForMac: edit.submenu was not an array!');
|
||||
}
|
||||
|
||||
const windowMenu = template[4];
|
||||
strictAssert(windowMenu, 'Missing windowMenu');
|
||||
// Replace Window menu
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
template[4].submenu = [
|
||||
|
||||
windowMenu.submenu = [
|
||||
{
|
||||
label: i18n('icu:windowMenuMinimize'),
|
||||
accelerator: 'CmdOrCtrl+M',
|
||||
|
||||
Reference in New Issue
Block a user