ConfusedPolarBear / intro-skipper

Fingerprint audio to automatically detect and skip intro sequences in Jellyfin
GNU General Public License v3.0
988 stars 392 forks source link

intro-skipper javascript collides with the jellyscrub script #111

Closed tam1m closed 1 year ago

tam1m commented 1 year ago

Describe the bug

When the script is being injected into the webinterface jellyscrub won't work anymore, since both scripts try to declare the same variables in the global scope.

Since intro-skipper is injected into <head> and thus executed before jellyscrub, which is injected into <body>, jellyscrub will fail with

Uncaught SyntaxError: redeclaration of let originalFetch
    <anonymous> https://jf.example.org/Trickplay/ClientScript:1

Both scripts are being injected via nginx's sub_filter module. The nginx config look like this


location = /web/ { 
...
    proxy_set_header Accept-Encoding "";

    # inject intro-skipper plugin script
    sub_filter
    '</body>'
    '<script plugin="Jellyscrub" version="1.0.0.0" src="/Trickplay/ClientScript"></script>
    </body>';

    # inject jellyscrup plugin script
    sub_filter
    '</head>'
    '<script plugin="intro-skipper" version="1.0.0.0" src="/web/configurationpage?name=skip-intro-button.js"></script>
    </head>';

    sub_filter_once on;
...
}

Operating system

Ubuntu 22.04.1 LTS

Jellyfin installation method

Docker

Container image and tag

linuxserver/jellyfin:latest

Support Bundle

FFmpeg version:

ffmpeg version 5.1.2-Jellyfin Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-libs=-lfftw3f --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-shared --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-static --enable-gmp --enable-gnutls --enable-chromaprint --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libdav1d --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libsvtav1 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-opencl --enable-vaapi --enable-amf --enable-libmfx --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
libavutil      57. 28.100 / 57. 28.100
libavcodec     59. 37.100 / 59. 37.100
libavformat    59. 27.100 / 59. 27.100
libavdevice    59.  7.100 / 59.  7.100
libavfilter     8. 44.100 /  8. 44.100
libswscale      6.  7.100 /  6.  7.100
libswresample   4.  7.100 /  4.  7.100
libpostproc    56.  6.100 / 56.  6.100

Jellyfin logs

No response

ConfusedPolarBear commented 1 year ago

This should be fixed by 39d235006fa72958e249cd69dad1511842ec929e. Can you retest with this build?

tam1m commented 1 year ago

Fixed. Thank you!