[fix]: various issues discovered during testing (#3002)
* fix: prevent invalid calls to exchange APIs * fix: audit conditions * fix: audit filtering
This commit is contained in:
parent
89d85a0d7e
commit
048aff3db4
5 changed files with 17 additions and 10 deletions
|
|
@ -134,6 +134,7 @@ class AuditMiddleware(BaseHTTPMiddleware):
|
||||||
assert response
|
assert response
|
||||||
return response
|
return response
|
||||||
finally:
|
finally:
|
||||||
|
if request_details:
|
||||||
duration = (datetime.now(timezone.utc) - start_time).total_seconds()
|
duration = (datetime.now(timezone.utc) - start_time).total_seconds()
|
||||||
await self._log_audit(request, response, duration, request_details)
|
await self._log_audit(request, response, duration, request_details)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -695,7 +695,9 @@ class AuditSettings(LNbitsSettings):
|
||||||
if _re_fullmatch_safe(exclude_path, path):
|
if _re_fullmatch_safe(exclude_path, path):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if len(self.lnbits_audit_include_paths) != 0:
|
if len(self.lnbits_audit_include_paths) == 0:
|
||||||
|
return True
|
||||||
|
|
||||||
if not path:
|
if not path:
|
||||||
return False
|
return False
|
||||||
for include_path in self.lnbits_audit_include_paths:
|
for include_path in self.lnbits_audit_include_paths:
|
||||||
|
|
|
||||||
2
lnbits/static/bundle.min.js
vendored
2
lnbits/static/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -357,6 +357,7 @@ window.LNbits = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
prepareFilterQuery(tableConfig, props) {
|
prepareFilterQuery(tableConfig, props) {
|
||||||
|
tableConfig.filter = tableConfig.filter || {}
|
||||||
if (props) {
|
if (props) {
|
||||||
tableConfig.pagination = props.pagination
|
tableConfig.pagination = props.pagination
|
||||||
Object.assign(tableConfig.filter, props.filter)
|
Object.assign(tableConfig.filter, props.filter)
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ currencies = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def allowed_currencies():
|
def allowed_currencies() -> list[str]:
|
||||||
if len(settings.lnbits_allowed_currencies) > 0:
|
if len(settings.lnbits_allowed_currencies) > 0:
|
||||||
return [
|
return [
|
||||||
item
|
item
|
||||||
|
|
@ -187,6 +187,9 @@ def allowed_currencies():
|
||||||
|
|
||||||
|
|
||||||
async def btc_rates(currency: str) -> list[tuple[str, float]]:
|
async def btc_rates(currency: str) -> list[tuple[str, float]]:
|
||||||
|
if currency.upper() not in allowed_currencies():
|
||||||
|
raise ValueError(f"Currency '{currency}' not allowed.")
|
||||||
|
|
||||||
def replacements(ticker: str):
|
def replacements(ticker: str):
|
||||||
return {
|
return {
|
||||||
"FROM": "BTC",
|
"FROM": "BTC",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue