This plugin is no longer actively maintained. Please use the fork Jellyfin JavaScript Injector by @n00bcodr, which is more actively maintained and includes more features.
This plugin allows you to inject custom JavaScript code into the Jellyfin web UI. It provides a configuration page with a text area where you can enter any JavaScript code, which will then be executed when the Jellyfin web interface loads.
The client script will fail to inject automatically into the jellyfin-web server if there is a difference in permission between the owner of the web files (root, or www-data, etc.) and the executor of the main jellyfin-server. You will see an error in your Jellyfin server logs in this case, like
[2025-03-09 19:30:41.162 +00:00] [ERR] [1] Jellyfin.Plugin.CustomJavaScript.Plugin: Encountered exception while writing to "/usr/share/jellyfin/web/index.html": "System.UnauthorizedAccessException: Access to the path '/usr/share/jellyfin/web/index.html' is denied.
If this happens, you can mitigate the issue by
docker cp jellyfin_server_1:/usr/share/jellyfin/web/index.html /your/jellyfin/config/path/index.htmlvolume mapping, like - /your/jellyfin/config/path/index.html:/usr/share/jellyfin/web/index.htmlThis way, the plugin will have appropriate permissions to inject javascript into the index.html file.
Dashboard -> Plugins -> Catalog -> Gear Icon (upper left) add and a repository.Here are some examples of what you can do with custom JavaScript:
console.log("hello from the plugin");
const userNameToShowCustomCss = 'guest'
const customCSS = document.createElement('style');
customCSS.textContent = `
.skinHeader::after {
content: "NOTICE: This banner CSS was created via custom javascript! You'll only see this when logged in as ${userNameToShowCustomCss}$";
display: block;
position: relative;
background-color: #fbc531;
color: #192a56;
left: 50%;
transform: translateX(-50%);
width: fit-content;
text-align: center;
width: 100%;
padding: 10px;
}
.homeSectionsContainer {
margin-top: 50px;
}
`;
const userButton = document.querySelector(".headerUserButton");
if (userButton.title.toLowerCase() === userNameToShowCustomCss) {
document.head.appendChild(customCSS);
}
Clone the repository:
git clone https://github.com/johnpc/jellyfin-plugin-custom-javascript.git
Build the plugin:
dotnet build
The compiled dll will be in the bin/Debug/net6.0 directory
Plugin.cs - The main plugin classConfiguration/PluginConfiguration.cs - Defines the configuration modelConfiguration/configPage.html - The HTML for the configuration pageWeb/customjavascript.js - The JavaScript file that injects custom code into JellyfinThis plugin is licensed under the MIT License.
Be careful when using custom JavaScript as it can potentially introduce security vulnerabilities. Only use code from trusted sources or that you fully understand. The plugin author is not responsible for any issues caused by custom code entered by users.
18 commits
JavaScript
38.5%
C#
29.2%
HTML
17.8%
Shell
11.1%
Makefile
3.4%
This plugin is no longer actively maintained. Please use the fork Jellyfin JavaScript Injector by @n00bcodr, which is more actively maintained and includes more features.
This plugin allows you to inject custom JavaScript code into the Jellyfin web UI. It provides a configuration page with a text area where you can enter any JavaScript code, which will then be executed when the Jellyfin web interface loads.
The client script will fail to inject automatically into the jellyfin-web server if there is a difference in permission between the owner of the web files (root, or www-data, etc.) and the executor of the main jellyfin-server. You will see an error in your Jellyfin server logs in this case, like
[2025-03-09 19:30:41.162 +00:00] [ERR] [1] Jellyfin.Plugin.CustomJavaScript.Plugin: Encountered exception while writing to "/usr/share/jellyfin/web/index.html": "System.UnauthorizedAccessException: Access to the path '/usr/share/jellyfin/web/index.html' is denied.
If this happens, you can mitigate the issue by
docker cp jellyfin_server_1:/usr/share/jellyfin/web/index.html /your/jellyfin/config/path/index.htmlvolume mapping, like - /your/jellyfin/config/path/index.html:/usr/share/jellyfin/web/index.htmlThis way, the plugin will have appropriate permissions to inject javascript into the index.html file.
Dashboard -> Plugins -> Catalog -> Gear Icon (upper left) add and a repository.Here are some examples of what you can do with custom JavaScript:
console.log("hello from the plugin");
const userNameToShowCustomCss = 'guest'
const customCSS = document.createElement('style');
customCSS.textContent = `
.skinHeader::after {
content: "NOTICE: This banner CSS was created via custom javascript! You'll only see this when logged in as ${userNameToShowCustomCss}$";
display: block;
position: relative;
background-color: #fbc531;
color: #192a56;
left: 50%;
transform: translateX(-50%);
width: fit-content;
text-align: center;
width: 100%;
padding: 10px;
}
.homeSectionsContainer {
margin-top: 50px;
}
`;
const userButton = document.querySelector(".headerUserButton");
if (userButton.title.toLowerCase() === userNameToShowCustomCss) {
document.head.appendChild(customCSS);
}
Clone the repository:
git clone https://github.com/johnpc/jellyfin-plugin-custom-javascript.git
Build the plugin:
dotnet build
The compiled dll will be in the bin/Debug/net6.0 directory
Plugin.cs - The main plugin classConfiguration/PluginConfiguration.cs - Defines the configuration modelConfiguration/configPage.html - The HTML for the configuration pageWeb/customjavascript.js - The JavaScript file that injects custom code into JellyfinThis plugin is licensed under the MIT License.
Be careful when using custom JavaScript as it can potentially introduce security vulnerabilities. Only use code from trusted sources or that you fully understand. The plugin author is not responsible for any issues caused by custom code entered by users.
18 commits
JavaScript
38.5%
C#
29.2%
HTML
17.8%
Shell
11.1%
Makefile
3.4%