mirror of
https://github.com/axeloz/filesharing.git
synced 2025-05-06 10:03:55 +02:00
Moving IPs configuration into .env file
This commit is contained in:
parent
983166742f
commit
ebd1624f03
2 changed files with 9 additions and 5 deletions
|
@ -77,11 +77,19 @@ class Upload {
|
||||||
// Getting the IP limit configuration
|
// Getting the IP limit configuration
|
||||||
$ips = config('sharing.upload_ip_limit');
|
$ips = config('sharing.upload_ip_limit');
|
||||||
|
|
||||||
|
if (empty($ips)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ips = explode(',', $ips);
|
||||||
|
|
||||||
// If set and not empty, checking client's IP
|
// If set and not empty, checking client's IP
|
||||||
if (! empty($ips) && count($ips) > 0) {
|
if (! empty($ips) && count($ips) > 0) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
|
|
||||||
foreach ($ips as $ip) {
|
foreach ($ips as $ip) {
|
||||||
|
$ip = trim($ip);
|
||||||
|
|
||||||
// Client's IP appears in the whitelist
|
// Client's IP appears in the whitelist
|
||||||
if (self::isValidIp($current_ip, $ip)) {
|
if (self::isValidIp($current_ip, $ip)) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
|
@ -13,9 +13,5 @@ return [
|
||||||
** 3. CIDR Format (192.168.10/24) OR 1.2.3.4/255.255.255.0
|
** 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)
|
** 4. Start-end IP (192.168.10.0-192.168.10.10)
|
||||||
*/
|
*/
|
||||||
'upload_ip_limit' => [
|
'upload_ip_limit' => env('UPLOAD_LIMIT_IPS', null),
|
||||||
'127.0.0.1'
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
Loading…
Add table
Reference in a new issue