[addon] adds configurable support

This commit is contained in:
TheBeastLT
2020-05-26 18:35:00 +02:00
parent 05c55af5c4
commit 3c31c040c3
2 changed files with 8 additions and 5 deletions

View File

@@ -35,6 +35,10 @@ function manifest(config = {}) {
idPrefixes: ['tt', 'kitsu'],
background: `https://i.ibb.co/VtSfFP9/t8wVwcg.jpg`,
logo: `https://i.ibb.co/w4BnkC9/GwxAcDV.png`,
behaviorHints: {
configurable: true,
configurationRequired: false
}
}
}

View File

@@ -16,13 +16,12 @@ const limiter = rateLimit({
router.use(limiter);
router.get('/', (_, res) => {
const landingHTML = landingTemplate(manifest());
res.setHeader('content-type', 'text/html');
res.end(landingHTML);
res.redirect('/configure')
res.end();
});
router.get('/:configuration', (req, res) => {
const configValues = parseConfiguration(req.params.configuration);
router.get('/:configuration?/configure', (req, res) => {
const configValues = parseConfiguration(req.params.configuration || '');
const landingHTML = landingTemplate(manifest(configValues), configValues);
res.setHeader('content-type', 'text/html');
res.end(landingHTML);