mirror of
https://github.com/jellyfin/jellyfin-plugin-opds.git
synced 2024-11-23 22:29:47 +00:00
Remove unused config
This commit is contained in:
parent
099c3deb20
commit
9ce1753506
@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using MediaBrowser.Model.Plugins;
|
||||
|
||||
namespace Jellyfin.Plugin.Opds.Configuration;
|
||||
@ -14,16 +13,10 @@ public class PluginConfiguration : BasePluginConfiguration
|
||||
public PluginConfiguration()
|
||||
{
|
||||
AllowAnonymousAccess = false;
|
||||
BookLibraries = Array.Empty<Guid>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the api should allow anonymous access.
|
||||
/// </summary>
|
||||
public bool AllowAnonymousAccess { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of book libraries.
|
||||
/// </summary>
|
||||
public Guid[] BookLibraries { get; set; }
|
||||
}
|
||||
|
@ -18,21 +18,11 @@
|
||||
<input id="chkAllowAnonymous" type="checkbox" is="emby-checkbox" />
|
||||
<span>Allow Anonymous Access</span>
|
||||
</label>
|
||||
<label>Book Libraries:</label>
|
||||
<div id="library-wrapper">
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<button id="saveConfig" is="emby-button" type="submit" class="raised button-submit block">
|
||||
<span>Save</span>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<template id="library-template">
|
||||
<label class="checkboxContainer">
|
||||
<input is="emby-checkbox" type="checkbox" data-name="chkLibrary"/>
|
||||
<span data-name="libraryName"></span>
|
||||
</label>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -3,43 +3,20 @@ export default function (view){
|
||||
const Plugin = {
|
||||
pluginId: 'F30880AE-3365-449E-B9E6-BF133C8401B0',
|
||||
chkAllowAnonymous: document.querySelector('#chkAllowAnonymous'),
|
||||
libraryWrapper: document.querySelector('#library-wrapper'),
|
||||
libraryTemplate: document.querySelector('#library-template'),
|
||||
|
||||
init: async function(){
|
||||
const config = await window.ApiClient.getPluginConfiguration(Plugin.pluginId);
|
||||
const virtualFolders = await window.ApiClient.getVirtualFolders();
|
||||
for(const folder of virtualFolders){
|
||||
const template = Plugin.libraryTemplate.cloneNode(true).content;
|
||||
const name = template.querySelector('[data-name=libraryName]');
|
||||
const value = template.querySelector('[data-name=chkLibrary]');
|
||||
|
||||
name.innerText = folder.Name;
|
||||
value.dataset.value = folder.ItemId;
|
||||
value.checked = config.BookLibraries.includes(folder.ItemId);
|
||||
|
||||
Plugin.libraryWrapper.appendChild(template);
|
||||
}
|
||||
|
||||
Plugin.chkAllowAnonymous.checked = config.AllowAnonymousAccess;
|
||||
|
||||
document.querySelector("#saveConfig").addEventListener("click", Plugin.saveConfig);
|
||||
},
|
||||
getLibraries: function(){
|
||||
const checkboxes = Plugin.libraryWrapper.querySelectorAll('[data-name=chkLibrary]:checked');
|
||||
const libraries = [];
|
||||
for(const checkbox of checkboxes) {
|
||||
libraries.push(checkbox.dataset.value);
|
||||
}
|
||||
|
||||
return libraries;
|
||||
},
|
||||
saveConfig: function(e){
|
||||
e.preventDefault();
|
||||
|
||||
const config = {};
|
||||
|
||||
config.AllowAnonymousAccess = Plugin.chkAllowAnonymous.checked;
|
||||
config.BookLibraries = Plugin.getLibraries();
|
||||
|
||||
window.ApiClient.updatePluginConfiguration(Plugin.pluginId, config).then(Dashboard.processPluginConfigurationUpdateResult);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user