π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Prune web comments and documentation
Manav Rathi7f8cd7acdfd1
diff --git a/docs/docs/photos/features/account/passkeys.md b/docs/docs/photos/features/account/passkeys.mdindex 3c45adc414..5c2e38649c 100644--- a/docs/docs/photos/features/account/passkeys.md+++ b/docs/docs/photos/features/account/passkeys.md@@ -12,7 +12,6 @@ Passkeys are a new authentication mechanism that uses strong cryptography built> Passkeys are the colloquial term for a WebAuthn (Web Authentication) credentials.>> - More details about why and how are in the Passkeys announcement [blog post](https://ente.com/blog/introducing-passkeys-on-ente/).-> - And to know more technical details about how our passkey verification works, you can see this [technical note in our source code](https://github.com/ente/ente/blob/main/web/docs/webauthn-passkeys.md).## Passkeys and TOTPdiff --git a/web/.gitignore b/web/.gitignoreindex 6e34c07ab1..e7aa15ae32 100644--- a/web/.gitignore+++ b/web/.gitignore@@ -1,23 +1,17 @@-# Local env files.env*.local-# tsc*.tsbuildinfo-# Vitedist-# Next.js.next/.next-dev/.next-desktop/out/next-env.d.ts-# Static export outputsapps/ensu/next/-# Generated wasm buildpackages/wasm/pkg/packages/wasm/space/pkg/packages/wasm-core/pkg/diff --git a/web/CLAUDE.md b/web/CLAUDE.mddeleted file mode 100644index 57a86988bf..0000000000--- a/web/CLAUDE.md+++ /dev/null@@ -1,52 +0,0 @@-# CLAUDE.md--## Commit Message Guidelines--When making commits, follow these rules:--- Keep messages CONCISE (no walls of text)-- Subject line under 72 chars as a single sentence (no body text, no bullets, no lists)-- NO emojis-- NO promotional text or links-- NO Co-Authored-By lines-- ONLY run pre-commit checks (format, lint, typecheck, build) when explicitly creating a commit--Example:--```-Format markdown files with Prettier for consistent styling-```--## Commands--```sh-# Install dependencies from the committed lockfile-npm ci-# Fast path when the lock file has not changed since the last npm ci, OR when-# adding or updating dependencies.-npm install--# Run development servers-npm run dev # Photos app (port 3000)-npm run dev:auth # Auth app (port 3003)-# ...-npm run # To see the full list of apps--# Production builds-npm run build # Photos app-npm run build:auth # Auth app-...--# Code quality. Run when:-# 1. Explicitly requested by user-# 2. Before creating a commit (pre-commit)-# Do not run automatically after file modifications-npm run lint # Check formatting, linting, and TypeScript types-npm run lint:fix # Auto-fix linting and formatting issues-```--## Structure--This is a monorepo containing multiple Ente web applications using npm workspaces.--Shared code goes in `packages/`. All apps use Next.js for static export except `payments`. Run `ls apps/` and `ls packages/` to see the full list.diff --git a/web/Dockerfile b/web/Dockerfileindex 9117ad5a4b..24d035ede7 100644--- a/web/Dockerfile+++ b/web/Dockerfile@@ -1,8 +1,5 @@-# Docs - https://github.com/ente/ente/blob/main/web/docs/docker.md-FROM node:24 AS builder-# Install Rust for building ente-wasmRUN apt-get update && apt-get install -y curl build-essential && rm -rf /var/lib/apt/lists/* && \curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --target wasm32-unknown-unknownENV PATH="/root/.cargo/bin:${PATH}"@@ -42,6 +39,7 @@ COPY --from=builder /build/web/apps/paste/out /out/pasteCOPY --from=builder /build/web/apps/locker/out /out/lockerCOPY --from=builder /build/web/apps/memories/out /out/memories+# 40-enable-ipv6.sh activates the commented listeners when IPv6 is available.COPY <<'EOF' /etc/nginx/conf.d/default.confserver {listen 3000;@@ -125,7 +123,6 @@ EOFRUN chmod +x /docker-entrypoint.d/90-replace-ente-env.sh-# Dynamically enable IPv6 if the container environment supports itCOPY <<'EOF' /docker-entrypoint.d/40-enable-ipv6.sh#!/bin/shif [ -f /proc/net/if_inet6 ]; thendiff --git a/web/README.md b/web/README.mdindex 4b7004c88c..a3861de9fa 100644--- a/web/README.md+++ b/web/README.md@@ -1,8 +1,8 @@# Ente's web apps-Source code for Ente's various web apps and supporting websites.+Source code for Ente's web apps and supporting websites.-Live versions are at:+Live versions include:- Ente Photos: [photos.ente.com](https://photos.ente.com)- Ente Albums: [albums.ente.com](https://albums.ente.com)@@ -29,35 +29,13 @@ npm run devThat's it. The web app will automatically hot reload when you make changes.-> [!TIP]->-> If you're new to web development and unsure about how to get started, or are facing some problems when running the above steps, see [docs/new.md](docs/new.md).--> [!NOTE]->-> If `package-lock.json` has not changed since your last `npm ci`, you can use `npm install` as a faster incremental alternative. For caveats, see [docs/dev.md](docs/dev.md#npm-ci-npm-install).--## Other apps-By default, `npm run dev` builds the Photos app. To run the public albums app, use `npm run dev:albums`. To run auth, use `npm run dev:auth`.To see the full list of apps you can run (and other scripts that you can use), use `npm run`.-For more details about development workflows, see [docs/dev](docs/dev.md).--## Directory structure--As a brief overview, this directory contains the following apps:--- `apps/photos`: A fully functional web client for Ente Photos.-- `apps/albums`: The public albums web app used for shared album and file links.-- `apps/auth`: A view only client for Ente Auth. Currently you can only view your 2FA codes using this web app. For adding and editing your 2FA codes, please use the Ente Auth [mobile/desktop app](../auth/README.md) instead.--Apart from these primary apps there are other smaller ones too (see `apps/` for the full list).--The apps take use various `packages/` to share code amongst themselves.--You might also find this [overview of dependencies](docs/dependencies.md) useful.+> [!NOTE]+>+> If `package-lock.json` has not changed since your last `npm ci`, you can use `npm install` as a faster incremental alternative.## Docker images@@ -71,9 +49,7 @@ City coordinates from [Simple Maps](https://simplemaps.com/data/world-cities)[](https://crowdin.com/project/ente-photos-web)-If you're interested in helping out with translation, please visit our [Crowdin project](https://crowdin.com/project/ente-photos-web) to get started. Thank you for your support.--If your language is not listed for translation, please [create a GitHub issue](https://github.com/ente/ente/issues/new?title=Request+for+New+Language+Translation&body=Language+name%3A) to have it added.+The web apps can be translated in the [Ente Web Crowdin project](https://crowdin.com/project/ente-photos-web). See [docs/translations.md](docs/translations.md) for more details.## π Contributediff --git a/web/apps/accounts/README.md b/web/apps/accounts/README.mdindex 843acedb02..0af7b33ceb 100644--- a/web/apps/accounts/README.md+++ b/web/apps/accounts/README.md@@ -12,8 +12,6 @@ It also includes other cross app account-level like family invitation acceptance`accounts.ente.io` remains the legacy origin for users who already have Passkeys scoped to the old `ente.io` relying-party ID.-For more details about the Passkey flows, [docs/webauthn-passkeys.md](../../docs/webauthn-passkeys.md).-## DevelopmentTo set this up to work with a locally running museum, modify your local `museum.yaml` to set the relaying party's ID to "localhost" (without any port number).diff --git a/web/apps/memories/next.config.js b/web/apps/memories/next.config.jsindex b56119d3cd..21cdd711ba 100644--- a/web/apps/memories/next.config.js+++ b/web/apps/memories/next.config.js@@ -2,16 +2,14 @@ const baseConfig = require("ente-base/next.config.base.js");module.exports = {...baseConfig,- // Override output for development to support rewrites- // In production, we use static export (inherited from baseConfig)+ // Keep static export in production; in development, serve arbitrary routes+ // through the index page so local browser loads match Cloudflare fallback....(process.env.NODE_ENV === "development" && {- output: undefined, // Remove 'export' mode in development to allow rewrites- // Add rewrites only in development for SPA routing+ output: undefined,async rewrites() {return {fallback: [{- // Catch all routes except static files and Next.js internalssource: "/:path((?!_next|images|favicon.ico).*)",destination: "/",},diff --git a/web/apps/share/next.config.js b/web/apps/share/next.config.jsindex b56119d3cd..21cdd711ba 100644--- a/web/apps/share/next.config.js+++ b/web/apps/share/next.config.js@@ -2,16 +2,14 @@ const baseConfig = require("ente-base/next.config.base.js");module.exports = {...baseConfig,- // Override output for development to support rewrites- // In production, we use static export (inherited from baseConfig)+ // Keep static export in production; in development, serve arbitrary routes+ // through the index page so local browser loads match Cloudflare fallback....(process.env.NODE_ENV === "development" && {- output: undefined, // Remove 'export' mode in development to allow rewrites- // Add rewrites only in development for SPA routing+ output: undefined,async rewrites() {return {fallback: [{- // Catch all routes except static files and Next.js internalssource: "/:path((?!_next|images|favicon.ico).*)",destination: "/",},diff --git a/web/docs/README.md b/web/docs/README.mddeleted file mode 100644index 3c3b06f2e0..0000000000--- a/web/docs/README.md+++ /dev/null@@ -1,14 +0,0 @@-# Developer docs--If you just want to run Ente's web apps locally or develop them, you can do--```sh-npm ci-npm run dev-```--The docs in this directory provide more details that some developers might find useful.--> [!TIP]->-> To prepare your machine, see [new](new.md).diff --git a/web/docs/dependencies.md b/web/docs/dependencies.mddeleted file mode 100644index f4c84824de..0000000000--- a/web/docs/dependencies.md+++ /dev/null@@ -1,181 +0,0 @@-# Dependencies--## Dev--These are some global dev dependencies in the root `package.json`. These set the baseline for how our code should be in all the workspaces in this npm monorepo.--- [prettier](https://prettier.io) - Formatter--- [eslint](https://eslint.org) - Linter--- [typescript](https://www.typescriptlang.org/) - Type checker--They also need some support packages, which come from the leaf `ente-build-config` package:--- [@eslint/js](https://eslint.org/) provides JavaScript ESLint functionality, and provides the configuration recommended the by ESLint team.--- [typescript-eslint](https://typescript-eslint.io/packages/typescript-eslint/) - provides TypeScript ESLint functionality and provides a set of recommended configurations (`typescript-eslint` is the new entry point, our yet-unmigrated packages use the older method of separately including [@typescript-eslint/parser](https://typescript-eslint.io/packages/eslint-plugin/) - which tells ESLint how to read TypeScript syntax - and [@typescript-eslint/eslint-plugin](https://typescript-eslint.io/packages/eslint-plugin/) - which provides the TypeScript rules and presets).--- [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react), [eslint-plugin-react-hooks](https://reactjs.org/) - Some React specific ESLint rules and configurations that are used by the workspaces that have React code.--- [eslint-plugin-react-refresh](https://github.com/ArnaudBarre/eslint-plugin-react-refresh) - A plugin to ensure that React components are exported in a way that they can be HMR-ed.--- [prettier-plugin-organize-imports](https://github.com/simonhaenisch/prettier-plugin-organize-imports) - A Prettier plugin to sort imports.--- [prettier-plugin-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson) - A Prettier plugin to also prettify `package.json`.--The root `package.json` also has a convenience dev dependency:--- [concurrently](https://github.com/open-cli-tools/concurrently) for spawning parallel tasks when we invoke various npm scripts.--> [!NOTE]->-> We need to repeat some of the dependencies in multiple `package.json`s to avoid spurious missing peer dependency warnings.->-> For example, ideally we'd just have specified the react dependencies in _ente-base_, but that leads to missing peer dependency warnings in our other packages, so we need to need to repeat them. For now, we manually ensure that all of them use the same version.->-> Additionally, we pin the versions of the react types using the overrides field in the top level `package.json`, to avoid type errors because of multiple versions of react types being in scope.--## Cryptography--We use [libsodium](https://libsodium.gitbook.io/doc/) for our cryptography primitives. We use its WebAssembly target, accessible via JavaScript wrappers maintained by the original authors of libsodium themselves - [libsodium-wrappers](https://github.com/jedisct1/libsodium.js).--More precisely, we use the sumo variant, "libsodium-wrappers-sumo", since the standard variant does not provide the `crypto_pwhash_*` functions.--## Meta frameworks--### Next.js--[Next.js](https://nextjs.org) (package: [next](https://github.com/vercel/next.js)) provides the meta framework for both the photos and the auth app, and also for some of the sidecar apps like accounts and cast.--We use a limited subset of Next.js. The main thing we get out of it is a reasonable set of defaults for bundling our app into a static export which we can then deploy to our webserver. In addition, the Next.js page router is convenient. Overall our apps can be described as regular React SPAs, and are not particularly tied to Next.js.--### Vite--For some of our newer code, we have started to use [Vite](https://vitejs.dev). It is likely the future (both generally, and for our code) since Next.js is becoming less suitable for SPAs and static SSR with their push towards RSC and dynamic SSR.--## UI--### React--[React](https://react.dev) (package: [react](https://github.com/facebook/react)) is our core framework. We also import its a sibling [react-dom](https://github.com/facebook/react) package that renders JSX to the DOM.--### MUI and Material Icons--We use [MUI](https://mui.com)'s [@mui/material](https://mui.com/material-ui/getting-started/installation/) as our base React component library (In our code and documentation, we use the name "MUI" to refer to the the combination of both MUI's "Material UI" and "System" packages that we use).--MUI uses [Emotion](https://emotion.sh/) as its preferred CSS-in-JS library, for which we need to install install two Emotion packages (`@emotion/react` and `@emotion/styled`) as peer dependencies.--We also use MUI's [@mui/material-icons](https://mui.com/material-ui/material-icons/) package, which provides Material icons exported as React components (a `SvgIcon`).--> [!NOTE]->-> For a similar reason as with react,->-> - the `@mui/material` dependency is also repeated at more places - the one in _ente-base_ is the canonical one.-> - we need to add an explicit dependency to `mui/system` in _ente-new_ even though we don't directly depend on it.--### Date pickers--[@mui/x-date-pickers](https://mui.com/x/react-date-pickers/getting-started/) is used to get a date/time picker component. This is the community version of the DateTimePicker component provided by MUI.--[dayjs](https://github.com/iamkun/dayjs) is used as the date library that that `@mui/x-date-pickers` will internally use to manipulate dates.--### Translations--For showing the app's UI in multiple languages, we use the [i18next](https://www.i18next.com), specifically its three components--- [i18next](https://github.com/i18next/i18next): The core `i18next` library.--- [react-i18next](https://github.com/i18next/react-i18next): React specific support in `i18next`.--- [i18next-http-backend](https://github.com/i18next/i18next-http-backend): Adds support for initializing `i18next` with JSON file containing the translation in a particular language, fetched at runtime.--Note that inspite of the "next" in the name of the library, it has nothing to do with Next.js.--[get-user-locale](https://github.com/wojtekmaj/get-user-locale) is used for enumerating the user's locale's to find the best match.--For more details, see [translations.md](translations.md).--### Font--Inter Variable (with support for weights 100 - 90) is used as the primary font, via [@fontsource-variable/inter](https://fontsource.org/fonts/inter/install).--### UI components--- [react-window](https://github.com/bvaughn/react-window) is used for lazy-ily rendering large lists of dynamically created content, each item being of a variable height. It is usually used in tandem with its sibling package, [react-virtualized-auto-sizer](https://github.com/bvaughn/react-virtualized-auto-sizer) which allows the lazy list to resize itself automatically to fill the entire remaining space available in the container.--- [formik](https://github.com/jaredpalmer/formik) provides an easier to use abstraction for dealing with form state, validation and submission states when using React.--- [react-select](https://react-select.com/) is used for search dropdowns.--- [react-otp-input](https://github.com/devfolioco/react-otp-input) is used to render a segmented OTP input field for 2FA authentication.--## Utilities--- [comlink](https://github.com/GoogleChromeLabs/comlink) provides a minimal layer on top of web workers to make them more easier to use.--- [idb](https://github.com/jakearchibald/idb) provides a promise API over the browser-native IndexedDB APIs. Older code (the file and collection store), uses [localForage](https://github.com/localForage/localForage) for IndexedDB access.-- > For more details about IDB and its role, see [storage.md](storage.md).--- [zod](https://github.com/colinhacks/zod) is used for runtime typechecking (e.g. verifying that API responses match the expected TypeScript shape).--- [nanoid](https://github.com/ai/nanoid) is used for generating unique identifiers. For one particular use case, we also need [uuid](https://github.com/uuidjs/uuid) for UUID v4 generation.--- [bs58](https://github.com/cryptocoinjs/bs58) is used for base-58 conversion (used for encoding the collection key to use as the hash in the share URL).--- [debounce](https://github.com/sindresorhus/debounce) and its promise-supporting sibling [p-debounce](https://github.com/sindresorhus/p-debounce) are used for debouncing operations (See also: `[Note: Throttle and debounce]`).--- [bip39](https://github.com/bitcoinjs/bip39) is used for generating the 24-word recovery key mnemonic.--- [zxcvbn](https://github.com/dropbox/zxcvbn) is used for password strength estimation.--- [fast-srp-hap](https://github.com/homebridge/fast-srp) is used for the maths underlying the SRP protocol.--## Media--- [@ffmpeg/ffmpeg](https://github.com/ffmpegwasm/ffmpeg.wasm) is used to run FFmpeg in the browser using WebAssembly (Wasm). Note that this is substantially slower than native ffmpeg (the desktop app can, and does, bundle the faster native ffmpeg implementation too).--- [exifreader](https://github.com/mattiasw/ExifReader) is used for Exif parsing.--- [jszip](https://github.com/Stuk/jszip) is used for reading zip files in the web code (Live photos are zip files under the hood). Note that the desktop app uses also has a ZIP parser (that one supports streaming).--- [file-type](https://github.com/sindresorhus/file-type) is used for MIME type detection.--- [heic-convert](https://github.com/catdad-experiments/heic-convert) is used for converting HEIC files (which browsers don't natively support) into JPEG. For (much more) details, see [heic.md](heic.md).--## Photos app specific--- [photoswipe](https://photoswipe.com) provides the base image viewer on top of which we've built our file viewer.--- For streaming video (HLS), we use three libraries:- 1. [media-chrome](https://github.com/muxinc/media-chrome) provides custom video controls which we use when playing HLS playlists (we use custom controls to provide a standardized UX across browsers, but really the main reason is that Safari's default video controls are on the verge of unusable, especially for streaming playback),-- 2. [hls-video-element](https://github.com/muxinc/media-elements/tree/main/packages/hls-video-element) provides a custom web component element that glues media-chrome and hls.js together, and-- 3. [hls.js](https://github.com/video-dev/hls.js/) (indirect dependency via hls-video-element) is needed on HLS playback on Chrome and Firefox (which do not have native support for HLS playlists).--- [react-dropzone](https://github.com/react-dropzone/react-dropzone/) is a React hook to create a drag-and-drop input zone.--- [sanitize-filename](https://github.com/parshap/node-sanitize-filename) is for converting arbitrary strings into strings that are suitable for being used as filenames.--- [chrono-node](https://github.com/wanasit/chrono) is used for parsing natural language queries into dates for showing search results.--- [ml-matrix](https://github.com/mljs/matrix) is mathematical matrix abstraction by the machine learning code. It is used alongwith [similarity-transformation](https://github.com/shaileshpandit/similarity-transformation-js) during face alignment.--- [react-top-loading-bar](https://github.com/klendi/react-top-loading-bar) is used for showing a progress indicator for global actions (This shouldn't be used always, it is only meant as a fallback when there isn't an otherwise suitable place for showing a local activity indicator).--## Auth app specific--- [otpauth](https://github.com/hectorm/otpauth) is used for the generation of the actual OTP from the user's TOTP/HOTP secret.--- However, otpauth doesn't support steam OTPs. For these, we need to compute the SHA-1, and we use `@noble/hashes`, the same hash library that `otpauth` uses.--## Pinned--- `react-dropzone` is pinned to the 14.2.10, the last version in the 14.2 series, since if we use 14.3 onwards (I tested till 14.3.5) then we are unable to get back a path from the file by using the `webUtils.getPathForFile` function provided by Electron. See: https://github.com/react-dropzone/react-dropzone/issues/1411--- `@stripe/stripe-js` is pinned to the latest 1.x (it works as it is currently, migrating to newer major versions requires headspace since it _might_ also require museum changes).--- `base-x` is pinned to 5.0.1 via the root `overrides` field because it is pulled in transitively by `bs58`, and 5.0.0 is affected by [CVE-2025-27611](https://github.com/advisories/GHSA-xq7p-g2vc-g82p).diff --git a/web/docs/deploy.md b/web/docs/deploy.mddeleted file mode 100644index ceb53415af..0000000000--- a/web/docs/deploy.md+++ /dev/null@@ -1,69 +0,0 @@-# Deploying--The various web apps and static sites in this repository are deployed on Cloudflare Pages using GitHub workflows.--- Automated production deployments of `main` daily 8:00 AM IST.--- [ente.com/help](https://ente.com/help) gets deployed whenever a PR that changes anything inside `docs/` gets merged to `main`.--- Production deployments can made manually by triggering the corresponding workflow.--## Deployments--Here is a list of all the deployments, whether or not they are production deployments, and the action that triggers them:--| URL | Type | Deployment action |-| ---------------------------------------------- | ---------- | ------------------------------------------ |-| [photos.ente.com](https://photos.ente.com) | Production | Daily deploy of `main` |-| [albums.ente.com](https://albums.ente.com) | Production | Daily deploy of `main` |-| [auth.ente.com](https://auth.ente.com) | Production | Daily deploy of `main` |-| [accounts.ente.com](https://accounts.ente.com) | Production | Daily deploy of `main` |-| [cast.ente.com](https://cast.ente.com) | Production | Daily deploy of `main` |-| [payments.ente.com](https://payments.ente.com) | Production | Daily deploy of `main` |-| [ente.com/help](https://ente.com/help) | Production | Changes in `docs/` on push to `main` |-| [staff.ente.sh](https://staff.ente.sh) | Production | Changes in `infra/staff` on push to `main` |--### Other subdomains--Apart from this, there are also some other deployments:--- `family.ente.io` serves the legacy family portal from a [separate repository](https://github.com/ente/families) for older clients (Current clients manage families directly in their Photos UI).-- `accounts.ente.io` remains the legacy Passkey RP origin during the `accounts.ente.com` dual-RP migration.-------## Details--The rest of the document describes details about how things were setup. You likely don't need to know them to be able to deploy.--## First time preparation--Create a new Pages project in Cloudflare, setting it up to use [Direct Upload](https://developers.cloudflare.com/pages/get-started/direct-upload/).--> [!NOTE]->-> Direct upload doesn't work for existing projects tied to your repository using the [Git integration](https://developers.cloudflare.com/pages/get-started/git-integration/).->-> If you want to keep the pages.dev domain from an existing project, you should be able to delete your existing project and recreate it (assuming no one claims the domain in the middle). I've not seen this documented anywhere, but it worked when I tried, and it seems to have worked for [other people too](https://community.cloudflare.com/t/linking-git-repo-to-existing-cf-pages-project/530888).--There are two ways to create a new project, using Wrangler [[1](https://github.com/cloudflare/pages-action/issues/51)] or using the Cloudflare dashboard [[2](https://github.com/cloudflare/pages-action/issues/115)]. Since this is one time thing, the second option might be easier.--The remaining steps are documented in [Cloudflare's guide for using Direct Upload with CI](https://developers.cloudflare.com/pages/how-to/use-direct-upload-with-continuous-integration/). As a checklist,--- Generate `CLOUDFLARE_API_TOKEN`-- Add `CLOUDFLARE_ACCOUNT_ID` and `CLOUDFLARE_API_TOKEN` to the GitHub secrets-- Add your workflow. e.g. see `docs-deploy.yml`.--This is the basic setup, and should already work.--## Deploying multiple sites--However, we wish to deploy multiple sites from this same repository, so the standard Cloudflare conception of a single "production" branch doesn't work for us.--Instead, we tie each deployment to a branch name. Note that we don't have to actually create the branch or push to it, this branch name is just used as the the `branch` parameter that gets passed to `cloudflare/pages-action`.--Since our root pages project is `ente.pages.dev`, so a branch named `foo` would be available at `foo.ente.pages.dev`.--Finally, we create CNAME aliases using a [Custom Domain in Cloudflare](https://developers.cloudflare.com/pages/how-to/custom-branch-aliases/) to point to these deployments from our user facing DNS names.--As a concrete example, the GitHub workflow that deploys `docs/` passes "help" as the branch name. The resulting deployment is available at "help.ente.pages.dev". Finally, we add a custom domain to point to it from [ente.com/help](https://ente.com/help).diff --git a/web/docs/dev.md b/web/docs/dev.mddeleted file mode 100644index c9a4c10c11..0000000000--- a/web/docs/dev.md+++ /dev/null@@ -1,70 +0,0 @@-# Development--## Editor setup--We recommend VS Code, with the following extensions:--- Prettier - reformats your code automatically (enable format on save),-- ESLint - warns you about issues--Optionally, if you're going to make many changes to the CSS in JS, you might also find it useful to install the _vscode-styled-components_ extension.--## npm commands--Use the npm version from `package.json`.--### npm ci, npm install--Use `npm ci` to install dependencies using the committed lockfile. You need this for initial setup, and whenever `package-lock.json` changes (e.g. after pulling the latest upstream).--`npm ci` is the safe default. However, it deletes and recreates `node_modules` each time. For a faster incremental install, you can use `npm install` if you have already run `npm ci` and `package-lock.json` has not changed since then.--> We pin exact versions in `package.json` and commit the lockfile so both `npm install` and `npm ci` should give the same outcome; however, this is not guaranteed, so if `npm install` changes `package-lock.json`, review the diff instead of treating it as incidental churn.--Use `npm install <package> --workspace <workspace>` only when intentionally adding or updating dependencies, and review the resulting `package.json` and `package-lock.json` changes.--Installs skip dependency lifecycle scripts (`ignore-scripts` in `.npmrc`) so that installing cannot run arbitrary code from packages. The packages we use work fine without their lifecycle scripts: they either ship prebuilt binaries (e.g. `esbuild`, `sharp`) or fetch them on first use (`wasm-pack`). `save-exact` in `.npmrc` keeps newly added dependencies pinned to exact versions.--### npm run dev:\*--Launch the app in development mode. There is one `npm run dev:foo` for each app, e.g. `npm run dev:auth`. `npm run dev` is a shortcut for `npm run dev:photos`.--Common ports are `3000` for photos, `3002` for albums, `3003` for auth, `3005` for share, and `3006` for embed. See `package.json` for the full list.--### npm run build:\*--Build a production export for the app. This is a bunch of static HTML/JS/CSS that can be then deployed to any web server.--There is one `npm run build:foo` for each app, e.g. `npm run build:auth`. The output will be placed in `apps/<foo>/out`, e.g. `apps/auth/out`.--### lint, lint:fix--Use `npm run lint` to check that your code formatting is as expected, and that there are no linter errors. Use `npm run lint:fix` to try and automatically fix the issues.--## Monorepo--The monorepo uses npm workspaces.--To run a command for a workspace `<ws>`, invoke `npm exec --workspace <ws> -- <cmd>` from the root folder. For example, to start a development server for the `photos` app, we can do--```sh-npm exec --workspace photos -- next dev --webpack-```--There is also a convenience alias, `npm run dev:photos`. See `package.json` for the full list of such aliases. The two common patterns are `dev:<app-name>` for running a local development server, and `build:<app-name>` for creating a production build.--> Tip: `npm run dev` is a shortcut for `npm run dev:photos`--Note that npm does not automatically update `node_modules` if you switch to a branch that has added or modified dependencies. So if you encounter unexpected errors on switching branches, make sure that your `node_modules` is up to date first: use `npm install` if `package-lock.json` has not changed since your last `npm ci`, otherwise use `npm ci`.--To add a local package as a dependency, use `<package-name>@*`. The "\*" here denotes any version.--```sh-npm install 'ente-utils@*' --workspace photos-```--To see the workspace package metadata, use--```sh-npm query .workspace-```diff --git a/web/docs/docker.md b/web/docs/docker.mdindex a3b5268430..44cf96852d 100644--- a/web/docs/docker.md+++ b/web/docs/docker.md@@ -1,8 +1,8 @@# Docker-Automated Docker images for the self-hosting web apps are created every Wednesday. You can fetch them from `ghcr.io/ente/web`.+Automated Docker images for the self-hosting web apps are created every Wednesday, available from `ghcr.io/ente/web`.-These images expose 10 web apps on the following ports:+These images expose web apps on the following ports:- `3000` - Photos- `3001` - Accounts@@ -15,7 +15,7 @@ These images expose 10 web apps on the following ports:- `3009` - Locker- `3010` - Memories-For example, for selectively exposing only the photos web app on your port 8000, you could:+For example, for selectively exposing only the photos web app on your port 8000:```shdocker run -it --rm -p 8000:3000 ghcr.io/ente/web@@ -23,9 +23,9 @@ docker run -it --rm -p 8000:3000 ghcr.io/ente/webThese images accept one environment variable:-- `ENTE_API_ORIGIN` - The API origin (scheme://host:port) for your API server. Default: "http://localhost:8080".+- `ENTE_API_ORIGIN` - The API origin (scheme://host:port) for the custom API server. Default: "http://localhost:8080".-For example, if your API server is running at `https://api.example.org`, you can configure your Docker image to connect to it:+For example, if the API server is running at `https://api.example.org`:```shdocker run -it --rm -e ENTE_API_ORIGIN=https://api.example.org ghcr.io/ente/web@@ -33,11 +33,11 @@ docker run -it --rm -e ENTE_API_ORIGIN=https://api.example.org ghcr.io/ente/web> [!TIP]>-> Configure web app origins, such as Photos and Albums, in Museum's `apps` section.+> Some of the web app origins (e.g. albums) also need to be configured in Museum's `apps` section.### Dockerfile-If you're manually building the Docker image using `web/Dockerfile` instead of using prebuilt `ghcr.io/ente/web` image, remember to run the build from the repo root since the context requires both the `web` and `rust` folders.+For manually building the Docker image using `web/Dockerfile` instead of using prebuilt `ghcr.io/ente/web` image, the build must be run from the repo root since the context requires both the `web` and `rust` folders.```shdocker build -f web/Dockerfile .diff --git a/web/docs/heic.md b/web/docs/heic.mddeleted file mode 100644index 44de1c4b51..0000000000--- a/web/docs/heic.md+++ /dev/null@@ -1,63 +0,0 @@-# HEIC conversion--## What--**HEIF** is a container format.--- It was developed by Nokia, which also provides a reference implementation that no one (?) uses (it has some samples though - https://github.com/nokiatech/heif/tree/gh-pages/content).--- The de-facto implementation is **libheif** (https://github.com/strukturag/libheif).--**HEIF** can contain HEVC and AV1 data.--- HEIF can contain one or more images (e.g burst photos)--- These images can have arbitrary codecs like HEVC, AV1, or even JPEG.--**HEVC**, aka H.265, is a video codec.--- It is the successor of H.264.--- The de-facto implementation is x265, by the VLC folks (https://www.videolan.org/developers/x265.html). aka **libx265**.--- Since x265 is GPL, a popular LGPL alternative H.265 decoder (only) is **libde265** by the same folks who make libheif (https://github.com/strukturag/libde265).--- A new, still WIP, alternative encoder is https://github.com/ultravideo/kvazaar.--**AV1** is a video codec.--- It is made by a pool of companies, AOM (Alliance for Open Media), as a royalty free alternative to H.265.--**AVIF** files are HEIF container and AV1 codec.--- They're supported by all major browsers.--**HEIC** files are HEIF container and HEVC codec.--- iPhones and Samsung Galaxy use them as the default.--- They're only supported by Safari (latest).--## FFmpeg--FFmpeg (and its native library, libavcodec) supports HEVC.--- Default software codec is libx265.--- Hardware support is platform specific. On macOS `ffmpeg -codecs` lists `hevc_videotoolbox` as a codec. Video Toolbox is Apple's access to hardware encoders / decoders (https://developer.apple.com/documentation/videotoolbox)--FFmpeg, as of 2024, partially supports converting HEIC files--- "So once this patch is applied, the only unsupported items would be Alpha and Grid (Tiles) for both AVIF and HEIC." ([ref](https://patchwork.ffmpeg.org/project/ffmpeg/patch/[email protected]/#80191))--- This partial support is not enough. Trying `ffmpeg -i 1.heic 1.jpeg` on a photo taken by iPhone (iOS 18) gives only a small area of the image. The upstream issue - [Support merging HEIC tile grids in ffmpeg](https://trac.ffmpeg.org/ticket/11170) - mentions a workaround by combining the grid but that produces a thick gray border on the right and bottom (and the orientation is also not respected).--FFmpeg support would be nice since we already bundle it both in the desktop app and also as a web Wasm build.-------## libheif + libde265--Every other HEIC converter, binary or library (e.g. ImageMagick, GraphicsMagick, libvips, sharp and wasm-vips), I've seen eventually the uses the combination of libheif (for the HEIF container) + libde265 (for the HEVC decoding), with an option to swap libde265 with libx265 or kvazaar.--Currently our web app uses [heic-convert](https://github.com/catdad-experiments/heic-convert), which provides packaged Wasm builds of libheif + libde265, and the desktop app uses a [custom build](https://github.com/ente/libvips-packaging) of `vips` on Linux and Windows, and Apple's `sips` on macOS.diff --git a/web/docs/new.md b/web/docs/new.mddeleted file mode 100644index 48fff48791..0000000000--- a/web/docs/new.md+++ /dev/null@@ -1,20 +0,0 @@-# Welcome!--If you're new to web stuff or coming back to it after mobile/backend development, here is a recommended workflow:--1. Install **VS Code**.--2. Install the **Prettier** and **ESLint** extensions.--3. Enable the VS Code setting to format on save.--4. Install **node** on your machine. There are myriad ways to do this, here are some examples:- - OS agnostic: Install [NVM](https://github.com/nvm-sh/nvm), then `nvm install 24`.-- - macOS: `brew install node@24`-- - Ubuntu: `sudo apt install nodejs npm`--5. Install [Rust](https://www.rust-lang.org/tools/install).--That's it. Enjoy coding!diff --git a/web/docs/storage.md b/web/docs/storage.mddeleted file mode 100644index 475f3889b5..0000000000--- a/web/docs/storage.md+++ /dev/null@@ -1,49 +0,0 @@-# Storage--## Session Storage--Data tied to the browser tab's lifetime.--The primary information store in session storage is the user's encryption key here. In addition, various other transient bits and bobs are also kept here.--## Local Storage--Data in the local storage is persisted even after the user closes the tab, or the browser itself. This is in contrast with session storage, where the data is cleared when the browser tab is closed.--The data in local storage is tied to the Document's origin (scheme + host).--Some things that get stored here are:--- Details about the logged in user (See: [Note: Accounts DB]).--- Some user preferences (export settings, collection sort order).--> Local storage is not accessible to web workers, so if any non main-thread context needs access to the data, it should be stored in IndexedDB.--## IndexedDB--IndexedDB is a transactional NoSQL store provided by browsers. It has quite large storage limits, and data is stored per origin (and remains persistent across tab restarts).--Unlike local storage, IndexedDB is also accessible from web workers and so we also use IndexedDB for storing ad-hoc key value pairs.--Older code used the LocalForage library for storing things in Indexed DB. This library falls back to localStorage in case Indexed DB storage is not available.--Newer code uses the idb library which provides a promise API over the IndexedDB, but otherwise does not introduce any new abstractions.--For more details, see:--- https://web.dev/articles/indexeddb-- https://github.com/jakearchibald/idb-- https://github.com/localForage/localForage--Some things that get stored here are:--- The collection and file data (See: [Files DB]). Note that the file contents themselves are not stored, only the "EnteFile" object that describes a file.--- Various key value pairs (See: [Note: KV DB]).--## OPFS--OPFS is used for caching entire files when we're running under Electron (the Web Cache API is used in the browser).--As it name suggests, it is an entire file system, private for us ("origin"). In is not undbounded though, and the storage is not guaranteed to be persistent (at least with the APIs we use), hence the cache designation.diff --git a/web/docs/translations.md b/web/docs/translations.mdindex 2db294b916..b196452166 100644--- a/web/docs/translations.md+++ b/web/docs/translations.md@@ -1,31 +1,39 @@-# Translations+# Ente web translations-We use Crowdin for translations, and the `i18next` library to load these at runtime.+The user-facing strings and translations shared by the web apps live in `packages/base/locales`. The apps load them with `i18next`.-Within our project we have the _source_ strings - these are the key value pairs in the `packages/base/locales/en-US/translation.json` file.+## Translate-Volunteers can add a new _translation_ in their language corresponding to each such source key-value to our [Crowdin project](https://crowdin.com/project/ente-photos-web).+The strings can be translated in the [Ente Web Crowdin project](https://crowdin.com/project/ente-photos-web).-Every Monday, and whenever source strings or the Crowdin config change on `main`, we run a [GitHub workflow](../../.github/workflows/web-crowdin-sync.yml) that+If your language is not listed, [request it on GitHub](https://github.com/ente/ente/issues/new?title=Request+for+New+Language+Translation&body=Language+name%3A+%0AProject%3A+web).-- Uploads sources to Crowdin - So any new key value pair we add in the source `translation.json` becomes available to translators to translate.+Partial translations are welcome; the apps generally enable a language after roughly 90% of its strings are translated.-- Downloads translations from Crowdin - So any new translations that translators have made on the Crowdin dashboard (for existing sources) will be added to the corresponding `lang/translation.json`.+## Add a string-The workflow also uploads the current source strings before downloading translations.+1. Add the key and English text to [`translation.json`](../packages/base/locales/en-US/translation.json).-## Adding a new string+2. Use the key in the app code:-- Add a new entry in `packages/base/locales/en-US/translation.json` (the **source `translation.json`**).-- Use the new key in code with the `t` function (`import { t } from "i18next"`).-- During the next sync, the workflow will upload this source item to Crowdin's dashboard, allowing translators to translate it.+ ```ts+ import { t } from "i18next";-## Updating an existing string+ t("new_string_key");+ ```-- Update the existing value for the key in the source `translation.json`.-- During the next sync, the workflow will clear out all the existing translations so that they can be translated afresh.+3. Commit the source string and app changes.-## Deleting an existing string+After the pull request merges, the [Crowdin workflow](../../.github/workflows/web-crowdin-sync.yml) uploads the new string. The same workflow downloads translations every Monday and opens a pull request for them.-- Remove the key value pair from the source `translation.json`.-- During the next sync, the workflow will delete that source item from all existing translations (both in the Crowdin project and also from the other `lang/translation.json` files in the repository).+## Update a string++> [!WARNING]+>+> Updating the English text invalidates its existing translations.++Update the value in [`translation.json`](../packages/base/locales/en-US/translation.json) and commit the change. After the pull request merges, the Crowdin workflow updates the source string.++## Delete a string++Remove every use of the key, remove it from [`translation.json`](../packages/base/locales/en-US/translation.json), and commit both changes. After the pull request merges, the Crowdin workflow removes the source string; its next translation pull removes the key from the translated files.diff --git a/web/docs/webauthn-passkeys.md b/web/docs/webauthn-passkeys.mddeleted file mode 100644index ae0fb131a0..0000000000--- a/web/docs/webauthn-passkeys.md+++ /dev/null@@ -1,386 +0,0 @@-# Passkeys on Ente--Passkeys is a colloquial term for a relatively new authentication standard called [WebAuthn](https://en.wikipedia.org/wiki/WebAuthn). Now rolled out to all major browsers and operating systems, it uses asymmetric cryptography to authenticate the user with a server using replay-attack resistant signatures. These processes are usually abstracted from the user through biometric prompts, such as Touch ID/Face ID/Optic ID, Fingerprint Unlock and Windows Hello. These passkeys can also be securely synced by major password managers, such as Bitwarden and 1Password, although the syncing experience can greatly vary due to some operating system restrictions.--## Terms--| Term | Definition |-| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |-| Credential | Passkey. It is an asymmetric keypair identified by a unique ID generated by the client. |-| Authenticator | A software-based implementation or physical device capable of storing and using credentials to authenticate. |-| Relying Party | Us. We rely on the user's authenticator to verify their identity through a cryptographic signature. We prove this signature through the credential's public key that we store. |-| Ceremony | An analogy referring to the multiple steps involved in authenticating or registering a credential with a relying party. Ceremonies have a "begin" and a "finish". Information must be persisted between these two steps. |--## Getting to the passkeys manager--As of Jun 2024, Ente clients have a button to navigate to a WebView of Ente Accounts. Ente Accounts allows users to add and manage their registered passkeys, and later authenticate with them as a second factor.--> [!NOTE]->-> Your WebView MUST invoke the operating-system's default browser, or an equivalent browser with matching API parity. Otherwise, the user will not be able to register or use registered WebAuthn credentials.--### Ente Accounts specific session token--When a user clicks this button, the client sends a request for an Accounts-specific JWT session token as shown below. **The Ente Accounts API is restricted to this type of session token, so the user session token cannot be used.** This restriction is a byproduct of the enablement for automatic login.--#### GET /users/accounts-token--##### Headers--| Name | Type | Value |-| ------------ | ------ | ------------------------------------------------ |-| X-Auth-Token | string | The user session token. It is encoded in base64. |--##### Response body (JSON)--| Key | Type | Value |-| ------------- | ------ | ----------------------------------------------------------------- |-| accountsToken | string | The Accounts-specific JWT session token. It is encoded in base64. |-| accountsUrl | string | The Accounts origin the client should open for this user. |--### Automatically logging into Ente Accounts--Clients open a WebView with the URL `<accountsUrl>/passkeys?token=<accountsToken>`.--If the token is valid, the user will be show a list of their passkeys, and they can edit / delete them, or add new ones.--## Registering a WebAuthn credential--### Requesting publicKey options (begin)--The registration ceremony starts in the browser. When the user clicks the "Add new passkey" button, a request is sent to the server for "public key" creation options. Although named "public key" options, they actually define customizable parameters for the entire credential creation process. They're like an instructional sheet that defines exactly what we want.--On the server side, the WebAuthn library generates this information based on data provided from a `webauthn.User` interface. As a result, we satisfy this interface by creating a type with methods returning information from the database. Information stored in the database about credentials are all pre-processed using base64 where necessary.--```go-type PasskeyUser struct {- *ente.User- repo *Repository-}--func (u *PasskeyUser) WebAuthnID() []byte {- b, _ := byteMarshaller.ConvertInt64ToByte(u.ID)- return b-}--func (u *PasskeyUser) WebAuthnName() string {- return u.Email-}--func (u *PasskeyUser) WebAuthnDisplayName() string {- return u.Name-}--func (u *PasskeyUser) WebAuthnCredentials() []webauthn.Credential {- creds, err := u.repo.GetUserPasskeyCredentials(u.ID)- if err != nil {- return []webauthn.Credential{}- }-- return creds-}-```--#### POST /passkeys/registration/begin--##### Headers--| Name | Type | Value |-| ------------ | ------ | ------------------------------------------------ |-| X-Auth-Token | string | The user session token. It is encoded in base64. |--##### Response body (JSON)--| Key | Type | Value |-| --------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |-| options | object | The credential creation options that will be provided to the browser. |-| sessionID | string (uuid) | The identifier the server uses to persist metadata about the registration ceremony, like the user ID and challenge to prevent replay attacks. |--```json-{- "options": {- "publicKey": {- "rp": { "name": "Ente", "id": "ente.io" },- "user": {- "name": "[email protected]",- "displayName": "",- "id": "AAWdgssasAY"- },- "challenge": "xYVv1V08dgrsU_4k5niEkFcfIGbwPauWKPBARS6C6Dg",- "pubKeyCredParams": [- { "type": "public-key", "alg": -7 },- { "type": "public-key", "alg": -35 },- { "type": "public-key", "alg": -36 },- { "type": "public-key", "alg": -257 },- { "type": "public-key", "alg": -258 },- { "type": "public-key", "alg": -259 },- { "type": "public-key", "alg": -37 },- { "type": "public-key", "alg": -38 },- { "type": "public-key", "alg": -39 },- { "type": "public-key", "alg": -8 }- ],- "timeout": 300000,- "authenticatorSelection": {- "requireResidentKey": false,- "userVerification": "preferred"- }- }- },- "sessionID": "0a8442d7-8580-4391-8ac3-4a75d6a7f115"-}-```--### Pre-processing the options before registration--Even though the server generates these options, the browser still doesn't understand them. For interoperability, the server's WebAuthn library returns binary data in base64, like IDs and the challenge. However, the browser requires this data back in binary.--We just have to decode the base64 fields back into `Uint8Array`.--```ts-const options = response.options;--options.publicKey.challenge = sodium.from_base64(options.publicKey.challenge);-options.publicKey.user.id = sodium.from_base64(options.publicKey.user.id);-```--### Creating the credential--We use `navigator.credentials.create` with these options to generate the credential. At this point, the user will see a prompt to decide where to save this credential, and probably a biometric authentication gate depending on the platform.--```ts-const newCredential = await navigator.credentials.create(options);-```--### Sending the public key to the server (finish)--The browser returns the newly created credential with a bunch of binary fields, so we have to encode them into base64 for transport to the server.--```ts-const attestationObjectB64 = sodium.to_base64(- new Uint8Array(credential.response.attestationObject),- sodium.base64_variants.URLSAFE_NO_PADDING-);-const clientDataJSONB64 = sodium.to_base64(- new Uint8Array(credential.response.clientDataJSON),- sodium.base64_variants.URLSAFE_NO_PADDING-```--Attestation object contains information about the nature of the credential, like what device it was generated on. Client data JSON contains metadata about the credential, like where it is registered to.--After pre-processing, the client sends the public key to the server so it can verify future signatures during authentication.--#### POST /passkeys/registration/finish--When the server receives the new public key credential, it pre-processes the JSON objects so they can fit within the database. This includes base64 encoding `[]byte` slices and their encompassing arrays or objects.--```go-// Convert the PublicKey to base64-publicKeyB64 := base64.StdEncoding.EncodeToString(cred.PublicKey)--// Convert the Transports slice to a comma-separated string-var transports []string-for _, t := range cred.Transport {- transports = append(transports, string(t))-}-authenticatorTransports := strings.Join(transports, ",")--// Marshal the Flags to JSON-credentialFlags, err := json.Marshal(cred.Flags)-if err != nil {- return nil, err-}--// Marshal the Authenticator to JSON and encode AAGUID to base64-authenticatorMap := map[string]interface{}{- "AAGUID": base64.StdEncoding.EncodeToString(cred.Authenticator.AAGUID),- "SignCount": cred.Authenticator.SignCount,- "CloneWarning": cred.Authenticator.CloneWarning,- "Attachment": cred.Authenticator.Attachment,-}-authenticatorJSON, err := json.Marshal(authenticatorMap)-if err != nil {- return nil, err-}--// convert cred.ID into base64-credID := base64.StdEncoding.EncodeToString(cred.ID)-```--On retrieval, this process is effectively the opposite.--#### Query parameters--| Key | Value |-| ------------ | ------------------------------------------------------------------------------------------------------- |-| friendlyName | The user's entered name for their credential. It helps them identify it in the dashboard in the future. |-| sessionID | The server's identifier for this registration ceremony instance, as returned from the begin step. |--##### Headers--| Name | Type | Value |-| ------------ | ------ | ------------------------------------------------ |-| X-Auth-Token | string | The user session token. It is encoded in base64. |--##### Request body (JSON)--| Key | Type | Value |-| -------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |-| id | string | Base64 encoded client generated identifier for the credential. |-| rawId | string | Base64 encoded client generated identifier for the credential that can be derived from the browser's rawId field, but can also just be set to id. |-| type | string | The type of credential. |-| response | object | Contains attestationObject and clientDataJSON fields that were encoded prior to request. |--**Example**--```js-{- id: credential.id,- rawId: credential.id,- type: credential.type,- response: {- attestationObject: attestationObjectB64,- clientDataJSON: clientDataJSONB64,- },-}-```--## Authenticating with a credential--Passkeys have been integrated into the existing two-factor ceremony. When logging in via SRP or verifying an email OTT, the server checks if the user has any number of credentials setup or has 2FA TOTP enabled. If the user has setup at least one credential, they will be served a `passkeySessionID` which will initiate the authentication ceremony.--```tsx-const {- // ...- twoFactorSessionID,- passkeySessionID,-} = await verifySRP(srpAttributes, kek);-if (passkeySessionID) {- // ...-}-```--The client should redirect the user to the Ente Accounts web app with this session ID to prompt credential authentication.--```-https://accounts.ente.com/passkeys?- passkeySessionID=<sid>&clientPackage=<pkg>&- redirect=<redirect>&recover=<recover-redirect>-```--We use Ente Accounts as the central WebAuthn hub since it allows us to handle mobile and desktop clients too.--During the dual-RP migration, the server returns `accounts.ente.io` for users who still have legacy `ente.io` passkeys, and `accounts.ente.com` for users without legacy passkeys.--### Requesting publicKey options (begin)--#### POST /users/two-factor/passkeys/begin--##### Query parameters--| Key | Value |-| --------- | ------------------------------------------------------------------------- |-| sessionID | The `passkeySessionID` returned from SRP login or email OTT verification. |--##### Response body (JSON)--**Example**--```json-{- "ceremonySessionID": "98a80fbd-c484-4f3b-a139-c43faf4b171f",- "options": {- "publicKey": {- "challenge": "dF-mmdZSBxP6Z7OhZrmQ4h-k-BkuuX6ERnW_ckYdkvc",- "timeout": 300000,- "rpId": "ente.io",- "allowCredentials": [- {- "type": "public-key",- "id": "lGfY8iSVjdAsqGKzWv3mkAesRfo",- "transports": [""]- }- ],- "userVerification": "preferred"- }- }-}-```--| Key | Type | Value |-| ----------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| ceremonySessionID | string | The server identifier for the authentication session. |-| options | object | publicKey options that define which WebAuthn credentials are valid. These credentials can be safely shared with the user because they do not contain any personally identifiable information. |--### Pre-processing the options before retrieval--The browser requires `Uint8Array` versions of the `options` challenge and credential IDs.--```ts-publicKey.challenge = sodium.from_base64(- publicKey.challenge,- sodium.base64_variants.URLSAFE_NO_PADDING,-);-publicKey.allowCredentials?.forEach(function (listItem: any) {- listItem.id = sodium.from_base64(- listItem.id,- sodium.base64_variants.URLSAFE_NO_PADDING,- );-});-```--### Retrieving the credential--```ts-const credential = await navigator.credentials.get({ publicKey: options });-```--### Pre-processing the credential metadata and signature before authentication--Before sending the public key and signature to the server, their outputs must be encoded into Base64.--```ts-authenticatorData: sodium.to_base64(- new Uint8Array(credential.response.authenticatorData),- sodium.base64_variants.URLSAFE_NO_PADDING-),-clientDataJSON: sodium.to_base64(- new Uint8Array(credential.response.clientDataJSON),- sodium.base64_variants.URLSAFE_NO_PADDING-),-signature: sodium.to_base64(- new Uint8Array(credential.response.signature),- sodium.base64_variants.URLSAFE_NO_PADDING-),-userHandle: sodium.to_base64(- new Uint8Array(credential.response.userHandle),- sodium.base64_variants.URLSAFE_NO_PADDING-),-```--### Sending the credential metadata and signature to the server (finish)--#### POST /users/two-factor/passkeys/finish--##### Query parameters--| Key | Value |-| ----------------- | ---------------------------------------------------------------------------------------- |-| ceremonySessionID | The `ceremonySessionID` identifier from the begin step. |-| sessionID | The `passkeySessionID` identifier from the SRP login or email OTT verification response. |--##### Request body (JSON)--| Key | Type | Value |-| -------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |-| id | string | Base64 encoded client generated identifier for the credential. |-| rawId | string | Base64 encoded client generated identifier for the credential that can be derived from the browser's rawId field, but can also just be set to id. |-| type | string | The type of credential. |-| response | object | Contains authenticatorData, clientDataJSON, signature and userHandle fields that were encoded prior to request. |--##### Response body (JSON)--| Key | Type | Value |-| -------------- | ------ | ------------------------------------------- |-| id | int64 | The user's ID. |-| keyAttributes | object | Contains user encryption metadata. |-| encryptedToken | string | The encrypted user session token in Base64. |diff --git a/web/packages/accounts-rs/README.md b/web/packages/accounts-rs/README.mdindex 28fd472a84..26fe76415d 100644--- a/web/packages/accounts-rs/README.md+++ b/web/packages/accounts-rs/README.md@@ -1,13 +1,3 @@## ente-accounts-rs-A package for sharing the pages involved in the signup/login flow.--Currently this is used by the photos and auth apps.--> [!NOTE]->-> This is distinct from the accounts _app_, which currently acts as a broker for passkeys.--### Packaging--This (internal) package exports a React TypeScript library. We rely on the importing project to transpile and bundle it.+Shared signup and login flows backed by Rust cryptography through `ente-wasm`. Locker, Space, Legacy, and Contacts use this package; the other account flows use the parallel `ente-accounts` implementation.diff --git a/web/packages/accounts/README.md b/web/packages/accounts/README.mddeleted file mode 100644index e9a56f85f3..0000000000--- a/web/packages/accounts/README.md+++ /dev/null@@ -1,13 +0,0 @@-## ente-accounts--A package for sharing the pages involved in the signup/login flow.--Currently this is used by the photos and auth apps.--> [!NOTE]->-> This is distinct from the accounts _app_, which currently acts as a broker for passkeys.--### Packaging--This (internal) package exports a React TypeScript library. We rely on the importing project to transpile and bundle it.diff --git a/web/packages/base/README.md b/web/packages/base/README.mdindex 9343359194..58eaa6d8a7 100644--- a/web/packages/base/README.md+++ b/web/packages/base/README.md@@ -1,11 +1,3 @@## ente-base-A base (+ UI layer) package for sharing code between our production apps.--This is a higher layer package than `ente-utils` (which is framework agnostic). This package is meant for sharing code between our Next.js apps that use React and MUI. Both the photos and auth apps use it.--Our smaller, Vite based apps, e.g. payments, don't use this.--### Packaging--This (internal) package exports a React TypeScript library. We rely on the importing project to transpile and bundle it.+Shared application code built on React and MUI. Framework-agnostic code belongs in `ente-utils` instead.diff --git a/web/packages/base/components/utils/hooks.ts b/web/packages/base/components/utils/hooks.tsindex b256cea924..7ce1e130ea 100644--- a/web/packages/base/components/utils/hooks.ts+++ b/web/packages/base/components/utils/hooks.ts@@ -4,7 +4,8 @@ import { useCallback, useEffect, useEffectEvent, useState } from "react";export const useIsSmallWidth = () =>useMediaQuery(useTheme().breakpoints.down("sm"));-// Only use this touchscreen heuristic where misclassification degrades gracefully.+// This media query is only a heuristic: a tablet with a mouse can be+// misclassified. Use it only when either result is safe.export const useIsTouchscreen = () =>useMediaQuery("(hover: none) and (pointer: coarse)", { noSsr: true });diff --git a/web/packages/base/env.ts b/web/packages/base/env.tsindex 0474258006..a3b8d4c5fc 100644--- a/web/packages/base/env.ts+++ b/web/packages/base/env.ts@@ -1,4 +1,4 @@-// Replaced at build time.+// The build replaces these process.env reads in browser bundles.declare const process: {readonly env: {readonly NODE_ENV: "development" | "production" | "test";diff --git a/web/packages/base/next.config.base.js b/web/packages/base/next.config.base.jsindex c8eaea4e4f..1d58faf9f3 100644--- a/web/packages/base/next.config.base.js+++ b/web/packages/base/next.config.base.js@@ -1,31 +1,11 @@// @ts-check-/**- * @file Configure the Next.js build- *- * This file gets used by the Next.js build phase, and is not included in the- * browser build. It will not be parsed by Webpack, Babel or TypeScript, so- * don't use features that will not be available in our target node version.- *- * https://nextjs.org/docs/pages/api-reference/next-config-js- */-const cp = require("child_process");const os = require("os");const path = require("path");const fs = require("fs");-/**- * Return the current commit ID if we're running inside a git repository.- */const gitSHA = (() => {- // Allow the command to fail. gitSHA will be an empty string in such cases.- // This allows us to run the build even when we're outside of a git context.- //- // The /dev/null redirection is needed so that we don't print error messages- // if someone is trying to run outside of a git context. Since the way to- // redirect output and ignore failure is different on Windows, the command- // needs to be OS specific.const command =os.platform() == "win32"? "git rev-parse --short HEAD 2> NUL || cd ."@@ -33,50 +13,18 @@ const gitSHA = (() => {const result = cp.execSync(command, { cwd: __dirname, encoding: "utf8" }).trimEnd();- // Convert empty strings (e.g. when the `|| true` part of the above execSync- // comes into play) to undefined.return result ? result : undefined;})();-/**- * The name of the Ente app we're building.- *- * This is taken from the name of the directory which we're building. e.g.- * `npm run dev:auth` will run Next.js in `web/apps/auth`, and so this will be- * set to `auth`.- *- * In our runtime code, all references to `process.env.appName` will be- * statically replaced by this value at build time.- */const appName = path.basename(process.cwd());-/**- * "1" if we're building our desktop app.- *- * The _ENTE_IS_DESKTOP environment variable will be set by the npm script that- * builds the web app for embedding in the desktop app. Whenever it is set, we- * set this value to "1".- *- * In our runtime code, all references to `process.env.isDesktop` will be- * statically replaced by this value at build time.- */const isDesktop = process.env._ENTE_IS_DESKTOP ? "1" : "";-/**- * When we're running within the desktop app, also extract the version of the- * desktop app for use in our "X-Client-Version" string.- *- * > The web app has continuous deployments, and doesn't have versions.- */const desktopAppVersion = isDesktop? JSON.parse(fs.readFileSync("../../../desktop/package.json", "utf-8")).version: undefined;-// Fail the build if the user is setting legacy environment variables-// which have now been replaced with museum configuration. This is meant to help-// self hosters find the new setting instead of being caught unawares.-if (process.env.NEXT_PUBLIC_ENTE_ACCOUNTS_URL) {console.log("The NEXT_PUBLIC_ENTE_ACCOUNTS_URL environment variable is not supported.",@@ -93,10 +41,6 @@ if (process.env.NEXT_PUBLIC_ENTE_FAMILY_URL) {process.exit(1);}-// Print a notice if the user is setting legacy environment variables which-// were only client-side handoff hints, and now no-ops. The functional effects-// (previously and now) require setting Museum's app config.-if (process.env.NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT) {console.log("The NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT environment variable is not used anymore and is ignored.",@@ -122,24 +66,13 @@ if (process.env.NEXT_PUBLIC_ENTE_SHARE_ENDPOINT) {);}-/**- * Configuration for the Next.js build- *- * @type {import("next").NextConfig}- */+/** @type {import("next").NextConfig} */const nextConfig = {- // Generate a static export when we run `next build`.output: "export",- // Instead of the nice and useful HMR indicator that used to exist prior to- // 15.2, the Next.js folks have made this a persistent "branding" indicator- // that gets in the way and needs to be disabled.devIndicators: false,compiler: { emotion: true },- // Use Next.js to transpile our internal packages before bundling them.transpilePackages: ["ente-base", "ente-utils", "ente-new", "ente-wasm"],- // Add environment variables to the JavaScript bundle. They will be- // available as `process.env.varName` to our code.env: { gitSHA, appName, isDesktop, desktopAppVersion },// Desktop development runs via ente://app, and uses a separate dist@@ -147,28 +80,19 @@ const nextConfig = {...(process.env.NODE_ENV != "production" &&isDesktop && { allowedDevOrigins: ["app"], distDir: ".next-desktop" }),- // Customize the webpack configuration used by Next.js.webpack: (config, { isServer }) => {- // https://dev.to/marcinwosinek/how-to-add-resolve-fallback-to-webpack-5-in-nextjs-10-i6jif (!isServer) {config.resolve.fallback.fs = false;}- // Suppress the warning "Critical dependency: require function is used- // in a way in which dependencies cannot be statically extracted" when- // import heic-convert.- //- // Upstream issue, which currently doesn't have a workaround.+ // libheif-js triggers an unavoidable dynamic-require warning.// https://github.com/catdad-experiments/libheif-js/issues/23config.ignoreWarnings = [{ module: /libheif-js/ }];- // Webpack 5 doesn't enable WebAssembly by default.config.experiments = { ...config.experiments, asyncWebAssembly: true };- // Webpack emits a warning about async/await not being supported when- // importing wasm. The canonical way to do this would be to provide a- // browserlist to Next.js, but to avoid changing behaviour we tell- // Webpack just that async/await is supported.+ // Webpack otherwise warns that Wasm's async functions are unsupported.+ // Declare that capability without changing every Next.js browser target.config.output = config.output || {};config.output.environment = {...(config.output.environment || {}),diff --git a/web/packages/build-config/README.md b/web/packages/build-config/README.mddeleted file mode 100644index 5a9431d743..0000000000--- a/web/packages/build-config/README.md+++ /dev/null@@ -1,15 +0,0 @@-## ente-build-config--Build time configuration files. This can be thought of as a `devDependency` that exports various config files that our packages use at build time.--### Packaging--This is _not_ a TypeScript package, nor is it linted. It is not meant to be transpiled, it just exports static files that can be included verbatim.--### Debugging--Too see what tsc is seeing (e.g. when it is trying to type-check `ente-utils`), use `npm exec --workspace ente-utils -- tsc --showConfig`.--Similarly, to verify what ESLint is trying to do, use `npm exec --workspace ente-utils -- eslint --debug .`--If the issue is in VSCode, open the output window of the corresponding plugin, it might be telling us what's going wrong there. In particular, when changing the settings here, you might need to "Developer: Reload Window" in VSCode to get it to pick up the changes.diff --git a/web/packages/build-config/eslintrc-base.mjs b/web/packages/build-config/eslintrc-base.mjsindex 487a7d7ec2..edbbbbb575 100644--- a/web/packages/build-config/eslintrc-base.mjs+++ b/web/packages/build-config/eslintrc-base.mjs@@ -15,64 +15,31 @@ export default tseslint.config({rules: {"@typescript-eslint/no-import-type-side-effects": "error",- // Allow numbers to be used in template literals."@typescript-eslint/restrict-template-expressions": ["error",{ allowNumber: true },],- // Allow void expressions as the entire body of an arrow function."@typescript-eslint/no-confusing-void-expression": ["error",{ ignoreArrowShorthand: true },],- // Allow async functions to be passed as JSX attributes expected to- // be functions that return void (typically onFoo event handlers).- //- // This should be safe since we have registered global unhandled- // Promise handlers.+ // Promise-returning callbacks are allowed where a void callback is+ // expected. Global handlers report any unhandled rejection."@typescript-eslint/no-misused-promises": ["error",{ checksVoidReturn: { arguments: false, attributes: false } },],- // Allow force unwrapping potentially optional values.- //- // [Note: non-null-assertions have better stack trace]- //- // It is best if non-null assertions can be avoided by restructuring- // the code, but there do arise legitimate scenarios where we know- // from code logic that the value should be present. Of course, the- // surrounding code might change causing that expectation to be- // falsified, but in certain cases there isn't much we can do other- // than throwing an exception.- //- // Instead of rolling our own such exception (which we in fact used- // to do at, look in git history a utility function named "ensure"),- // it is better rely on the JS's native undefined property access- // exception since that conveys more information in the logs.+ // Non-null assertions are allowed when surrounding logic guarantees+ // the value. If that assumption breaks, the native error carries+ // more context than an error from a custom unwrap helper."@typescript-eslint/no-non-null-assertion": "off",- // Allow `while(true)` etc."@typescript-eslint/no-unnecessary-condition": ["error",{ allowConstantLoopConditions: true },],- // This one is a good suggestion in general, but it not always the- // one we want because there are cases where we'd intentionally want- // to map falsey values like empty strings to the default (e.g.- // remote might be returning a blank string to indicate a missing- // value), for which `||` is the appropriate operator, and doing it- // without using `||` is unnecessarily convoluted.- //- // So the next best thing would be for us to disable this piecemeal,- // and I tried that for a while. But that runs into a different- // problem: currently some of our code gets linted under different- // rules depending on the (pseudo-)package that is importing it.- // This rules being on by default but off in some cases means that- // for the same line of code, it is an error for some but not all- // invocations of eslint. And so eslint then starts complaining- // about us trying to squelch a non error.- //- // Given that (a) it is not always the right choice, and (b) it is- // not not usable for our current state, disabling it globally.+ // Shared files are linted by workspaces with different configs, so+ // a local disable can be required in one run and invalid in another.+ // We also use `||` when a blank string should select the default."@typescript-eslint/prefer-nullish-coalescing": "off",},},diff --git a/web/packages/build-config/eslintrc-next-app.mjs b/web/packages/build-config/eslintrc-next-app.mjsindex 5ad5e91554..4d53534299 100644--- a/web/packages/build-config/eslintrc-next-app.mjs+++ b/web/packages/build-config/eslintrc-next-app.mjs@@ -2,7 +2,6 @@import config from "./eslintrc-react.mjs";-// A base config for Next.js apps.export default [...config,{diff --git a/web/packages/build-config/eslintrc-react.mjs b/web/packages/build-config/eslintrc-react.mjsindex e2d58e74a8..b3b4afe014 100644--- a/web/packages/build-config/eslintrc-react.mjs+++ b/web/packages/build-config/eslintrc-react.mjs@@ -18,13 +18,8 @@ export default [files: ["**/*.{jsx,tsx}"],settings: { react: { version: "detect" } },rules: {- // The rule is misguided - only the opener should be omitted, not- // the referrer."react/jsx-no-target-blank": ["warn", { allowReferrer: true }],- // Otherwise we need to do unnecessary boilerplating when using memo."react/display-name": "off",- // Without React in scope, this rule starts causing false positives- // (We don't use prop types in our own code anyways)."react/prop-types": "off",},},@@ -35,34 +30,10 @@ export default ["react-refresh": reactRefreshPlugin,},rules: {- // The current eslint-plugin-react-hooks recommended preset is:- //- // ...hooksPlugin.configs.recommended.rules,- //- // Keep the old effective rule set for now. In v7, recommended also- // enables React Compiler rules, which is a separate policy change.+ // eslint-plugin-react-hooks v7's preset also enables React Compiler+ // rules. Keep the existing policy until that change is reviewed."react-hooks/rules-of-hooks": "error","react-hooks/exhaustive-deps": "warn",- // "react-hooks/static-components": "error",- // "react-hooks/use-memo": "error",- // "react-hooks/preserve-manual-memoization": "error",- // "react-hooks/incompatible-library": "warn",- // "react-hooks/immutability": "error",- // "react-hooks/globals": "error",- // "react-hooks/refs": "error",- // "react-hooks/set-state-in-effect": "error",- // "react-hooks/error-boundaries": "error",- // "react-hooks/purity": "error",- // "react-hooks/set-state-in-render": "error",- // "react-hooks/unsupported-syntax": "warn",- // "react-hooks/config": "error",- // "react-hooks/gating": "error",- //- // Apparently Fast refresh only works if a file only exports- // components, and this rule warns if we break that that.- //- // Constants are okay though practically (otherwise we'll need to- // create unnecessary helper files)."react-refresh/only-export-components": ["warn",{ allowConstantExport: true, extraHOCs: ["styled"] },diff --git a/web/packages/build-config/eslintrc-vite-app.mjs b/web/packages/build-config/eslintrc-vite-app.mjsindex d3ceea7b50..3bd2e47a41 100644--- a/web/packages/build-config/eslintrc-vite-app.mjs+++ b/web/packages/build-config/eslintrc-vite-app.mjs@@ -2,5 +2,4 @@import config from "./eslintrc-react.mjs";-// A base config for Vite apps.export default [...config, { ignores: ["dist", ".env*"] }];diff --git a/web/packages/build-config/tsconfig-next.json b/web/packages/build-config/tsconfig-next.jsonindex 3e6d09a10f..df1fe669cf 100644--- a/web/packages/build-config/tsconfig-next.json+++ b/web/packages/build-config/tsconfig-next.json@@ -1,5 +1,4 @@{- /* A base TSConfig for typechecking our Next.js apps and packages. */"extends": "ente-build-config/tsconfig-typecheck.json","compilerOptions": {/* Next.js forcefully insists on adding these, which prevents us from@@ -9,6 +8,5 @@/* MUI doesn't work with exactOptionalPropertyTypes yet. */"exactOptionalPropertyTypes": false},- /* Next.js insists on adding this, even though we don't need it. */"exclude": ["node_modules"]}diff --git a/web/packages/build-config/tsconfig-typecheck.json b/web/packages/build-config/tsconfig-typecheck.jsonindex 98af7e3ff0..042632bcc9 100644--- a/web/packages/build-config/tsconfig-typecheck.json+++ b/web/packages/build-config/tsconfig-typecheck.json@@ -1,87 +1,22 @@{- /* TSConfig for a TypeScript project that'll get transpiled by Next.js */- /* TSConfig docs: https://aka.ms/tsconfig.json */"compilerOptions": {- /* We use TypeScript (tsc) as a type checker, not as a build tool */"noEmit": true,-- /*- * Tell TypeScript which all things it can assume that our target- * runtime will have.- *- * In our case, we tell it that the code will run in a modern browser,- * and will have access to a latest JS ("ESNext") and the DOM ("DOM")- * and web workers ("WebWorker").- *- * Unlike the other individual library components (say how "esnext"- * implies "ESNext.*"), "DOM.Iterable" (the ability to iterate over DOM- * elements) is not a subset of "DOM" and needs to be listed out- * explicitly.- */"lib": ["ESnext", "DOM", "DOM.Iterable", "WebWorker"],-- /**- * We don't potentially need to specify the `target` compilerOption,- * since tsc isn't actually generating (emitting) the JavaScript.- * However, without a target TypeScript becomes very conservative, and- * complains about things like- *- * > Type 'Float32Array' can only be iterated through when using the- * > '--downlevelIteration' flag or with a '--target' of 'es2015' or- * > higher.- *- > > BigInt literals are not available when targeting lower than ES2020- */"target": "ES2020",-- /*- * The module system to assume the generated JavaScript will use.- *- * Since we're using a bundler, we should set this to "esnext"- * https://www.typescriptlang.org/docs/handbook/modules/guides/choosing-compiler-options.html- */"module": "ESNext",-- /*- * Tell TypeScript how to lookup the file for a given import- *- * From the TypeScript docs:- *- * > 'bundler' is for use with bundlers. Like node16 and nodenext, this- * mode supports package.json `imports` and `exports`, but unlinke the- * Node.js resolution modes, bundler never requires file extensions on- * relative paths in imports.- *- * > bundler does not support resolution of `require` calls.- */"moduleResolution": "bundler",-- /* Allow use of `.tsx` files, but don't transform them */"jsx": "preserve",-- /* Ask TypeScript to warn us if we use TypeScript features that cannot- be used by single-file transpilers */"isolatedModules": true,- /* Enable various workarounds to play better with CJS libraries */"esModuleInterop": true,-- /* Speed things up by not type checking `node_modules` */"skipLibCheck": true,- /* Require the `type` modifier when importing types */"verbatimModuleSyntax": true,- /* Enable importing .json files */"resolveJsonModule": true,-"strict": true,- /* Stricter than strict */"noImplicitReturns": true,"noUnusedParameters": true,"noUnusedLocals": true,"noFallthroughCasesInSwitch": true,- /* e.g. makes array indexing returns undefined. */"noUncheckedIndexedAccess": true,- /* Treat optional (?) properties and properties where undefined is a- valid value separately */"exactOptionalPropertyTypes": true}}diff --git a/web/packages/build-config/tsconfig-vite.json b/web/packages/build-config/tsconfig-vite.jsonindex c2dae2d1c0..47607b9563 100644--- a/web/packages/build-config/tsconfig-vite.json+++ b/web/packages/build-config/tsconfig-vite.json@@ -1,45 +1,22 @@{- /* TSConfig file used for typechecking the files in src/.- *- * The base configuration was generated using `npm create vite`. This was- * already almost the same as the `tsconfig-typecheck.json` we use- * elsewhere, with one or two differences.- *- * For more details about the flags vite cares about, see- * https://vitejs.dev/guide/features.html#typescript-compiler-options- */"compilerOptions": {"target": "ES2020","useDefineForClassFields": true,"lib": ["ES2020", "DOM", "DOM.Iterable"],"module": "esnext","skipLibCheck": true,-- /* Bundler mode. */"moduleResolution": "bundler","allowImportingTsExtensions": true,"resolveJsonModule": true,"isolatedModules": true,"noEmit": true,"jsx": "react-jsx",-- /* Linting. */"strict": true,"noUnusedLocals": true,"noUnusedParameters": true,"noFallthroughCasesInSwitch": true,-- /*- * On top of the generated configuration, we've mostly added additional- * strictness checks.- */-- /* Require the `type` modifier when importing types. */"verbatimModuleSyntax": true,-- /* Stricter than strict. */"noImplicitReturns": true,- /* e.g. makes array indexing returns undefined. */"noUncheckedIndexedAccess": true,"exactOptionalPropertyTypes": true},diff --git a/web/packages/build-config/tsconfig-vite.node.json b/web/packages/build-config/tsconfig-vite.node.jsonindex 3dbf1c3868..6675f46d30 100644--- a/web/packages/build-config/tsconfig-vite.node.json+++ b/web/packages/build-config/tsconfig-vite.node.json@@ -1,8 +1,4 @@{- /* TSConfig file used for typechecking vite's config file itself.- *- * These are vite defaults, generated using `npm create vite`.- */"compilerOptions": {"composite": true,"skipLibCheck": true,diff --git a/web/packages/build-config/tsconfig.json b/web/packages/build-config/tsconfig.jsonindex 3828ee1917..8b5cbced1c 100644--- a/web/packages/build-config/tsconfig.json+++ b/web/packages/build-config/tsconfig.json@@ -1,5 +1,4 @@{- /* A minimal tsconfig so that we can run tsc on the build-config itself. */"compilerOptions": {"target": "ES2023","module": "ESNext",diff --git a/web/packages/gallery/README.md b/web/packages/gallery/README.mddeleted file mode 100644index 06b1ad7bdc..0000000000--- a/web/packages/gallery/README.md+++ /dev/null@@ -1,9 +0,0 @@-## ente-gallery--A package for sharing code between our apps that show media (photos, videos) in a gallery like view.--Specifically, this is the intersection of code required by both the photos and public albums apps.--### Packaging--This (internal) package exports a React TypeScript library. We rely on the importing project to transpile and bundle it.diff --git a/web/packages/media/README.md b/web/packages/media/README.mddeleted file mode 100644index 9491734bc0..0000000000--- a/web/packages/media/README.md+++ /dev/null@@ -1,9 +0,0 @@-## ente-media--A package for sharing code between our apps that show media (photos, videos).--Specifically, this is the intersection of code required by both the photos app (or the public albums app) and cast apps.--### Packaging--This (internal) package exports a React TypeScript library. We rely on the importing project to transpile and bundle it.diff --git a/web/packages/new/README.md b/web/packages/new/README.mdindex ebf4373d01..7af168ff94 100644--- a/web/packages/new/README.md+++ b/web/packages/new/README.md@@ -1,7 +1,3 @@## ente-newThis package is only transient. Once the remaining files in apps/photos have been revisited for clarity, and the albums app has been split into a separate folder, this package will not exist.--### Packaging--This (internal) package exports a vanilla TypeScript library. We rely on the importing project to transpile and bundle it.diff --git a/web/packages/new/photos/services/reaction.ts b/web/packages/new/photos/services/reaction.tsindex 1287b17b66..e9981f9673 100644--- a/web/packages/new/photos/services/reaction.ts+++ b/web/packages/new/photos/services/reaction.ts@@ -3,7 +3,8 @@ import { authenticatedRequestHeaders, ensureOk } from "ente-base/http";import { apiURL } from "ente-base/origins";import { z } from "zod";-// Hide reaction length in ciphertext; emoji names are currently at most ~70 characters.+// Pad every reaction before encryption so its ciphertext does not reveal its+// length. Emoji names are currently at most about 70 characters.const paddedReactionLength = 100;const padReaction = (reactionType: string): string =>diff --git a/web/packages/new/photos/services/user-entity/db.ts b/web/packages/new/photos/services/user-entity/db.tsindex ad3d957d74..64cc649827 100644--- a/web/packages/new/photos/services/user-entity/db.ts+++ b/web/packages/new/photos/services/user-entity/db.ts@@ -43,6 +43,6 @@ export const savedRemoteUserEntityKey = (export const saveLatestUpdatedAt = (type: EntityType, value: number) =>setKV(latestUpdatedAtKey(type), value);-// Diff checkpoint; resume pulls from this timestamp.+// This is the last fetched diff timestamp. The next pull resumes from it.export const savedLatestUpdatedAt = (type: EntityType) =>getKVN(latestUpdatedAtKey(type));diff --git a/web/packages/utils/README.md b/web/packages/utils/README.mddeleted file mode 100644index 67b5fd5a4f..0000000000--- a/web/packages/utils/README.md+++ /dev/null@@ -1,9 +0,0 @@-## ente-utils--Utility functions, types and assortments.--> "Life is like a box of chocolates" - _Forrest Gump_--### Packaging--This (internal) package exports a vanilla TypeScript library. We rely on the importing project to transpile and bundle it.