-
-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3583 from Roardom/fix-image-whitelist
(Fix) Whitelisted image url domain matching
- Loading branch information
Showing
10 changed files
with
122 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 0 additions & 59 deletions
59
app/Http/Controllers/Staff/WhitelistedImageDomainController.php
This file was deleted.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
app/Http/Controllers/Staff/WhitelistedImageUrlController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
/** | ||
* NOTICE OF LICENSE. | ||
* | ||
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0 | ||
* The details is bundled with this project in the file LICENSE.txt. | ||
* | ||
* @project UNIT3D Community Edition | ||
* | ||
* @author Roardom <roardom@protonmail.com> | ||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 | ||
*/ | ||
|
||
namespace App\Http\Controllers\Staff; | ||
|
||
use App\Http\Controllers\Controller; | ||
use App\Http\Requests\Staff\StoreWhitelistedImageUrlRequest; | ||
use App\Http\Requests\Staff\UpdateWhitelistedImageUrlRequest; | ||
use App\Models\WhitelistedImageUrl; | ||
|
||
class WhitelistedImageUrlController extends Controller | ||
{ | ||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View | ||
{ | ||
return view('Staff.whitelisted-image-url.index', [ | ||
'whitelistedImageUrls' => WhitelistedImageUrl::orderBy('pattern')->get(), | ||
]); | ||
} | ||
|
||
public function update(UpdateWhitelistedImageUrlRequest $request, WhitelistedImageUrl $whitelistedImageUrl): \Illuminate\Http\RedirectResponse | ||
{ | ||
$whitelistedImageUrl->update($request->validated()); | ||
|
||
cache()->forget('whitelisted-image-urls'); | ||
|
||
return to_route('staff.whitelisted_image_urls.index') | ||
->withSuccess('Image url pattern updated successfully.'); | ||
} | ||
|
||
public function store(StoreWhitelistedImageUrlRequest $request): \Illuminate\Http\RedirectResponse | ||
{ | ||
WhitelistedImageUrl::create($request->validated()); | ||
|
||
cache()->forget('whitelisted-image-urls'); | ||
|
||
return to_route('staff.whitelisted_image_urls.index') | ||
->withSuccess('New image url pattern whitelisted.'); | ||
} | ||
|
||
public function destroy(WhitelistedImageUrl $whitelistedImageUrl): \Illuminate\Http\RedirectResponse | ||
{ | ||
$whitelistedImageUrl->delete(); | ||
|
||
cache()->forget('whitelisted-image-urls'); | ||
|
||
return to_route('staff.whitelisted_image_urls.index') | ||
->withSuccess('Image url pattern removed from whitelist.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.