forked from mirror/pixelfed
Update PrivacySettings
This commit is contained in:
parent
95807c93e5
commit
74b76ac175
|
@ -10,6 +10,7 @@ use App\Profile;
|
||||||
use App\User;
|
use App\User;
|
||||||
use App\UserFilter;
|
use App\UserFilter;
|
||||||
use App\Util\Lexer\PrettyNumber;
|
use App\Util\Lexer\PrettyNumber;
|
||||||
|
use App\Util\ActivityPub\Helpers;
|
||||||
use Auth, Cache, DB;
|
use Auth, Cache, DB;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
@ -134,9 +135,13 @@ trait PrivacySettings
|
||||||
public function blockedInstanceStore(Request $request)
|
public function blockedInstanceStore(Request $request)
|
||||||
{
|
{
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'domain' => 'required|active_url'
|
'domain' => 'required|url|min:1|max:120'
|
||||||
]);
|
]);
|
||||||
$domain = $request->input('domain');
|
$domain = $request->input('domain');
|
||||||
|
if(Helpers::validateUrl($domain) == false) {
|
||||||
|
return abort(400, 'Invalid domain');
|
||||||
|
}
|
||||||
|
$domain = parse_url($domain, PHP_URL_HOST);
|
||||||
$instance = Instance::firstOrCreate(['domain' => $domain]);
|
$instance = Instance::firstOrCreate(['domain' => $domain]);
|
||||||
$filter = new UserFilter;
|
$filter = new UserFilter;
|
||||||
$filter->user_id = Auth::user()->profile->id;
|
$filter->user_id = Auth::user()->profile->id;
|
||||||
|
|
Loading…
Reference in New Issue