Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Remove zero-risk decomment follow-ups

Manav Rathi0911ef985f5e
diff --git a/cli/cmd/admin.go b/cli/cmd/admin.go
index f71fb49c58..eb2d5815de 100644
--- a/cli/cmd/admin.go
+++ b/cli/cmd/admin.go
@@ -173,7 +173,6 @@ func init() {
_deleteUser.Flags().StringP("user", "u", "", "The email of the user to delete. (required)")
_updateFreeUserStorage.Flags().StringP("admin-user", "a", "", "The email of the admin user.")
_updateFreeUserStorage.Flags().StringP("user", "u", "", "The email of the user to update subscription for. (required)")
- // add a flag with no value --no-limit
_updateFreeUserStorage.Flags().String("no-limit", "True", "When true, sets 100TB as storage limit, and expiry to current date + 100 years")
_sendMail.Flags().StringP("admin-user", "a", "", "The email of the admin user.")
_adminCmd.AddCommand(_userDetailsCmd, _disable2faCmd, _disablePasskeyCmd, _updateFreeUserStorage, _listUsers, _deleteUser, _sendMail)
diff --git a/web/.gitignore b/web/.gitignore
index e7aa15ae32..717f609f5e 100644
--- a/web/.gitignore
+++ b/web/.gitignore
@@ -10,8 +10,6 @@ dist
out/
next-env.d.ts
-apps/ensu/next/
-
packages/wasm/pkg/
packages/wasm/space/pkg/
packages/wasm-core/pkg/
diff --git a/web/apps/accounts/src/pages/passkeys/index.tsx b/web/apps/accounts/src/pages/passkeys/index.tsx
index 89210b0cf4..49c38712ae 100644
--- a/web/apps/accounts/src/pages/passkeys/index.tsx
+++ b/web/apps/accounts/src/pages/passkeys/index.tsx
@@ -208,7 +208,7 @@ interface AddPasskeyFormProps {
onRefreshPasskeys: () => Promise<void>;
}
-export const AddPasskeyForm: React.FC<AddPasskeyFormProps> = ({
+const AddPasskeyForm: React.FC<AddPasskeyFormProps> = ({
token,
onRefreshPasskeys,
}) => {
diff --git a/web/apps/albums/src/public-album/components/TripLayout/mapHelpers.ts b/web/apps/albums/src/public-album/components/TripLayout/mapHelpers.ts
index c27242cfea..7b2abc1d2c 100644
--- a/web/apps/albums/src/public-album/components/TripLayout/mapHelpers.ts
+++ b/web/apps/albums/src/public-album/components/TripLayout/mapHelpers.ts
@@ -249,26 +249,3 @@ export const getLocationPosition = (
return [lat, lng - lngShift];
};
-
-export const getLocationPositionAtZoom = (
- lat: number,
- lng: number,
- zoom: number,
-): [number, number] => {
- const isMobile = isMobileDevice();
- const timelineWidthRatio = isMobile ? 0.0 : 0.5;
-
- const baseDegreesPerPixelAtZoom10 = 0.35 / 1000;
- const zoomScaleFactor = Math.pow(2, 10 - zoom);
- const degreesPerPixelAtCurrentZoom =
- baseDegreesPerPixelAtZoom10 * zoomScaleFactor;
-
- const basePixelsToShift =
- (window.innerWidth || 1400) * (1 - timelineWidthRatio);
- const pixelsToShiftFor20Percent = isMobile
- ? basePixelsToShift * 0.6
- : basePixelsToShift * 3.0;
- const lngShift = pixelsToShiftFor20Percent * degreesPerPixelAtCurrentZoom;
-
- return [lat, lng - lngShift];
-};
diff --git a/web/apps/auth/src/services/remote.ts b/web/apps/auth/src/services/remote.ts
index 9af3a029f8..34b3601d2e 100644
--- a/web/apps/auth/src/services/remote.ts
+++ b/web/apps/auth/src/services/remote.ts
@@ -77,6 +77,8 @@ const AuthenticatorEntityDiffResponse = z.object({
timestamp: z.number().nullish().transform(nullToUndefined),
});
+const authenticatorEntityDiffBatchSize = 2500;
+
export interface AuthenticatorEntityDiffResult {
entities: AuthenticatorEntity[];
timeOffset: number | undefined;
@@ -96,7 +98,6 @@ export const authenticatorEntityDiff = async (
{ id: string; encryptedData: string; header: string }
>();
let sinceTime = 0;
- const batchSize = 2500;
let timeOffset: number | undefined = undefined;
@@ -104,7 +105,7 @@ export const authenticatorEntityDiff = async (
const res = await fetch(
await apiURL("/authenticator/entity/diff", {
sinceTime,
- limit: batchSize,
+ limit: authenticatorEntityDiffBatchSize,
}),
{ headers: await authenticatedRequestHeaders() },
);
@@ -164,9 +165,8 @@ export const getAuthenticatorEntityKey = async (): Promise<
if (!res.ok) {
if (res.status == 404) return undefined;
throw new HTTPError(res);
- } else {
- return AuthenticatorEntityKey.parse(await res.json());
}
+ return AuthenticatorEntityKey.parse(await res.json());
};
const decryptAuthenticatorKey = async (
diff --git a/web/apps/embed/src/services/in-memory-storage.ts b/web/apps/embed/src/services/in-memory-storage.ts
index 670052dd01..25b0b0bd21 100644
--- a/web/apps/embed/src/services/in-memory-storage.ts
+++ b/web/apps/embed/src/services/in-memory-storage.ts
@@ -18,27 +18,10 @@ export class InMemoryStorage {
this.storage.delete(key);
}
- clear(): void {
- this.storage.clear();
- }
-
ready(): void {
// No-op that exists only to satisfy the localForage interface.
}
- keys(): string[] {
- return Array.from(this.storage.keys());
- }
-
- length(): number {
- return this.storage.size;
- }
-
- key(index: number): string | null {
- const keys = this.keys();
- return keys[index] || null;
- }
-
config(): void {
// No-op that exists only to satisfy the localForage interface.
}
diff --git a/web/apps/embed/src/services/public-albums-storage.ts b/web/apps/embed/src/services/public-albums-storage.ts
index d3df373fef..c4323ed35d 100644
--- a/web/apps/embed/src/services/public-albums-storage.ts
+++ b/web/apps/embed/src/services/public-albums-storage.ts
@@ -40,13 +40,6 @@ export const removePublicCollectionByKey = (collectionKey: string) => {
const LocalString = z.string().nullish().transform(nullToUndefined);
-export const savedLastPublicCollectionReferralCode = () =>
- LocalString.parse(inMemoryStorage.getItem("public-referral-code"));
-
-export const saveLastPublicCollectionReferralCode = (referralCode: string) => {
- inMemoryStorage.setItem("public-referral-code", referralCode);
-};
-
const LocalSavedPublicCollectionFilesEntry = z.object({
collectionUID: z.string(),
files: LocalEnteFiles,
@@ -141,24 +134,3 @@ export const savePublicCollectionLinkDeviceToken = (
linkDeviceToken,
);
};
-
-export const removePublicCollectionLinkDeviceToken = (
- apiOrigin: string,
- accessToken: string,
-) => {
- inMemoryStorage.removeItem(
- publicCollectionLinkDeviceTokenKey(apiOrigin, accessToken),
- );
-};
-
-export const savedPublicCollectionUploaderName = (accessToken: string) =>
- LocalString.parse(
- inMemoryStorage.getItem(`public-${accessToken}-uploaderName`),
- );
-
-export const savePublicCollectionUploaderName = (
- accessToken: string,
- uploaderName: string,
-) => {
- inMemoryStorage.setItem(`public-${accessToken}-uploaderName`, uploaderName);
-};
diff --git a/web/packages/accounts-rs/components/VerifyMasterPasswordForm.tsx b/web/packages/accounts-rs/components/VerifyMasterPasswordForm.tsx
index f0937352e9..1bdfb6547d 100644
--- a/web/packages/accounts-rs/components/VerifyMasterPasswordForm.tsx
+++ b/web/packages/accounts-rs/components/VerifyMasterPasswordForm.tsx
@@ -60,7 +60,7 @@ export const VerifyMasterPasswordForm: React.FC<
try {
await verifyPassword(password, setPasswordFieldError);
} catch (e) {
- log.error("Failed to to verify password", e);
+ log.error("Failed to verify password", e);
setPasswordFieldError(t("generic_error"));
}
},
diff --git a/web/packages/accounts-rs/services/passkey.ts b/web/packages/accounts-rs/services/passkey.ts
index 09b1ef7c13..145c878c6f 100644
--- a/web/packages/accounts-rs/services/passkey.ts
+++ b/web/packages/accounts-rs/services/passkey.ts
@@ -23,7 +23,6 @@ export const passkeyVerificationRedirectURL = (
accountsURL: string,
passkeySessionID: string,
) => {
- const clientPackage = clientPackageName;
// In the desktop app, window.location.origin is the custom app protocol
// origin, which doubles as the deeplink back into the app.
const redirect = `${window.location.origin}/passkeys/finish`;
@@ -33,7 +32,7 @@ export const passkeyVerificationRedirectURL = (
? {}
: { recover: `${window.location.origin}/passkeys/recover` };
const params = new URLSearchParams({
- clientPackage,
+ clientPackage: clientPackageName,
passkeySessionID,
redirect,
...recoverOption,
diff --git a/web/packages/accounts/components/VerifyMasterPasswordForm.tsx b/web/packages/accounts/components/VerifyMasterPasswordForm.tsx
index 93fa323875..c240e75cbc 100644
--- a/web/packages/accounts/components/VerifyMasterPasswordForm.tsx
+++ b/web/packages/accounts/components/VerifyMasterPasswordForm.tsx
@@ -60,7 +60,7 @@ export const VerifyMasterPasswordForm: React.FC<
try {
await verifyPassword(password, setPasswordFieldError);
} catch (e) {
- log.error("Failed to to verify password", e);
+ log.error("Failed to verify password", e);
setPasswordFieldError(t("generic_error"));
}
},
diff --git a/web/packages/accounts/services/passkey.ts b/web/packages/accounts/services/passkey.ts
index 0c53d26623..c2e478cdc4 100644
--- a/web/packages/accounts/services/passkey.ts
+++ b/web/packages/accounts/services/passkey.ts
@@ -23,7 +23,6 @@ export const passkeyVerificationRedirectURL = (
accountsURL: string,
passkeySessionID: string,
) => {
- const clientPackage = clientPackageName;
// In the desktop app, window.location.origin is the custom app protocol
// origin, which doubles as the deeplink back into the app.
const redirect = `${window.location.origin}/passkeys/finish`;
@@ -33,7 +32,7 @@ export const passkeyVerificationRedirectURL = (
? {}
: { recover: `${window.location.origin}/passkeys/recover` };
const params = new URLSearchParams({
- clientPackage,
+ clientPackage: clientPackageName,
passkeySessionID,
redirect,
...recoverOption,
diff --git a/web/packages/base/components/mui/PasswordInputAdornment.tsx b/web/packages/base/components/mui/PasswordInputAdornment.tsx
index 4397634b35..a5b7109dab 100644
--- a/web/packages/base/components/mui/PasswordInputAdornment.tsx
+++ b/web/packages/base/components/mui/PasswordInputAdornment.tsx
@@ -11,7 +11,7 @@ interface ShowHidePasswordInputAdornmentProps {
export const ShowHidePasswordInputAdornment: React.FC<
ShowHidePasswordInputAdornmentProps
-> = ({ showPassword, onToggle: onToggle }) => {
+> = ({ showPassword, onToggle }) => {
// Prevent the visibility button from blurring the password field.
const preventDefault = (event: React.MouseEvent<HTMLButtonElement>) => {
event.preventDefault();
diff --git a/web/packages/base/components/utils/theme.ts b/web/packages/base/components/utils/theme.ts
index 0ca085c1b7..eee384922e 100644
--- a/web/packages/base/components/utils/theme.ts
+++ b/web/packages/base/components/utils/theme.ts
@@ -20,54 +20,44 @@ const getTheme = (appName: AppName): Theme => {
const getColors = (appName: AppName) => ({
..._colors,
- ...{
- fixed: {
- ..._colors.fixed,
- dark: {
- background: _colors.dark.background,
- text: _colors.dark.text,
- divider: _colors.dark.stroke.faint,
- },
+ fixed: {
+ ..._colors.fixed,
+ dark: {
+ background: _colors.dark.background,
+ text: _colors.dark.text,
+ divider: _colors.dark.stroke.faint,
},
},
- ...{
- accent:
- appName == "auth"
- ? _colors.accentAuth
- : appName == "share" || appName == "locker"
- ? _colors.accentShare
- : appName == "ensu"
- ? _colors.accentEnsu
- : _colors.accentPhotos,
- accentDark:
- appName == "ensu"
- ? _colors.accentEnsuDark
- : appName == "auth"
- ? _colors.accentAuth
- : appName == "share" || appName == "locker"
- ? _colors.accentShare
- : _colors.accentPhotos,
- },
- ...{
- accentContrastText:
- appName == "ensu" ? _colors.fixed.black : _colors.fixed.white,
- },
- ...{
- light:
- appName == "share" || appName == "locker"
- ? _colors.lightShare
- : appName == "ensu"
- ? _colors.lightEnsu
- : _colors.light,
- },
- ...{
- dark:
- appName == "share" || appName == "locker"
- ? _colors.darkShare
- : appName == "ensu"
- ? _colors.darkEnsu
- : _colors.dark,
- },
+ accent:
+ appName == "auth"
+ ? _colors.accentAuth
+ : appName == "share" || appName == "locker"
+ ? _colors.accentShare
+ : appName == "ensu"
+ ? _colors.accentEnsu
+ : _colors.accentPhotos,
+ accentDark:
+ appName == "ensu"
+ ? _colors.accentEnsuDark
+ : appName == "auth"
+ ? _colors.accentAuth
+ : appName == "share" || appName == "locker"
+ ? _colors.accentShare
+ : _colors.accentPhotos,
+ accentContrastText:
+ appName == "ensu" ? _colors.fixed.black : _colors.fixed.white,
+ light:
+ appName == "share" || appName == "locker"
+ ? _colors.lightShare
+ : appName == "ensu"
+ ? _colors.lightEnsu
+ : _colors.light,
+ dark:
+ appName == "share" || appName == "locker"
+ ? _colors.darkShare
+ : appName == "ensu"
+ ? _colors.darkEnsu
+ : _colors.dark,
});
const _colors = {
diff --git a/web/packages/base/log.ts b/web/packages/base/log.ts
index 08fcac1c38..6c7f4cb08c 100644
--- a/web/packages/base/log.ts
+++ b/web/packages/base/log.ts
@@ -34,9 +34,7 @@ const messageWithError = (message: string, e?: unknown) => {
const st = e.stack;
if (st) {
// V8 stacks already start with "Name: message".
- es = st.startsWith(es)
- ? es.concat(st.slice(es.length))
- : [es, st].join("\n");
+ es = st.startsWith(es) ? st : [es, st].join("\n");
}
} else {
// Best-effort for arbitrary thrown values.
diff --git a/web/packages/media/collection.ts b/web/packages/media/collection.ts
index f220ff3a1e..d8276c7423 100644
--- a/web/packages/media/collection.ts
+++ b/web/packages/media/collection.ts
@@ -210,7 +210,6 @@ export const decryptRemoteCollection = async (
owner: parseRemoteCollectionUser(owner),
name,
sharees: sharees.map(parseRemoteCollectionUser),
- publicURLs: rest.publicURLs,
magicMetadata,
pubMagicMetadata,
sharedMagicMetadata,
diff --git a/web/packages/media/heic-convert.worker.ts b/web/packages/media/heic-convert.worker.ts
index 1cc558a951..2f9afcf5dd 100644
--- a/web/packages/media/heic-convert.worker.ts
+++ b/web/packages/media/heic-convert.worker.ts
@@ -19,10 +19,6 @@ logUnhandledErrorsAndRejectionsInWorker();
const heicToJPEG = async (heicBlob: Blob): Promise<Blob> => {
const buffer = new Uint8Array(await heicBlob.arrayBuffer());
- // TypeScript versions after 5.6.3 report a type error here, possibly fixed
- // by newer Node.js types.
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
- // @ts-ignore
const result = await HeicConvert({ buffer, format: "JPEG" });
const convertedData = new Uint8Array(result);
return new Blob([convertedData], { type: "image/jpeg" });
diff --git a/web/packages/media/live-photo.ts b/web/packages/media/live-photo.ts
index 81e7c9fc6b..8c1274c84d 100644
--- a/web/packages/media/live-photo.ts
+++ b/web/packages/media/live-photo.ts
@@ -30,7 +30,6 @@ const potentialVideoExtensions = [
"webm",
"3gp",
"3g2",
- "avi",
"ogv",
"mpg",
"mp",
diff --git a/web/packages/utils/promise.ts b/web/packages/utils/promise.ts
index 3e7402cfc9..5a5e1cdd8a 100644
--- a/web/packages/utils/promise.ts
+++ b/web/packages/utils/promise.ts
@@ -42,10 +42,16 @@ export const withTimeout = async <T>(
};
export class PromiseQueue<T> {
- private q: { task: () => Promise<T>; handlers: unknown }[] = [];
+ private q: {
+ task: () => Promise<T>;
+ handlers: [
+ (value: T | PromiseLike<T>) => void,
+ (reason?: unknown) => void,
+ ];
+ }[] = [];
async add(task: () => Promise<T>): Promise<T> {
- let handlers;
+ let handlers!: (typeof this.q)[number]["handlers"];
const p = new Promise<T>((...args) => (handlers = args));
this.q.push({ task, handlers });
if (this.q.length == 1) this.next();
@@ -57,7 +63,6 @@ export class PromiseQueue<T> {
if (!item) return;
const { task, handlers } = item;
void task()
- // @ts-expect-error Can't think of an easy way to satisfy tsc.
.then(...handlers)
.finally(() => {
this.q.shift();
diff --git a/web/packages/utils/type-guards.ts b/web/packages/utils/type-guards.ts
index fd7c5ccb58..c950a7ef68 100644
--- a/web/packages/utils/type-guards.ts
+++ b/web/packages/utils/type-guards.ts
@@ -3,6 +3,6 @@
// https://github.com/microsoft/TypeScript/issues/48247
// https://github.com/microsoft/TypeScript/issues/26255#issuecomment-502899689
export function includes<T, U extends T>(us: readonly U[], t: T): t is U {
- // @ts-expect-error @typescript-eslint/no-unsafe-argument
+ // @ts-expect-error Array.includes cannot narrow an arbitrary T to U.
return us.includes(t);
}