mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Re-add configuration page for OpenSubtitles
This commit is contained in:
parent
c7ce1ac8ec
commit
76d3fcfbb6
4 changed files with 82 additions and 0 deletions
|
@ -297,6 +297,11 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
|
|||
icon: "swap_horiz",
|
||||
href: "encodingsettings.html",
|
||||
pageIds: ["encodingSettingsPage"]
|
||||
}, {
|
||||
name: "Open Subtitles",
|
||||
href: "opensubtitles.html",
|
||||
pageIds: ["openSubtitlesPage"],
|
||||
icon: "closed_caption"
|
||||
}];
|
||||
addPluginPagesToMainMenu(links, pluginItems, "server");
|
||||
links.push({
|
||||
|
|
36
src/scripts/opensubtitles.js
Normal file
36
src/scripts/opensubtitles.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
define(["loading", "fnchecked", "emby-linkbutton", "emby-input", "emby-checkbox", "emby-button"], function (loading) {
|
||||
"use strict";
|
||||
|
||||
function loadPage(page, config) {
|
||||
page.querySelector("#txtOpenSubtitleUsername").value = config.OpenSubtitlesUsername;
|
||||
page.querySelector("#txtOpenSubtitlePassword").value = config.OpenSubtitlesPasswordHash || "";
|
||||
loading.hide();
|
||||
}
|
||||
|
||||
function onSubmit(e__q) {
|
||||
e__q.preventDefault();
|
||||
loading.show();
|
||||
var form = this;
|
||||
ApiClient.getNamedConfiguration("subtitles").then(function (config) {
|
||||
config.OpenSubtitlesUsername = form.querySelector("#txtOpenSubtitleUsername").value;
|
||||
var newPassword = form.querySelector("#txtOpenSubtitlePassword").value;
|
||||
|
||||
if (newPassword) {
|
||||
config.OpenSubtitlesPasswordHash = newPassword;
|
||||
}
|
||||
|
||||
ApiClient.updateNamedConfiguration("subtitles", config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
$(document).on("pageinit", "#openSubtitlesPage", function() {
|
||||
$(".metadataSubtitlesForm").off("submit", onSubmit).on("submit", onSubmit)
|
||||
}).on("pageshow", "#openSubtitlesPage", function() {
|
||||
loading.show();
|
||||
var page = this;
|
||||
ApiClient.getNamedConfiguration("subtitles").then(function (response) {
|
||||
loadPage(page, response);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -512,6 +512,11 @@ var Dashboard = {
|
|||
dependencies: [],
|
||||
autoFocus: !1,
|
||||
roles: "admin"
|
||||
}), defineRoute({
|
||||
path: "/opensubtitles.html",
|
||||
dependencies: [],
|
||||
autoFocus: !1,
|
||||
roles: "admin"
|
||||
}), defineRoute({
|
||||
path: "/forgotpassword.html",
|
||||
dependencies: ["emby-input", "emby-button"],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue