Skip to content
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

Merged
merged 31 commits into from
Jan 4, 2025
Merged

Share GPX #978

merged 31 commits into from
Jan 4, 2025

Conversation

alisa911
Copy link
Contributor

No description provided.

@alisa911
Copy link
Contributor Author

@alisa911
Copy link
Contributor Author

API list

  • generate url - /generate-shared-url
  • get gpx by url - /gpx/share/{token}
  • get users with access - /accessed-users
  • create blacklist - /create-file-blacklist
  • get backlist - /get-blacklist

@alisa911 alisa911 requested review from RZR-UA and vshcherb November 20, 2024 14:55
@alisa911
Copy link
Contributor Author

shared_info
{"blacklist": {"users": [9, 15]}, "whitelist": {"permissions": {"13": {"permissionType": "READ"}}}, "accessedUsers": {"users": [19]}}
shared_code
7e3ebd26-5a2f-49a1-b9ba-9f0e80447cdd

@alisa911 alisa911 requested review from vshcherb and RZR-UA November 21, 2024 10:42
@alisa911
Copy link
Contributor Author

API list

/file-share - create and save code, return url
/share/gpx/{code} - get file by url
/share/accessed-users - get users with access
/share/edit-blacklist
/share/edit-whitelist
/share/get-blacklist

@vshcherb
Copy link
Member

vshcherb commented Nov 21, 2024

API Editor

  • /share/generate-link?file=&filetype=&type= - create and save code, return url
  • /share/edit-blacklist -
  • /share/edit-whitelist -
  • /share/get-shared-info - (full json from db with integer replaced by users)

Link
https://osmand.net/map/?share=UNIQUE_CODE.

API Get access:

  • /share/check-access?share=UNIQUE_CODE. - returns how access could be and whether you have access or not (if logged in)
  • /share/get?share=UNIQUE_CODE.

/share/get-gpx

@alisa911
Copy link
Contributor Author

alisa911 commented Nov 28, 2024

API

  • generate-link
    /share/generate-link?fileName=2022_11_11_09.49.41_Dag.gpx&fileType=GPX&type=publicByLogin

    {
        "url": "/share/get?code=cb5f0208-2022_11_g.gpx"
    }
  • /share/get
    /share/get?code=cb5f0208-2022_11_g.gpx
    Result: File (binary)

  • get-shared-info
    /share/get-shared-info?name=2022_11_11_09.49.41_Dag.gpx&type=GPX

    {
        "whitelist": {
            "permissions": {
                "13": {
                    "permissionType": "READ"
                }
            }
        },
        "blacklist": {
            "users": [
                9,
                15
            ]
        },
        "accessedUsers": {
            "users": {
                "19": 1732804100607
            }
        },
        "sharingType": "PUBLIC_BY_LOGIN",
        "groupActions": []
    }
  • /share/edit-blacklist
    /share/edit-blacklist?name=2022_11_11_09.49.41_Dag.gpx&type=GPX

  • /share/edit-whitelist
    /share/edit-whitelist?name=2022_11_11_09.49.41_Dag.gpx&type=GPX

  • check-access
    /share/check-access?code=cb5f0208-2022_11_g.gpx

    {
        "groupActions": [],
        "type": "PUBLIC_BY_LOGIN",
        "hasAccess": true
    }

@alisa911 alisa911 requested review from RZR-UA and vshcherb November 28, 2024 15:05
@RZR-UA
Copy link
Contributor

RZR-UA commented Nov 29, 2024

/share/generate-link?fileName=2022_11_11_09.49.41_Dag.gpx&fileType=GPX&type=publicByLogin

  1. It is possible that using fileId would be better than using fileName/tileType

  2. Anyway, what will happen with the generated link when:

  • file is deleted
  • file is moved/renamed
  • file is replaced with the fresher one

@alisa911 alisa911 marked this pull request as ready for review December 18, 2024 12:17
db/sql_changeset_schema Outdated Show resolved Hide resolved
@alisa911 alisa911 requested review from RZR-UA and vshcherb December 18, 2024 16:29
@alisa911 alisa911 requested a review from RZR-UA December 19, 2024 08:22
CREATE TABLE user_share_files (
id SERIAL PRIMARY KEY,
ownerid INTEGER NOT NULL,
uuid UUID UNIQUE,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to use VARCHAR not UUID. Some day we might decide to use some shorter code such as set of [a-zA-Z0-9]. VARCHAR would be OK for both UUID and String.

@vshcherb vshcherb merged commit a0730eb into master Jan 4, 2025
@vshcherb vshcherb deleted the T2527 branch January 4, 2025 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants