Compare commits

..

1 Commits

Author SHA1 Message Date
RiotRobot
cbac8742bc v1.12.10-rc.0 2026-02-03 13:32:38 +00:00
31 changed files with 7610 additions and 9634 deletions

2
.github/CODEOWNERS vendored
View File

@@ -1,5 +1,5 @@
* @element-hq/element-web-reviewers
/.github/workflows/** @element-hq/element-web-team
/package.json @element-hq/element-web-team
/pnpm-lock.yaml @element-hq/element-web-team
/yarn.lock @element-hq/element-web-team
/src/i18n/strings

View File

@@ -55,14 +55,13 @@ jobs:
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
cache: "pnpm"
cache: "yarn"
node-version: "lts/*"
- name: Install dependencies
run: pnpm install --frozen-lockfile
run: yarn install --frozen-lockfile
- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
@@ -72,7 +71,7 @@ jobs:
merge-multiple: true
- name: Merge into HTML Report
run: pnpm playwright merge-reports -c ./playwright.config.ts --reporter=html ./all-blob-reports
run: yarn playwright merge-reports -c ./playwright.config.ts --reporter=html ./all-blob-reports
- name: Upload HTML report
if: always()

View File

@@ -116,23 +116,22 @@ jobs:
- name: Cache .hak
id: cache
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5
with:
key: ${{ runner.os }}-${{ github.ref_name }}-${{ inputs.sqlcipher }}-${{ inputs.arch }}-${{ hashFiles('hakHash', 'electronVersion', 'dockerbuild/*') }}
path: |
./.hak
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version-file: .node-version
cache: "pnpm"
cache: "yarn"
env:
# Workaround for https://github.com/actions/setup-node/issues/317
FORCE_COLOR: 0
- name: Install Deps
run: pnpm install --frozen-lockfile
run: "yarn install --frozen-lockfile"
- name: "Get modified files"
id: changed_files
@@ -158,18 +157,11 @@ jobs:
docker run \
-v ${{ github.workspace }}:/work -w /work \
-e SQLCIPHER_BUNDLED \
-e CI=1 \
$HAK_DOCKER_IMAGE \
pnpm build:native
yarn build:native
- name: Fix permissions
run: |
# For .hak
sudo chown -R $USER:$USER .hak
# DEBUG
ls -lah node_modules/7zip-bin/linux/*/7za
# For node_modules pnpm strict security
sudo chmod +x node_modules/7zip-bin/linux/*/7za
- name: Fix permissions on .hak
run: sudo chown -R $USER:$USER .hak
- name: Check native libraries in hak dependencies
run: |
@@ -186,7 +178,7 @@ jobs:
fi
- name: Build App
run: pnpm build --publish never ${{ steps.config.outputs.build-args }} -l ${{ inputs.targets }}
run: yarn build --publish never ${{ steps.config.outputs.build-args }} -l ${{ inputs.targets }}
env:
VARIANT_PATH: variant.json
# Only set for Nightly builds

View File

@@ -90,7 +90,7 @@ jobs:
- name: Cache .hak
id: cache
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5
with:
key: ${{ runner.os }}-${{ hashFiles('hakHash', 'electronVersion') }}
path: |
@@ -105,7 +105,7 @@ jobs:
rustup target add x86_64-apple-darwin
# M1 macos-14 comes without Python preinstalled
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6
with:
python-version: "3.13"
@@ -113,24 +113,23 @@ jobs:
# https://github.com/electron-userland/electron-builder/issues/9511#issuecomment-3774092888
- run: sudo pip3 install pyobjc-framework-Quartz
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version-file: .node-version
cache: "pnpm"
cache: "yarn"
- name: Install Deps
run: "pnpm install --frozen-lockfile"
run: "yarn install --frozen-lockfile"
- name: Build Natives
if: steps.cache.outputs.cache-hit != 'true'
run: pnpm build:native:universal
run: yarn build:native:universal
# We split these because electron-builder gets upset if we set CSC_LINK even to an empty string
- name: "[Signed] Build App"
if: inputs.sign != ''
run: |
pnpm build:universal --publish never -m ${{ inputs.targets }}
yarn build:universal --publish never -m ${{ inputs.targets }}
env:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_ID: ${{ secrets.APPLE_ID }}
@@ -152,7 +151,7 @@ jobs:
- name: "[Unsigned] Build App"
if: inputs.sign == ''
run: |
pnpm build:universal --publish never -m ${{ inputs.targets }}
yarn build:universal --publish never -m ${{ inputs.targets }}
env:
CSC_IDENTITY_AUTO_DISCOVERY: false
VARIANT_PATH: variant.json

View File

@@ -56,14 +56,13 @@ jobs:
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version-file: .node-version
cache: "pnpm"
cache: "yarn"
- name: Install Deps
run: "pnpm install --frozen-lockfile"
run: "yarn install --frozen-lockfile"
- name: Fetch Element Web (matching branch)
id: branch-matching
@@ -72,10 +71,10 @@ jobs:
run: |
scripts/branch-match.sh
cp "$CONFIG_DIR/config.json" element-web/
pnpm --cwd element-web install --frozen-lockfile
pnpm --cwd element-web run build
yarn --cwd element-web install --frozen-lockfile
yarn --cwd element-web run build
mv element-web/webapp .
pnpm asar-webapp
yarn asar-webapp
env:
# These must be set for branch-match.sh to get the right branch
REPOSITORY: ${{ github.repository }}
@@ -84,7 +83,7 @@ jobs:
- name: Fetch Element Web (${{ inputs.version }})
if: steps.branch-matching.outcome == 'failure' || steps.branch-matching.outcome == 'skipped'
run: pnpm run fetch --noverify -d ${{ inputs.config }} ${{ inputs.version }}
run: yarn run fetch --noverify -d ${{ inputs.config }} ${{ inputs.version }}
- name: Copy variant config
run: cp "$CONFIG_DIR/build.json" variant.json
@@ -94,9 +93,8 @@ jobs:
# We split this out to save the build_* scripts having to do it to make use of `hashFiles` in the cache action
- name: Generate cache hash files
run: |
set -ex
# Add --no-sandbox as otherwise it fails because the helper isn't setuid root. It's only getting the version.
pnpm --silent electron --no-sandbox --version > electronVersion
yarn run --silent electron --no-sandbox --version > electronVersion
cat package.json | jq -c .hakDependencies | sha1sum > hakHash
find hak -type f -print0 | xargs -0 sha1sum >> hakHash
find scripts/hak -type f -print0 | xargs -0 sha1sum >> hakHash

View File

@@ -40,14 +40,13 @@ jobs:
with:
repository: ${{ github.repository == 'element-hq/element-web-pro' && 'element-hq/element-desktop' || github.repository }}
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version-file: .node-version
cache: "pnpm"
cache: "yarn"
- name: Install Deps
run: "pnpm install --frozen-lockfile"
run: "yarn install --frozen-lockfile"
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
with:
@@ -81,7 +80,7 @@ jobs:
uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a
timeout-minutes: 20
with:
run: pnpm test --project=${{ inputs.project }} ${{ runner.os != 'Linux' && '--ignore-snapshots' || '' }} ${{ inputs.blob_report == false && '--reporter=html' || '' }} ${{ inputs.args }}
run: yarn test --project=${{ inputs.project }} ${{ runner.os != 'Linux' && '--ignore-snapshots' || '' }} ${{ inputs.blob_report == false && '--reporter=html' || '' }} ${{ inputs.args }}
env:
ELEMENT_DESKTOP_EXECUTABLE: ${{ steps.executable.outputs.path }}

View File

@@ -119,7 +119,7 @@ jobs:
- name: Cache .hak
id: cache
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5
with:
key: ${{ runner.os }}-${{ inputs.arch }}-${{ hashFiles('hakHash', 'electronVersion') }}
path: |
@@ -148,28 +148,27 @@ jobs:
rustup default stable
rustup target add ${{ steps.config.outputs.target }}
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version-file: .node-version
cache: "pnpm"
cache: "yarn"
- name: Install Deps
run: "pnpm install --frozen-lockfile"
run: "yarn install --frozen-lockfile"
- name: Insert config snippet
if: steps.config.outputs.extra_config != ''
shell: bash
run: |
mkdir config-edit
pnpm asar extract webapp.asar config-edit
yarn asar extract webapp.asar config-edit
cd config-edit
mv config.json old-config.json
echo '${{ steps.config.outputs.extra_config }}' | jq -s '.[0] * .[1]' old-config.json - > config.json
rm old-config.json
cd ..
rm webapp.asar
pnpm asar pack config-edit/ webapp.asar
yarn asar pack config-edit/ webapp.asar
- name: Set up sqlcipher macros
if: steps.cache.outputs.cache-hit != 'true' && contains(inputs.arch, 'arm')
@@ -187,7 +186,7 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: |
refreshenv
pnpm build:native --target ${{ steps.config.outputs.target }}
yarn build:native --target ${{ steps.config.outputs.target }}
- name: Install and configure eSigner CKA
run: |
@@ -233,7 +232,7 @@ jobs:
MASTER_KEY_FILE: C:\Users\runneradmin\eSignerCKA\master.key
- name: Build App
run: pnpm build --publish never ${{ steps.config.outputs.build-args }} -w ${{ inputs.targets }}
run: yarn build --publish never ${{ steps.config.outputs.build-args }} -w ${{ inputs.targets }}
env:
VARIANT_PATH: variant.json
# Only set for Nightly builds

View File

@@ -39,10 +39,10 @@ jobs:
platforms: linux/amd64
- name: Test image
run: docker run -v $PWD:/project element-desktop-dockerbuild pnpm install
run: docker run -v $PWD:/project element-desktop-dockerbuild yarn install
- name: Log in to the Container registry
uses: docker/login-action@3227f5311cb93ffd14d13e65d8cc400d30f4dd8a
uses: docker/login-action@0567fa5ae8c9a197cb207537dc5cbb43ca3d803f
if: github.event_name != 'pull_request'
with:
registry: ${{ env.REGISTRY }}

View File

@@ -11,27 +11,25 @@ jobs:
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version-file: package.json
cache: "pnpm"
cache: "yarn"
# Does not need branch matching as only analyses this layer
- name: Install Deps
run: "pnpm install --frozen-lockfile"
run: "yarn install --frozen-lockfile"
- name: Typecheck
run: "pnpm run lint:types"
run: "yarn run lint:types"
i18n_lint:
name: "i18n Check"
uses: matrix-org/matrix-web-i18n/.github/workflows/i18n_check.yml@3673fd3abbf8dfae1de849c6cd3e69e24ed7a766
uses: matrix-org/matrix-web-i18n/.github/workflows/i18n_check.yml@main
permissions:
pull-requests: read
with:
hardcoded-words: "Element"
packageManager: pnpm
js_lint:
name: "ESLint"
@@ -39,18 +37,17 @@ jobs:
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version-file: package.json
cache: "pnpm"
cache: "yarn"
# Does not need branch matching as only analyses this layer
- name: Install Deps
run: "pnpm install --frozen-lockfile"
run: "yarn install --frozen-lockfile"
- name: Run Linter
run: "pnpm run lint:js"
run: "yarn run lint:js"
workflow_lint:
name: "Workflow Lint"
@@ -58,18 +55,17 @@ jobs:
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version-file: package.json
cache: "pnpm"
cache: "yarn"
# Does not need branch matching as only analyses this layer
- name: Install Deps
run: "pnpm install --frozen-lockfile"
run: "yarn install --frozen-lockfile"
- name: Run Linter
run: "pnpm lint:workflows"
run: "yarn lint:workflows"
analyse_dead_code:
name: "Analyse Dead Code"
@@ -77,14 +73,13 @@ jobs:
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version-file: package.json
cache: "pnpm"
cache: "yarn"
- name: Install Deps
run: "pnpm install --frozen-lockfile"
run: "yarn install --frozen-lockfile"
- name: Run linter
run: "pnpm run lint:knip"
run: "yarn run lint:knip"

View File

@@ -7,7 +7,7 @@
/src/i18n/strings
/CHANGELOG.md
/package-lock.json
/pnpm-lock.yaml
/yarn.lock
/playwright/html-report
/playwright/test-results

View File

@@ -14,7 +14,7 @@ Element Desktop is a Matrix client for desktop platforms with Element Web at its
Before you do anything else, fetch the dependencies:
```
pnpm install
yarn install
```
# Fetching Element
@@ -26,7 +26,7 @@ so the first step is to get a working copy of Element Web. There are a few ways
# Fetch the prebuilt release Element package from the element-web GitHub releases page. The version
# fetched will be the same as the local element-desktop package.
# We're explicitly asking for no config, so the packaged Element will have no config.json.
pnpm run fetch --noverify --cfgdir ""
yarn run fetch --noverify --cfgdir ""
```
...or if you'd like to use GPG to verify the downloaded package:
@@ -35,9 +35,9 @@ pnpm run fetch --noverify --cfgdir ""
# Fetch the Element public key from the element.io web server over a secure connection and import
# it into your local GPG keychain (you'll need GPG installed). You only need to to do this
# once.
pnpm run fetch --importkey
yarn run fetch --importkey
# Fetch the package and verify the signature
pnpm run fetch --cfgdir ""
yarn run fetch --cfgdir ""
```
...or either of the above, but fetching a specific version of Element:
@@ -45,7 +45,7 @@ pnpm run fetch --cfgdir ""
```
# Fetch the prebuilt release Element package from the element-web GitHub releases page. The version
# fetched will be the same as the local element-desktop package.
pnpm run fetch --noverify --cfgdir "" v1.5.6
yarn run fetch --noverify --cfgdir "" v1.5.6
```
If you only want to run the app locally and don't need to build packages, you can
@@ -53,7 +53,7 @@ provide the `webapp` directory directly:
```
# Assuming you've checked out and built a copy of element-web in ../element-web.
# Note that you will not be able to `pnpm build` after this, but `pnpm start`
# Note that you will not be able to `yarn build` after this, but `yarn start`
# will work fine.
ln -s ../element-web/webapp ./
```
@@ -72,7 +72,7 @@ which include support for searching in encrypted rooms and secure storage. Skipp
Then, run
```
pnpm run build
yarn run build
```
This will do a couple of things:
@@ -88,12 +88,12 @@ Alternatively, you can also build using docker, which will always produce the li
```
# Run this once to make the docker image
pnpm run docker:setup
yarn run docker:setup
pnpm run docker:install
yarn run docker:install
# if you want to build the native modules (this will take a while)
pnpm run docker:build:native
pnpm run docker:build
yarn run docker:build:native
yarn run docker:build
```
After running, the packages should be in `dist/`.
@@ -103,19 +103,19 @@ After running, the packages should be in `dist/`.
If you'd just like to run the electron app locally for development:
```
pnpm start
yarn start
```
# Config
If you'd like the packaged Element to have a configuration file, you can create a
config directory and place `config.json` in there, then specify this directory
with the `--cfgdir` option to `pnpm run fetch`, eg:
with the `--cfgdir` option to `yarn run fetch`, eg:
```
mkdir myconfig
cp /path/to/my/config.json myconfig/
pnpm run fetch --cfgdir myconfig
yarn run fetch --cfgdir myconfig
```
The config dir for the official Element app is in `element.io`. If you use this,

View File

@@ -1,9 +1,10 @@
# Docker image to facilitate building Element Desktop's native bits using a glibc version (2.31)
# with broader compatibility, down to Debian bullseye & Ubuntu focal.
FROM rust:bullseye@sha256:3ebcc2d6d71fb93a2967e35723902c51dd87dbb36f66f795a58d7921553fbcd4
FROM rust:bullseye@sha256:c6d501c039204c21e9fa374f234bd41bdc8b36cfd455a407ef145d9bef19f2b7
ENV DEBIAN_FRONTEND=noninteractive
RUN curl --proto "=https" -L https://yarnpkg.com/latest.tar.gz | tar xvz && mv yarn-* /yarn && ln -s /yarn/bin/yarn /usr/bin/yarn
RUN apt-get -qq update && apt-get -y -qq dist-upgrade && \
apt-get -y -qq install --no-install-recommends \
# tclsh is required for building SQLite as part of SQLCipher

View File

@@ -9,4 +9,3 @@ ARCH="${archMap["$TARGETARCH"]}"
NODE_VERSION=$(cat /.node-version | sed -e 's/^v//')
curl --proto "=https" -L "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-$TARGETOS-$ARCH.tar.gz" | tar xz -C /usr/local --strip-components=1 && \
unlink /usr/local/CHANGELOG.md && unlink /usr/local/LICENSE && unlink /usr/local/README.md
corepack enable

View File

@@ -13,9 +13,10 @@ you will need debug symbols.
2. Figure out which version of Electron your Element-Desktop is based on. The
best way to do this is to figure out the version of Element-Desktop, then
look at
[`package.json`](https://github.com/element-hq/element-desktop/blob/develop/package.json)
for the corresponding version. There will be an entry within `dependencies` of
`electron`: the value will tell you the version of Electron that was used for that version of Element-Desktop.
[`yarn.lock`](https://github.com/element-hq/element-desktop/blob/develop/yarn.lock)
for the corresponding version. There should be an entry starting
`electron@`, and under it a `version` line: this will tell you the version
of Electron that was used for that version of Element-Desktop.
3. Go to [Electron's releases page](https://github.com/electron/electron/releases/)
and find the version you just identified. Under "Assets", download

View File

@@ -18,20 +18,21 @@ when releasing.
If you are building for Linux, you can build the native modules with:
```
pnpm docker:setup
pnpm docker:install
INDOCKER_SQLCIPHER_BUNDLED=1 pnpm docker:build:native
yarn docker:setup
yarn docker:install
INDOCKER_SQLCIPHER_BUNDLED=1 yarn docker:build:native
```
The above will build `matrix-seshat` in
`docker/node_modules/matrix-seshat`. You can then either run `pnpm docker:build`
`docker/node_modules/matrix-seshat`. You can then either run `yarn docker:build`
to build the app inside docker, or:
```
pnpm link docker/node_modules/matrix-seshat
yarn --cwd docker/node_modules/matrix-seshat link
yarn link matrix-seshat
```
... and build the app with `pnpm build` or run it with `pnpm start`.
... and build the app with `yarn build` or run it with `yarn start`.
(See also https://github.com/element-hq/element-desktop#docker.)
@@ -48,7 +49,7 @@ Then optionally, [add seshat and dependencies to support search in E2E rooms](#a
Then, to build for an architecture selected automatically based on your system (recommended), run:
```
pnpm run build:native
yarn run build:native
```
If you need to build for a specific architecture, see [here](#compiling-for-specific-architectures).
@@ -66,20 +67,20 @@ Seshat also depends on the SQLCipher library to store its data in encrypted form
on disk. You'll need to install it via your OS package manager.
After installing the Rust compiler and SQLCipher, Seshat support can be added
using pnpm at the root of this project:
using yarn at the root of this project:
pnpm add matrix-seshat
yarn add matrix-seshat
You will have to rebuild the native libraries against electron's version
of node rather than your system node, using the `electron-build-env` tool.
This is also needed to when pulling in changes to Seshat using `pnpm link`.
This is also needed to when pulling in changes to Seshat using `yarn link`.
pnpm add electron-build-env
yarn add electron-build-env
Recompiling Seshat itself can be done like so:
ELECTRON_VERSION=$(electron --version)
pnpm electron-build-env -- --electron ${ELECTRON_VERSION#v} -- neon build matrix-seshat --release
yarn run electron-build-env -- --electron ${ELECTRON_VERSION#v} -- neon build matrix-seshat --release
Please make sure to include all the `--` as well as the `--release` command line
switch at the end. Modify your electron version accordingly depending on the
@@ -88,7 +89,7 @@ version that is installed on your system.
After this is done the Electron version of Element can be run from the main folder
as usual using:
pnpm start
yarn start
### Statically linking libsqlcipher
@@ -108,26 +109,26 @@ and https://github.com/vector-im/element-web/issues/20926.
On macOS, you can build universal native modules too:
```
pnpm run build:native:universal
yarn run build:native:universal
```
...or you can build for a specific architecture:
```
pnpm run build:native --target x86_64-apple-darwin
yarn run build:native --target x86_64-apple-darwin
```
or
```
pnpm run build:native --target aarch64-apple-darwin
yarn run build:native --target aarch64-apple-darwin
```
You'll then need to create a built bundle with the same architecture.
To bundle a universal build for macOS, run:
```
pnpm run build:universal
yarn run build:universal
```
### Windows
@@ -135,13 +136,13 @@ pnpm run build:universal
If you're on Windows, you can choose to build specifically for 32 or 64 bit:
```
pnpm run build:32
yarn run build:32
```
or
```
pnpm run build:64
yarn run build:64
```
### Cross compiling
@@ -155,19 +156,19 @@ at this time.
The native module build system keeps the different architectures
separate, so you can keep native modules for several architectures at the same
time and switch which are active using a `pnpm run hak copy` command, passing
time and switch which are active using a `yarn run hak copy` command, passing
the appropriate architectures. This will error if you haven't yet built those
architectures. eg:
```
pnpm run build:native --target x86_64-apple-darwin
yarn run build:native --target x86_64-apple-darwin
# We've now built & linked into place native modules for Intel
pnpm run build:native --target aarch64-apple-darwin
yarn run build:native --target aarch64-apple-darwin
# We've now built Apple Silicon modules too, and linked them into place as the active ones
pnpm run hak copy --target x86_64-apple-darwin
yarn run hak copy --target x86_64-apple-darwin
# We've now switched back to our Intel modules
pnpm run hak copy --target x86_64-apple-darwin --target aarch64-apple-darwin
yarn run hak copy --target x86_64-apple-darwin --target aarch64-apple-darwin
# Now our native modules are universal x86_64+aarch64 binaries
```

View File

@@ -16,7 +16,7 @@ If you want to build native modules, make sure that the following tools are inst
You can install the above tools using [Chocolatey](https://chocolatey.org/install):
```cmd
choco install --no-progress -y git nodejs-lts pnpm python StrawberryPerl rustup.install nasm magicsplat-tcl-tk
choco install --no-progress -y git nodejs-lts yarn python StrawberryPerl rustup.install nasm magicsplat-tcl-tk
```
- [Build Tools for Visual Studio 2019](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019) with the following configuration:

View File

@@ -3,7 +3,7 @@
"productName": "Element",
"main": "lib/electron-main.js",
"exports": "./lib/electron-main.js",
"version": "1.12.9",
"version": "1.12.10-rc.0",
"description": "Element: the future of secure communication",
"author": {
"name": "Element",
@@ -21,43 +21,43 @@
"node": ">=18.0.0"
},
"scripts": {
"i18n": "matrix-gen-i18n && pnpm i18n:sort && pnpm i18n:lint",
"i18n": "matrix-gen-i18n && yarn i18n:sort && yarn i18n:lint",
"i18n:sort": "matrix-sort-i18n src/i18n/strings/en_EN.json",
"i18n:lint": "prettier --log-level=silent --write src/i18n/strings/ --ignore-path /dev/null",
"i18n:diff": "cp src/i18n/strings/en_EN.json src/i18n/strings/en_EN_orig.json && pnpm i18n && matrix-compare-i18n-files src/i18n/strings/en_EN_orig.json src/i18n/strings/en_EN.json",
"i18n:diff": "cp src/i18n/strings/en_EN.json src/i18n/strings/en_EN_orig.json && yarn i18n && matrix-compare-i18n-files src/i18n/strings/en_EN_orig.json src/i18n/strings/en_EN.json",
"mkdirs": "mkdirp packages deploys",
"fetch": "pnpm run mkdirs && tsx scripts/fetch-package.ts",
"fetch": "yarn run mkdirs && tsx scripts/fetch-package.ts",
"asar-webapp": "asar p webapp webapp.asar",
"start": "pnpm run build:ts && pnpm run build:res && electron .",
"lint": "pnpm lint:types && pnpm lint:js && pnpm lint:workflows",
"start": "yarn run build:ts && yarn run build:res && electron .",
"lint": "yarn lint:types && yarn lint:js && yarn lint:workflows",
"lint:js": "eslint --max-warnings 0 src hak playwright scripts && prettier --check .",
"lint:js-fix": "eslint --fix --max-warnings 0 src hak playwright scripts && prettier --log-level=warn --write .",
"lint:types": "pnpm lint:types:src && pnpm lint:types:test && pnpm lint:types:scripts && pnpm lint:types:hak",
"lint:types": "yarn lint:types:src && yarn lint:types:test && yarn lint:types:scripts && yarn lint:types:hak",
"lint:types:src": "tsc --noEmit",
"lint:types:test": "tsc --noEmit -p playwright/tsconfig.json",
"lint:types:scripts": "tsc --noEmit -p scripts/tsconfig.json",
"lint:types:hak": "tsc --noEmit -p hak/tsconfig.json",
"lint:workflows": "find .github/workflows -type f \\( -iname '*.yaml' -o -iname '*.yml' \\) | xargs -I {} sh -c 'echo \"Linting {}\"; action-validator \"{}\"'",
"lint:knip": "knip",
"build:native": "pnpm run hak",
"build:native:universal": "pnpm run hak --target x86_64-apple-darwin fetchandbuild && pnpm run hak --target aarch64-apple-darwin fetchandbuild && pnpm run hak --target x86_64-apple-darwin --target aarch64-apple-darwin copyandlink",
"build:32": "pnpm run build:ts && pnpm run build:res && electron-builder --ia32",
"build:64": "pnpm run build:ts && pnpm run build:res && electron-builder --x64",
"build:universal": "pnpm run build:ts && pnpm run build:res && electron-builder --universal",
"build": "pnpm run build:ts && pnpm run build:res && electron-builder",
"build:native": "yarn run hak",
"build:native:universal": "yarn run hak --target x86_64-apple-darwin fetchandbuild && yarn run hak --target aarch64-apple-darwin fetchandbuild && yarn run hak --target x86_64-apple-darwin --target aarch64-apple-darwin copyandlink",
"build:32": "yarn run build:ts && yarn run build:res && electron-builder --ia32",
"build:64": "yarn run build:ts && yarn run build:res && electron-builder --x64",
"build:universal": "yarn run build:ts && yarn run build:res && electron-builder --universal",
"build": "yarn run build:ts && yarn run build:res && electron-builder",
"build:ts": "tsc",
"build:res": "tsx scripts/copy-res.ts",
"docker:setup": "docker build --platform linux/amd64 -t element-desktop-dockerbuild -f dockerbuild/Dockerfile .",
"docker:build:native": "scripts/in-docker.sh pnpm run hak",
"docker:build": "scripts/in-docker.sh pnpm run build",
"docker:install": "scripts/in-docker.sh pnpm install",
"docker:build:native": "scripts/in-docker.sh yarn run hak",
"docker:build": "scripts/in-docker.sh yarn run build",
"docker:install": "scripts/in-docker.sh yarn install",
"clean": "rimraf webapp.asar dist packages deploys lib",
"hak": "tsx scripts/hak/index.ts",
"test": "playwright test",
"test:open": "pnpm test --ui",
"test:open": "yarn test --ui",
"test:screenshots:build": "docker build playwright -t element-desktop-playwright --platform linux/amd64",
"test:screenshots:run": "docker run --rm --network host -v $(pwd):/work/element-desktop -v element-desktop-playwright:/work/element-desktop/node_modules -v /var/run/docker.sock:/var/run/docker.sock --platform linux/amd64 -it element-desktop-playwright",
"postinstall": "electron-builder install-app-deps"
"postinstall": "patch-package && electron-builder install-app-deps"
},
"dependencies": {
"@sentry/electron": "^7.0.0",
@@ -76,7 +76,7 @@
"@babel/preset-env": "^7.18.10",
"@babel/preset-typescript": "^7.18.6",
"@electron/asar": "4.0.1",
"@playwright/test": "1.58.1",
"@playwright/test": "1.57.0",
"@stylistic/eslint-plugin": "^5.0.0",
"@types/auto-launch": "^5.0.1",
"@types/counterpart": "^0.18.1",
@@ -88,11 +88,10 @@
"app-builder-lib": "26.6.0",
"chokidar": "^5.0.0",
"detect-libc": "^2.0.0",
"electron": "40.1.0",
"electron": "40.0.0",
"electron-builder": "26.6.0",
"electron-builder-squirrel-windows": "26.6.0",
"electron-devtools-installer": "^4.0.0",
"electron-playwright-helpers": "^2.1.0",
"eslint": "^8.26.0",
"eslint-config-google": "^0.14.0",
"eslint-config-prettier": "^10.0.0",
@@ -104,9 +103,11 @@
"husky": "^9.1.6",
"knip": "^5.0.0",
"lint-staged": "^16.0.0",
"matrix-web-i18n": "3.6.0",
"matrix-web-i18n": "3.5.2",
"mkdirp": "^3.0.0",
"pacote": "^21.0.0",
"patch-package": "^8.0.1",
"postinstall-postinstall": "^2.1.0",
"prettier": "^3.0.0",
"rimraf": "^6.0.0",
"tar": "^7.0.0",
@@ -122,22 +123,5 @@
"config-file-ts": "0.2.8-rc1",
"node-abi": "4.26.0",
"@types/pg-pool": "2.0.7"
},
"pnpm": {
"onlyBuiltDependencies": [
"electron"
],
"patchedDependencies": {
"@types/auto-launch": "patches/@types__auto-launch.patch"
},
"peerDependencyRules": {
"allowedVersions": {
"eslint": "8"
}
},
"allowedDeprecatedVersions": {
"eslint": "8"
}
},
"packageManager": "pnpm@10.28.2+sha512.41872f037ad22f7348e3b1debbaf7e867cfd448f2726d9cf74c08f19507c31d2c8e7a11525b983febc2df640b5438dee6023ebb1f84ed43cc2d654d2bc326264"
}
}

View File

@@ -1,7 +1,7 @@
diff --git a/index.d.ts b/index.d.ts
diff --git a/node_modules/@types/auto-launch/index.d.ts b/node_modules/@types/auto-launch/index.d.ts
index a30a77c..e512ce1 100644
--- a/index.d.ts
+++ b/index.d.ts
--- a/node_modules/@types/auto-launch/index.d.ts
+++ b/node_modules/@types/auto-launch/index.d.ts
@@ -25,6 +25,13 @@ interface AutoLaunchOptions {
declare class AutoLaunch {
constructor(options: AutoLaunchOptions);

View File

@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/playwright:v1.58.1-jammy@sha256:1b52a0833ae13c3bb16f728eec5f9216db29f3cd5eec21a9cbd33e7623723c0e
FROM mcr.microsoft.com/playwright:v1.57.0-jammy@sha256:6aca677c27a967caf7673d108ac67ffaf8fed134f27e17b27a05464ca0ace831
WORKDIR /work/element-desktop

View File

@@ -8,8 +8,8 @@ sleep 2
export DISPLAY=:99
pnpm install --frozen-lockfile
pnpm build -l --dir
yarn install --frozen-lockfile
yarn build -l --dir
PLAYWRIGHT_HTML_OPEN=never ELEMENT_DESKTOP_EXECUTABLE="./dist/linux-unpacked/element-desktop" \
npx playwright test --update-snapshots --reporter line,html "$1"

View File

@@ -12,7 +12,6 @@ import path, { dirname } from "node:path";
import os from "node:os";
import { fileURLToPath } from "node:url";
import { PassThrough } from "node:stream";
import { stubDialog } from "electron-playwright-helpers";
/**
* A PassThrough stream that captures all data written to it.
@@ -112,8 +111,6 @@ export const test = base.extend<Fixtures>({
page: async ({ app }, use) => {
const window = await app.firstWindow();
await use(window);
// EW may be configured to ask for confirmation before the app exits.
await stubDialog(app, "showMessageBoxSync", 1);
await app.close().catch((e) => {
console.error(e);
});

9416
pnpm-lock.yaml generated
View File

File diff suppressed because it is too large Load Diff

View File

@@ -1 +0,0 @@
nodeLinker: hoisted

View File

@@ -18,7 +18,7 @@ but should work equally well for building modules for normal node.
# Running
Hak is invoked with a command and a dependency, eg. `pnpm run hak fetch matrix-seshat`.
Hak is invoked with a command and a dependency, eg. `yarn run hak fetch matrix-seshat`.
If no dependencies are given, hak runs the command on all dependencies.
# Files
@@ -37,15 +37,15 @@ There are a lot of files involved:
Hak works around native node modules that try to fetch or build their native component in
the npm 'install' phase - modules that do this will typically end up with native components
targeted to the build platform and the node that npm/pnpm is using, which is no good for an
targeted to the build platform and the node that npm/yarn is using, which is no good for an
electron app.
It does this by installing it with `--ignore-scripts` and then using `pnpm link` to keep the
dependency module separate so pnpm doesn't try to run its install / postinstall script
at other points (eg. whenever you `pnpm add` a random other dependency).
It does this by installing it with `--ignore-scripts` and then using `yarn link` to keep the
dependency module separate so yarn doesn't try to run its install / postinstall script
at other points (eg. whenever you `yarn add` a random other dependency).
This also means that the dependencies cannot be listed in `dependencies` or
`devDependencies` in the project, since this would cause pnpm to install them and
`devDependencies` in the project, since this would cause npm / yarn to install them and
try to fetch their native parts. Instead, they are listed in `hakDependencies` which
hak reads to install them for you.
@@ -53,6 +53,9 @@ Hak will _not_ install dependencies for the copy of the module it links into you
project, so if your native module has javascript dependencies that are actually needed at
runtime (and not just to fetch / build the native parts), it won't work.
Hak will generate a `.yarnrc` in the project directory to set the link directory to its
own in the .hak directory (unless one already exists, in which case this is your problem).
# Lifecycle
Hak is divided into lifecycle stages, in order:

View File

@@ -8,7 +8,6 @@ Please see LICENSE files in the repository root for full details.
import fsProm from "node:fs/promises";
import pacote from "pacote";
import path from "node:path";
import type HakEnv from "./hakEnv.js";
import type { DependencyInfo } from "./dep.js";
@@ -31,13 +30,6 @@ export default async function fetch(hakEnv: HakEnv, moduleInfo: DependencyInfo):
packumentCache,
});
// Workaround for us switching to pnpm but matrix-seshat still using yarn classic
const packageJsonPath = path.join(moduleInfo.moduleBuildDir, "package.json");
const packageJson = await fsProm.readFile(packageJsonPath, "utf-8");
const packageJsonData = JSON.parse(packageJson);
packageJsonData["packageManager"] = "yarn@1.22.22";
await fsProm.writeFile(packageJsonPath, JSON.stringify(packageJsonData, null, 2), "utf-8");
console.log("Running yarn install in " + moduleInfo.moduleBuildDir);
await hakEnv.spawn("yarn", ["install", "--ignore-scripts"], {
cwd: moduleInfo.moduleBuildDir,

View File

@@ -6,11 +6,18 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
Please see LICENSE files in the repository root for full details.
*/
import path from "node:path";
import type HakEnv from "./hakEnv.js";
import { type DependencyInfo } from "./dep.js";
export default async function link(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
await hakEnv.spawn("pnpm", ["link", moduleInfo.moduleOutDir], {
const linkFolder = path.join(hakEnv.dotHakDir, "links");
await hakEnv.spawn("yarn", ["link", "--link-folder", linkFolder], {
cwd: moduleInfo.moduleOutDir,
});
await hakEnv.spawn("yarn", ["link", "--link-folder", linkFolder, moduleInfo.name], {
cwd: hakEnv.projectRoot,
});
}

View File

@@ -8,7 +8,7 @@ IMAGE=${DOCKER_IMAGE_NAME:-"element-desktop-dockerbuild"}
docker inspect "$IMAGE" 2> /dev/null > /dev/null
if [ $? != 0 ]; then
echo "Docker image $IMAGE not found. Have you run pnpm run docker:setup?"
echo "Docker image $IMAGE not found. Have you run yarn run docker:setup?"
exit 1
fi

View File

@@ -14,7 +14,7 @@ export async function versionFromAsar(): Promise<string> {
try {
await fs.stat("webapp.asar");
} catch {
throw new Error("No 'webapp.asar' found. Run 'pnpm run fetch'");
throw new Error("No 'webapp.asar' found. Run 'yarn run fetch'");
}
return asar.extractFile("webapp.asar", "version").toString().trim();
@@ -25,7 +25,7 @@ export async function setPackageVersion(ver: string): Promise<void> {
// all the various version fields
await new Promise<void>((resolve, reject) => {
childProcess.execFile(
process.platform === "win32" ? "pnpm.cmd" : "pnpm",
process.platform === "win32" ? "yarn.cmd" : "yarn",
[
"version",
"-s",

View File

@@ -507,42 +507,15 @@ app.on("ready", async () => {
const exitShortcutPressed =
input.type === "keyDown" && exitShortcuts.some((shortcutFn) => shortcutFn(input, process.platform));
// Early return if:
// 1. Keys that were pressed are not shortcuts for exiting the app
// 2. Electron mainWindow is null for some reason
// 3. The application is already in the process of quitting
if (!exitShortcutPressed || !global.mainWindow || global.appQuitting) return;
// We only care about the exit shortcuts here
if (!exitShortcutPressed || !global.mainWindow) return;
// Prevent the default behaviour
event.preventDefault();
// Check if the user expects us to minimize to tray instead of quitting the app
// Two cases:
// 1. On Linux/Windows, user has enabled "Show tray icon and minimise window to it on close" in settings.
// 2. On Mac, the canonical behaviour is to minimize to tray; this is not configurable.
const shouldMinimize = store.get("minimizeToTray") || process.platform === "darwin";
if (shouldMinimize) {
if (global.mainWindow?.isFullScreen()) {
global.mainWindow.once("leave-full-screen", () => global.mainWindow?.hide());
global.mainWindow.setFullScreen(false);
} else {
global.mainWindow?.hide();
}
return;
}
// Quit the app; rest of the quit logic is on the close event handler below.
app.quit();
});
global.mainWindow.on("closed", () => {
global.mainWindow = null;
});
global.mainWindow.on("close", async (e) => {
// Check if the user expects us to ask for confirmation before quitting the app
// Let's ask the user if they really want to exit the app
const shouldWarnBeforeExit = store.get("warnBeforeExit", true);
if (shouldWarnBeforeExit && global.mainWindow) {
if (shouldWarnBeforeExit) {
const shouldCancelCloseRequest =
dialog.showMessageBoxSync(global.mainWindow, {
type: "question",
@@ -556,11 +529,33 @@ app.on("ready", async () => {
defaultId: 1,
cancelId: 0,
}) === 0;
if (shouldCancelCloseRequest) {
e.preventDefault();
global.appQuitting = false;
return false;
if (shouldCancelCloseRequest) return;
}
// Exit the app
app.exit();
});
global.mainWindow.on("closed", () => {
global.mainWindow = null;
});
global.mainWindow.on("close", async (e) => {
// If we are not quitting and have a tray icon then minimize to tray
if (!global.appQuitting && (tray.hasTray() || process.platform === "darwin")) {
// On Mac, closing the window just hides it
// (this is generally how single-window Mac apps
// behave, eg. Mail.app)
e.preventDefault();
if (global.mainWindow?.isFullScreen()) {
global.mainWindow.once("leave-full-screen", () => global.mainWindow?.hide());
global.mainWindow.setFullScreen(false);
} else {
global.mainWindow?.hide();
}
return false;
}
});

View File

@@ -35,7 +35,7 @@
"eol": {
"no_more_updates": "Používáte nepodporovanou verzi systému macOS. Prosím upgradujte %(brand)s pro získání aktualizací.",
"title": "Systém není podporován",
"warning": "Používáte nepodporovanou verzi systému macOS. Proveďte prosím upgrade %(brand)s, aby byl stále funkční."
"warning": "Používáte nepodporovanou verzi systému macOS. Proveďte prosím upgrade %(brand)s , aby byl stále funkční."
},
"file_menu": {
"label": "Soubor"

7432
yarn.lock Normal file
View File

File diff suppressed because it is too large Load Diff