2828 </tbody >
2929 </table >
3030
31+ <NcCheckboxRadioSwitch :model-value =" isApplyAllowListToRateLimitEnabled"
32+ :disabled =" loading"
33+ type =" switch"
34+ @update:model-value =" saveApplyAllowListToRateLimit" >
35+ {{ t('spreed', 'Apply whitelist to rate limit') }}
36+ </NcCheckboxRadioSwitch >
37+
3138 <h3 >{{ t('bruteforcesettings', 'Add a new whitelist') }}</h3 >
3239 <div class =" whitelist__form" >
3340 <NcInputField id =" ip"
@@ -71,6 +78,7 @@ import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
7178import NcNoteCard from ' @nextcloud/vue/dist/Components/NcNoteCard.js'
7279import NcSettingsSection from ' @nextcloud/vue/dist/Components/NcSettingsSection.js'
7380import NcInputField from ' @nextcloud/vue/dist/Components/NcInputField.js'
81+ import NcCheckboxRadioSwitch from ' @nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js'
7482
7583import PlusIcon from ' vue-material-design-icons/Plus.vue'
7684
@@ -84,6 +92,7 @@ export default {
8492 NcButton,
8593 NcNoteCard,
8694 NcSettingsSection,
95+ NcCheckboxRadioSwitch,
8796 NcInputField,
8897 PlusIcon,
8998 },
@@ -97,6 +106,8 @@ export default {
97106 remoteAddress: ' ' ,
98107 delay: 0 ,
99108 isBypassListed: false ,
109+ isApplyAllowListToRateLimitEnabled: false ,
110+ loading: false ,
100111 }
101112 },
102113
@@ -128,6 +139,7 @@ export default {
128139 this .remoteAddress = loadState (' bruteforcesettings' , ' remote-address' , ' 127.0.0.1' )
129140 this .isBypassListed = loadState (' bruteforcesettings' , ' bypass-listed' , false )
130141 this .delay = loadState (' bruteforcesettings' , ' delay' , 0 )
142+ this .isApplyAllowListToRateLimitEnabled = OCP .AppConfig .getValue (' bruteforcesettings' , ' apply_allowlist_to_ratelimit' )
131143
132144 axios .get (generateUrl (' apps/bruteforcesettings/ipwhitelist' ))
133145 .then ((response ) => {
@@ -157,6 +169,16 @@ export default {
157169 showError (t (' bruteforcesettings' , ' There was an error adding the IP to the whitelist.' ))
158170 }
159171 },
172+
173+ saveApplyAllowListToRateLimit (value ) {
174+ this .loading = true
175+ OCP .AppConfig .setValue (' bruteforcesettings' , ' apply_allowlist_to_ratelimit' , value ? 1 : 0 , {
176+ success : () => {
177+ this .loading = false
178+ this .isApplyAllowListToRateLimitEnabled = value
179+ },
180+ })
181+ },
160182 },
161183}
162184 </script >
0 commit comments