forked from mirror/pixelfed
Update SettingsController
This commit is contained in:
parent
bcfbb0299c
commit
20caabc358
1 changed files with 6 additions and 4 deletions
|
@ -10,6 +10,7 @@ use App\UserFilter;
|
||||||
use Auth, Cookie, DB, Cache, Purify;
|
use Auth, Cookie, DB, Cache, Purify;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
use App\Http\Controllers\Settings\{
|
use App\Http\Controllers\Settings\{
|
||||||
ExportSettings,
|
ExportSettings,
|
||||||
LabsSettings,
|
LabsSettings,
|
||||||
|
@ -188,12 +189,12 @@ class SettingsController extends Controller
|
||||||
'opencollective' => 'nullable|string'
|
'opencollective' => 'nullable|string'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$patreon = $request->input('patreon');
|
$patreon = Str::startsWith($request->input('patreon'), 'patreon.com/') ? e($request->input('patreon')) : null;
|
||||||
$liberapay = $request->input('liberapay');
|
$liberapay = Str::startsWith($request->input('liberapay'), 'liberapay.com/') ? e($request->input('liberapay')) : null;
|
||||||
$opencollective = $request->input('opencollective');
|
$opencollective = Str::startsWith($request->input('opencollective'), 'opencollective.com/') ? e($request->input('opencollective')) : null;
|
||||||
|
|
||||||
if(empty($patreon) && empty($liberapay) && empty($opencollective)) {
|
if(empty($patreon) && empty($liberapay) && empty($opencollective)) {
|
||||||
abort(400, 'Bad request');
|
return redirect(route('settings'))->with('error', 'An error occured. Please try again later.');;
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = [
|
$res = [
|
||||||
|
@ -210,5 +211,6 @@ class SettingsController extends Controller
|
||||||
$sponsors = $res;
|
$sponsors = $res;
|
||||||
return redirect(route('settings'))->with('status', 'Sponsor settings successfully updated!');;
|
return redirect(route('settings'))->with('status', 'Sponsor settings successfully updated!');;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue