mirror of
https://github.com/Kovah/LinkAce.git
synced 2025-04-21 07:22:20 +02:00
commit
ad53f367bf
@ -3,7 +3,7 @@
|
||||
## Basic app configuration
|
||||
# The application name is used internally and may not be changed
|
||||
APP_NAME=LinkAce
|
||||
COMPOSE_PROJECT_NAME=LinkAce
|
||||
COMPOSE_PROJECT_NAME=linkace
|
||||
# The URL should be set if you notice issues with URLs generated by Laravel, which might be an issue with
|
||||
# nginx configuration or the proxy you use.
|
||||
APP_URL=http://localhost
|
||||
|
@ -3,7 +3,7 @@
|
||||
## Basic app configuration
|
||||
# The application name is used internally and may not be changed
|
||||
APP_NAME=LinkAce
|
||||
COMPOSE_PROJECT_NAME=LinkAce
|
||||
COMPOSE_PROJECT_NAME=linkace
|
||||
# The URL should be set if you notice issues with URLs generated by Laravel, which might be an issue with
|
||||
# nginx configuration or the proxy you use.
|
||||
APP_URL=http://localhost
|
||||
|
@ -6,6 +6,7 @@ use App\Models\User;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Laravel\Fortify\Contracts\CreatesNewUsers;
|
||||
|
||||
class CreateNewUser implements CreatesNewUsers
|
||||
@ -15,10 +16,11 @@ class CreateNewUser implements CreatesNewUsers
|
||||
/**
|
||||
* Validate and create a newly registered user.
|
||||
*
|
||||
* @param array $input
|
||||
* @return \App\Models\User
|
||||
* @param array $input
|
||||
* @return User
|
||||
* @throws ValidationException
|
||||
*/
|
||||
public function create(array $input)
|
||||
public function create(array $input): User
|
||||
{
|
||||
Validator::make($input, [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
|
@ -11,7 +11,7 @@ trait PasswordValidationRules
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function passwordRules()
|
||||
protected function passwordRules(): array
|
||||
{
|
||||
return ['required', 'string', new Password, 'confirmed'];
|
||||
}
|
||||
|
@ -16,10 +16,9 @@ class ResetUserPassword implements ResetsUserPasswords
|
||||
*
|
||||
* @param mixed $user
|
||||
* @param array $input
|
||||
* @return void
|
||||
* @throws ValidationException
|
||||
*/
|
||||
public function reset($user, array $input)
|
||||
public function reset($user, array $input): void
|
||||
{
|
||||
Validator::make($input, [
|
||||
'password' => $this->passwordRules(),
|
||||
|
@ -4,6 +4,7 @@ namespace App\Actions\Fortify;
|
||||
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Laravel\Fortify\Contracts\UpdatesUserPasswords;
|
||||
|
||||
class UpdateUserPassword implements UpdatesUserPasswords
|
||||
@ -13,17 +14,17 @@ class UpdateUserPassword implements UpdatesUserPasswords
|
||||
/**
|
||||
* Validate and update the user's password.
|
||||
*
|
||||
* @param mixed $user
|
||||
* @param array $input
|
||||
* @return void
|
||||
* @param mixed $user
|
||||
* @param array $input
|
||||
* @throws ValidationException
|
||||
*/
|
||||
public function update($user, array $input)
|
||||
public function update($user, array $input): void
|
||||
{
|
||||
Validator::make($input, [
|
||||
'current_password' => ['required', 'string'],
|
||||
'password' => $this->passwordRules(),
|
||||
])->after(function ($validator) use ($user, $input) {
|
||||
if (! Hash::check($input['current_password'], $user->password)) {
|
||||
if (!Hash::check($input['current_password'], $user->password)) {
|
||||
$validator->errors()->add('current_password', trans('settings.old_password_invalid'));
|
||||
}
|
||||
})->validateWithBag('updatePassword');
|
||||
|
@ -5,6 +5,7 @@ namespace App\Actions\Fortify;
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;
|
||||
|
||||
class UpdateUserProfileInformation implements UpdatesUserProfileInformation
|
||||
@ -12,11 +13,11 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
|
||||
/**
|
||||
* Validate and update the given user's profile information.
|
||||
*
|
||||
* @param mixed $user
|
||||
* @param array $input
|
||||
* @return void
|
||||
* @param mixed $user
|
||||
* @param array $input
|
||||
* @throws ValidationException
|
||||
*/
|
||||
public function update($user, array $input)
|
||||
public function update($user, array $input): void
|
||||
{
|
||||
Validator::make($input, [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
@ -43,9 +44,8 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
|
||||
/**
|
||||
* Update the given verified user's profile information.
|
||||
*
|
||||
* @param mixed $user
|
||||
* @param array $input
|
||||
* @return void
|
||||
* @param mixed $user
|
||||
* @param array $input
|
||||
*/
|
||||
protected function updateVerifiedUser($user, array $input): void
|
||||
{
|
||||
|
@ -15,6 +15,14 @@ class ImportHtmlBookmarks
|
||||
protected $imported = 0;
|
||||
protected $skipped = 0;
|
||||
|
||||
/**
|
||||
* Import all links from a given bookmarks file.
|
||||
*
|
||||
* @param string $data
|
||||
* @param string $userId
|
||||
* @param bool $generateMeta
|
||||
* @return bool
|
||||
*/
|
||||
public function run(string $data, string $userId, bool $generateMeta = true): bool
|
||||
{
|
||||
$parser = new NetscapeBookmarkParser(true, [], '0', storage_path('logs'));
|
||||
|
@ -5,19 +5,16 @@ namespace App\Console\Commands;
|
||||
use App\Models\Link;
|
||||
use App\Models\User;
|
||||
use App\Notifications\LinkCheckNotification;
|
||||
use Exception;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
|
||||
/**
|
||||
* Class CheckLinksCommand
|
||||
*
|
||||
* @package App\Console\Commands
|
||||
*/
|
||||
class CheckLinksCommand extends Command
|
||||
{
|
||||
protected $signature = 'links:check {--limit=} {--noWait}';
|
||||
protected $description = 'This command checks the current status of a chunk of links. It is intended to be run on a schedule.';
|
||||
|
||||
/** @var int $limit Check a maximum of 100 links at once */
|
||||
public $limit = 100;
|
||||
@ -115,7 +112,7 @@ class CheckLinksCommand extends Command
|
||||
* Get links but limit the results to a fixed number of links.
|
||||
* If there is an offset saved, use this instead of beginning from the first entry.
|
||||
*
|
||||
* @return mixed
|
||||
* @return \LaravelIdea\Helper\App\Models\_IH_Link_C|Link[]
|
||||
*/
|
||||
protected function getLinks()
|
||||
{
|
||||
@ -149,7 +146,7 @@ class CheckLinksCommand extends Command
|
||||
try {
|
||||
$response = Http::timeout(20)->head($link->url);
|
||||
$statusCode = $response->status();
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
// Set status code to null so the link will be marked as broken
|
||||
$statusCode = 0;
|
||||
}
|
||||
|
@ -7,11 +7,6 @@ use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
/**
|
||||
* Class ImportCommand
|
||||
*
|
||||
* @package App\Console\Commands
|
||||
*/
|
||||
class ImportCommand extends Command
|
||||
{
|
||||
use AsksForUser;
|
||||
@ -21,6 +16,8 @@ class ImportCommand extends Command
|
||||
{--skip-meta-generation : Whether the automatic generation of titles should be skipped.}
|
||||
{--skip-check : Whether the links checking should be skipped afterwards}';
|
||||
|
||||
protected $description = 'Import links from a bookmarks file which is stored locally in your file system.';
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
$lookupMeta = true;
|
||||
@ -37,7 +34,7 @@ class ImportCommand extends Command
|
||||
$this->info('Reading file "' . $this->argument('filepath') . '"...');
|
||||
$data = File::get(storage_path($this->argument('filepath')));
|
||||
|
||||
if ($data === false || empty($data)) {
|
||||
if (empty($data)) {
|
||||
$this->warn('The provided file is empty or could not be read!');
|
||||
return;
|
||||
}
|
||||
|
@ -6,17 +6,10 @@ use App\Models\User;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
/**
|
||||
* Class RegisterUser
|
||||
*
|
||||
* Provides a php artisan command to register a new user:
|
||||
* php artisan registeruser UserName mail@user.com
|
||||
*
|
||||
* @package App\Console\Commands
|
||||
*/
|
||||
class RegisterUserCommand extends Command
|
||||
{
|
||||
protected $signature = 'registeruser {name? : Username} {email? : User email address}';
|
||||
protected $description = 'Register a new user with a given user name and an email address.';
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
|
@ -2,21 +2,17 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
/**
|
||||
* Class ResetPasswordCommand
|
||||
*
|
||||
* @package App\Console\Commands
|
||||
*/
|
||||
class ResetPasswordCommand extends Command
|
||||
{
|
||||
use AsksForUser;
|
||||
|
||||
protected $signature = 'reset-password';
|
||||
|
||||
protected $description = 'Reset the password for a given user without the need of configuring email sending.';
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
$this->line('This tool allows you to reset the password for any user.');
|
||||
@ -25,7 +21,7 @@ class ResetPasswordCommand extends Command
|
||||
$this->resetUserPassword();
|
||||
}
|
||||
|
||||
protected function resetUserPassword()
|
||||
protected function resetUserPassword(): void
|
||||
{
|
||||
do {
|
||||
$newPassword = $this->secret('Please enter a new password for this user');
|
||||
|
@ -12,7 +12,7 @@ class UpdateLinkThumbnails extends Command
|
||||
|
||||
protected $description = 'Updates the thumbnails for all existing links, done in batches.';
|
||||
|
||||
public function handle()
|
||||
public function handle(): void
|
||||
{
|
||||
$this->confirm('This command updates the thumbnail for all links with the status "ok". This can take a long time, depending on the amount of links you have saved. Do you want to proceed?');
|
||||
|
||||
|
@ -2,21 +2,16 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
/**
|
||||
* Class ViewRecoveryCodesCommand
|
||||
*
|
||||
* @package App\Console\Commands
|
||||
*/
|
||||
class ViewRecoveryCodesCommand extends Command
|
||||
{
|
||||
use AsksForUser;
|
||||
|
||||
protected $signature = '2fa:view-recovery-codes';
|
||||
|
||||
protected $description = 'View the recovery codes for a given user, in case the user has no access to the dashboard anymore.';
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
$this->line('This tool allows you to view the 2FA recovery codes for any user.');
|
||||
@ -32,7 +27,7 @@ class ViewRecoveryCodesCommand extends Command
|
||||
return;
|
||||
}
|
||||
|
||||
$this->info('Recovery Codes for user ' . $this->user->name .':');
|
||||
$this->info('Recovery Codes for user ' . $this->user->name . ':');
|
||||
|
||||
$recoveryCodes = json_decode(decrypt($this->user->two_factor_recovery_codes), true);
|
||||
foreach ($recoveryCodes as $code) {
|
||||
|
@ -4,18 +4,13 @@ namespace App\Console;
|
||||
|
||||
use App\Console\Commands\CheckLinksCommand;
|
||||
use App\Console\Commands\CleanupLinkHistoriesCommand;
|
||||
use App\Console\Commands\ImportCommand;
|
||||
use App\Console\Commands\RegisterUserCommand;
|
||||
use App\Console\Commands\ResetPasswordCommand;
|
||||
use App\Console\Commands\ImportCommand;
|
||||
use App\Console\Commands\UpdateLinkThumbnails;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
/**
|
||||
* Class Kernel
|
||||
*
|
||||
* @package App\Console
|
||||
*/
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
@ -36,9 +31,8 @@ class Kernel extends ConsoleKernel
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
protected function schedule(Schedule $schedule): void
|
||||
{
|
||||
$schedule->command('links:check')->hourly();
|
||||
|
||||
@ -53,10 +47,8 @@ class Kernel extends ConsoleKernel
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function commands()
|
||||
protected function commands(): void
|
||||
{
|
||||
$this->load(__DIR__ . '/Commands');
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@ -33,10 +32,9 @@ class Handler extends ExceptionHandler
|
||||
* Report or log an exception.
|
||||
*
|
||||
* @param Throwable $exception
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function report(Throwable $exception)
|
||||
public function report(Throwable $exception): void
|
||||
{
|
||||
if ($this->shouldReport($exception) && app()->bound('sentry')) {
|
||||
app('sentry')->captureException($exception);
|
||||
@ -53,7 +51,7 @@ class Handler extends ExceptionHandler
|
||||
* @return Response
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function render($request, Throwable $exception)
|
||||
public function render($request, Throwable $exception): Response
|
||||
{
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class HtmlMeta
|
||||
$this->buildFallback();
|
||||
|
||||
try {
|
||||
$this->meta = \Kovah\HtmlMeta\Facades\HtmlMeta::forUrl($url);
|
||||
$this->meta = \Kovah\HtmlMeta\Facades\HtmlMeta::forUrl($url)->getMeta();
|
||||
} catch (InvalidUrlException $e) {
|
||||
Log::warning($url . ': ' . $e->getMessage());
|
||||
if ($flashAlerts) {
|
||||
|
@ -2,11 +2,6 @@
|
||||
|
||||
namespace App\Helper;
|
||||
|
||||
/**
|
||||
* Class LinkAce
|
||||
*
|
||||
* @package App\Helper
|
||||
*/
|
||||
class LinkAce
|
||||
{
|
||||
/**
|
||||
@ -21,8 +16,6 @@ class LinkAce
|
||||
"'_blank','menubar=no,height=720,width=600,toolbar=no," .
|
||||
"scrollbars=yes,status=no,dialog=1');})();";
|
||||
|
||||
$bmCode = str_replace('##URL##', route('bookmarklet-add'), $bmCode);
|
||||
|
||||
return $bmCode;
|
||||
return str_replace('##URL##', route('bookmarklet-add'), $bmCode);
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,6 @@
|
||||
|
||||
namespace App\Helper;
|
||||
|
||||
/**
|
||||
* Class LinkIconMapper
|
||||
*
|
||||
* @package App\Helper
|
||||
*/
|
||||
class LinkIconMapper
|
||||
{
|
||||
/** @var string Default icon as fallback if no specific icon was found */
|
||||
|
@ -4,11 +4,6 @@ namespace App\Helper;
|
||||
|
||||
use App\Models\Link;
|
||||
|
||||
/**
|
||||
* Class Sharing
|
||||
*
|
||||
* @package App\Helper
|
||||
*/
|
||||
class Sharing
|
||||
{
|
||||
public static $linkClasses = 'share-link btn btn-xs btn-outline-secondary';
|
||||
|
@ -8,11 +8,6 @@ use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
* Class UpdateHelper
|
||||
*
|
||||
* @package App\Helper
|
||||
*/
|
||||
class UpdateHelper
|
||||
{
|
||||
protected const RELEASE_API_URL = 'https://updates.linkace.org/api/current-version';
|
||||
|
@ -5,11 +5,6 @@ namespace App\Helper;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class WaybackMachine
|
||||
*
|
||||
* @package App\Helper
|
||||
*/
|
||||
class WaybackMachine
|
||||
{
|
||||
/** @var string */
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
use App\Helper\Alert;
|
||||
use App\Helper\Sharing;
|
||||
use App\Helper\WaybackMachine;
|
||||
use App\Models\Link;
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\Http\Controllers\API;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Models\LinkDeleteRequest;
|
||||
use App\Http\Requests\Models\LinkStoreRequest;
|
||||
use App\Http\Requests\Models\LinkUpdateRequest;
|
||||
use App\Models\Link;
|
||||
@ -62,7 +61,7 @@ class LinkController extends Controller
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param LinkUpdateRequest $request
|
||||
* @param Link $link
|
||||
* @param Link $link
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(LinkUpdateRequest $request, Link $link): JsonResponse
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\Http\Controllers\API;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Models\ListDeleteRequest;
|
||||
use App\Http\Requests\Models\ListStoreRequest;
|
||||
use App\Http\Requests\Models\ListUpdateRequest;
|
||||
use App\Models\LinkList;
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\Http\Controllers\API;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Models\NoteDeleteRequest;
|
||||
use App\Http\Requests\Models\NoteStoreRequest;
|
||||
use App\Http\Requests\Models\NoteUpdateRequest;
|
||||
use App\Models\Note;
|
||||
@ -30,7 +29,7 @@ class NoteController extends Controller
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param NoteUpdateRequest $request
|
||||
* @param Note $note
|
||||
* @param Note $note
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(NoteUpdateRequest $request, Note $note): JsonResponse
|
||||
|
@ -44,7 +44,7 @@ class SearchController extends Controller
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function searchTags(Request $request): JsonResponse
|
||||
public function searchByTags(Request $request): JsonResponse
|
||||
{
|
||||
$query = $request->input('query', false);
|
||||
|
||||
@ -54,7 +54,7 @@ class SearchController extends Controller
|
||||
|
||||
$tags = Tag::byUser($request->user()->id)
|
||||
->where('name', 'like', '%' . $query . '%')
|
||||
->orderBy('name', 'asc')
|
||||
->orderBy('name')
|
||||
->pluck('name', 'id');
|
||||
|
||||
return response()->json($tags);
|
||||
@ -68,7 +68,7 @@ class SearchController extends Controller
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function searchLists(Request $request): JsonResponse
|
||||
public function searchByLists(Request $request): JsonResponse
|
||||
{
|
||||
$query = $request->input('query', false);
|
||||
|
||||
@ -78,7 +78,7 @@ class SearchController extends Controller
|
||||
|
||||
$tags = LinkList::byUser($request->user()->id)
|
||||
->where('name', 'like', '%' . $query . '%')
|
||||
->orderBy('name', 'asc')
|
||||
->orderBy('name')
|
||||
->pluck('name', 'id');
|
||||
|
||||
return response()->json($tags);
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\Http\Controllers\API;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Models\TagDeleteRequest;
|
||||
use App\Http\Requests\Models\TagStoreRequest;
|
||||
use App\Http\Requests\Models\TagUpdateRequest;
|
||||
use App\Models\Tag;
|
||||
|
@ -16,7 +16,7 @@ use Illuminate\Http\Response;
|
||||
|
||||
class TrashController extends Controller
|
||||
{
|
||||
public function getLinks(Request $request)
|
||||
public function getLinks(Request $request): JsonResponse
|
||||
{
|
||||
$links = Link::onlyTrashed()
|
||||
->byUser($request->user()->id)
|
||||
@ -25,7 +25,7 @@ class TrashController extends Controller
|
||||
return response()->json($links->toArray());
|
||||
}
|
||||
|
||||
public function getLists(Request $request)
|
||||
public function getLists(Request $request): JsonResponse
|
||||
{
|
||||
$lists = LinkList::onlyTrashed()
|
||||
->byUser($request->user()->id)
|
||||
@ -34,7 +34,7 @@ class TrashController extends Controller
|
||||
return response()->json($lists);
|
||||
}
|
||||
|
||||
public function getTags(Request $request)
|
||||
public function getTags(Request $request): JsonResponse
|
||||
{
|
||||
$tags = Tag::onlyTrashed()
|
||||
->byUser($request->user()->id)
|
||||
@ -43,7 +43,7 @@ class TrashController extends Controller
|
||||
return response()->json($tags);
|
||||
}
|
||||
|
||||
public function getNotes(Request $request)
|
||||
public function getNotes(Request $request): JsonResponse
|
||||
{
|
||||
$notes = Note::onlyTrashed()
|
||||
->byUser($request->user()->id)
|
||||
|
@ -4,9 +4,9 @@ namespace App\Http\Controllers\App;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Contracts\View\View;
|
||||
|
||||
class BookmarkletController extends Controller
|
||||
{
|
||||
|
@ -5,10 +5,9 @@ namespace App\Http\Controllers\App;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Link;
|
||||
use Illuminate\Contracts\Container\BindingResolutionException;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use League\Csv\CannotInsertRecord;
|
||||
use League\Csv\Writer;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
@ -31,13 +30,12 @@ class ExportController extends Controller
|
||||
* importing/exporting bookmarks in browsers. The rendered view is then
|
||||
* streamed to the user as a file download.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return StreamedResponse
|
||||
* @throws BindingResolutionException
|
||||
*/
|
||||
public function doHtmlExport(Request $request): StreamedResponse
|
||||
public function doHtmlExport(): StreamedResponse
|
||||
{
|
||||
$links = Link::orderBy('title', 'asc')->with('tags')->get();
|
||||
$links = Link::orderBy('title')->with('tags')->get();
|
||||
|
||||
$fileContent = view()->make('app.export.html-export', ['links' => $links])->render();
|
||||
$fileName = config('app.name') . '_export.html';
|
||||
@ -52,12 +50,11 @@ class ExportController extends Controller
|
||||
* names. A CSV file is generated with the League\Csv\Writer and made
|
||||
* available to download.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return RedirectResponse|StreamedResponse
|
||||
*/
|
||||
public function doCsvExport(Request $request)
|
||||
public function doCsvExport()
|
||||
{
|
||||
$links = Link::orderBy('title', 'asc')->get();
|
||||
$links = Link::orderBy('title')->get();
|
||||
|
||||
$rows = $links->map(function (Link $link) {
|
||||
$link->tags = $link->tags()->get()->pluck('name')->join(',');
|
||||
@ -66,7 +63,7 @@ class ExportController extends Controller
|
||||
})->toArray();
|
||||
|
||||
try {
|
||||
$csv = Writer::createFromString('');
|
||||
$csv = Writer::createFromString();
|
||||
$csv->insertOne(array_keys($rows[0]));
|
||||
$csv->insertAll($rows);
|
||||
} catch (CannotInsertRecord $e) {
|
||||
|
@ -6,12 +6,11 @@ use App\Helper\UpdateHelper;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\SystemSettingsUpdateRequest;
|
||||
use App\Models\Setting;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Contracts\View\View;
|
||||
|
||||
class SystemSettingsController extends Controller
|
||||
{
|
||||
@ -75,10 +74,9 @@ class SystemSettingsController extends Controller
|
||||
/**
|
||||
* Generate a new API token for the current user.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function generateCronToken(Request $request): JsonResponse
|
||||
public function generateCronToken(): JsonResponse
|
||||
{
|
||||
$newToken = Str::random(32);
|
||||
|
||||
|
@ -10,8 +10,8 @@ use App\Models\LinkList;
|
||||
use App\Models\Note;
|
||||
use App\Models\Tag;
|
||||
use App\Repositories\TrashRepository;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class TrashController extends Controller
|
||||
{
|
||||
|
@ -6,15 +6,14 @@ use App\Actions\Fortify\UpdateUserPassword;
|
||||
use App\Actions\Fortify\UpdateUserProfileInformation;
|
||||
use App\Helper\LinkAce;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\UserAccountUpdateRequest;
|
||||
use App\Http\Requests\UserPasswordUpdateRequest;
|
||||
use App\Http\Requests\UserSettingsUpdateRequest;
|
||||
use App\Models\Setting;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class UserSettingsController extends Controller
|
||||
{
|
||||
@ -38,6 +37,7 @@ class UserSettingsController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
* @return RedirectResponse
|
||||
* @throws ValidationException
|
||||
*/
|
||||
public function saveAccountSettings(Request $request): RedirectResponse
|
||||
{
|
||||
@ -92,6 +92,7 @@ class UserSettingsController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
* @return RedirectResponse
|
||||
* @throws ValidationException
|
||||
*/
|
||||
public function changeUserPassword(Request $request): RedirectResponse
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ class FetchController extends Controller
|
||||
|
||||
$tags = Tag::byUser(auth()->user()->id)
|
||||
->where('name', 'like', '%' . escapeSearchQuery($query) . '%')
|
||||
->orderBy('name', 'asc')
|
||||
->orderBy('name')
|
||||
->get();
|
||||
|
||||
if (!$tags->isEmpty()) {
|
||||
@ -61,7 +61,7 @@ class FetchController extends Controller
|
||||
|
||||
$tags = LinkList::byUser(auth()->user()->id)
|
||||
->where('name', 'like', '%' . escapeSearchQuery($query) . '%')
|
||||
->orderBy('name', 'asc')
|
||||
->orderBy('name')
|
||||
->get();
|
||||
|
||||
if (!$tags->isEmpty()) {
|
||||
|
@ -39,7 +39,7 @@ class ListController extends Controller
|
||||
* @param int $listID
|
||||
* @return View
|
||||
*/
|
||||
public function show(Request $request, $listID): View
|
||||
public function show(Request $request, int $listID): View
|
||||
{
|
||||
$list = LinkList::publicOnly()->findOrFail($listID);
|
||||
|
||||
|
@ -40,7 +40,7 @@ class TagController extends Controller
|
||||
* @param int $tagID
|
||||
* @return View
|
||||
*/
|
||||
public function show(Request $request, $tagID): View
|
||||
public function show(Request $request, int $tagID): View
|
||||
{
|
||||
$tag = Tag::publicOnly()->findOrFail($tagID);
|
||||
|
||||
|
@ -8,9 +8,9 @@ use App\Http\Requests\Models\ListUpdateRequest;
|
||||
use App\Models\LinkList;
|
||||
use App\Repositories\ListRepository;
|
||||
use Exception;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use \Illuminate\Contracts\View\View;
|
||||
|
||||
class ListController extends Controller
|
||||
{
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\Http\Controllers\Models;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Models\NoteDeleteRequest;
|
||||
use App\Http\Requests\Models\NoteStoreRequest;
|
||||
use App\Http\Requests\Models\NoteUpdateRequest;
|
||||
use App\Models\Link;
|
||||
|
@ -53,7 +53,7 @@ class TagController extends Controller
|
||||
* @param TagStoreRequest $request
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function store(TagStoreRequest $request)
|
||||
public function store(TagStoreRequest $request): RedirectResponse
|
||||
{
|
||||
$data = $request->except(['reload_view']);
|
||||
|
||||
|
@ -4,10 +4,11 @@ namespace App\Http\Controllers\Setup;
|
||||
|
||||
use App\Actions\Fortify\CreateNewUser;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class AccountController extends Controller
|
||||
{
|
||||
@ -31,6 +32,7 @@ class AccountController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
* @return RedirectResponse
|
||||
* @throws ValidationException
|
||||
*/
|
||||
protected function register(Request $request): RedirectResponse
|
||||
{
|
||||
|
@ -5,14 +5,13 @@ namespace App\Http\Controllers\Setup;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\SetupDatabaseRequest;
|
||||
use Exception;
|
||||
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use PDOException;
|
||||
|
||||
class DatabaseController extends Controller
|
||||
@ -34,7 +33,6 @@ class DatabaseController extends Controller
|
||||
*
|
||||
* @param SetupDatabaseRequest $request
|
||||
* @return RedirectResponse
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
public function configure(SetupDatabaseRequest $request): RedirectResponse
|
||||
{
|
||||
@ -61,7 +59,7 @@ class DatabaseController extends Controller
|
||||
*
|
||||
* @param array $credentials
|
||||
*/
|
||||
protected function createTempDatabaseConnection($credentials): void
|
||||
protected function createTempDatabaseConnection(array $credentials): void
|
||||
{
|
||||
$this->dbConfig = config('database.connections.mysql');
|
||||
|
||||
|
@ -3,8 +3,8 @@
|
||||
namespace App\Http\Controllers\Setup;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class MetaController extends Controller
|
||||
{
|
||||
|
@ -3,8 +3,8 @@
|
||||
namespace App\Http\Controllers\Setup;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class RequirementsController extends Controller
|
||||
{
|
||||
@ -39,7 +39,7 @@ class RequirementsController extends Controller
|
||||
'storage_writable' => File::isWritable(storage_path()) && File::isWritable(storage_path('logs')),
|
||||
];
|
||||
|
||||
$success = !in_array(false, $results);
|
||||
$success = !in_array(false, $results, true);
|
||||
|
||||
return [$success, $results];
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ trait SearchesLinks
|
||||
* @param SearchRequest $request
|
||||
* @return Builder
|
||||
*/
|
||||
protected function buildDatabaseQuery(SearchRequest $request)
|
||||
protected function buildDatabaseQuery(SearchRequest $request): Builder
|
||||
{
|
||||
// Start building the search
|
||||
$search = Link::byUser($request->user()->id);
|
||||
|
@ -3,17 +3,18 @@
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class GuestAccess
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param Request $request
|
||||
* @param Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
// Check for logged in users
|
||||
if (auth()->check()) {
|
||||
|
@ -3,20 +3,20 @@
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string|null $guard
|
||||
* @param Request $request
|
||||
* @param Closure $next
|
||||
* @param string|null $guard
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next, $guard = null)
|
||||
public function handle(Request $request, Closure $next, $guard = null)
|
||||
{
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect('/dashboard');
|
||||
|
@ -3,22 +3,18 @@
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Class SettingsMiddleware
|
||||
*
|
||||
* @package App\Http\Middleware
|
||||
*/
|
||||
class SettingsMiddleware
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param Request $request
|
||||
* @param Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
// Set global configs based on the user settings
|
||||
if ($user_timezone = usersettings('timezone')) {
|
||||
|
@ -5,11 +5,6 @@ namespace App\Http\Middleware;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Class SetupCheckMiddleware
|
||||
*
|
||||
* @package App\Http\Middleware
|
||||
*/
|
||||
class SetupCheckMiddleware
|
||||
{
|
||||
/**
|
||||
@ -19,7 +14,7 @@ class SetupCheckMiddleware
|
||||
* @param Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
if ($request->is('setup/*')) {
|
||||
if (config('app.setup_completed') === true) {
|
||||
|
@ -11,7 +11,7 @@ class TrustHosts extends Middleware
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function hosts()
|
||||
public function hosts(): array
|
||||
{
|
||||
return [
|
||||
$this->allSubdomainsOfApplicationUrl(),
|
||||
|
@ -4,11 +4,6 @@ namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* Class DoImportRequest
|
||||
*
|
||||
* @package App\Http\Requests
|
||||
*/
|
||||
class DoImportRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
@ -16,7 +11,7 @@ class DoImportRequest extends FormRequest
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -26,7 +21,7 @@ class DoImportRequest extends FormRequest
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'import-file' => 'required|file|mimes:html,htm',
|
||||
|
@ -3,14 +3,8 @@
|
||||
namespace App\Http\Requests\Models;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
/**
|
||||
* Class LinkStoreRequest
|
||||
*
|
||||
* @package App\Http\Requests\Models
|
||||
*/
|
||||
class LinkStoreRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
@ -18,7 +12,7 @@ class LinkStoreRequest extends FormRequest
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(Request $request): bool
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -3,22 +3,15 @@
|
||||
namespace App\Http\Requests\Models;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Class LinkToggleCheckRequest
|
||||
*
|
||||
* @package App\Http\Requests\Models
|
||||
*/
|
||||
class LinkToggleCheckRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(Request $request)
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -28,7 +21,7 @@ class LinkToggleCheckRequest extends FormRequest
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'toggle' => 'required|boolean',
|
||||
|
@ -2,16 +2,10 @@
|
||||
|
||||
namespace App\Http\Requests\Models;
|
||||
|
||||
use App\Models\Link;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
/**
|
||||
* Class LinkUpdateRequest
|
||||
*
|
||||
* @package App\Http\Requests\Models
|
||||
*/
|
||||
class LinkUpdateRequest extends FormRequest
|
||||
{
|
||||
/** @var bool */
|
||||
@ -23,7 +17,7 @@ class LinkUpdateRequest extends FormRequest
|
||||
* @param Request $request
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(Request $request)
|
||||
public function authorize(Request $request): bool
|
||||
{
|
||||
if ($request->input('url') !== null) {
|
||||
$this->requireUniqueUrl = $request->route('link')->url !== $request->input('url');
|
||||
@ -37,7 +31,7 @@ class LinkUpdateRequest extends FormRequest
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'url' => 'required|string',
|
||||
|
@ -4,11 +4,6 @@ namespace App\Http\Requests\Models;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* Class ListStoreRequest
|
||||
*
|
||||
* @package App\Http\Requests\Models
|
||||
*/
|
||||
class ListStoreRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
@ -16,7 +11,7 @@ class ListStoreRequest extends FormRequest
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -26,7 +21,7 @@ class ListStoreRequest extends FormRequest
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'required|string',
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Http\Requests\Models;
|
||||
|
||||
use App\Models\LinkList;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\Rule;
|
||||
@ -23,10 +22,10 @@ class ListUpdateRequest extends FormRequest
|
||||
* @param Request $request
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(Request $request)
|
||||
public function authorize(Request $request): bool
|
||||
{
|
||||
if ($request->input('name') !== null) {
|
||||
$this->requireUniqueName = $request->route('list')->name !== $request->input('name');
|
||||
$this->requireUniqueName = $request->route('list')->name !== $request->input('name');
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -37,7 +36,7 @@ class ListUpdateRequest extends FormRequest
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'name' => 'required|string',
|
||||
|
@ -4,11 +4,6 @@ namespace App\Http\Requests\Models;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* Class NoteStoreRequest
|
||||
*
|
||||
* @package App\Http\Requests\Models
|
||||
*/
|
||||
class NoteStoreRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
@ -16,7 +11,7 @@ class NoteStoreRequest extends FormRequest
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -26,7 +21,7 @@ class NoteStoreRequest extends FormRequest
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'link_id' => 'required',
|
||||
|
@ -3,22 +3,15 @@
|
||||
namespace App\Http\Requests\Models;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Class NoteUpdateRequest
|
||||
*
|
||||
* @package App\Http\Requests\Models
|
||||
*/
|
||||
class NoteUpdateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(Request $request)
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -28,7 +21,7 @@ class NoteUpdateRequest extends FormRequest
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'note' => 'required',
|
||||
|
@ -5,11 +5,6 @@ namespace App\Http\Requests\Models;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
/**
|
||||
* Class TagStoreRequest
|
||||
*
|
||||
* @package App\Http\Requests\Models
|
||||
*/
|
||||
class TagStoreRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
@ -17,7 +12,7 @@ class TagStoreRequest extends FormRequest
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -27,7 +22,7 @@ class TagStoreRequest extends FormRequest
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => [
|
||||
|
@ -2,16 +2,10 @@
|
||||
|
||||
namespace App\Http\Requests\Models;
|
||||
|
||||
use App\Models\Tag;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
/**
|
||||
* Class TagUpdateRequest
|
||||
*
|
||||
* @package App\Http\Requests\Models
|
||||
*/
|
||||
class TagUpdateRequest extends FormRequest
|
||||
{
|
||||
/** @var bool */
|
||||
@ -23,7 +17,7 @@ class TagUpdateRequest extends FormRequest
|
||||
* @param Request $request
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(Request $request)
|
||||
public function authorize(Request $request): bool
|
||||
{
|
||||
if ($request->input('name') !== null) {
|
||||
$this->requireUniqueName = $request->route('tag')->name !== $request->input('name');
|
||||
@ -37,7 +31,7 @@ class TagUpdateRequest extends FormRequest
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'name' => 'required',
|
||||
|
@ -4,11 +4,6 @@ namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* Class SearchRequest
|
||||
*
|
||||
* @package App\Http\Requests
|
||||
*/
|
||||
class SearchRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
@ -16,7 +11,7 @@ class SearchRequest extends FormRequest
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -26,7 +21,7 @@ class SearchRequest extends FormRequest
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'query' => 'bail|required_without_all:only_lists,only_tags,broken_only',
|
||||
@ -45,9 +40,9 @@ class SearchRequest extends FormRequest
|
||||
{
|
||||
return [
|
||||
'query.required_without_all' => trans('search.validation_query_missing'),
|
||||
'only_lists.required_without_all' => trans('search.validation_query_missing'),
|
||||
'only_tags.required_without_all' => trans('search.validation_query_missing'),
|
||||
'broken_only.required_without_all' => trans('search.validation_query_missing'),
|
||||
'only_lists.required_without_all' => trans('search.validation_query_missing'),
|
||||
'only_tags.required_without_all' => trans('search.validation_query_missing'),
|
||||
'broken_only.required_without_all' => trans('search.validation_query_missing'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -4,11 +4,6 @@ namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* Class SetupDatabaseRequest
|
||||
*
|
||||
* @package App\Http\Requests
|
||||
*/
|
||||
class SetupDatabaseRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
@ -16,7 +11,7 @@ class SetupDatabaseRequest extends FormRequest
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -26,7 +21,7 @@ class SetupDatabaseRequest extends FormRequest
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'db_host' => 'required',
|
||||
|
@ -3,22 +3,15 @@
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Class SystemSettingsUpdateRequest
|
||||
*
|
||||
* @package App\Http\Requests
|
||||
*/
|
||||
class SystemSettingsUpdateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(Request $request)
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -28,7 +21,7 @@ class SystemSettingsUpdateRequest extends FormRequest
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'system_page_title' => 'max:256',
|
||||
|
@ -3,22 +3,15 @@
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Class UserSettingsUpdateRequest
|
||||
*
|
||||
* @package App\Http\Requests
|
||||
*/
|
||||
class UserSettingsUpdateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(Request $request)
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -28,7 +21,7 @@ class UserSettingsUpdateRequest extends FormRequest
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'locale' => 'required',
|
||||
|
@ -97,9 +97,9 @@ class Link extends Model
|
||||
*
|
||||
* @param Builder $query
|
||||
* @param int $userId
|
||||
* @return mixed
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopeByUser($query, $userId)
|
||||
public function scopeByUser(Builder $query, int $userId): Builder
|
||||
{
|
||||
return $query->where('user_id', $userId);
|
||||
}
|
||||
@ -108,9 +108,9 @@ class Link extends Model
|
||||
* Scope for the user relation
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return mixed
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopePrivateOnly(Builder $query)
|
||||
public function scopePrivateOnly(Builder $query): Builder
|
||||
{
|
||||
return $query->where('is_private', true);
|
||||
}
|
||||
@ -119,9 +119,9 @@ class Link extends Model
|
||||
* Scope for the user relation
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return mixed
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopePublicOnly(Builder $query)
|
||||
public function scopePublicOnly(Builder $query): Builder
|
||||
{
|
||||
return $query->where('is_private', false);
|
||||
}
|
||||
@ -134,7 +134,7 @@ class Link extends Model
|
||||
/**
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function user()
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
@ -142,7 +142,7 @@ class Link extends Model
|
||||
/**
|
||||
* @return BelongsToMany
|
||||
*/
|
||||
public function lists()
|
||||
public function lists(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(LinkList::class, 'link_lists', 'link_id', 'list_id');
|
||||
}
|
||||
@ -150,7 +150,7 @@ class Link extends Model
|
||||
/**
|
||||
* @return BelongsToMany
|
||||
*/
|
||||
public function tags()
|
||||
public function tags(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Tag::class, 'link_tags', 'link_id', 'tag_id');
|
||||
}
|
||||
@ -158,7 +158,7 @@ class Link extends Model
|
||||
/**
|
||||
* @return HasMany
|
||||
*/
|
||||
public function notes()
|
||||
public function notes(): HasMany
|
||||
{
|
||||
return $this->hasMany(Note::class, 'link_id');
|
||||
}
|
||||
@ -191,9 +191,9 @@ class Link extends Model
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function shortUrl()
|
||||
public function shortUrl(int $maxLength = 50): string
|
||||
{
|
||||
return Str::limit(trim($this->url, '/'), 50);
|
||||
return Str::limit(trim($this->url, '/'), $maxLength);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,7 +53,7 @@ class LinkList extends Model
|
||||
/**
|
||||
* Add the OrderNameScope to the Tag model
|
||||
*/
|
||||
protected static function boot()
|
||||
protected static function boot(): void
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
@ -70,9 +70,9 @@ class LinkList extends Model
|
||||
*
|
||||
* @param Builder $query
|
||||
* @param int $user_id
|
||||
* @return mixed
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopeByUser(Builder $query, $user_id)
|
||||
public function scopeByUser(Builder $query, int $user_id): Builder
|
||||
{
|
||||
return $query->where('user_id', $user_id);
|
||||
}
|
||||
@ -81,9 +81,9 @@ class LinkList extends Model
|
||||
* Scope for selecting private lists only
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return mixed
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopePrivateOnly(Builder $query)
|
||||
public function scopePrivateOnly(Builder $query): Builder
|
||||
{
|
||||
return $query->where('is_private', true);
|
||||
}
|
||||
@ -92,9 +92,9 @@ class LinkList extends Model
|
||||
* Scope for selecting public lists only
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return mixed
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopePublicOnly(Builder $query)
|
||||
public function scopePublicOnly(Builder $query): Builder
|
||||
{
|
||||
return $query->where('is_private', false);
|
||||
}
|
||||
@ -107,7 +107,7 @@ class LinkList extends Model
|
||||
/**
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function user()
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo('App\Models\User', 'user_id');
|
||||
}
|
||||
@ -115,7 +115,7 @@ class LinkList extends Model
|
||||
/**
|
||||
* @return BelongsToMany
|
||||
*/
|
||||
public function links()
|
||||
public function links(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany('App\Models\Link', 'link_lists', 'list_id', 'link_id');
|
||||
}
|
||||
|
@ -56,9 +56,9 @@ class Note extends Model
|
||||
*
|
||||
* @param Builder $query
|
||||
* @param int $user_id
|
||||
* @return mixed
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopeByUser($query, $user_id)
|
||||
public function scopeByUser(Builder $query, int $user_id): Builder
|
||||
{
|
||||
return $query->where('user_id', $user_id);
|
||||
}
|
||||
@ -71,7 +71,7 @@ class Note extends Model
|
||||
/**
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function user()
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo('App\Models\User', 'user_id');
|
||||
}
|
||||
@ -79,7 +79,7 @@ class Note extends Model
|
||||
/**
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function link()
|
||||
public function link(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo('App\Models\Link', 'link_id');
|
||||
}
|
||||
@ -112,7 +112,7 @@ class Note extends Model
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function addedAt()
|
||||
public function addedAt(): string
|
||||
{
|
||||
$output = '<time-ago class="cursor-help"';
|
||||
$output .= ' datetime="' . $this->created_at->toIso8601String() . '"';
|
||||
|
@ -42,9 +42,9 @@ class Setting extends Model
|
||||
*
|
||||
* @param Builder $query
|
||||
* @param int $user_id
|
||||
* @return mixed
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopeByUser($query, $user_id)
|
||||
public function scopeByUser(Builder $query, int $user_id): Builder
|
||||
{
|
||||
return $query->where('user_id', $user_id);
|
||||
}
|
||||
@ -53,9 +53,9 @@ class Setting extends Model
|
||||
* Scope to get system settings only
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return mixed
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopeSystemOnly($query)
|
||||
public function scopeSystemOnly(Builder $query): Builder
|
||||
{
|
||||
return $query->whereNull('user_id');
|
||||
}
|
||||
|
@ -67,9 +67,9 @@ class Tag extends Model
|
||||
*
|
||||
* @param Builder $query
|
||||
* @param int $user_id
|
||||
* @return mixed
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopeByUser($query, $user_id)
|
||||
public function scopeByUser(Builder $query, int $user_id): Builder
|
||||
{
|
||||
return $query->where('user_id', $user_id);
|
||||
}
|
||||
@ -78,9 +78,9 @@ class Tag extends Model
|
||||
* Scope for selecting private tags only
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return mixed
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopePrivateOnly(Builder $query)
|
||||
public function scopePrivateOnly(Builder $query): Builder
|
||||
{
|
||||
return $query->where('is_private', true);
|
||||
}
|
||||
@ -89,9 +89,9 @@ class Tag extends Model
|
||||
* Scope for selecting public tags only
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return mixed
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopePublicOnly(Builder $query)
|
||||
public function scopePublicOnly(Builder $query): Builder
|
||||
{
|
||||
return $query->where('is_private', false);
|
||||
}
|
||||
@ -104,7 +104,7 @@ class Tag extends Model
|
||||
/**
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function user()
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo('App\Models\User', 'user_id');
|
||||
}
|
||||
@ -112,7 +112,7 @@ class Tag extends Model
|
||||
/**
|
||||
* @return BelongsToMany
|
||||
*/
|
||||
public function links()
|
||||
public function links(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany('App\Models\Link', 'link_tags', 'tag_id', 'link_id');
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class User extends Authenticatable
|
||||
return $this->hasMany(Setting::class, 'user_id', 'id');
|
||||
}
|
||||
|
||||
public function settings()
|
||||
public function settings(): \Illuminate\Support\Collection
|
||||
{
|
||||
if ($this->rawSettings->isEmpty()) {
|
||||
$this->load('rawSettings');
|
||||
|
@ -30,10 +30,9 @@ class LinkCheckNotification extends Notification
|
||||
/**
|
||||
* Get the notification's delivery channels.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function via($notifiable)
|
||||
public function via(): array
|
||||
{
|
||||
return ['mail'];
|
||||
}
|
||||
@ -41,10 +40,9 @@ class LinkCheckNotification extends Notification
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||
* @return MailMessage
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
public function toMail(): MailMessage
|
||||
{
|
||||
return (new MailMessage)
|
||||
->subject(trans('link.notifications.linkcheck.errors'))
|
||||
@ -58,10 +56,9 @@ class LinkCheckNotification extends Notification
|
||||
/**
|
||||
* Get the array representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'subject' => trans('link.notifications.linkcheck.errors'),
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Pagination\Paginator;
|
||||
use Illuminate\Routing\UrlGenerator;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@ -26,7 +25,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
@ -21,7 +20,7 @@ class AuthServiceProvider extends ServiceProvider
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
@ -12,7 +12,7 @@ class BroadcastServiceProvider extends ServiceProvider
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
public function boot(): void
|
||||
{
|
||||
Broadcast::routes();
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
@ -23,7 +22,7 @@ class EventServiceProvider extends ServiceProvider
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
public function boot(): void
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
|
@ -16,7 +16,7 @@ class FortifyServiceProvider extends ServiceProvider
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
@ -26,7 +26,7 @@ class FortifyServiceProvider extends ServiceProvider
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
public function boot(): void
|
||||
{
|
||||
Fortify::createUsersUsing(CreateNewUser::class);
|
||||
Fortify::updateUserProfileInformationUsing(UpdateUserProfileInformation::class);
|
||||
|
@ -2,9 +2,8 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
@ -24,7 +23,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
|
||||
@ -36,7 +35,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map()
|
||||
public function map(): void
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
@ -52,10 +51,10 @@ class RouteServiceProvider extends ServiceProvider
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
protected function mapWebRoutes(): void
|
||||
{
|
||||
Route::middleware('web')
|
||||
->group(base_path('routes/web.php'));
|
||||
->group(base_path('routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -65,10 +64,10 @@ class RouteServiceProvider extends ServiceProvider
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapApiRoutes()
|
||||
protected function mapApiRoutes(): void
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->group(base_path('routes/api.php'));
|
||||
->middleware('api')
|
||||
->group(base_path('routes/api.php'));
|
||||
}
|
||||
}
|
||||
|
@ -7,17 +7,13 @@ use App\Helper\LinkIconMapper;
|
||||
use App\Models\Link;
|
||||
use App\Models\LinkList;
|
||||
use App\Models\Tag;
|
||||
use DateTime;
|
||||
use Exception;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Venturecraft\Revisionable\Revisionable;
|
||||
|
||||
/**
|
||||
* Class LinkRepository
|
||||
*
|
||||
* @package App\Repositories
|
||||
*/
|
||||
class LinkRepository
|
||||
{
|
||||
/**
|
||||
@ -239,8 +235,8 @@ class LinkRepository
|
||||
'old_value' => $oldData,
|
||||
'new_value' => $newData,
|
||||
'user_id' => $link->getSystemUserId(),
|
||||
'created_at' => new \DateTime(),
|
||||
'updated_at' => new \DateTime(),
|
||||
'created_at' => new DateTime(),
|
||||
'updated_at' => new DateTime(),
|
||||
];
|
||||
|
||||
$revisionable = Revisionable::newModel();
|
||||
|
@ -6,11 +6,6 @@ use App\Models\LinkList;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class ListRepository
|
||||
*
|
||||
* @package App\Repositories
|
||||
*/
|
||||
class ListRepository
|
||||
{
|
||||
/**
|
||||
|
@ -6,11 +6,6 @@ use App\Models\Note;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class NoteRepository
|
||||
*
|
||||
* @package App\Repositories
|
||||
*/
|
||||
class NoteRepository
|
||||
{
|
||||
/**
|
||||
|
@ -6,11 +6,6 @@ use App\Models\Tag;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class TagRepository
|
||||
*
|
||||
* @package App\Repositories
|
||||
*/
|
||||
class TagRepository
|
||||
{
|
||||
/**
|
||||
|
@ -6,11 +6,6 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Scope;
|
||||
|
||||
/**
|
||||
* Class OrderNameScope
|
||||
*
|
||||
* @package App\Scopes
|
||||
*/
|
||||
class OrderNameScope implements Scope
|
||||
{
|
||||
/**
|
||||
@ -20,7 +15,7 @@ class OrderNameScope implements Scope
|
||||
* @param Model $model
|
||||
* @return void
|
||||
*/
|
||||
public function apply(Builder $builder, Model $model)
|
||||
public function apply(Builder $builder, Model $model): void
|
||||
{
|
||||
$builder->orderBy('name', 'ASC');
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ namespace App\View\Components\Links;
|
||||
use App\Models\Link;
|
||||
use App\Models\LinkList;
|
||||
use App\Models\Tag;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\View\Component;
|
||||
use Illuminate\View\View;
|
||||
use Venturecraft\Revisionable\Revision;
|
||||
@ -41,9 +43,6 @@ class HistoryEntry extends Component
|
||||
$this->entry = $entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
if ($this->entry->fieldName() === 'deleted_at') {
|
||||
@ -117,7 +116,7 @@ class HistoryEntry extends Component
|
||||
* @param $newValue
|
||||
* @return null[]|string[]
|
||||
*/
|
||||
protected function processTagsField($oldValue, $newValue)
|
||||
protected function processTagsField($oldValue, $newValue): array
|
||||
{
|
||||
$oldTags = $oldValue
|
||||
? Tag::whereIn('id', explode(',', $oldValue))
|
||||
@ -191,7 +190,7 @@ class HistoryEntry extends Component
|
||||
* The deleted field displays its own string based on whether the link
|
||||
* was deleted or restored.
|
||||
*
|
||||
* @return View|string
|
||||
* @return Application|Factory|\Illuminate\Contracts\View\View
|
||||
*/
|
||||
protected function processDeletedField()
|
||||
{
|
||||
|
@ -10,7 +10,7 @@
|
||||
"fideloper/proxy": "^4.4",
|
||||
"fruitcake/laravel-cors": "^2.0",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"kovah/laravel-html-meta": "^1.0",
|
||||
"kovah/laravel-html-meta": "^2.0",
|
||||
"laracasts/flash": "^3.1",
|
||||
"laravel/fortify": "^1.7",
|
||||
"laravel/framework": "^8.0",
|
||||
|
565
composer.lock
generated
565
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class ChangeLinkThumbnailField extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('links', function (Blueprint $table) {
|
||||
$table->text('thumbnail')->change();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('links', function (Blueprint $table) {
|
||||
$table->string('thumbnail')->change();
|
||||
});
|
||||
}
|
||||
}
|
597
package-lock.json
generated
597
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "linkace",
|
||||
"version": "1.6.1",
|
||||
"version": "1.6.2",
|
||||
"description": "A small, selfhosted bookmark manager with advanced features, built with Laravel and Docker",
|
||||
"homepage": "https://github.com/Kovah/LinkAce",
|
||||
"repository": {
|
||||
@ -13,9 +13,9 @@
|
||||
"url": "https://github.com/Kovah/LinkAce/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"laravel-mix": "^6.0.16",
|
||||
"postcss": "^8.2.10",
|
||||
"sass": "^1.32.10",
|
||||
"laravel-mix": "^6.0.19",
|
||||
"postcss": "^8.2.14",
|
||||
"sass": "^1.32.12",
|
||||
"sass-loader": "^10.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -74,9 +74,9 @@ Route::prefix('v1')->group(function () {
|
||||
|
||||
Route::get('search/links', [SearchController::class, 'searchLinks'])
|
||||
->name('api.search.links');
|
||||
Route::get('search/tags', [SearchController::class, 'searchTags'])
|
||||
Route::get('search/tags', [SearchController::class, 'searchByTags'])
|
||||
->name('api.search.tags');
|
||||
Route::get('search/lists', [SearchController::class, 'searchLists'])
|
||||
Route::get('search/lists', [SearchController::class, 'searchByLists'])
|
||||
->name('api.search.lists');
|
||||
|
||||
Route::get('trash/links', [TrashController::class, 'getLinks'])
|
||||
|
@ -165,6 +165,28 @@ class LinkControllerTest extends TestCase
|
||||
$this->assertEquals('example.com', $databaseLink->title);
|
||||
}
|
||||
|
||||
public function testStoreRequestWithHugeThumbnail(): void
|
||||
{
|
||||
$img = 'https://assets.imgix.net/unsplash/unsplash006.jpg?w=640&h=400&usm=20&fit=crop&blend-mode=normal&blend-alpha=80&blend-x=30&blend-y=20&blend=https%3A%2F%2Fassets.imgix.net%2F~text%3Ftxt-color%3D9fb64d%26txt-font%3DAvenir%2BNext%2BHeavy%26txt-shad%3D20%26txt-size%3D32%26w%3D580%26txt%3Di%2Bthank%2Byou%2Bgod%2Bfor%2Bmost%2Bthis%2Bamazing%2Bday%3Afor%2Bthe%2Bleaping%2Bgreenly%2Bspirits%2Bof%2Btrees%2B-e.e.%2Bcummings';
|
||||
|
||||
$testHtml = '<!DOCTYPE html><head>' .
|
||||
'<title>Example Title</title>' .
|
||||
'<meta property="og:image" content="' . $img . '">' .
|
||||
'</head></html>';
|
||||
|
||||
Http::fake(['huge-thumbnail.com' => Http::response($testHtml)]);
|
||||
|
||||
$response = $this->post('links', [
|
||||
'url' => 'https://huge-thumbnail.com',
|
||||
]);
|
||||
|
||||
$response->assertRedirect('links/1');
|
||||
|
||||
$databaseLink = Link::first();
|
||||
|
||||
$this->assertEquals($img, $databaseLink->thumbnail);
|
||||
}
|
||||
|
||||
public function testStoreRequestWithContinue(): void
|
||||
{
|
||||
$response = $this->post('links', [
|
||||
|
@ -274,7 +274,7 @@ class HtmlMetaHelperTest extends TestCase
|
||||
|
||||
Http::fake([
|
||||
'*' => Http::response($testHtml, 200, [
|
||||
'Content-Type' => 'text/html; charset=iso-8859-1'
|
||||
'Content-Type' => 'text/html; charset=iso-8859-1',
|
||||
]),
|
||||
]);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user