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

feat: proposal for parsing shared urls #3644

Closed
wants to merge 1 commit into from

Conversation

MishkaRogachev
Copy link
Contributor

@MishkaRogachev MishkaRogachev commented Jun 20, 2023

For status-im/status-desktop#10851

Implement parsing shared urls in a new format

Important changes:

  • Parse url with a community key or community data (/c/ or /c#)
  • Parse url with a community channel (/cc/)
  • Parse url with a contact

@ghost
Copy link

ghost commented Jun 20, 2023

Pull Request Checklist

  • Have you updated the documentation, if impacted (e.g. docs.status.im)?
  • Have you tested changes with mobile?
  • Have you tested changes with desktop?

@status-im-auto
Copy link
Member

status-im-auto commented Jun 20, 2023

Jenkins Builds

Click to see older builds (17)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 14b69bb #1 2023-06-20 11:01:45 ~3 min ios 📦zip
✔️ cd2f4c2 #2 2023-06-20 11:11:10 ~3 min ios 📦zip
✖️ cd2f4c2 #2 2023-06-20 11:39:45 ~25 min tests 📄log
✔️ cd2f4c2 #2 2023-06-20 11:39:56 ~26 min linux 📦zip
✔️ cd2f4c2 #2 2023-06-20 11:40:52 ~27 min android 📦aar
✖️ 18d9055 #3 2023-06-21 08:54:05 ~1 min tests 📄log
✔️ 18d9055 #3 2023-06-21 08:55:44 ~2 min linux 📦zip
✔️ 18d9055 #3 2023-06-21 08:56:46 ~3 min ios 📦zip
✔️ 18d9055 #3 2023-06-21 08:57:36 ~4 min android 📦aar
✔️ 6bab02f #4 2023-06-21 10:30:52 ~2 min ios 📦zip
✔️ 6bab02f #4 2023-06-21 10:31:08 ~2 min linux 📦zip
✖️ 6bab02f #4 2023-06-21 10:31:10 ~2 min tests 📄log
✔️ 6bab02f #4 2023-06-21 10:34:09 ~5 min android 📦aar
✔️ 5f4f81f #5 2023-06-22 15:57:50 ~1 min android 📦aar
✔️ 5f4f81f #5 2023-06-22 15:58:35 ~2 min ios 📦zip
✔️ 5f4f81f #5 2023-06-22 15:58:52 ~2 min linux 📦zip
✖️ 5f4f81f #5 2023-06-22 15:58:56 ~2 min tests 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 6953065 #6 2023-06-22 15:59:38 ~1 min android 📦aar
✔️ 6953065 #6 2023-06-22 16:00:35 ~1 min linux 📦zip
✔️ 6953065 #6 2023-06-22 16:01:15 ~2 min ios 📦zip
✖️ 6953065 #6 2023-06-22 16:01:30 ~2 min tests 📄log
✔️ e0f4f45 #7 2023-06-22 22:06:46 ~1 min linux 📦zip
✔️ e0f4f45 #7 2023-06-22 22:07:13 ~1 min android 📦aar
✖️ e0f4f45 #7 2023-06-22 22:08:09 ~2 min tests 📄log
✔️ e0f4f45 #7 2023-06-22 22:09:19 ~3 min ios 📦zip

@MishkaRogachev MishkaRogachev force-pushed the feat/parse-shared-url branch from 14b69bb to cd2f4c2 Compare June 20, 2023 11:07
switch group {
case "c":
return m.ParseCommuntyShareURL(data, true)
case "c#":
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably you had some input for this, but I couldn't find what's c# in this context?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Answered below :)

@@ -88,6 +88,8 @@ var communityAdvertiseIntervalSecond int64 = 60 * 60
// messageCacheIntervalMs is how long we should keep processed messages in the cache, in ms
var messageCacheIntervalMs uint64 = 1000 * 60 * 60 * 48

var baseStatusUrl string = "https://status.app/"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we maybe also support:

  • http://
  • status.app/... directly without url scheme
  • upper/mixed case https://STATUS.App/...

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good questions! There are discussion on urls here: status-im/status-web#327, lets raise those questions there

Copy link
Collaborator

Choose a reason for hiding this comment

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

@@ -6463,3 +6465,27 @@ func (m *Messenger) handleSyncSocialLinks(message *protobuf.SyncSocialLinks, cal
func (m *Messenger) GetDeleteForMeMessages() ([]*protobuf.DeleteForMeMessage, error) {
return m.persistence.GetDeleteForMeMessages()
}

func (m *Messenger) ParseSharedURL(url string) (*MessengerResponse, error) {
if !strings.HasPrefix(url, baseStatusUrl) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe convert url to lower case here?
Or do we consider only everything in lower case as valid?

if byID {
// TODO: decompress community key
communityId := types.HexBytes(url)
community, err := m.GetCommunityByID(communityId)
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmmm... This will only work for "known" communities.
But I suppose in most cases user will user shared url for unknown community. Probably we should start fetching community details here, os smth like that.

Same for profile below. There it will use BuildContact and return smth for unknown contact, but probably still fetching name/image is a good idea.

Copy link
Contributor Author

@MishkaRogachev MishkaRogachev Jun 21, 2023

Choose a reason for hiding this comment

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

There are 2 groups: 'c#' which only provides community ID and c with community data in protobuf. Here i'm waiting for conversion functions from Boris

return nil, err
}

contact, err := m.BuildContact(&requests.BuildContact{PublicKey: types.EncodeHex(crypto.FromECDSAPub(pubKey))})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we support ENS names in shared urls, like status.app/u/vitalik.eth? 🤔

@igor-sirotin
Copy link
Collaborator

Basically the solution is great, just a bunch of minor questions 🙂

@MishkaRogachev MishkaRogachev force-pushed the feat/parse-shared-url branch 4 times, most recently from 5f4f81f to 6953065 Compare June 22, 2023 15:57
@MishkaRogachev MishkaRogachev force-pushed the feat/parse-shared-url branch from 6953065 to e0f4f45 Compare June 22, 2023 22:05
@MishkaRogachev
Copy link
Contributor Author

@igor-sirotin i'm closing this PR in favour of #3665
For your questions there are discussion and specs here:
vacp2p/rfc#600
status-im/status-web#327

@MishkaRogachev MishkaRogachev deleted the feat/parse-shared-url branch November 13, 2023 08:40
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