feat(frontend): don't allow duplicate addons

This commit is contained in:
Viren070
2024-12-26 18:33:00 +00:00
parent d29d254daf
commit 699ce194b9
@@ -385,6 +385,26 @@ export default function Configure() {
const validateConfig = () => {
const config = createConfig();
// check for any duplicate addons where both the ID and options are the same
const duplicateAddons = config.addons.filter(
(addon, index) =>
config.addons.findIndex(
(a) =>
a.id === addon.id &&
JSON.stringify(a.options) === JSON.stringify(addon.options)
) !== index
);
if (duplicateAddons.length > 0) {
showToast(
'Duplicate addons found. Please remove any duplicates',
'error',
'duplicateAddons'
);
return false
}
for (const addon of config.addons) {
// if torbox addon is enabled, torbox service must be enabled and torbox api key must be set
if (addon.id === 'torbox') {