mirror of
https://github.com/Viren070/AIOStreams.git
synced 2025-12-01 23:14:04 +01:00
feat(frontend): don't allow duplicate addons
This commit is contained in:
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user