BobHasNoSoul / jellyfin-mods

This is just a guide for various modifications and dumping ground for jellyfin mods so i dont have to make a new jftool for every platform and revision
300 stars 15 forks source link

Compatibility with 10.9.x #18

Open LeviSnoot opened 3 months ago

LeviSnoot commented 3 months ago

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 commented 2 months ago

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 commented 1 month ago

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 commented 1 month ago

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

LeviSnoot commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago
* 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 node_modules.@mui.x-data-grid.d16d629f2abd61a21fbe.chunk.js 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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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