mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2026-06-30 06:50:24 +00:00
🔥 Remove PowerGrid and related dependencies
- ❌ Deleted PowerGrid configuration file. - 🔄 Removed `power-components/livewire-powergrid` and its dependencies (e.g., `simplesoftwareio/simple-qrcode` and `calebporzio/sushi`) from `composer.json` and `composer.lock`. - 🧼 Cleaned up references to PowerGrid in CSS, JS, tests, and package files. - 🛠️ Refactored `SecurityMonitor` to eliminate unused methods (`getAttemptsFromIp` and `isIpSuspicious`) dependent on deprecated functionality.
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Services;
|
||||
use App\Models\SecurityAttempt;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Str;
|
||||
use Throwable;
|
||||
|
||||
class SecurityMonitor
|
||||
@@ -103,23 +104,6 @@ class SecurityMonitor
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getAttemptsFromIp(string $ip, int $hours = 24): int
|
||||
{
|
||||
try {
|
||||
return SecurityAttempt::query()
|
||||
->fromIp($ip)
|
||||
->recent($hours)
|
||||
->count();
|
||||
} catch (Throwable) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function isIpSuspicious(string $ip, int $threshold = 10, int $hours = 24): bool
|
||||
{
|
||||
return $this->getAttemptsFromIp($ip, $hours) >= $threshold;
|
||||
}
|
||||
|
||||
private function extractComponentName(Request $request): ?string
|
||||
{
|
||||
try {
|
||||
@@ -224,14 +208,6 @@ class SecurityMonitor
|
||||
|
||||
private function truncate(?string $value, int $length): ?string
|
||||
{
|
||||
if ($value === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (strlen($value) <= $length) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
return substr($value, 0, $length - 3).'...';
|
||||
return $value === null ? null : Str::limit($value, $length - 3);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user