Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with 10.9.x #18

Open
LeviSnoot opened this issue Apr 7, 2024 · 14 comments
Open

Compatibility with 10.9.x #18

LeviSnoot opened this issue Apr 7, 2024 · 14 comments

Comments

@LeviSnoot
Copy link
Contributor

10.9 is coming up, and I've had a look at main.jellyfin.bundle.js in an unstable build to see what kinds of changes to expect and figure out how to best adapt my config for the new version.

Unfortunately I was quickly overwhelmed, and since we're pretty much looking at compiled/obfuscated code I'm not really sure how to reverse engineer this so we can add the current tweaks in the repo to 10.9.x. For example, Adding logo to sidebar will now be obsolete as there is no reference to <div style="height:.5em;"></div>', in main.jellyfin.bundle.js. Forcing background has changed yet again and is now set to {return _} by default (although I think setting it to {return e} may do the trick in 10.9.x).

If anyone's willing to dive into the code with me so we can make a PR for 10.9, that'd be very much appreciated!

@BobHasNoSoul
Copy link
Owner

i wouldnt mind helping with this, however from experiance until we get a stable build they can and more than likley will change the code again (main reason jftool died.. it was too time consuming to keep up with like playing whack a mole) i get the feeling some of the devs hate heathens like me for modifying the code and not creating a new branch of jellyfin. however i love that more people are doing the mods and making them. if you get an idea of when it is supposed to be finally released i will help with the porting over at that point... note some more than likley will take longer than others. (usually things inside of menus... they love to break those)

@RoadHunk
Copy link

RoadHunk commented May 12, 2024

Yep, looks like 10.9 broke all the customization I had. Also not sure if it's just that my browser isn't reloading correctly but trying to change the favicon and logos doesn't seem to be working. Hoping this isn't the Jellyfin team being hostile toward custom branding.

@LeviSnoot
Copy link
Contributor Author

Okay so I've upgraded and looked into it a little bit. My findings so far:

  • They flipped the switch for toggling backdrops again. The string is set to enableBackdrops:function(){return _} by default now and needs to be changed back to enableBackdrops:function(){return P} in order to toggle backdrops on for all users.
  • Setting pagination to infinite should work the same way as it did in 10.8.x, but changing t=parseInt(this.get("libraryPageSize",!1),10);return 0===t?0:t||100}} to t=parseInt(this.get("libraryPageSize",!1),10);return 0===t?0:t||0}} has no effect for me.
  • In my instance there is a file called 73233.286cf9810333727af45b.chunk.js, this file has a lot of the same strings to customize as were present in main.jellyfin.bundle.js in 10.8.x, but editing this file seems to not yield any results. I checked the raw jellyfin 10.9.0 web archive and it contains an identical file, so it doesn't seem like this is a file that is just left over from 10.8.x.
  • I'm looking through the web directory for references to document.title and inside index.jsx there is the following string: document.title = globalize.translateHtml(document.title, 'core');. I'm not great at deciphering this stuff but this seems to me like a translation key whose value is probably hiding somewhere. I just can't seem to find it anywhere. Help appreciated.

@LeviSnoot
Copy link
Contributor Author

Yep, looks like 10.9 broke all the customization I had. Also not sure if it's just that my browser isn't reloading correctly but trying to change the favicon and logos doesn't seem to be working. Hoping this isn't the Jellyfin team being hostile toward custom branding.

This does work for me, ensure you're replacing not just the files within /usr/share/jellyfin/web/assets, but also the ones in /usr/share/jellyfin/web with obfuscated names like bc8d51405ec040305a87.ico. If it still doesn't work, make sure all site data is cleared for your instance in your web browser as the serviceworker may have cached it.

@RoadHunk
Copy link

RoadHunk commented May 12, 2024

Yep, looks like 10.9 broke all the customization I had. Also not sure if it's just that my browser isn't reloading correctly but trying to change the favicon and logos doesn't seem to be working. Hoping this isn't the Jellyfin team being hostile toward custom branding.

This does work for me, ensure you're replacing not just the files within /usr/share/jellyfin/web/assets, but also the ones in /usr/share/jellyfin/web with obfuscated names like bc8d51405ec040305a87.ico. If it still doesn't work, make sure all site data is cleared for your instance in your web browser as the serviceworker may have cached it.

Oh, I'm on the Windows version. I used to be able to replace the files under C:\Program Files\Jellyfin\Server\jellyfin-web and they would take effect but on 10.9 replacing these files didn't seem to do anything, but I could be wrong and could've just been dealing with some cache that refused to clear. Either way though, I ended up downgrading back to 10.8.13 because I was suddenly having issues this morning getting the server to load on my reverse proxy (and can confirm that replacing the files in the jellyfin-web folder does in fact work on 10.8.13).

@BobHasNoSoul
Copy link
Owner

i can confirm that they have changed a lot of things, it does seem like their normal par for the course of modifications.. over the coming weekend when i have some spare time i will try to dedicate a solid block of time to porting as much as i can over. (some stuff is also broken in the 10.9.0 build that may piss some users off.. api calls being different for certain object strings for one)

the update naming standard is fun to say the least. it needs to be ironed out but i will also add a guide to using the network tab inside of firefox and chrome to see what the file in use is (tldr is open the page just before the one you want to modify and then open the inspect option and then network tab then click on the link to the page you want to edit.. it should spit out two .js files in the list these are your first ports to call for editing)

none of this really stops me from editing it how i want but does slow me down until there is more free time and obviously i welcome any and all new modifications.. the way i see it.. its your server, your power, your internet, your content, your rules.. if you want it to be a dedicated my little pony site idc its your server you do you lol. however yeah with my work and kids it may take a while.. i may dive into it if i get a chance earlier for the major porting.

just need to write the new one as a seperate section for 10.9.x so people dont get confused

the main downside with the way they have named these also is that there could be more scrambling on builds making every modification temporary unless we fork the source and then add check boxes for them to be enabled and disabled... i would do this but seeing the amount of prs that break things i would really not want to do this because it will turn my hobby into a near full time job (that and im pretty sure i will get another message from a dev telling me off for using it)

@BobHasNoSoul
Copy link
Owner

BobHasNoSoul commented May 13, 2024

Yep, looks like 10.9 broke all the customization I had. Also not sure if it's just that my browser isn't reloading correctly but trying to change the favicon and logos doesn't seem to be working. Hoping this isn't the Jellyfin team being hostile toward custom branding.

favicon is now a .ico file in the webroot but is heavily randomised.. /web/bc8d51405ec040305a87.ico for example

replacing it and clearing the cache does appear to work (if in doubt you can use chrome and incognito mode to run the site with a cleared cache)

i beleive this is the splash could be wrong /web/f5bbb798cb2c65908633.png

and i beleive this is the top bar logo is still in the /web/assets/img/banner-light.png location

@BobHasNoSoul
Copy link
Owner

BobHasNoSoul commented May 13, 2024

* I'm looking through the web directory for references to `document.title` and inside `index.jsx` there is the following string: `document.title = globalize.translateHtml(document.title, 'core');`. I'm not great at deciphering this stuff but this seems to me like a translation key whose value is probably hiding _somewhere_. I just can't seem to find it anywhere. Help appreciated.

index.jsx
[email protected]
main.jellyfin.bundle.js
73233.286cf9810333727af45b.chunk.js
playback-video.383a3165348e5932b2a1.chunk.js
libraries/wasm-gen/libarchive.js
libraries/subtitles-octopus-worker-legacy.js
libraries/worker-bundle.js
libraries/subtitles-octopus-worker.js

all of those files contain the document.title string however the core translation seems to be hiding alogn with the rest of the strings for translation..

you can set it to a static one by replacing the occurances of it inside those to

document.title = "FancyFlix";

i will look into this further

update because there is more than one instance you get get this partially working with this workaround script

grep -rl 'document\.title="Jellyfin"' . | while read -r file; do
    sed -i 's/document\.title="Jellyfin"/document\.title="CHANGEME"/g' "$file"
done
grep -rl 'document.title=e||"Jellyfin"' . | while IFS= read -r file; do
    sed -i 's/document.title=e||"Jellyfin"/document.title=e||"CHANGEME"/g' "$file"
done

note you have the change the changeme part to the name you want and then run it as sudo from webroot it will then search through the files and replace the jellyfin name for documents however some pages still say jellyfin.. again more time needed but this is a start

@BobHasNoSoul
Copy link
Owner

okay so here is a few that have been updated at some point i need to migrate them into the main readme.md https://github.com/BobHasNoSoul/jellyfin-mods/blob/main/10.9.x.md and more to be added over the weekend. are there any urgents ones you want me to focus on first over others?

@LeviSnoot
Copy link
Contributor Author

LeviSnoot commented May 27, 2024

I have updated my Ansible playbook to work with 10.9.x and figured I could share some of the tasks if anyone wants to set up something similar:

jellyfin-mods.yaml

---
- name: Modifying Jellyfin...
  hosts: all
  remote_user: example

  tasks:
    - name: Stopping Jellyfin Service...
      ansible.builtin.service:
        name: jellyfin
        state: stopped
      become: true

    - name: Enabling backdrops for all users...
      ansible.builtin.replace:
        path: /usr/share/jellyfin/web/main.jellyfin.bundle.js
        regexp: 'enableBackdrops:function\(\){return _}'
        replace: "enableBackdrops:function(){return P}"
      become: true

    - name: Adding banner to sidebar...
      ansible.builtin.replace:
        path: /usr/share/jellyfin/web/73233.bce0f70761dae6c47906.chunk.js
        regexp: >-
          <div style="height:\.5em;"><\/div>
        replace: >-
          <div style="height:.5em;"></div>',n+='<a href="#/home.html"><img
          src="/web/assets/img/banner-light.png" width=250px style="padding:
          5px;display:block; margin-left: auto; margin-right: auto;
          margin-top: 10px; margin-bottom: 10px;"></a>
      become: true

    - name: Setting pagination to infinite for all users...
      ansible.builtin.replace:
        path: /usr/share/jellyfin/web/main.jellyfin.bundle.js
        regexp: 'var t=parseInt\(this\.get\("libraryPageSize",!1\),10\);return 0===t\?0:t\|\|100}}'
        replace: 'var t=parseInt(this.get("libraryPageSize",!1),10);return 0===t?0:t||0}}'
      become: true

    - name: Changing page title (step 1/6)...
      ansible.builtin.replace:
        path: /usr/share/jellyfin/web/73233.bce0f70761dae6c47906.chunk.js
        regexp: 'document\.title="Jellyfin"'
        replace: 'document.title="CHANGEME"'
      become: true

    - name: Changing page title (step 2/6)...
      ansible.builtin.replace:
        path: /usr/share/jellyfin/web/73233.bce0f70761dae6c47906.chunk.js
        regexp: 'document\.title=e\|\|"Jellyfin"'
        replace: 'document.title=e||"CHANGEME"'
      become: true

    - name: Changing page title (step 3/6)...
      ansible.builtin.replace:
        path: /usr/share/jellyfin/web/index.html
        regexp: '<meta name="application-name" content="Jellyfin">'
        replace: >-
          <meta name="application-name" content="CHANGEME">
      become: true

    - name: Changing page title (step 4/6)...
      ansible.builtin.replace:
        path: /usr/share/jellyfin/web/fd4301fdc170fd202474.json
        regexp: >-
          \"name\": \"Jellyfin\"
        replace: >-
          "name": "CHANGEME"
      become: true

    - name: Changing page title (step 5/6)...
      ansible.builtin.replace:
        path: /usr/share/jellyfin/web/fd4301fdc170fd202474.json
        regexp: >-
          \"short_name\": \"Jellyfin\"
        replace: >-
          "short_name": "CHANGEME"
      become: true

    - name: Changing page title (step 6/6)...
      ansible.builtin.replace:
        path: /usr/share/jellyfin/web/index.html
        regexp: '<title>Jellyfin<\/title>'
        replace: >-
          <title>CHANGEME</title>
      become: true

    - name: Starting Jellyfin Service...
      ansible.builtin.service:
        name: jellyfin
        state: restarted
      become: true

(You need to run this playbook with -K or --ask-become-pass so Ansible will prompt you for the servers root password for the become commands.)

EDIT: I have now created a more detailed document on this as a pull request here: #23

@LeviSnoot
Copy link
Contributor Author

Just updated to 10.9.5 and the file 73233.bce0f70761dae6c47906.chunk.js has been replaced with 73233.4d2a29454aacb263d3bf.chunk.js.

@Netfreak25
Copy link

moved further to 73233.87c77dce22de92e7c77a.chunk.js
but its always a single file 73233.*.chunk.js

Same for playback-video.*.chunk.js

@Netfreak25
Copy link

Netfreak25 commented Aug 2, 2024

moved further to 73233.87c77dce22de92e7c77a.chunk.js but its always a single file 73233.*.chunk.js

Same for playback-video.*.chunk.js

For Linux with bash this should work:

#!/bin/bash
CURRENT_NAME="Jellyfin"
TARGET_NAME="My Jellyfin Instance"
JELLYFIN_DIRECTORY="/usr/share/jellyfin/web/"
files=( "index.html" "index.jsx" "[email protected]" "main.jellyfin.bundle.js" "libraries/wasm-gen/libarchive.js" "libraries/subtitles-octopus-worker-legacy.js" "libraries/worker-bundle.js" "libraries/subtitles-octopus-worker.js" "73233.*.chunk.js" "playback-video.*.chunk.js" )

# Do not change below
clear
cd $JELLYFIN_DIRECTORY

echo "Checking if all Files are available"
echo

myerror=0
for i in "${files[@]}"
do
 ls $i >/dev/null 2>&1 || export myerror=1
done

if [ "$myerror" -eq "1" ]
then
  echo "At least one file was missing:"
  for i in "${files[@]}"
  do
   echo " -"$(ls $i 2>&1 | grep "No such file or directory" | cut -c 19- | rev | cut -c 28- | rev) | grep -x '.\{4,200\}'
   done
  echo
  echo "Renaming might not work properly!!"
else
  echo "All files found, were good to go!!"
fi

echo
echo
echo "Renaming now..."
read -n 1 -s -r -p "Press any key to continue"

function myrename {
file=$1
grep -rl 'document\.title="'$CURRENT_NAME'"' . | while read -r file; do
    sed -i 's/document\.title="'$CURRENT_NAME'"/document\.title="'$TARGET_NAME'"/g' "$file"
done
grep -rl '<title>'$CURRENT_NAME . | while read -r file; do
    sed -i 's/<title>'$CURRENT_NAME'/<title>'$TARGET_NAME'/' "$file"
done
grep -rl 'document.title=e||"'$CURRENT_NAME'"' . | while IFS= read -r file; do
    sed -i 's/document.title=e||"'$CURRENT_NAME'"/document.title=e||"'$TARGET_NAME'"/g' "$file"
done
}

for i in "${files[@]}"
do
 myrename $i
done

echo "done renaming Jellyfin Title"

@LeviSnoot
Copy link
Contributor Author

moved further to 73233.87c77dce22de92e7c77a.chunk.js but its always a single file 73233..chunk.js
Same for playback-video.
.chunk.js

I haven't found a way to select files in Ansible this way yet, so for the time being I'm updating the docs for that manually, but I'll do more research on it because it'd be a much neater solution than the current one. Good stuff with the bash script!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants