Skip to content

Commit

Permalink
Merge pull request #107 from Kovah/dev
Browse files Browse the repository at this point in the history
v0.0.34
  • Loading branch information
Kovah committed Apr 28, 2020
2 parents 3987f5d + 0ccb319 commit 0f2fa15
Show file tree
Hide file tree
Showing 99 changed files with 501 additions and 450 deletions.
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: kovah # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: kovah # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
21 changes: 21 additions & 0 deletions SECURITY.md
@@ -0,0 +1,21 @@
# Security Policy

## Supported Versions

As LinkAce is currently being developed, there is no support for the current releases. All releases are marked
as pre-releases, and a development disclaimer is present in the README. Usage of the app in this state is entirely
on your own risk.

| Version | Supported |
| ------- | ------------------ |
| 0.x | :x: |
| 1.x | :white_check_mark: |

## Reporting a Vulnerability

All dependencies are updated regularly, security fixes for those dependencies are released as fast as possible.

If you discover a security vulnerability, please contact me directly via `contact [at] linkace [dot] org`. Those
vulnerabilities are addressed as fast as possible.

At the moment, there is no bug bounty program active.
117 changes: 0 additions & 117 deletions app/Helper/Alert.php

This file was deleted.

17 changes: 16 additions & 1 deletion app/Helper/LinkAce.php
Expand Up @@ -2,7 +2,10 @@

namespace App\Helper;

use GuzzleHttp\Exception\RequestException;
use Illuminate\Http\Client\ConnectionException;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;

/**
* Class LinkAce
Expand All @@ -25,7 +28,19 @@ public static function getMetaFromURL(string $url): array
];

// Try to get the HTML content of that URL
$response = Http::get($url);
try {
$response = Http::get($url);
} catch (ConnectionException $e) {
flash(trans('link.added_connection_error'), 'warning');
Log::warning($url . ': ' . $e->getMessage());

return $fallback;
} catch (RequestException $e) {
flash(trans('link.added_request_error'), 'warning');
Log::warning($url . ': ' . $e->getMessage());

return $fallback;
}

if (!$response->successful()) {
return $fallback;
Expand Down
3 changes: 1 addition & 2 deletions app/Helper/WaybackMachine.php
Expand Up @@ -2,7 +2,6 @@

namespace App\Helper;

use GuzzleHttp\Client;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;

Expand Down Expand Up @@ -36,7 +35,7 @@ public static function saveToArchive(string $url): bool
try {
$response->throw();
} catch (\Exception $e) {
Log::warning($e);
Log::warning($archiveUrl . ': ' . $e->getMessage());
return false;
}

Expand Down
19 changes: 0 additions & 19 deletions app/Helper/functions.php
Expand Up @@ -195,25 +195,6 @@ function waybackLink($link): ?string
return WaybackMachine::getArchiveLink($link);
}

/**
* Flash an alert.
*
* @param string|null $message
* @param string|null $style
*
* @return Alert
*/
function alert(?string $message = null, ?string $style = 'info'): Alert
{
$alert = app('alert');

if ($message === null) {
return $alert;
}

return $alert->flash($message, $style);
}

/**
* Return proper link attributes based on the links_new_tab user setting
*
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/App/ImportController.php
Expand Up @@ -46,7 +46,7 @@ public function doImport(DoImportRequest $request)
$links = $parser->parseString($data);

if (empty($links)) {
alert(trans('import.import_empty'), 'warning');
flash(trans('import.import_empty'), 'warning');
return redirect()->back();
}

Expand Down Expand Up @@ -92,7 +92,7 @@ public function doImport(DoImportRequest $request)
$imported++;
}

alert(trans('import.import_successfully', [
flash(trans('import.import_successfully', [
'imported' => $imported,
'skipped' => $skipped,
]), 'success');
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/App/SystemSettingsController.php
Expand Up @@ -48,7 +48,7 @@ public function saveSystemSettings(SystemSettingsUpdateRequest $request): Redire
]);
}

alert(trans('settings.settings_saved'));
flash(trans('settings.settings_saved'));

return redirect()->route('get-sysstemsettings');
}
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/App/TrashController.php
Expand Up @@ -83,15 +83,15 @@ public function clearTrash(Request $reques, $model)
}

if ($entries->isEmpty()) {
alert(trans('trash.delete_no_entries'), 'warning');
flash(trans('trash.delete_no_entries'), 'warning');
return redirect()->back();
}

foreach ($entries as $entry) {
$entry->forceDelete();
}

alert(trans('trash.delete_success.' . $model), 'success');
flash(trans('trash.delete_success.' . $model), 'success');

return redirect()->route('get-trash');
}
Expand Down Expand Up @@ -133,7 +133,7 @@ public function restoreEntry(Request $request, $model, $id)

$entry->restore();

alert(trans('trash.restore.' . $model), 'success');
flash(trans('trash.restore.' . $model), 'success');

return redirect()->route('get-trash');
}
Expand Down
8 changes: 4 additions & 4 deletions app/Http/Controllers/App/UserSettingsController.php
Expand Up @@ -51,7 +51,7 @@ public function saveAccountSettings(UserAccountUpdateRequest $request): Redirect
'email',
]));

alert(trans('settings.settings_saved'), 'success');
flash(trans('settings.settings_saved'), 'success');
return redirect()->back();
}

Expand Down Expand Up @@ -89,7 +89,7 @@ public function saveAppSettings(UserSettingsUpdateRequest $request): RedirectRes
]);
}

alert(trans('settings.settings_saved'), 'success');
flash(trans('settings.settings_saved'), 'success');
return redirect()->back();
}

Expand All @@ -107,14 +107,14 @@ public function changeUserPassword(UserPasswordUpdateRequest $request): Redirect
]);

if (!$authorizationSuccessful) {
alert(trans('settings.old_password_invalid'));
flash(trans('settings.old_password_invalid'));
return redirect()->back()->withInput();
}

$currentUser->password = Hash::make($request->input('new_password'));
$currentUser->save();

alert(trans('settings.password_updated'), 'success');
flash(trans('settings.password_updated'), 'success');
return redirect()->back();
}

Expand Down
8 changes: 4 additions & 4 deletions app/Http/Controllers/Models/LinkController.php
Expand Up @@ -68,7 +68,7 @@ public function store(LinkStoreRequest $request)
{
$link = LinkRepository::create($request->all());

alert(trans('link.added_successfully'), 'success');
flash(trans('link.added_successfully'), 'success');

$isBookmarklet = session('bookmarklet.create');

Expand Down Expand Up @@ -130,7 +130,7 @@ public function update(LinkUpdateRequest $request, $id)

$link = LinkRepository::update($link, $request->all());

alert(trans('link.updated_successfully'), 'success');
flash(trans('link.updated_successfully'), 'success');

return redirect()->route('links.show', [$link->id]);
}
Expand All @@ -150,11 +150,11 @@ public function destroy(LinkDeleteRequest $request, $id)
$deletionSuccessfull = LinkRepository::delete($link);

if (!$deletionSuccessfull) {
alert(trans('link.deletion_error'), 'error');
flash(trans('link.deletion_error'), 'error');
return redirect()->back();
}

alert(trans('link.deleted_successfully'), 'warning');
flash(trans('link.deleted_successfully'), 'warning');
return redirect()->route('links.index');
}

Expand Down
8 changes: 4 additions & 4 deletions app/Http/Controllers/Models/ListController.php
Expand Up @@ -62,7 +62,7 @@ public function store(ListStoreRequest $request)

$list = ListRepository::create($data);

alert(trans('list.added_successfully'), 'success');
flash(trans('list.added_successfully'), 'success');

if ($request->get('reload_view')) {
session()->flash('reload_view', true);
Expand Down Expand Up @@ -128,7 +128,7 @@ public function update(ListUpdateRequest $request, $id)

$list = ListRepository::update($list, $request->all());

alert(trans('list.updated_successfully'), 'success');
flash(trans('list.updated_successfully'), 'success');

return redirect()->route('lists.show', [$list->id]);
}
Expand All @@ -148,11 +148,11 @@ public function destroy(ListDeleteRequest $request, $id)
$deletionSuccessfull = ListRepository::delete($list);

if (!$deletionSuccessfull) {
alert(trans('list.deletion_error'), 'error');
flash(trans('list.deletion_error'), 'error');
return redirect()->back();
}

alert(trans('list.deleted_successfully'), 'warning');
flash(trans('list.deleted_successfully'), 'warning');
return redirect()->route('lists.index');
}
}

0 comments on commit 0f2fa15

Please sign in to comment.