diff --git a/app/Legacy/V1/Controllers/Administration/SettingsController.php b/app/Legacy/V1/Controllers/Administration/SettingsController.php index 02897c02fd2..df82fe38bfe 100644 --- a/app/Legacy/V1/Controllers/Administration/SettingsController.php +++ b/app/Legacy/V1/Controllers/Administration/SettingsController.php @@ -33,6 +33,7 @@ use App\SmartAlbums\BaseSmartAlbum; use Illuminate\Database\Eloquent\Collection; use Illuminate\Routing\Controller; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Storage; use Symfony\Component\HttpFoundation\Exception\BadRequestException; @@ -403,6 +404,9 @@ public function getAll(GetSetAllSettingsRequest $request): Collection return Configs::query() ->orderBy('cat') ->orderBy('id') + // Only display settings which are not part of SE + ->where('level', '=', 0) + ->whereNotIn('key', ['email']) ->get(); } @@ -419,7 +423,16 @@ public function getAll(GetSetAllSettingsRequest $request): Collection public function saveAll(GetSetAllSettingsRequest $request): void { $lastException = null; - foreach ($request->except(['_token', 'function', '/api/Settings::saveAll']) as $key => $value) { + // Select all the SE settings. + $except = DB::table('configs') + ->select('key') + ->where('level', '=', '1') + ->pluck('key') + // Concat bunch of things coming from the POST request. + ->concat(['_token', 'function', '/api/Settings::saveAll']) + // Convert to array. + ->all(); + foreach ($request->except($except) as $key => $value) { $value ??= ''; try { Configs::set($key, $value); diff --git a/config/log-viewer.php b/config/log-viewer.php index dc34e7406d9..00118ba58f3 100644 --- a/config/log-viewer.php +++ b/config/log-viewer.php @@ -66,7 +66,7 @@ function renv_cond(string $cst): string | */ - 'back_to_system_url' => renv('APP_URL', 'http://localhost') . renv_cond('APP_DIR'), + 'back_to_system_url' => renv('APP_URL', 'http://localhost') . renv_cond('APP_DIR') . '/gallery', 'back_to_system_label' => null, // Displayed by default: "Back to {{ app.name }}" diff --git a/database/migrations/2024_10_23_222857_change_header.php b/database/migrations/2024_10_23_222857_change_header.php new file mode 100644 index 00000000000..932abcc15d0 --- /dev/null +++ b/database/migrations/2024_10_23_222857_change_header.php @@ -0,0 +1,22 @@ +where('value', '=', 'Lychee v5')->update(['value' => 'Lychee v6']); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + DB::table('configs')->where('value', '=', 'Lychee v6')->update(['value' => 'Lychee v5']); + } +}; diff --git a/database/migrations/2024_10_23_225332_warning_html_content.php b/database/migrations/2024_10_23_225332_warning_html_content.php new file mode 100644 index 00000000000..b658bd0fb90 --- /dev/null +++ b/database/migrations/2024_10_23_225332_warning_html_content.php @@ -0,0 +1,21 @@ +whereIn('key', ['nsfw_banner_override', 'footer_additional_text'])->update(['details' => ' Unsanitized html field.']); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + DB::table('configs')->whereIn('key', ['nsfw_banner_override', 'footer_additional_text'])->update(['details' => '']); + } +}; diff --git a/resources/js/components/forms/album/AlbumCreateDialog.vue b/resources/js/components/forms/album/AlbumCreateDialog.vue index cde263c3fe8..21af97ddfd5 100644 --- a/resources/js/components/forms/album/AlbumCreateDialog.vue +++ b/resources/js/components/forms/album/AlbumCreateDialog.vue @@ -13,7 +13,7 @@ - @@ -25,10 +25,11 @@ import AlbumService from "@/services/album-service"; import Dialog from "primevue/dialog"; import InputText from "@/components/forms/basic/InputText.vue"; -import { ref, watch } from "vue"; +import { computed, ref, watch } from "vue"; import { useRouter } from "vue-router"; import FloatLabel from "primevue/floatlabel"; import Button from "primevue/button"; +import { useToast } from "primevue/usetoast"; const props = defineProps<{ parentId: string | null; @@ -37,24 +38,31 @@ const props = defineProps<{ const visible = defineModel("visible", { default: false }); const parentId = ref(props.parentId); +const toast = useToast(); const router = useRouter(); const title = ref(undefined as undefined | string); +const isValid = computed(() => title.value !== undefined && title.value.length > 0 && title.value.length <= 100); + function create() { - if (!title.value) { + if (!isValid.value) { return; } AlbumService.createAlbum({ - title: title.value, + title: title.value as string, parent_id: parentId.value, - }).then((response) => { - title.value = undefined; - visible.value = false; - AlbumService.clearCache(parentId.value); - router.push(`/gallery/${response.data}`); - }); + }) + .then((response) => { + title.value = undefined; + visible.value = false; + AlbumService.clearCache(parentId.value); + router.push(`/gallery/${response.data}`); + }) + .catch((error) => { + toast.add({ severity: "error", summary: "Oups", detail: error.message }); + }); } watch( diff --git a/resources/js/components/forms/album/AlbumCreateTagDialog.vue b/resources/js/components/forms/album/AlbumCreateTagDialog.vue index 71461eadce3..d030506ba36 100644 --- a/resources/js/components/forms/album/AlbumCreateTagDialog.vue +++ b/resources/js/components/forms/album/AlbumCreateTagDialog.vue @@ -24,7 +24,7 @@ - @@ -36,34 +36,42 @@ import AlbumService from "@/services/album-service"; import Dialog from "primevue/dialog"; import FloatLabel from "primevue/floatlabel"; -import { ref, watch } from "vue"; +import { computed, ref, watch } from "vue"; import { useRouter } from "vue-router"; import InputText from "@/components/forms/basic/InputText.vue"; import Button from "primevue/button"; import AutoComplete from "primevue/autocomplete"; +import { useToast } from "primevue/usetoast"; const props = defineProps<{ visible: boolean; }>(); +const toast = useToast(); const router = useRouter(); const visible = ref(props.visible); const title = ref(undefined as undefined | string); const tags = ref([] as string[]); +const isValid = computed(() => title.value !== undefined && title.value.length > 0 && title.value.length <= 100); + function create() { - if (!title.value || tags.value.length === 0) { + if (!isValid.value) { return; } AlbumService.createTag({ - title: title.value, + title: title.value as string, tags: tags.value, - }).then((response) => { - AlbumService.clearAlbums(); - router.push(`/gallery/${response.data}`); - }); + }) + .then((response) => { + AlbumService.clearAlbums(); + router.push(`/gallery/${response.data}`); + }) + .catch((error) => { + toast.add({ severity: "error", summary: "Oups", detail: error.message }); + }); } watch( diff --git a/resources/js/components/forms/album/AlbumShare.vue b/resources/js/components/forms/album/AlbumShare.vue index 87cd6664c1d..9692db199c6 100644 --- a/resources/js/components/forms/album/AlbumShare.vue +++ b/resources/js/components/forms/album/AlbumShare.vue @@ -1,7 +1,7 @@