nextcloud / maps

🌍🌏🌎 The whole world fits inside your cloud!
https://apps.nextcloud.com/apps/maps
GNU Affero General Public License v3.0
503 stars 89 forks source link

Share favorite locations #70

Open anaqreon opened 5 years ago

anaqreon commented 5 years ago

My understanding is that currently the only way to share static locations stored in a user's "favorites" is by exporting them to a GPX-formatted file, either exporting all favorites or favorites in a selected category. This GPX file may then be shared in the standard ways file sharing is supported in Nextcloud.

It would be very useful to have the ability to share a favorite group "directly" with either (1) Nextcloud account holders (the same way files can be shared with access control based on authenticated Nextcloud accounts) or (2) via public link, where the practically-impossible-to-guess shared link opens the Maps app in a public view-only mode that displays the shared favorites group on the map. In the case of shares with local Nextcloud account holders, the shared favorites would appear alongside the user's own favorites, perhaps under a collapsible/toggleable "Locations shared with you" navigation section.

escoand commented 5 years ago

I would like to share not only the favorites but also a selection of my pictures/contacts/devices/...

tacruc commented 5 years ago

@escoand: for the pictures and contacts, just share it via the files/contact app and they will popup on the map of the other user. Let's discuss device sharing in an own Issue, as it is more complicated than favorite share. (most of the time you do not want to share a device (i.e. your phone) forever, but just for a limited time, like a live location in whatsapp).

jancborchardt commented 5 years ago

Yup, let’s focus on sharing sets of Favorites here. First version could be to just get a read-only link to a map view with the favorite places marked on the map.

escoand commented 5 years ago

@tacruc but I would also be interested in sharing to non-users by URL. Maybe as live holiday tracking or so. Sharing images, tracks and favourites separately would not help in this case.

jancborchardt commented 5 years ago

@anaqreon see my comment above. ;)

First version could be to just get a read-only link to a map view with the favorite places marked on the map.

And we will see from there. Step by step.

paulschwoerer commented 5 years ago

I'd be happy to have a go at a basic version to share favorites with other users on the same server. Is anyone already working on this?

jancborchardt commented 5 years ago

@paulschwoerer very cool! As far as I can see, no one is working on this.

Best would be to just have a "Share" icon left of the 3-dot menu of a favorite row, just like it is in the Files app.

Then there’s 2 ways:

This is also why I would start the sharing not with people on the same server but rather only getting a share link you can send out to anyone. It’s very simple, doesn’t need a list and it works with anyone directly. :) (As mentioned above at https://github.com/nextcloud/maps/issues/70#issuecomment-527174169 )

What do you think?

paulschwoerer commented 5 years ago

I agree that introducing the right side at an early stage like this is overkill. Might make sense in the future though, once the sharing functionality is further ahead. I'll familiarize myself with the code and see what I can come up with.

On a sidenote: Are there plans on adding in VueJS, like the core project and other nextcloud apps are doing? Maybe this question is off-topic and could be answered in a pm.

jancborchardt commented 5 years ago

I'll familiarize myself with the code and see what I can come up with.

Cool! Feel free to open up a pull request early so we can communicate about the direction and design. :)

Are there plans on adding in VueJS, like the core project and other nextcloud apps are doing?

I don’t know how familiar @eneiluj and @tacruc are with Vue.js, but yes, ideally we would use that too especially now that we have more and more in the compontent library. They will have to comment on that. :)

paulschwoerer commented 5 years ago

@jancborchardt I'm fairly experienced with VueJS, I'd be happy to help with the transition.

jancborchardt commented 5 years ago

@paulschwoerer very cool! We have our components at https://github.com/nextcloud/nextcloud-vue If you have time, you are invited to our next Contributor Week in Berlin, November 4–8. All info at https://nextcloud.com/blog/join-us-in-berlin-for-the-next-nextcloud-hackweek/ :)

(Also cc'ing some of our Vue experts @skjnldsv @juliushaertl)

paulschwoerer commented 5 years ago

Just to let anyone reading this ticket know of my progress so far: Basic public link sharing works in an early stage, public editing is still to be implemented. Due to the arguably tight coupling of the frontend controllers, it seemed like a lot of work to extract the necessary parts of the favorite controller without breaking everything. This is why I went a step further and used Vue for the public facing part of the app, because

  1. it serves as a proof of concept of how the transition to Vue could work out if it is decided to go along this path
  2. it seemed to be about the same amount of work as adapting the existing controllers

I might be able to open a pull request sometime next week, depending on how much time I can dedicate towards this project on the weekend. In the meantime, anyone interested in the changes so far can have a look at my fork of the maps app.

Cheers!

jancborchardt commented 5 years ago

@paulschwoerer very cool! Sent you an invite to the Nextcloud org, including the Maps and Vuejs teams (you can opt out if you like). You can then directly work in a branch off this main repo instead of in a fork which makes collaboration easier. Also you can open pull requests in Draft mode so we can directly discuss on that. :)

paulschwoerer commented 5 years ago

@jancborchardt Cool, sounds good. Thanks!

PS: I'd also be happy to join a hackweek, this time however won't work out.

anaqreon commented 4 years ago

@paulschwoerer I'm not sure which of your fork's branches to use. The latest commit is on the vue-rewrite branch, so I tried that one. I am unable to enable the Maps app on a fresh installation. It fails with the following error:

PHP Fatal error:  Cannot declare class InstallScan, because the name is already in use in /var/www/html/apps/maps/lib/Migration/InstallScan.php on line 45

If you have a working Docker environment, you should be able to reproduce this by executing

git clone --recursive --branch issue-70 https://github.com/anaqreon/nextcloud-maps-dev.git
cd nextcloud-maps-dev
./maps/init.sh

See the https://github.com/anaqreon/nextcloud-maps-dev Readme for details.

paulschwoerer commented 4 years ago

@anaqreon Yeah I see. For whatever reason (I guess by accident) I commented out the namespace line in file /var/www/html/apps/maps/lib/Migration/InstallScan.php. Undoing that got it working again. If you do a git submodule update --remote in your repository, it should install correctly.

However if you want to run the app in its current state you need to manually add a table to your database, as I did not create a migration, yet. This should help you:

CREATE TABLE `oc_maps_favorite_shares` (
  `id` int(11) NOT NULL,
  `owner` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `category` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `token` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

ALTER TABLE `oc_maps_favorite_shares`
  ADD PRIMARY KEY (`id`);

Also you need to manually add the share to the database, like so:

INSERT INTO `oc_maps_favorite_shares` (`id`, `owner`, `category`, `token`) VALUES
(1, 'YOUR_USER_NAME', 'Personal', 'TOKEN');

You can then access the shared favorites on: NEXTCLOUD_URL/apps/maps/s/favorites/TOKEN

This process is a bit tedious right now, but will be fixed soon(ish).

ghost commented 3 years ago

Upon clicking the three dots and Share link I see the following error in a notification in the top right corner of the map Failed to share favorites category However, the checkbox stays selected past a refresh.

A similar error shows when unchecking the share box as well. No errors in JS console besides something seems unrelated in https://eotl.cloud/js/activity/activity-sidebar.js?v=64336246-8:603

paulschwoerer commented 3 years ago

@basebuilder I'll have a look at that tomorrow.

paulschwoerer commented 3 years ago

@basebuilder Unfortunately, I cannot reproduce this behaviour in NC20, can you check if there are entries in the nexcloud.log, that could be related to the error?

eyecreate commented 3 years ago

I had the same issue as @basebuilder and see this in the request logs:

POST | https://<domain>/apps/maps/favorites-category/<Some-Category>/share
400 bad request
Response: "Unknown category"
louwers commented 2 years ago

For me it happens when there are spaces in the category name.

tacruc commented 2 years ago

@basebuilder are you trying to share the default category? Then I think it is solved in #510.

Gruefus commented 2 years ago

@louwers Thank you so much. Removing spaces and special characters fixed the issue for me.