[addon] populate existing config values in template
This commit is contained in:
@@ -185,7 +185,11 @@ button:active {
|
|||||||
const { Providers } = require('./manifest');
|
const { Providers } = require('./manifest');
|
||||||
const { SortType } = require('./sort');
|
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 background = manifest.background || 'https://dl.strem.io/addon-background.jpg';
|
||||||
const logo = manifest.logo || 'https://dl.strem.io/addon-logo.png';
|
const logo = manifest.logo || 'https://dl.strem.io/addon-logo.png';
|
||||||
const contactHTML = manifest.contactEmail ?
|
const contactHTML = manifest.contactEmail ?
|
||||||
@@ -266,6 +270,8 @@ function landingTemplate(manifest, providers = [], realDebridApiKey = '') {
|
|||||||
});
|
});
|
||||||
$('#iProviders').multiselect('select', [${providers.map(provider => '"' + provider + '"')}]);
|
$('#iProviders').multiselect('select', [${providers.map(provider => '"' + provider + '"')}]);
|
||||||
$('#iRealDebrid').val("${realDebridApiKey}");
|
$('#iRealDebrid').val("${realDebridApiKey}");
|
||||||
|
$('#iSort').val("${sort}");
|
||||||
|
$('#iLimit').val("${limit}");
|
||||||
generateInstallLink();
|
generateInstallLink();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ function manifest({ providers, realdebrid } = {}) {
|
|||||||
name: 'Torrentio',
|
name: 'Torrentio',
|
||||||
description: '[BETA] Provides torrent streams from scraped torrent providers.'
|
description: '[BETA] Provides torrent streams from scraped torrent providers.'
|
||||||
+ ` ${providersDesc} ${providersList.join(', ')}${realDebridDesc}.`
|
+ ` ${providersDesc} ${providersList.join(', ')}${realDebridDesc}.`
|
||||||
+ ' To configure providers,RealDebrid support and other settings visit www.torrentio.now.sh',
|
+ ' To configure providers, RealDebrid support and other settings visit www.torrentio.now.sh',
|
||||||
catalogs: [],
|
catalogs: [],
|
||||||
resources: ['stream'],
|
resources: ['stream'],
|
||||||
types: ['movie', 'series'],
|
types: ['movie', 'series'],
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ router.get('/', (_, res) => {
|
|||||||
|
|
||||||
router.get('/:configuration', (req, res) => {
|
router.get('/:configuration', (req, res) => {
|
||||||
const configValues = parseConfiguration(req.params.configuration);
|
const configValues = parseConfiguration(req.params.configuration);
|
||||||
const landingHTML = landingTemplate(manifest(configValues), configValues.providers, configValues.realdebrid);
|
const landingHTML = landingTemplate(manifest(configValues), configValues);
|
||||||
res.setHeader('content-type', 'text/html');
|
res.setHeader('content-type', 'text/html');
|
||||||
res.end(landingHTML);
|
res.end(landingHTML);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user