Skip to content

Commit

Permalink
Merge pull request #673 from Kovah/dev
Browse files Browse the repository at this point in the history
v1 Release
  • Loading branch information
Kovah authored Nov 1, 2023
2 parents abefd18 + c4f401a commit 9e8e8f0
Show file tree
Hide file tree
Showing 98 changed files with 2,297 additions and 1,281 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:

- uses: actions/upload-artifact@v3
with:
name: linkace-package-docker-simple
name: linkace-docker-simple
path: linkace-package-docker-simple.zip

- name: Rename files
Expand All @@ -126,6 +126,6 @@ jobs:

- uses: actions/upload-artifact@v3
with:
name: linkace-package-docker-advanced
name: linkace-docker-advanced
path: linkace-package-docker-advanced.zip

5 changes: 3 additions & 2 deletions app/Console/Commands/ImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ImportCommand extends Command
use AsksForUser;

protected $signature = 'links:import
{filepath : Bookmarks file to import}
{filepath : Bookmarks file to import, use absolute paths if stored outside of LinkAce}
{--skip-meta-generation : Whether the automatic generation of titles should be skipped.}
{--skip-check : Whether the links checking should be skipped afterwards}';

Expand All @@ -32,7 +32,8 @@ public function handle(): void
$this->askForUser();

$this->info('Reading file "' . $this->argument('filepath') . '"...');
$data = File::get(storage_path($this->argument('filepath')));
$filepath = $this->argument('filepath');
$data = File::get(str_starts_with($filepath, '/') ? $filepath : storage_path($filepath));

if (empty($data)) {
$this->warn('The provided file is empty or could not be read!');
Expand Down
21 changes: 17 additions & 4 deletions app/Http/Controllers/App/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,28 @@ public function index(): View
->where('status', '>', 1)
->count();

$totalLinks = Link::byUser()
->count();

$totalLists = LinkList::byUser()
->count();

$totalNotes = Note::byUser()
->count();

$totalTags = Tag::byUser()
->count();

$stats = [
'total_links' => Link::count(),
'total_lists' => LinkList::count(),
'total_tags' => Tag::count(),
'total_notes' => Note::count(),
'total_links' => $totalLinks,
'total_lists' => $totalLists,
'total_tags' => $totalTags,
'total_notes' => $totalNotes,
'total_broken_links' => $brokenLinks,
];

return view('dashboard', [
'pageTitle' => trans('linkace.dashboard'),
'recent_links' => $recentLinks,
'recent_tags' => $recentTags,
'recent_lists' => $recentLists,
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/App/ExportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ class ExportController extends Controller
*/
public function getExport(): View
{
return view('app.export.export');
return view('app.export.export', [
'pageTitle' => trans('export.export'),
]);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/App/ImportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ class ImportController extends Controller
*/
public function getImport(): View
{
return view('app.import.import');
return view('app.import.import', [
'pageTitle' => trans('import.import'),
]);
}

/**
Expand Down
8 changes: 6 additions & 2 deletions app/Http/Controllers/App/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ class SearchController extends Controller
*/
public function getSearch(): View
{
return view('app.search.search')
return view('app.search.search', [
'pageTitle' => trans('search.search'),
])
->with('results', collect([]))
->with('order_by_options', $this->orderByOptions)
->with('query_settings', [
Expand Down Expand Up @@ -47,7 +49,9 @@ public function doSearch(SearchRequest $request): View
$search = $this->buildDatabaseQuery($request);
$results = $search->paginate(getPaginationLimit());

return view('app.search.search')
return view('app.search.search', [
'pageTitle' => trans('search.results_for') . ' ' . $this->searchQuery,
])
->with('results', $results)
->with('order_by_options', $this->orderByOptions)
->with('query_settings', [
Expand Down
1 change: 1 addition & 0 deletions app/Http/Controllers/App/SystemSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class SystemSettingsController extends Controller
public function getSystemSettings(): View
{
return view('app.settings.system', [
'pageTitle' => trans('settings.system_settings'),
'linkaceVersion' => UpdateHelper::currentVersion(),
]);
}
Expand Down
1 change: 1 addition & 0 deletions app/Http/Controllers/App/TrashController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function index(): View
->get();

return view('app.trash.index', [
'pageTitle' => trans('trash.trash'),
'links' => $links,
'lists' => $lists,
'tags' => $tags,
Expand Down
1 change: 1 addition & 0 deletions app/Http/Controllers/App/UserSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function getUserSettings(): View
$bookmarkletCode = LinkAce::generateBookmarkletCode();

return view('app.settings.user', [
'pageTitle' => trans('settings.user_settings'),
'user' => auth()->user(),
'bookmarklet_code' => $bookmarkletCode,
]);
Expand Down
20 changes: 16 additions & 4 deletions app/Http/Controllers/FetchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Http;
use Masterminds\HTML5;

class FetchController extends Controller
{
Expand Down Expand Up @@ -121,9 +122,9 @@ public static function checkForUpdates(): JsonResponse
* implementation.
*
* @param Request $request
* @return Response
* @return JsonResponse
*/
public function htmlForUrl(Request $request): Response
public function htmlKeywordsFromUrl(Request $request)
{
$request->validate([
'url' => ['url'],
Expand All @@ -138,9 +139,20 @@ public function htmlForUrl(Request $request): Response
$response = $newRequest->get($url);

if ($response->successful()) {
return response($response->body());
$html5 = new HTML5();
$dom = $html5->loadHTML($response->body());
$keywords = [];
/** @var \DOMElement $metaTag */
foreach ($dom->getElementsByTagName('meta') as $metaTag) {
if (strtolower($metaTag->getAttribute('name')) === 'keywords') {
$keywords = explode(',', $metaTag->getAttributeNode('content')?->value);
$keywords = array_map(fn($keyword) => trim(e($keyword)), $keywords);
array_push($keywords, ...$keywords);
}
}
return response()->json(['keywords' => $keywords]);
}

return response(null);
return response()->json(['keywords' => null]);
}
}
1 change: 1 addition & 0 deletions app/Http/Controllers/Guest/LinkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function index(Request $request): View
}

return view('guest.links.index', [
'pageTitle' => trans('link.links'),
'links' => $links->paginate(getPaginationLimit()),
'route' => $request->getBaseUrl(),
'orderBy' => $request->input('orderBy', 'created_at'),
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Controllers/Guest/ListController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function index(Request $request): View
->paginate(getPaginationLimit());

return view('guest.lists.index', [
'pageTitle' => trans('list.lists'),
'lists' => $lists,
'orderBy' => $request->input('orderBy', 'name'),
'orderDir' => $this->getOrderDirection($request, 'asc'),
Expand All @@ -54,6 +55,7 @@ public function show(Request $request, int $listID): View
)->paginate(getPaginationLimit());

return view('guest.lists.show', [
'pageTitle' => trans('list.list') . ': ' . $list->name,
'list' => $list,
'listLinks' => $links,
'route' => $request->getBaseUrl(),
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Controllers/Guest/TagController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function index(Request $request): View
->paginate(getPaginationLimit());

return view('guest.tags.index', [
'pageTitle' => trans('tag.tags'),
'tags' => $tags,
'route' => $request->getBaseUrl(),
'orderBy' => $request->input('orderBy', 'name'),
Expand All @@ -55,6 +56,7 @@ public function show(Request $request, int $tagID): View
)->paginate(getPaginationLimit());

return view('guest.tags.show', [
'pageTitle' => trans('tag.tag') . ': ' . $tag->name,
'tag' => $tag,
'tagLinks' => $links,
'route' => $request->getBaseUrl(),
Expand Down
4 changes: 4 additions & 0 deletions app/Http/Controllers/Models/LinkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public function index(Request $request): View
}

return view('models.links.index', [
'pageTitle' => trans('link.links'),
'links' => $links->paginate(getPaginationLimit()),
'route' => $request->getBaseUrl(),
'orderBy' => $orderBy,
Expand All @@ -59,6 +60,7 @@ public function create(): View
session()->forget('bookmarklet.create');

return view('models.links.create', [
'pageTitle' => trans('link.add'),
'existing_link' => null,
]);
}
Expand Down Expand Up @@ -111,6 +113,7 @@ public function store(LinkStoreRequest $request): RedirectResponse
public function show(Link $link): View
{
return view('models.links.show', [
'pageTitle' => trans('link.link') . ': ' . $link->shortTitle(),
'link' => $link,
'history' => $link->revisionHistory()->latest()->get(),
]);
Expand All @@ -125,6 +128,7 @@ public function show(Link $link): View
public function edit(Link $link): View
{
return view('models.links.edit', [
'pageTitle' => trans('link.edit') . ': ' . $link->shortTitle(),
'link' => $link,
'existing_link' => null,
]);
Expand Down
11 changes: 9 additions & 2 deletions app/Http/Controllers/Models/ListController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function index(Request $request): View
$lists = $lists->paginate(getPaginationLimit());

return view('models.lists.index', [
'pageTitle' => trans('list.lists'),
'lists' => $lists,
'route' => $request->getBaseUrl(),
'orderBy' => $orderBy,
Expand All @@ -56,7 +57,9 @@ public function index(Request $request): View
*/
public function create(): View
{
return view('models.lists.create');
return view('models.lists.create', [
'pageTitle' => trans('list.add'),
]);
}

/**
Expand Down Expand Up @@ -98,6 +101,7 @@ public function show(Request $request, LinkList $list): View
)->paginate(getPaginationLimit());

return view('models.lists.show', [
'pageTitle' => trans('list.list') . ': ' . $list->name,
'list' => $list,
'listLinks' => $links,
'route' => $request->getBaseUrl(),
Expand All @@ -114,7 +118,10 @@ public function show(Request $request, LinkList $list): View
*/
public function edit(LinkList $list): View
{
return view('models.lists.edit', ['list' => $list]);
return view('models.lists.edit', [
'pageTitle' => trans('list.edit') . ': ' . $list->name,
'list' => $list,
]);
}

/**
Expand Down
5 changes: 4 additions & 1 deletion app/Http/Controllers/Models/NoteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ public function edit(Note $note): View
abort(403);
}

return view('models.notes.edit', ['note' => $note]);
return view('models.notes.edit', [
'pageTitle' => trans('note.edit'),
'note' => $note,
]);
}

/**
Expand Down
11 changes: 9 additions & 2 deletions app/Http/Controllers/Models/TagController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function index(Request $request): View
$tags = $tags->paginate(getPaginationLimit());

return view('models.tags.index', [
'pageTitle' => trans('tag.tags'),
'tags' => $tags,
'route' => $request->getBaseUrl(),
'orderBy' => $orderBy,
Expand All @@ -57,7 +58,9 @@ public function index(Request $request): View
*/
public function create(): View
{
return view('models.tags.create');
return view('models.tags.create', [
'pageTitle' => trans('tag.add'),
]);
}

/**
Expand Down Expand Up @@ -99,6 +102,7 @@ public function show(Request $request, Tag $tag): View
->paginate(getPaginationLimit());

return view('models.tags.show', [
'pageTitle' => trans('tag.tag') . ': ' . $tag->name,
'tag' => $tag,
'tagLinks' => $links,
'route' => $request->getBaseUrl(),
Expand All @@ -115,7 +119,10 @@ public function show(Request $request, Tag $tag): View
*/
public function edit(Tag $tag): View
{
return view('models.tags.edit', ['tag' => $tag]);
return view('models.tags.edit', [
'pageTitle' => trans('tag.edit') . ': ' . $tag->name,
'tag' => $tag,
]);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/Setup/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ protected function redirectTo(): string
*/
public function index(): View
{
return view('setup.account');
return view('setup.account', [
'pageTitle' => trans('setup.account_setup'),
]);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/Setup/DatabaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ class DatabaseController extends Controller
*/
public function index(): View
{
return view('setup.database');
return view('setup.database', [
'pageTitle' => trans('setup.database_configure'),
]);
}

/**
Expand Down
8 changes: 6 additions & 2 deletions app/Http/Controllers/Setup/MetaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ class MetaController extends Controller
*/
public function welcome(): View
{
return view('setup.welcome');
return view('setup.welcome', [
'pageTitle' => trans('setup.setup'),
]);
}

/**
Expand All @@ -30,6 +32,8 @@ public function complete(): View
Setting::create(['key' => 'system_setup_completed', 'value' => true]);
Cache::forget('systemsettings');

return view('setup.complete');
return view('setup.complete', [
'pageTitle' => trans('setup.complete'),
]);
}
}
1 change: 1 addition & 0 deletions app/Http/Controllers/Setup/RequirementsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public function index(): View
[$success, $results] = $this->checkRequirements();

return view('setup.requirements', [
'pageTitle' => trans('setup.setup_requirements'),
'success' => $success,
'results' => $results,
]);
Expand Down
Loading

0 comments on commit 9e8e8f0

Please sign in to comment.