mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-03-30 08:40:52 +02:00
Updated flaresolverr
This commit is contained in:
parent
679d20904d
commit
6690454de9
1 changed files with 42 additions and 40 deletions
|
@ -1,14 +1,14 @@
|
||||||
{ pkgs, stdenv }:
|
{ pkgs, stdenv }:
|
||||||
with pkgs;
|
with pkgs;
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
|
|
||||||
pname = "flaresolverr";
|
pname = "flaresolverr";
|
||||||
version = "2.2.6";
|
version = "2.2.10";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://github.com/FlareSolverr/FlareSolverr/releases/download/v2.2.6/flaresolverr-v2.2.6-linux-x64.zip";
|
url = "https://github.com/FlareSolverr/FlareSolverr/releases/download/v2.2.10/flaresolverr-v2.2.10-linux-x64.zip";
|
||||||
sha256 = "sha256-ou+hKcIn3NO1/ZzyP69LOtpd1NbATNUg6KDRxCbyen4=";
|
sha256 = "sha256-VZj7CkL1ef+Gfd90PCGUxMCuayzMkqVlGhJrM4Lmacs=";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,39 +18,41 @@ src = fetchurl {
|
||||||
|
|
||||||
buildInputs = [ gcc stdenv.cc.cc.lib firefox ];
|
buildInputs = [ gcc stdenv.cc.cc.lib firefox ];
|
||||||
|
|
||||||
preFixup = let
|
preFixup =
|
||||||
libPath = lib.makeLibraryPath [stdenv.cc.cc];
|
let
|
||||||
in ''
|
libPath = lib.makeLibraryPath [ stdenv.cc.cc ];
|
||||||
orig_size=$(stat --printf=%s $out/bin/flaresolverr)
|
in
|
||||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/flaresolverr
|
''
|
||||||
patchelf --set-rpath ${libPath} $out/bin/flaresolverr
|
orig_size=$(stat --printf=%s $out/bin/flaresolverr)
|
||||||
chmod +x $out/bin/flaresolverr
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/flaresolverr
|
||||||
new_size=$(stat --printf=%s $out/bin/flaresolverr)
|
patchelf --set-rpath ${libPath} $out/bin/flaresolverr
|
||||||
###### zeit-pkg fixing starts here.
|
chmod +x $out/bin/flaresolverr
|
||||||
# we're replacing plaintext js code that looks like
|
new_size=$(stat --printf=%s $out/bin/flaresolverr)
|
||||||
# PAYLOAD_POSITION = '1234 ' | 0
|
###### zeit-pkg fixing starts here.
|
||||||
# [...]
|
# we're replacing plaintext js code that looks like
|
||||||
# PRELUDE_POSITION = '1234 ' | 0
|
# PAYLOAD_POSITION = '1234 ' | 0
|
||||||
# ^-----20-chars-----^^------22-chars------^
|
# [...]
|
||||||
# ^-- grep points here
|
# PRELUDE_POSITION = '1234 ' | 0
|
||||||
#
|
# ^-----20-chars-----^^------22-chars------^
|
||||||
# var_* are as described above
|
# ^-- grep points here
|
||||||
# shift_by seems to be safe so long as all patchelf adjustments occur
|
#
|
||||||
# before any locations pointed to by hardcoded offsets
|
# var_* are as described above
|
||||||
var_skip=20
|
# shift_by seems to be safe so long as all patchelf adjustments occur
|
||||||
var_select=22
|
# before any locations pointed to by hardcoded offsets
|
||||||
shift_by=$(expr $new_size - $orig_size)
|
var_skip=20
|
||||||
function fix_offset {
|
var_select=22
|
||||||
# $1 = name of variable to adjust
|
shift_by=$(expr $new_size - $orig_size)
|
||||||
location=$(grep -obUam1 "$1" $out/bin/flaresolverr | cut -d: -f1)
|
function fix_offset {
|
||||||
location=$(expr $location + $var_skip)
|
# $1 = name of variable to adjust
|
||||||
value=$(dd if=$out/bin/flaresolverr iflag=count_bytes,skip_bytes skip=$location \
|
location=$(grep -obUam1 "$1" $out/bin/flaresolverr | cut -d: -f1)
|
||||||
bs=1 count=$var_select status=none)
|
location=$(expr $location + $var_skip)
|
||||||
value=$(expr $shift_by + $value)
|
value=$(dd if=$out/bin/flaresolverr iflag=count_bytes,skip_bytes skip=$location \
|
||||||
echo -n $value | dd of=$out/bin/flaresolverr bs=1 seek=$location conv=notrunc
|
bs=1 count=$var_select status=none)
|
||||||
}
|
value=$(expr $shift_by + $value)
|
||||||
fix_offset PAYLOAD_POSITION
|
echo -n $value | dd of=$out/bin/flaresolverr bs=1 seek=$location conv=notrunc
|
||||||
fix_offset PRELUDE_POSITION
|
}
|
||||||
|
fix_offset PAYLOAD_POSITION
|
||||||
|
fix_offset PRELUDE_POSITION
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,7 +63,7 @@ src = fetchurl {
|
||||||
ln -s ${pkgs.firefox}/bin/firefox $out/bin/firefox/firefox
|
ln -s ${pkgs.firefox}/bin/firefox $out/bin/firefox/firefox
|
||||||
'';
|
'';
|
||||||
|
|
||||||
dontStrip = true;
|
dontStrip = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue