0.1.5
This commit is contained in:
@@ -59,6 +59,21 @@ class ComicController extends Controller
|
||||
return str_replace(array_keys($this->zhConversion::ZH_TO_HANT), array_values($this->zhConversion::ZH_TO_HANT), $string);
|
||||
}
|
||||
|
||||
public function toggleHistory(Request $request): JsonResponse
|
||||
{
|
||||
if ($request->session()->has('historyDisabled')) {
|
||||
$newValue = !$request->session()->get('historyDisabled');
|
||||
} else {
|
||||
$newValue = true;
|
||||
}
|
||||
|
||||
// Put Session
|
||||
$request->session()->put('historyDisabled', $newValue);
|
||||
|
||||
// Return to frontend
|
||||
return response()->json(['historyDisabled' => $newValue]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show user favourites
|
||||
*
|
||||
@@ -323,7 +338,9 @@ class ComicController extends Controller
|
||||
ImageUpsert::dispatch($comicObj->id, $chapterObj->id, $chapter);
|
||||
|
||||
// Update history
|
||||
$request->user()->readingHistories()->attach($chapterObj->id, ['comic_id' => $comicObj->id]);
|
||||
if (!$request->session()->get('historyDisabled', false)) {
|
||||
$request->user()->readingHistories()->attach($chapterObj->id, ['comic_id' => $comicObj->id]);
|
||||
}
|
||||
|
||||
// Get chapters from DB
|
||||
$chapters = $comicObj->chapters()->where('metadata->group_path_word', $chapter['chapter']['group_path_word'])->orderBy('order')->get(['name', 'chapter_uuid']);
|
||||
|
||||
@@ -13,13 +13,12 @@ class PagesController
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param string $path
|
||||
* @return ResponseFactory|Application|\Illuminate\Http\Response|Response
|
||||
*/
|
||||
public function show(Request $request, string $path = '')
|
||||
public function show(string $path = '')
|
||||
{
|
||||
if (!File::exists(resource_path("js/Pages/Pages/$path.jsx"))) {
|
||||
if (!File::exists(resource_path("js/Pages/Pages/{$path}.jsx"))) {
|
||||
return response('Page not found', 404);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@ class UserCollection extends ResourceCollection
|
||||
'name' => $request->user()->name,
|
||||
'email' => $request->user()->email,
|
||||
'settings' => $request->user()->settings,
|
||||
'favourites' => $request->user()->favourites()->get(['pathword'])->pluck('pathword')
|
||||
'favourites' => $request->user()->favourites()->get(['pathword'])->pluck('pathword'),
|
||||
'historyDisabled' => $request->session()->get('historyDisabled', false),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user