From ffd105eac621cdddaa3e6af2747c7548a1e47fb6 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Wed, 8 Mar 2023 10:22:36 -0800 Subject: [PATCH] feat: add gps data editor (close #418) --- lib/Controller/PageController.php | 3 + src/components/Metadata.vue | 2 + src/components/modal/EditExif.vue | 10 +- src/components/modal/EditLocation.vue | 194 +++++++++++++++++++++ src/components/modal/EditMetadataModal.vue | 20 ++- src/components/modal/FaceList.vue | 7 +- 6 files changed, 230 insertions(+), 6 deletions(-) create mode 100644 src/components/modal/EditLocation.vue diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 0c53ad02..e3277c5f 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -133,6 +133,9 @@ class PageController extends Controller $addImageDomain('https://*.tile.openstreetmap.org'); $addImageDomain('https://*.a.ssl.fastly.net'); + // Allow Nominatim + $policy->addAllowedConnectDomain('nominatim.openstreetmap.org'); + return $policy; } diff --git a/src/components/Metadata.vue b/src/components/Metadata.vue index eb762191..12510f5f 100644 --- a/src/components/Metadata.vue +++ b/src/components/Metadata.vue @@ -163,6 +163,8 @@ export default defineComponent({ subtitle: [], icon: LocationIcon, href: this.mapFullUrl, + edit: () => + globalThis.editMetadata([globalThis.currentViewerPhoto], [4]), }); } diff --git a/src/components/modal/EditExif.vue b/src/components/modal/EditExif.vue index 37bf43b4..abcd9f8b 100644 --- a/src/components/modal/EditExif.vue +++ b/src/components/modal/EditExif.vue @@ -7,10 +7,13 @@ @@ -119,6 +122,11 @@ export default defineComponent({ ? t("memories", "Empty") : t("memories", "Unchanged"); }, + + reset(field: any) { + this.exif[field.field] = ""; + this.dirty[field.field] = false; + }, }, }); diff --git a/src/components/modal/EditLocation.vue b/src/components/modal/EditLocation.vue new file mode 100644 index 00000000..facb5cfb --- /dev/null +++ b/src/components/modal/EditLocation.vue @@ -0,0 +1,194 @@ + + + + + diff --git a/src/components/modal/EditMetadataModal.vue b/src/components/modal/EditMetadataModal.vue index 701b5cf4..52c42ff2 100644 --- a/src/components/modal/EditMetadataModal.vue +++ b/src/components/modal/EditMetadataModal.vue @@ -37,6 +37,13 @@ + +
+
+ {{ t("memories", "Geolocation") }} +
+ +
@@ -56,9 +63,10 @@ const NcProgressBar = () => import("@nextcloud/vue/dist/Components/NcProgressBar"); import Modal from "./Modal.vue"; -import EditExif from "./EditExif.vue"; import EditDate from "./EditDate.vue"; import EditTags from "./EditTags.vue"; +import EditExif from "./EditExif.vue"; +import EditLocation from "./EditLocation.vue"; import { showError } from "@nextcloud/dialogs"; import { emit } from "@nextcloud/event-bus"; @@ -74,9 +82,10 @@ export default defineComponent({ NcProgressBar, Modal, - EditExif, EditDate, EditTags, + EditExif, + EditLocation, }, mixins: [UserConfig], @@ -95,7 +104,7 @@ export default defineComponent({ this.$emit("refresh", val); }, - async open(photos: IPhoto[], sections: number[] = [1, 2, 3]) { + async open(photos: IPhoto[], sections: number[] = [1, 2, 3, 4]) { const state = (this.state = Math.random()); this.show = true; this.processing = true; @@ -164,7 +173,10 @@ export default defineComponent({ } // Get exif fields diff - const exifResult = (this.$refs.editExif)?.result?.() || {}; + const exifResult = { + ...((this.$refs.editExif)?.result?.() || {}), + ...((this.$refs.editLocation)?.result?.() || {}), + }; const tagsResult = (this.$refs.editTags)?.result?.() || null; // Start processing diff --git a/src/components/modal/FaceList.vue b/src/components/modal/FaceList.vue index 07246a3f..e9077341 100644 --- a/src/components/modal/FaceList.vue +++ b/src/components/modal/FaceList.vue @@ -6,7 +6,9 @@ :label="t('memories', 'Search')" :placeholder="t('memories', 'Search')" @input="searchChanged" - /> + > + +
@@ -28,11 +30,14 @@ import NcTextField from "@nextcloud/vue/dist/Components/NcTextField"; import * as dav from "../../services/DavRequests"; import Fuse from "fuse.js"; +import Magnify from "vue-material-design-icons/Magnify.vue"; + export default defineComponent({ name: "FaceList", components: { Tag, NcTextField, + Magnify, }, data: () => ({