Minor UX and code improvements

This commit is contained in:
Bruno Bernardino
2024-12-06 06:08:15 +00:00
parent 63a39970fa
commit e08188b58b
3 changed files with 10 additions and 8 deletions

View File

@@ -25,9 +25,9 @@ export function isRunningLocally(request: Request): boolean {
// Private IP ranges check
const ipParts = hostname.split('.').map(Number);
// Check if valid IP address
if (ipParts.length !== 4 || ipParts.some(part => isNaN(part) || part < 0 || part > 255)) {
// Check if the IP address is valid
if (ipParts.length !== 4 || ipParts.some((part) => isNaN(part) || part < 0 || part > 255)) {
return false;
}
@@ -47,7 +47,8 @@ export function isRunningLocally(request: Request): boolean {
}
return false;
} catch {
} catch (error) {
console.info('Failed to check if the request is running locally', error);
return false;
}
}