[addon] populate existing config values in template

This commit is contained in:
TheBeastLT
2020-03-19 20:01:59 +01:00
parent e8390ad2a5
commit 25aafc7555
3 changed files with 9 additions and 3 deletions

View File

@@ -185,7 +185,11 @@ button:active {
const { Providers } = require('./manifest');
const { SortType } = require('./sort');
function landingTemplate(manifest, providers = [], realDebridApiKey = '') {
function landingTemplate(manifest, config = {}) {
const providers = config.providers || [];
const realDebridApiKey = config.realdebrid || '';
const sort = config.sort === SortType.SEEDERS ? SortType.SEEDERS : SortType.QUALITY;
const limit = config.limit || '';
const background = manifest.background || 'https://dl.strem.io/addon-background.jpg';
const logo = manifest.logo || 'https://dl.strem.io/addon-logo.png';
const contactHTML = manifest.contactEmail ?
@@ -266,6 +270,8 @@ function landingTemplate(manifest, providers = [], realDebridApiKey = '') {
});
$('#iProviders').multiselect('select', [${providers.map(provider => '"' + provider + '"')}]);
$('#iRealDebrid').val("${realDebridApiKey}");
$('#iSort').val("${sort}");
$('#iLimit').val("${limit}");
generateInstallLink();
});