[fix] callback url validation (#2959)

This commit is contained in:
Vlad Stan
2025-02-13 15:11:46 +02:00
committed by GitHub
parent b76d8b5458
commit bfa23568e3
14 changed files with 139 additions and 5 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+4
View File
@@ -248,6 +248,10 @@ window.localisation.en = {
allow_access_hint: 'Allow access by IP (will override blocked IPs)',
enter_ip: 'Enter IP and hit enter',
rate_limiter: 'Rate Limiter',
callback_url_rules: 'Callback URL Rules',
enter_callback_url_rule: 'Enter URL rule as regex and hit enter',
callback_url_rule_hint:
'Callback URLs (like LNURL one) will be validated against all of these rules. No rule means all URLs are allowed.',
wallet_limiter: 'Wallet Limiter',
wallet_config: 'Wallet Config',
wallet_charts: 'Wallet Charts',
+23
View File
@@ -56,6 +56,7 @@ window.AdminPageLogic = {
formAddExtensionsManifest: '',
nostrNotificationIdentifier: '',
formAllowedIPs: '',
formCallbackUrlRule: '',
formBlockedIPs: '',
nostrAcceptedUrl: '',
formAddIncludePath: '',
@@ -331,6 +332,28 @@ window.AdminPageLogic = {
b => b !== blocked_ip
)
},
addCallbackUrlRule() {
const allowedCallback = this.formCallbackUrlRule.trim()
const allowedCallbacks = this.formData.lnbits_callback_url_rules
if (
allowedCallback &&
allowedCallback.length &&
!allowedCallbacks.includes(allowedCallback)
) {
this.formData.lnbits_callback_url_rules = [
...allowedCallbacks,
allowedCallback
]
this.formCallbackUrlRule = ''
}
},
removeCallbackUrlRule(allowedCallback) {
const allowedCallbacks = this.formData.lnbits_callback_url_rules
this.formData.lnbits_callback_url_rules = allowedCallbacks.filter(
a => a !== allowedCallback
)
},
addNostrUrl() {
const url = this.nostrAcceptedUrl.trim()
this.removeNostrUrl(url)