Skip to content

Commit

Permalink
Fixes Session timeout error #2896 and #2897 (#2898)
Browse files Browse the repository at this point in the history
  • Loading branch information
sancsin authored Jan 13, 2025
1 parent 52b4a74 commit 773a5e3
Show file tree
Hide file tree
Showing 35 changed files with 258 additions and 99 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/VueController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ private function check(AbstractAlbum $album): bool

return $result ? true : throw new UnauthorizedException();
}
}
}
16 changes: 16 additions & 0 deletions app/Http/Middleware/VerifyCsrfToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,20 @@ public function handle($request, \Closure $next): mixed

return parent::handle($request, $next);
}

/**
* Determine if the HTTP request uses a ‘read’ verb.
*
* @param \Illuminate\Http\Request $request
*
* @return bool
*/
protected function isReading($request)
{
if (str_starts_with($request->route()->uri, 'api/v2')) {
return false;
}

return parent::isReading($request);
}
}
6 changes: 6 additions & 0 deletions lang/cz/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,10 @@
'se' => [
'available' => 'Available in the Supporter Edition',
],
'session_expired' => [
'title' => 'Session expired',
'message' => 'Your session has expired.<br />Please reload the page.',
'reload' => 'Reload',
'go_to_gallery' => 'Go to the Gallery',
],
];
6 changes: 6 additions & 0 deletions lang/de/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,10 @@
'se' => [
'available' => 'Available in the Supporter Edition',
],
'session_expired' => [
'title' => 'Session expired',
'message' => 'Your session has expired.<br />Please reload the page.',
'reload' => 'Reload',
'go_to_gallery' => 'Go to the Gallery',
],
];
6 changes: 6 additions & 0 deletions lang/el/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,10 @@
'se' => [
'available' => 'Available in the Supporter Edition',
],
'session_expired' => [
'title' => 'Session expired',
'message' => 'Your session has expired.<br />Please reload the page.',
'reload' => 'Reload',
'go_to_gallery' => 'Go to the Gallery',
],
];
6 changes: 6 additions & 0 deletions lang/en/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,10 @@
'se' => [
'available' => 'Available in the Supporter Edition',
],
'session_expired' => [
'title' => 'Session expired',
'message' => 'Your session has expired.<br />Please reload the page.',
'reload' => 'Reload',
'go_to_gallery' => 'Go to the Gallery',
],
];
6 changes: 6 additions & 0 deletions lang/es/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,10 @@
'se' => [
'available' => 'Available in the Supporter Edition',
],
'session_expired' => [
'title' => 'Session expired',
'message' => 'Your session has expired.<br />Please reload the page.',
'reload' => 'Reload',
'go_to_gallery' => 'Go to the Gallery',
],
];
6 changes: 6 additions & 0 deletions lang/fr/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,10 @@
'se' => [
'available' => 'Available in the Supporter Edition',
],
'session_expired' => [
'title' => 'Session expired',
'message' => 'Your session has expired.<br />Please reload the page.',
'reload' => 'Reload',
'go_to_gallery' => 'Go to the Gallery',
],
];
6 changes: 6 additions & 0 deletions lang/hu/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,10 @@
'se' => [
'available' => 'Available in the Supporter Edition',
],
'session_expired' => [
'title' => 'Session expired',
'message' => 'Your session has expired.<br />Please reload the page.',
'reload' => 'Reload',
'go_to_gallery' => 'Go to the Gallery',
],
];
6 changes: 6 additions & 0 deletions lang/it/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,10 @@
'se' => [
'available' => 'Available in the Supporter Edition',
],
'session_expired' => [
'title' => 'Session expired',
'message' => 'Your session has expired.<br />Please reload the page.',
'reload' => 'Reload',
'go_to_gallery' => 'Go to the Gallery',
],
];
6 changes: 6 additions & 0 deletions lang/ja/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,10 @@
'se' => [
'available' => 'Available in the Supporter Edition',
],
'session_expired' => [
'title' => 'Session expired',
'message' => 'Your session has expired.<br />Please reload the page.',
'reload' => 'Reload',
'go_to_gallery' => 'Go to the Gallery',
],
];
6 changes: 6 additions & 0 deletions lang/nl/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,10 @@
'se' => [
'available' => 'Available in the Supporter Edition',
],
'session_expired' => [
'title' => 'Session expired',
'message' => 'Your session has expired.<br />Please reload the page.',
'reload' => 'Reload',
'go_to_gallery' => 'Go to the Gallery',
],
];
6 changes: 6 additions & 0 deletions lang/no/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,10 @@
'se' => [
'available' => 'Available in the Supporter Edition',
],
'session_expired' => [
'title' => 'Session expired',
'message' => 'Your session has expired.<br />Please reload the page.',
'reload' => 'Reload',
'go_to_gallery' => 'Go to the Gallery',
],
];
6 changes: 6 additions & 0 deletions lang/pl/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,10 @@
'se' => [
'available' => 'Available in the Supporter Edition',
],
'session_expired' => [
'title' => 'Session expired',
'message' => 'Your session has expired.<br />Please reload the page.',
'reload' => 'Reload',
'go_to_gallery' => 'Go to the Gallery',
],
];
6 changes: 6 additions & 0 deletions lang/pt/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,10 @@
'se' => [
'available' => 'Available in the Supporter Edition',
],
'session_expired' => [
'title' => 'Session expired',
'message' => 'Your session has expired.<br />Please reload the page.',
'reload' => 'Reload',
'go_to_gallery' => 'Go to the Gallery',
],
];
6 changes: 6 additions & 0 deletions lang/ru/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,10 @@
'se' => [
'available' => 'Available in the Supporter Edition',
],
'session_expired' => [
'title' => 'Session expired',
'message' => 'Your session has expired.<br />Please reload the page.',
'reload' => 'Reload',
'go_to_gallery' => 'Go to the Gallery',
],
];
6 changes: 6 additions & 0 deletions lang/sk/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,10 @@
'se' => [
'available' => 'Available in the Supporter Edition',
],
'session_expired' => [
'title' => 'Session expired',
'message' => 'Your session has expired.<br />Please reload the page.',
'reload' => 'Reload',
'go_to_gallery' => 'Go to the Gallery',
],
];
6 changes: 6 additions & 0 deletions lang/sv/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,10 @@
'se' => [
'available' => 'Available in the Supporter Edition',
],
'session_expired' => [
'title' => 'Session expired',
'message' => 'Your session has expired.<br />Please reload the page.',
'reload' => 'Reload',
'go_to_gallery' => 'Go to the Gallery',
],
];
6 changes: 6 additions & 0 deletions lang/vi/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,10 @@
'se' => [
'available' => 'Available in the Supporter Edition',
],
'session_expired' => [
'title' => 'Session expired',
'message' => 'Your session has expired.<br />Please reload the page.',
'reload' => 'Reload',
'go_to_gallery' => 'Go to the Gallery',
],
];
6 changes: 6 additions & 0 deletions lang/zh_CN/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,10 @@
'se' => [
'available' => 'Available in the Supporter Edition',
],
'session_expired' => [
'title' => 'Session expired',
'message' => 'Your session has expired.<br />Please reload the page.',
'reload' => 'Reload',
'go_to_gallery' => 'Go to the Gallery',
],
];
6 changes: 6 additions & 0 deletions lang/zh_TW/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,10 @@
'se' => [
'available' => 'Available in the Supporter Edition',
],
'session_expired' => [
'title' => 'Session expired',
'message' => 'Your session has expired.<br />Please reload the page.',
'reload' => 'Reload',
'go_to_gallery' => 'Go to the Gallery',
],
];
12 changes: 4 additions & 8 deletions resources/js/components/drawers/PhotoEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,10 @@ function save() {
tags: tags.value ?? [],
license: license.value?.value ?? "none",
upload_date: uploadDate.value?.toISOString().slice(0, 16) + uploadTz.value,
})
.then((response) => {
toast.add({ severity: "success", summary: "Success", life: 3000 });
load(response.data);
})
.catch((error) => {
console.error(error);
});
}).then((response) => {
toast.add({ severity: "success", summary: "Success", life: 3000 });
load(response.data);
});
}
load(props.photo);
Expand Down
24 changes: 8 additions & 16 deletions resources/js/components/forms/album/AlbumProperties.vue
Original file line number Diff line number Diff line change
Expand Up @@ -429,14 +429,10 @@ function saveAlbum() {
album_timeline: albumTimeline.value?.value ?? null,
photo_timeline: photoTimeline.value?.value ?? null,
};
AlbumService.updateAlbum(data)
.then(() => {
toast.add({ severity: "success", summary: trans("toast.success"), life: 3000 });
AlbumService.clearCache(albumId.value);
})
.catch((error) => {
console.error(error);
});
AlbumService.updateAlbum(data).then(() => {
toast.add({ severity: "success", summary: trans("toast.success"), life: 3000 });
AlbumService.clearCache(albumId.value);
});
}
function saveTagAlbum() {
Expand All @@ -456,14 +452,10 @@ function saveTagAlbum() {
photo_layout: photoLayout.value?.value ?? null,
photo_timeline: photoTimeline.value?.value ?? null,
};
AlbumService.updateTag(data)
.then(() => {
toast.add({ severity: "success", summary: trans("toasts.success"), life: 3000 });
AlbumService.clearCache(albumId.value);
})
.catch((error) => {
console.error(error);
});
AlbumService.updateTag(data).then(() => {
toast.add({ severity: "success", summary: trans("toasts.success"), life: 3000 });
AlbumService.clearCache(albumId.value);
});
}
watch(
Expand Down
24 changes: 10 additions & 14 deletions resources/js/components/forms/album/AlbumVisibility.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,15 @@ function save() {
password: password.value,
};
AlbumService.updateProtectionPolicy(data)
.then(() => {
toast.add({ severity: "success", summary: trans("toasts.success"), detail: trans("dialogs.visibility.visibility_updated"), life: 3000 });
AlbumService.clearCache(albumId.value);
if (props.config.is_model_album) {
// @ts-expect-error
AlbumService.clearCache(props.album.parent_id);
} else {
AlbumService.clearAlbums();
}
})
.catch((error) => {
console.error(error);
});
AlbumService.updateProtectionPolicy(data).then(() => {
toast.add({ severity: "success", summary: trans("toasts.success"), detail: trans("dialogs.visibility.visibility_updated"), life: 3000 });
AlbumService.clearCache(albumId.value);
if (props.config.is_model_album) {
// @ts-expect-error
AlbumService.clearCache(props.album.parent_id);
} else {
AlbumService.clearAlbums();
}
});
}
</script>
2 changes: 1 addition & 1 deletion resources/js/components/maintenance/MaintenanceFixTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<ProgressSpinner v-if="loading" class="w-full"></ProgressSpinner>
</ScrollPanel>
<div class="flex gap-4 mt-1">
<Button as="router-link" to="/fixTree" v-if="fixable && !loading" severity="primary" class="w-full border-none">{{
<Button as="router-link" :to="{ name: 'tree' }" v-if="fixable && !loading" severity="primary" class="w-full border-none">{{
$t("maintenance.fix-tree.button")
}}</Button>
</div>
Expand Down
10 changes: 3 additions & 7 deletions resources/js/components/modals/AboutLychee.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,9 @@ const lycheeStore = useLycheeStateStore();
const { is_se_enabled, is_se_info_hidden } = storeToRefs(lycheeStore);
InitService.fetchVersion()
.then((data) => {
version.value = data.data;
})
.catch((error) => {
console.error(error);
});
InitService.fetchVersion().then((data) => {
version.value = data.data;
});
function closeCallback() {
visible.value = false;
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/modals/LoginModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<InputPassword id="password" v-model="password" @keydown.enter="login" autocomplete="current-password" />
<label class="" for="password">{{ $t("dialogs.login.password") }}</label>
</FloatLabel>
<Message v-if="invalidPassword" severity="error">{{ $t("dialog.login.unknonw_invalid") }}</Message>
<Message v-if="invalidPassword" severity="error">{{ $t("dialog.login.unknown_invalid") }}</Message>
</div>
<div class="px-9 text-muted-color text-right font-semibold">Lychee <span class="text-primary-500" v-if="is_se_enabled">SE</span></div>
<div class="flex items-center mt-9">
Expand Down
Loading

0 comments on commit 773a5e3

Please sign in to comment.