httptoolkit: 1.24.4 -> 1.26.0

This commit is contained in:
TomaSajt
2026-05-17 21:59:22 +02:00
parent 474274d474
commit 083d96b112
2 changed files with 106 additions and 38 deletions
@@ -0,0 +1,60 @@
diff --git a/httptoolkit-ctl b/httptoolkit-ctl
index 0878247..d299b71 100644
--- a/httptoolkit-ctl
+++ b/httptoolkit-ctl
@@ -1,10 +1,5 @@
#!/bin/sh
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
-APP_DIR="$(dirname "$SCRIPT_DIR")"
export HTK_DESKTOP_RESOURCES="$SCRIPT_DIR"
-if [ "$(uname)" = "Darwin" ]; then
- export HTK_DESKTOP_EXE="$APP_DIR/MacOS/HTTP Toolkit"
-else
- export HTK_DESKTOP_EXE="$APP_DIR/httptoolkit"
-fi
+export HTK_DESKTOP_EXE="@out@/bin/httptoolkit"
exec "$SCRIPT_DIR/httptoolkit-server/bin/httptoolkit-server" ctl "$@"
diff --git a/httptoolkit-mcp b/httptoolkit-mcp
index c27b25a..c7b3f07 100644
--- a/httptoolkit-mcp
+++ b/httptoolkit-mcp
@@ -1,10 +1,5 @@
#!/bin/sh
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
-APP_DIR="$(dirname "$SCRIPT_DIR")"
export HTK_DESKTOP_RESOURCES="$SCRIPT_DIR"
-if [ "$(uname)" = "Darwin" ]; then
- export HTK_DESKTOP_EXE="$APP_DIR/MacOS/HTTP Toolkit"
-else
- export HTK_DESKTOP_EXE="$APP_DIR/httptoolkit"
-fi
+export HTK_DESKTOP_EXE="@out@/bin/httptoolkit"
exec "$SCRIPT_DIR/httptoolkit-server/bin/httptoolkit-server" mcp "$@"
diff --git a/package.json b/package.json
index e6a9ef4..f8d7ec1 100644
--- a/package.json
+++ b/package.json
@@ -58,8 +58,8 @@
],
"extraResources": [
"httptoolkit-server/**/*",
- "httptoolkit-ctl{,.*}",
- "httptoolkit-mcp{,.*}"
+ "httptoolkit-ctl",
+ "httptoolkit-mcp"
],
"artifactName": "HttpToolkit-${version}-${arch}.${ext}",
"mac": {
diff --git a/src/index.ts b/src/index.ts
index 8a63c58..0511575 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -392,7 +392,7 @@ if (!amMainInstance) {
...process.env,
HTK_SERVER_TOKEN: AUTH_TOKEN,
- HTK_DESKTOP_EXE: app.getPath('exe'),
+ HTK_DESKTOP_EXE: '@out@/bin/httptoolkit',
HTK_DESKTOP_RESOURCES: RESOURCES_PATH,
NODE_SKIP_PLATFORM_CHECK: '1',
OPENSSL_CONF: undefined, // Not relevant to us, and if set this can crash Node.js
+46 -38
View File
@@ -1,89 +1,97 @@
{
lib,
stdenv,
buildNpmPackage,
fetchFromGitHub,
makeWrapper,
makeDesktopItem,
copyDesktopItems,
electron_39,
makeWrapper,
xcbuild,
electron_41,
httptoolkit-server,
}:
let
electron = electron_39;
electron = electron_41;
in
buildNpmPackage rec {
pname = "httptoolkit";
# update together with httptoolkit-server
# nixpkgs-update: no auto update
version = "1.24.4";
version = "1.26.0";
src = fetchFromGitHub {
owner = "httptoolkit";
repo = "httptoolkit-desktop";
tag = "v${version}";
hash = "sha256-b1u+DFhxU/ED4GgMHFaF51zNfC+0vIg6ujyA8jIy8AQ=";
hash = "sha256-WEl0DGYdq1qa5zNEVO6L8TW6lgNTI0NdL0YXeR3Z0BI=";
};
npmDepsHash = "sha256-FX8sClJL66zvWEaaw0lmoat7cM396RA8Rq9NgRVh0Vw=";
patches = [
./fix-paths.patch
];
postPatch = ''
substituteInPlace httptoolkit-{mcp,ctl} src/index.ts \
--replace-fail "@out@" "$out"
'';
npmDepsHash = "sha256-fGVxHhJU/1ZsRyX3AnP6jM/jkY0PZHKDA1tb2z06lLs=";
makeCacheWritable = true;
env = {
ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
# disable code signing on Darwin
CSC_IDENTITY_AUTO_DISCOVERY = "false";
};
env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
nativeBuildInputs = [
makeWrapper
]
++ lib.optionals stdenv.hostPlatform.isLinux [ copyDesktopItems ];
++ lib.optionals stdenv.hostPlatform.isLinux [ copyDesktopItems ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ xcbuild ];
npmBuildScript = "build:src";
postBuild = ''
substituteInPlace package.json --replace-fail \
'"forceCodeSigning": true' \
'"forceCodeSigning": false'
cp -rL ${electron.dist} electron-dist
chmod -R u+w electron-dist
npm exec electron-builder -- \
--dir \
-c.electronDist=electron-dist \
-c.electronVersion=${electron.version}
--dir \
-c.electronDist=electron-dist \
-c.electronVersion=${electron.version} \
-c.mac.forceCodeSigning=false \
-c.mac.identity=null
# ^ this disables codesigning on Darwin
'';
installPhase = ''
runHook preInstall
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
mkdir -p $out/share/httptoolkit
cp -r dist/*-unpacked/{locales,resources{,.pak}} $out/share/httptoolkit
${lib.optionalString stdenv.hostPlatform.isLinux ''
mkdir -p $out/share/httptoolkit
cp -r dist/*-unpacked/{locales,resources{,.pak}} $out/share/httptoolkit
ln -s ${httptoolkit-server} $out/share/httptoolkit/resources/httptoolkit-server
ln -s ${httptoolkit-server} $out/share/httptoolkit/resources/httptoolkit-server
install -Dm644 src/icons/icon.svg $out/share/icons/hicolor/scalable/apps/httptoolkit.svg
install -Dm644 src/icons/icon.svg $out/share/icons/hicolor/scalable/apps/httptoolkit.svg
makeWrapper ${lib.getExe electron} $out/bin/httptoolkit \
--add-flags $out/share/httptoolkit/resources/app.asar \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
--inherit-argv0
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/Applications
cp -r dist/mac*/"HTTP Toolkit.app" $out/Applications
makeWrapper ${lib.getExe electron} $out/bin/httptoolkit \
--add-flags $out/share/httptoolkit/resources/app.asar \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
--inherit-argv0
''}
${lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/Applications
cp -r dist/mac*/"HTTP Toolkit.app" $out/Applications
ln -s ${httptoolkit-server} "$out/Applications/HTTP Toolkit.app/Contents/Resources/httptoolkit-server"
makeWrapper "$out/Applications/HTTP Toolkit.app/Contents/MacOS/HTTP Toolkit" $out/bin/httptoolkit
''}
ln -s ${httptoolkit-server} "$out/Applications/HTTP Toolkit.app/Contents/Resources/httptoolkit-server"
makeWrapper "$out/Applications/HTTP Toolkit.app/Contents/MacOS/HTTP Toolkit" $out/bin/httptoolkit
''
+ ''
runHook postInstall
'';