Compare commits

...

52 Commits

Author SHA1 Message Date
3e518d38f6
Update workflow
Some checks failed
/ build-element (push) Failing after 16s
2025-03-07 15:22:37 +01:00
c6d95a774e
Update workflow
Some checks failed
/ build-element (push) Failing after 16s
2025-03-07 15:20:43 +01:00
adfae6f51d
Update workflow
Some checks failed
/ build-element (push) Failing after 7m44s
2025-03-07 15:06:58 +01:00
07ea7afb9e
Update workflow
Some checks failed
/ build-element (push) Failing after 7m30s
2025-03-04 22:22:13 +01:00
4aabc986ef
Update workflow
Some checks failed
/ build-element (push) Failing after 7m44s
2025-03-04 22:11:40 +01:00
d1c2be8898
Update workflow
Some checks failed
/ build-element (push) Failing after 7m9s
2025-03-04 21:59:05 +01:00
d4a78d0d4f
Update workflow
Some checks failed
/ build-element (push) Failing after 1m2s
2025-03-04 21:55:05 +01:00
458ca631e6
Update workflow
Some checks failed
/ build-element (push) Failing after 10s
2025-03-04 21:54:14 +01:00
508df5a8fb
Update workflow
Some checks failed
/ build-element (push) Failing after 1m7s
2025-03-04 21:52:42 +01:00
ac3055f51e
Update workflow
Some checks failed
/ build-element (push) Failing after 3m21s
2025-03-04 21:47:28 +01:00
2a89cdf443
Update workflow
Some checks failed
/ build-element (push) Failing after 2m52s
2025-03-04 21:37:22 +01:00
b272e50a67
Update workflow
Some checks failed
/ build-element (push) Failing after 29s
2025-03-04 21:32:52 +01:00
14c0db5565
Update workflow
Some checks failed
/ build-element (push) Failing after 21s
2025-03-04 21:31:11 +01:00
8d9343e54d
Update workflow
Some checks failed
/ build-element (push) Failing after 4m53s
2025-03-04 21:20:48 +01:00
695860d8cd
Update workflow 2025-03-04 20:21:54 +01:00
c964c11d2b
Update workflow 2025-03-04 20:20:54 +01:00
5898fd756f
Update workflow 2025-03-04 19:30:40 +01:00
deda5d64db
Add workflow (WIP) 2025-03-04 19:28:22 +01:00
renovate[bot]
987ce7dde4
Update dependency eslint-plugin-n to v17.16.1 (#2194)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-04 17:26:08 +00:00
renovate[bot]
a013504e17
Update electron-builder to v26.0.10 (#2193)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-04 17:25:27 +00:00
renovate[bot]
79abfcfddc
Update dependency @types/node to v18.19.79 (#2192)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-04 17:24:00 +00:00
renovate[bot]
d8f4644ffc
Update electron-builder to v26.0.9 (#2187)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-04 15:17:43 +00:00
renovate[bot]
f1d9b0a847
Update typescript-eslint monorepo to v8.25.0 (#2190)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-04 15:12:52 +00:00
renovate[bot]
960ff865fb
Update dependency @sentry/electron to v6 (#2191)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-04 14:47:39 +00:00
renovate[bot]
bbcb7c0438
Update dependency typescript to v5.8.2 (#2189)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-04 14:47:13 +00:00
renovate[bot]
e36b3b3ce1
Update dependency electron to v34.3.0 (#2188)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-04 14:46:58 +00:00
renovate[bot]
566b32041d
Update dependency @types/node to v18.19.78 (#2186)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-04 14:43:52 +00:00
renovate[bot]
d57ac6f016
Update docker (#2184)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-04 14:35:48 +00:00
renovate[bot]
76a5dcf5c8
Update all non-major dependencies (#2185)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-04 14:35:40 +00:00
Will Hunt
50b0a757a8
Merge pull request #2181 from element-hq/hs/deprecate-windows-32bit
Deprecate ia32 Windows builds
2025-03-04 11:38:53 +00:00
Will Hunt
2669b2adeb
Update notice 2025-03-04 09:57:29 +00:00
Michael Telatynski
e6ab8743d1
Simplify workflows remove unused parameters (#2182)
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-03-04 09:18:37 +00:00
Michael Telatynski
f733c2e942
Switch to shiftkey/node-keytar as it has NAPI 10 updates (#2172)
* Test keytar-forked

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Leverage electron-builder to build keytar rather than hak

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Add logging

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Update imports

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Update knip.ts

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-03-03 11:04:29 +00:00
Half-Shot
5b0ab72745 s/webpack/webapp 2025-03-03 11:00:48 +00:00
Half-Shot
783d0f15b8 lint 2025-03-03 10:32:27 +00:00
Half-Shot
0fc37c929a wait til after deps install 2025-03-03 10:31:42 +00:00
Half-Shot
f2319fc173 quote 2025-03-03 10:29:19 +00:00
Half-Shot
50836358dc another bracket -_- 2025-03-03 10:22:26 +00:00
Half-Shot
d61c284d8e drop newlines 2025-03-03 10:20:13 +00:00
Half-Shot
ae17facfe0 off by one brackets 2025-03-03 10:17:24 +00:00
Half-Shot
63f29006fc escaped 2025-03-03 10:13:43 +00:00
Half-Shot
0bb7ccb054 that's actually a config now 2025-03-03 10:09:19 +00:00
Half-Shot
3c4791f7ce use var mapper 2025-03-03 10:08:22 +00:00
Half-Shot
782ba453cf drop build_and_deploy.yaml changes 2025-03-03 10:08:20 +00:00
Half-Shot
7c17bdcafe switch order 2025-03-03 10:04:10 +00:00
Half-Shot
46e81cd8f8 Add ability to insert extra config for windows builds. 2025-03-03 10:03:01 +00:00
Michael Telatynski
1496f3d64c
Remove unused parts of the hak build system (#2174) 2025-02-28 15:15:32 +00:00
Michael Telatynski
7847e53adc
Update build to always install setuptools
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-02-28 15:15:19 +00:00
Michael Telatynski
9a1d2291c1
Make keytar mandatory and build it without hak (#2173) 2025-02-28 15:13:35 +00:00
Michael Telatynski
ff7f53fb35
Use modern Dockerfile env format to silence warnings (#2171) 2025-02-28 11:39:31 +00:00
Michael Telatynski
bce251b35b
Update node engines, 23.x is broken too 2025-02-28 11:17:07 +00:00
Michael Telatynski
a46985d91e
Specify node version to avoid NAPI keytar bug (#2168) 2025-02-28 10:23:49 +00:00
29 changed files with 651 additions and 595 deletions

View File

@ -0,0 +1,23 @@
on: [push, workflow_dispatch]
jobs:
build-element:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download Cringe Studios configuration
run: "mkdir cringe && wget -O cringe/config.json https://chat.cringe-studios.com/config.json"
- name: Docker setup
run: "docker build --platform linux/amd64 -t element-desktop-dockerbuild -f dockerbuild/Dockerfile ."
- name: Docker build
run: >
ls -la && PWD=$(pwd) scripts/in-docker.sh bash -c 'ls -la &&
yarn add matrix-seshat &&
yarn &&
yarn run fetch --noverify --cfgdir cringe &&
SQLCIPHER_BUNDLED=1 yarn run docker:build:native &&
yarn run docker:build --linux rpm --linux deb --linux tar.xz --linux AppImage --win squirrel'

View File

@ -92,7 +92,6 @@ jobs:
uses: ./.github/workflows/build_linux.yaml
with:
arch: ${{ matrix.arch }}
config: ${{ needs.prepare.outputs.config }}
sqlcipher: ${{ matrix.sqlcipher }}
version: ${{ needs.prepare.outputs.nightly-version }}

View File

@ -35,7 +35,6 @@ jobs:
sqlcipher: [system, static]
arch: [amd64, arm64]
with:
config: ${{ github.event.pull_request.base.ref == 'develop' && 'element.io/nightly' || 'element.io/release' }}
sqlcipher: ${{ matrix.sqlcipher }}
arch: ${{ matrix.arch }}
@ -97,7 +96,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version-file: package.json
node-version-file: .node-version
cache: "yarn"
- name: Install Deps

View File

@ -8,10 +8,6 @@ on:
type: string
required: true
description: "The architecture to build for, one of 'amd64' | 'arm64'"
config:
type: string
required: true
description: "The config directory to use"
version:
type: string
required: false
@ -76,7 +72,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version-file: package.json
node-version-file: .node-version
cache: "yarn"
env:
# Workaround for https://github.com/actions/setup-node/issues/317
@ -95,10 +91,10 @@ jobs:
# This allows contributors to test changes to the dockerbuild image within a pull request
- name: Build docker image
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6
if: steps.changed_files.outputs.any_modified == 'true'
with:
context: dockerbuild
file: dockerbuild/Dockerfile
load: true
platforms: linux/${{ inputs.arch }}
tags: ${{ env.HAK_DOCKER_IMAGE }}

View File

@ -62,18 +62,19 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version-file: package.json
node-version-file: .node-version
cache: "yarn"
- name: Install Deps
run: "yarn install --frozen-lockfile"
# Python 3.12 drops distutils which keytar relies on
- name: Install setuptools
run: pip3 install setuptools
- name: Build Natives
if: steps.cache.outputs.cache-hit != 'true'
run: |
# Python 3.12 drops distutils which keytar relies on
pip3 install setuptools
yarn 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"

View File

@ -34,12 +34,9 @@ on:
packages-dir:
description: "The directory non-deb packages for this run should live in within packages.element.io"
value: ${{ inputs.nightly && 'nightly' || 'desktop' }}
# These are just simple pass-throughs of the input to simplify reuse of complex inline conditions
config:
description: "The relative path to the config file for this run"
value: ${{ inputs.config }}
# This is just a simple pass-through of the input to simplify reuse of complex inline conditions
deploy:
description: "The relative path to the config file for this run"
description: "Whether the build should be deployed to production"
value: ${{ inputs.deploy }}
permissions: {}
jobs:
@ -56,7 +53,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version-file: package.json
node-version-file: .node-version
cache: "yarn"
- name: Install Deps

View File

@ -56,7 +56,8 @@ jobs:
"ia32": {
"target": "i686-pc-windows-msvc",
"build-args": "--ia32",
"arch": "x86"
"arch": "x86",
"extra_config": "{\"user_notice\": {\"title\": \"Your desktop support ends soon\",\"description\": \"Support for 32-bit Windows installations will end soon, this impacts you. Transition to the web or mobile app for continued access.\"}}"
}
}
@ -99,14 +100,26 @@ jobs:
- uses: actions/setup-node@v4
with:
# node-version-file: package.json
# For https://github.com/element-hq/element-desktop/issues/2161
node-version: 22.13.1
node-version-file: .node-version
cache: "yarn"
- name: Install Deps
run: "yarn install --frozen-lockfile"
- name: Insert config snippet
if: steps.config.outputs.extra_config != ''
shell: bash
run: |
mkdir 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
yarn asar pack config-edit/ webapp.asar
- name: Set up sqlcipher macros
if: steps.cache.outputs.cache-hit != 'true' && contains(inputs.arch, 'arm')
shell: pwsh

View File

@ -22,17 +22,17 @@ jobs:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@4574d27a4764455b42196d70a065bc6853246a25 # v3
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca # v3
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3
with:
install: true
- name: Build test image
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6
with:
context: dockerbuild
file: dockerbuild/Dockerfile
push: false
load: true
tags: element-desktop-dockerbuild
@ -52,7 +52,7 @@ jobs:
- name: Extract metadata for Docker
id: meta
if: github.event_name != 'pull_request'
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
@ -61,9 +61,9 @@ jobs:
- name: Build and push Docker image
if: github.event_name != 'pull_request'
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6
with:
context: dockerbuild
file: dockerbuild/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

1
.node-version Normal file
View File

@ -0,0 +1 @@
v22.14.0

View File

@ -2,7 +2,7 @@
# with broader compatibility, down to Debian bullseye & Ubuntu focal.
FROM rust:bullseye
ENV DEBIAN_FRONTEND noninteractive
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 && \
@ -14,15 +14,15 @@ RUN apt-get -qq update && apt-get -y -qq dist-upgrade && \
# Used by seshat (when not SQLCIPHER_STATIC) \
libsqlcipher-dev && \
apt-get purge -y --auto-remove && rm -rf /var/lib/apt/lists/*
RUN dpkg --add-architecture i386 && apt-get update && apt-get install -y wine mono-devel rpm
RUN ln -s /usr/bin/python3 /usr/bin/python & ln -s /usr/bin/pip3 /usr/bin/pip
ENV DEBUG_COLORS true
ENV FORCE_COLOR true
ENV DEBUG_COLORS=true
ENV FORCE_COLOR=true
WORKDIR /project
ENV NODE_VERSION 20.18.2
ARG TARGETOS
ARG TARGETARCH
COPY setup.sh /setup.sh
COPY .node-version dockerbuild/setup.sh /
RUN /setup.sh

View File

@ -3,5 +3,6 @@
set -x
declare -A archMap=(["amd64"]="x64" ["arm64"]="arm64")
ARCH="${archMap["$TARGETARCH"]}"
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 && \
NODE_VERSION=$(cat /.node-version)
curl --proto "=https" -L "https://nodejs.org/dist/$NODE_VERSION/node-$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

View File

@ -174,6 +174,9 @@ const config: Omit<Writable<Configuration>, "electronFuses"> & {
schemes: ["io.element.desktop", "element"],
},
],
nativeRebuilder: "sequential",
nodeGypRebuild: false,
npmRebuild: true,
};
/**

View File

@ -1,26 +0,0 @@
/*
Copyright 2024 New Vector Ltd.
Copyright 2020 The Matrix.org Foundation C.I.C.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import path from "node:path";
import type HakEnv from "../../scripts/hak/hakEnv.js";
import type { DependencyInfo } from "../../scripts/hak/dep.js";
export default async function buildKeytar(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
const env = hakEnv.makeGypEnv();
console.log("Running yarn with env", env);
await hakEnv.spawn(
path.join(moduleInfo.nodeModuleBinDir, "node-gyp"),
["rebuild", "--arch", hakEnv.getTargetArch()],
{
cwd: moduleInfo.moduleBuildDir,
env,
},
);
}

View File

@ -1,15 +0,0 @@
/*
Copyright 2024 New Vector Ltd.
Copyright 2020 The Matrix.org Foundation C.I.C.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import type HakEnv from "../../scripts/hak/hakEnv.js";
import type { DependencyInfo } from "../../scripts/hak/dep.js";
export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
// node-gyp uses python for reasons beyond comprehension
await hakEnv.checkTools([["python", "--version"]]);
}

View File

@ -1,10 +0,0 @@
{
"scripts": {
"check": "check.ts",
"build": "build.ts"
},
"copy": "build/Release/keytar.node",
"dependencies": {
"libsecret": "0.20.3"
}
}

View File

@ -5,7 +5,6 @@ export default {
project: ["**/*.{js,ts}"],
ignoreDependencies: [
// Brought in via hak scripts
"keytar",
"matrix-seshat",
// Required for `action-validator`
"@action-validator/*",

View File

@ -44,7 +44,7 @@
"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 dockerbuild",
"docker:setup": "docker build --platform linux/amd64 -t element-desktop-dockerbuild -f dockerbuild/Dockerfile .",
"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",
@ -53,15 +53,17 @@
"test": "playwright test",
"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 /var/run/docker.sock:/var/run/docker.sock --platform linux/amd64 -it element-desktop-playwright"
"test:screenshots:run": "docker run --rm --network host -v $(pwd):/work/element-desktop -v /var/run/docker.sock:/var/run/docker.sock --platform linux/amd64 -it element-desktop-playwright",
"postinstall": "electron-builder install-app-deps"
},
"dependencies": {
"@sentry/electron": "^5.0.0",
"@sentry/electron": "^6.0.0",
"@standardnotes/electron-clear-data": "^1.0.5",
"auto-launch": "^5.0.5",
"counterpart": "^0.18.6",
"electron-store": "^10.0.0",
"electron-window-state": "^5.0.3",
"keytar-forked": "7.10.0",
"minimist": "^1.2.6",
"png-to-ico": "^2.1.1",
"uuid": "^11.0.0"
@ -78,16 +80,16 @@
"@types/auto-launch": "^5.0.1",
"@types/counterpart": "^0.18.1",
"@types/minimist": "^1.2.1",
"@types/node": "18.19.76",
"@types/node": "18.19.79",
"@types/pacote": "^11.1.1",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"app-builder-lib": "26.0.8",
"app-builder-lib": "26.0.10",
"chokidar": "^4.0.0",
"detect-libc": "^2.0.0",
"electron": "34.2.0",
"electron-builder": "26.0.8",
"electron-builder-squirrel-windows": "26.0.8",
"electron": "34.3.0",
"electron-builder": "26.0.10",
"electron-builder-squirrel-windows": "26.0.10",
"electron-devtools-installer": "^4.0.0",
"eslint": "^8.26.0",
"eslint-config-google": "^0.14.0",
@ -108,14 +110,13 @@
"rimraf": "^6.0.0",
"tar": "^7.0.0",
"tsx": "^4.19.2",
"typescript": "5.7.3"
"typescript": "5.8.2"
},
"hakDependencies": {
"matrix-seshat": "^4.0.1",
"keytar": "^7.9.0"
"matrix-seshat": "^4.0.1"
},
"resolutions": {
"@types/node": "18.19.76",
"@types/node": "18.19.79",
"config-file-ts": "0.2.8-rc1"
}
}

View File

@ -67,14 +67,14 @@ Hak is divided into lifecycle stages, in order:
# hak.json
The scripts section contains scripts used for lifecycle stages that need them (fetch, fetchDeps, build).
The scripts section contains scripts used for lifecycle stages that need them (fetch, build).
It also contains 'prune' and 'copy' which are globs of files to delete from the output module directory
and copy over from the module build directory to the output module directory, respectively.
# Shortcomings
Hak doesn't know about dependencies between lifecycle stages, ie. it doesn't know that you need to
'fetch' and 'fetchDeps' before you can 'build', etc. You get to run each individually, and remember
'fetch' before you can 'build', etc. You get to run each individually, and remember
the right order.
There is also a _lot_ of duplication in the command execution: we should abstract away

View File

@ -10,7 +10,5 @@ import type { DependencyInfo } from "./dep.js";
import type HakEnv from "./hakEnv.js";
export default async function check(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
if (moduleInfo.scripts.check) {
await moduleInfo.scripts.check(hakEnv, moduleInfo);
}
await moduleInfo.scripts.check?.(hakEnv, moduleInfo);
}

View File

@ -9,7 +9,6 @@ Please see LICENSE files in the repository root for full details.
import path from "node:path";
import fsProm from "node:fs/promises";
import childProcess from "node:child_process";
import { rimraf } from "rimraf";
import { glob } from "glob";
import { mkdirp } from "mkdirp";
@ -17,20 +16,6 @@ import type HakEnv from "./hakEnv.js";
import type { DependencyInfo } from "./dep.js";
export default async function copy(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
if (moduleInfo.cfg.prune) {
console.log("Removing " + moduleInfo.cfg.prune + " from " + moduleInfo.moduleOutDir);
// rimraf doesn't have a 'cwd' option: it always uses process.cwd()
// (and if you set glob.cwd it just breaks because it can't find the files)
const oldCwd = process.cwd();
try {
await mkdirp(moduleInfo.moduleOutDir);
process.chdir(moduleInfo.moduleOutDir);
await rimraf(moduleInfo.cfg.prune);
} finally {
process.chdir(oldCwd);
}
}
if (moduleInfo.cfg.copy) {
// If there are multiple moduleBuildDirs, singular moduleBuildDir
// is the same as moduleBuildDirs[0], so we're just listing the contents

View File

@ -1,19 +0,0 @@
/*
Copyright 2024 New Vector Ltd.
Copyright 2020 The Matrix.org Foundation C.I.C.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import { mkdirp } from "mkdirp";
import type { DependencyInfo } from "./dep.js";
import type HakEnv from "./hakEnv.js";
export default async function fetchDeps(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
await mkdirp(moduleInfo.moduleDotHakDir);
if (moduleInfo.scripts.fetchDeps) {
await moduleInfo.scripts.fetchDeps(hakEnv, moduleInfo);
}
}

View File

@ -19,7 +19,7 @@ import packageJson from "../../package.json";
const MODULECOMMANDS = ["check", "fetch", "link", "build", "copy", "clean"];
// Shortcuts for multiple commands at once (useful for building universal binaries
// because you can run the fetch/fetchDeps/build for each arch and then copy/link once)
// because you can run the fetch/build for each arch and then copy/link once)
const METACOMMANDS: Record<string, string[]> = {
fetchandbuild: ["check", "fetch", "build"],
copyandlink: ["copy", "link"],

View File

@ -8,9 +8,12 @@ if [ $? != 0 ]; then
exit 1
fi
echo "${PWD}"
echo $(ls "${PWD}")
# Taken from https://www.electron.build/multi-platform-build#docker
# Pass through any vars prefixed with INDOCKER_, removing the prefix
docker run --rm -ti \
docker run --rm \
--platform linux/amd64 \
--env-file <(env | grep -E '^INDOCKER_' | sed -e 's/^INDOCKER_//') \
--env ELECTRON_CACHE="/root/.cache/electron" \
@ -21,4 +24,5 @@ docker run --rm -ti \
-v ${PWD}/docker/.gnupg:/root/.gnupg \
-v ~/.cache/electron:/root/.cache/electron \
-v ~/.cache/electron-builder:/root/.cache/electron-builder \
--workdir "/project" \
"$IMAGE" "$@"

View File

@ -1,54 +0,0 @@
// Based on https://github.com/atom/node-keytar/blob/master/keytar.d.ts because keytar is a hak-dependency and not a normal one
// Definitions by: Milan Burda <https://github.com/miniak>, Brendan Forster <https://github.com/shiftkey>, Hari Juturu <https://github.com/juturu>
// Adapted from DefinitelyTyped: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/keytar/index.d.ts
declare module "keytar" {
/**
* Get the stored password for the service and account.
*
* @param service The string service name.
* @param account The string account name.
*
* @returns A promise for the password string.
*/
export function getPassword(service: string, account: string): Promise<string | null>;
/**
* Add the password for the service and account to the keychain.
*
* @param service The string service name.
* @param account The string account name.
* @param password The string password.
*
* @returns A promise for the set password completion.
*/
export function setPassword(service: string, account: string, password: string): Promise<void>;
/**
* Delete the stored password for the service and account.
*
* @param service The string service name.
* @param account The string account name.
*
* @returns A promise for the deletion status. True on success.
*/
export function deletePassword(service: string, account: string): Promise<boolean>;
/**
* Find a password for the service in the keychain.
*
* @param service The string service name.
*
* @returns A promise for the password string.
*/
export function findPassword(service: string): Promise<string | null>;
/**
* Find all accounts and passwords for `service` in the keychain.
*
* @param service The string service name.
*
* @returns A promise for the array of found credentials.
*/
export function findCredentials(service: string): Promise<Array<{ account: string; password: string }>>;
}

View File

@ -22,7 +22,6 @@ import { URL, fileURLToPath } from "node:url";
import minimist from "minimist";
import "./ipc.js";
import "./keytar.js";
import "./seshat.js";
import "./settings.js";
import * as tray from "./tray.js";

View File

@ -7,12 +7,12 @@ Please see LICENSE files in the repository root for full details.
import { app, autoUpdater, desktopCapturer, ipcMain, powerSaveBlocker, TouchBar, nativeImage } from "electron";
import { relaunchApp } from "@standardnotes/electron-clear-data";
import keytar from "keytar-forked";
import IpcMainEvent = Electron.IpcMainEvent;
import { recordSSOSession } from "./protocol.js";
import { randomArray } from "./utils.js";
import { Settings } from "./settings.js";
import { keytar } from "./keytar.js";
import { getDisplayMediaCallback, setDisplayMediaCallback } from "./displayMediaCallback.js";
ipcMain.on("setBadgeCount", function (_ev: IpcMainEvent, count: number): void {
@ -141,11 +141,11 @@ ipcMain.on("ipcCall", async function (_ev: IpcMainEvent, payload) {
case "getPickleKey":
try {
ret = await keytar?.getPassword("element.io", `${args[0]}|${args[1]}`);
ret = await keytar.getPassword("element.io", `${args[0]}|${args[1]}`);
// migrate from riot.im (remove once we think there will no longer be
// logins from the time of riot.im)
if (ret === null) {
ret = await keytar?.getPassword("riot.im", `${args[0]}|${args[1]}`);
ret = await keytar.getPassword("riot.im", `${args[0]}|${args[1]}`);
}
} catch {
// if an error is thrown (e.g. keytar can't connect to the keychain),
@ -161,17 +161,18 @@ ipcMain.on("ipcCall", async function (_ev: IpcMainEvent, payload) {
// rather than sending them a pickle key we did not store on their behalf.
await keytar!.setPassword("element.io", `${args[0]}|${args[1]}`, pickleKey);
ret = pickleKey;
} catch {
} catch (e) {
console.error("Failed to create pickle key", e);
ret = null;
}
break;
case "destroyPickleKey":
try {
await keytar?.deletePassword("element.io", `${args[0]}|${args[1]}`);
await keytar.deletePassword("element.io", `${args[0]}|${args[1]}`);
// migrate from riot.im (remove once we think there will no longer be
// logins from the time of riot.im)
await keytar?.deletePassword("riot.im", `${args[0]}|${args[1]}`);
await keytar.deletePassword("riot.im", `${args[0]}|${args[1]}`);
} catch {}
break;
case "getDesktopCapturerSources":

View File

@ -1,21 +0,0 @@
/*
Copyright 2022-2024 New Vector Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import type * as Keytar from "keytar"; // Hak dependency type
let keytar: typeof Keytar | undefined;
try {
({ default: keytar } = await import("keytar"));
} catch (e) {
if ((<NodeJS.ErrnoException>e).code === "MODULE_NOT_FOUND") {
console.log("Keytar isn't installed; secure key storage is disabled.");
} else {
console.warn("Keytar unexpected error:", e);
}
}
export { keytar };

View File

@ -8,6 +8,7 @@ Please see LICENSE files in the repository root for full details.
import { app, ipcMain } from "electron";
import { promises as afs } from "node:fs";
import path from "node:path";
import keytar from "keytar-forked";
import type {
Seshat as SeshatType,
@ -16,7 +17,6 @@ import type {
} from "matrix-seshat"; // Hak dependency type
import IpcMainEvent = Electron.IpcMainEvent;
import { randomArray } from "./utils.js";
import { keytar } from "./keytar.js";
let seshatSupported = false;
let Seshat: typeof SeshatType;

919
yarn.lock

File diff suppressed because it is too large Load Diff