-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Share GPX #978
base: master
Are you sure you want to change the base?
Conversation
API list
|
java-tools/OsmAndServer/src/main/java/net/osmand/server/api/services/UserdataService.java
Outdated
Show resolved
Hide resolved
@@ -833,4 +828,112 @@ public String getRegionsByLatlon(@RequestParam("lat") double lat, @RequestParam( | |||
regions = osmandRegions.getRegionsToDownload(lat, lon, regions); | |||
return gson.toJson(Map.of("regions", regions)); | |||
} | |||
|
|||
@GetMapping(path = {"/generate-shared-url"}, produces = "application/json") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please create a new API group for sharing, i.e. /share/get /share/generate /share/accessed-users, etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 url is enough, how access is provided is just a single string type. Other apis to edit blacklist whitelist should be provided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better naming:
/file-share - always with POST !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 url is enough - what do you mean?
java-tools/OsmAndServer/src/main/java/net/osmand/server/api/services/UserdataService.java
Outdated
Show resolved
Hide resolved
java-tools/OsmAndServer/src/main/java/net/osmand/server/api/services/UserdataService.java
Outdated
Show resolved
Hide resolved
return ResponseEntity.ok(gson.toJson(Map.of("sharedUrl", sharedUrl))); | ||
} | ||
|
||
@GetMapping(path = {"/gpx/share/{token}"}, produces = "application/json") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/share/get/{token}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's token?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a generated unique code to create the shared url
b0244cbc06abda8c69b83722315a for url https://osmand.net/map/gpx/share/b0244cbc06abda8c69b83722315a
It is stored in user_files
return ResponseEntity.ok("Blacklist created"); | ||
} | ||
|
||
@GetMapping(path = {"/get-blacklist"}, produces = "application/json") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method get file shared information is enough with all information of json. No secrets could be to the owner of the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what you mean. This is api for showing the list to the user.
java-tools/OsmAndServer/src/main/java/net/osmand/server/controllers/user/MapApiController.java
Outdated
Show resolved
Hide resolved
shared_info |
Iterable<UserFile> findAllByUserid(int userid); | ||
|
||
|
||
UserFile findUserFileBySharedCode(String code); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
db index?
API list /file-share - create and save code, return url |
} | ||
|
||
public static class AccessedUsers { | ||
private Set<Integer> users; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Map<Integer, Long> - timestamp of first access
@@ -833,4 +832,128 @@ public String getRegionsByLatlon(@RequestParam("lat") double lat, @RequestParam( | |||
regions = osmandRegions.getRegionsToDownload(lat, lon, regions); | |||
return gson.toJson(Map.of("regions", regions)); | |||
} | |||
|
|||
// Share GPX |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Share controller needed with own url /share
API Editor
Link API Get access:
/share/get-gpx |
public enum PermissionType { | ||
READ, | ||
WRITE, | ||
EXECUTE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EXECUTE - execute what and where?
String domain = request.getScheme() + "://" + request.getServerName() + | ||
(request.getServerPort() != 80 && request.getServerPort() != 443 ? ":" + request.getServerPort() : ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to not use OsmAnd Server Name/Port in the URL. The URL should exclude domain/port and should be processed on the Client (Web - relative to URL of current site, Android - fixed osmand.net/..., etc.)
No description provided.