diff --git a/app/Helpers/Upload.php b/app/Helpers/Upload.php index af40c2f..0d505b4 100644 --- a/app/Helpers/Upload.php +++ b/app/Helpers/Upload.php @@ -77,11 +77,19 @@ class Upload { // Getting the IP limit configuration $ips = config('sharing.upload_ip_limit'); + if (empty($ips)) { + return true; + } + + $ips = explode(',', $ips); + // If set and not empty, checking client's IP if (! empty($ips) && count($ips) > 0) { $valid = false; foreach ($ips as $ip) { + $ip = trim($ip); + // Client's IP appears in the whitelist if (self::isValidIp($current_ip, $ip)) { $valid = true; diff --git a/config/sharing.php b/config/sharing.php index 8abe3c3..f400d12 100644 --- a/config/sharing.php +++ b/config/sharing.php @@ -13,9 +13,5 @@ return [ ** 3. CIDR Format (192.168.10/24) OR 1.2.3.4/255.255.255.0 ** 4. Start-end IP (192.168.10.0-192.168.10.10) */ - 'upload_ip_limit' => [ - '127.0.0.1' - ] - - + 'upload_ip_limit' => env('UPLOAD_LIMIT_IPS', null), ];