Skip to content
This repository has been archived by the owner on May 20, 2023. It is now read-only.

Supports opening twitter.com links directly #54

Open
spazziale opened this issue Oct 29, 2022 · 5 comments
Open

Supports opening twitter.com links directly #54

spazziale opened this issue Oct 29, 2022 · 5 comments
Labels
Discussion A point to be discussed.
Milestone

Comments

@spazziale
Copy link

For example, FreeTube is a Linux frontend for Youtube that allow to open links directly in app, thanks to Privacy Redirect ( a browser extension ), As far as I know the extension convert the url into a uri supported by Freetube.

Adding more options to the uri protocol cawbird:// is something that could be implemented, so other apps could call Cawbird using that.

@CodedOre CodedOre added this to the Future milestone Oct 29, 2022
@CodedOre
Copy link
Owner

I think adding the option to open posts or users in view using the cawbird:// uri is something we could add.

The question then is about how to design that uri-scheme and what it should support.
The common links are for users and posts, so it might be enough to add support for those two.

Also, there are two things that needs to be consider before implementing this:

  • How would a post or user displayed?
    If we would support Allow the use of Cawbird without an account #53, and no account was added, it makes sense to open the content with that anonymous session. With just one account, we just open it with that account. But if we have multiple accounts, do we use the last used one?
  • Does this work with Mastodon?
    Mastodon will be supported in Cawbird 2.0, but there a post can have different id's depending on which server you're making the API call from. If we have an account on server A, but a url with the id from server B, can we ensure we get the correct post?

@CodedOre CodedOre added the Discussion A point to be discussed. label Oct 29, 2022
@spazziale
Copy link
Author

With just one account, we just open it with that account. But if we have multiple accounts, do we use the last used one?

I think the user should choose a default account ( also email clients chose this approach ) and have the ability to change accounts easily ( many apps like telegram allow this thanks to a picker in the sidebar )

@IBBoard
Copy link
Contributor

IBBoard commented Nov 2, 2022

How would a post or user displayed?
If we would support #53, and no account was added, it makes sense to open the content with that anonymous session. With just one account, we just open it with that account. But if we have multiple accounts, do we use the last used one?

Cawbird 1 has the idea of your "default" account. So I've got three accounts on Cawbird (IBBoard, CawbirdClient and my test account). But when I run cawbird then I just get a single window with the IBBoard account loaded. It would seem reasonable to use that default account with Cawbird 2, if it keeps that approach.

Although that still fails if you support opening multiple windows!

Does this work with Mastodon?
Mastodon will be supported in Cawbird 2.0, but there a post can have different id's depending on which server you're making the API call from. If we have an account on server A, but a url with the id from server B, can we ensure we get the correct post?

What? I assumed IDs were universal 😄 That's going to get confusing.

Cawbird 1 has custom link formats for tweets and handles. Not proper URLs with a scheme, but still something that it can handle and pull the necessary info from. And it works because it only has to deal with Twitter links. But since Cawbird 2 has to differentiate Twitter from Mastodon, and Mastodon from another Mastodon server, could our scheme basically be cawbird://domain/path? Just replace the https:// with cawbird://? Or does fetching from a remote server not make sense in Mastodon land? (I'm still trying to use it a bit more at the moment and learn where it's different!)

@CodedOre
Copy link
Owner

CodedOre commented Nov 2, 2022

Cawbird 1 has the idea of your "default" account. So I've got three accounts on Cawbird (IBBoard, CawbirdClient and my test account). But when I run cawbird then I just get a single window with the IBBoard account loaded. It would seem reasonable to use that default account with Cawbird 2, if it keeps that approach.

NewCaw does not currently have an "default" account, on main it just opens the lastly opened windows on quit. But it might make sense to use default accounts instead.

Although that still fails if you support opening multiple windows!

Let's say we allow one default account, then we use the following:

  • If no window is open, use the default account.
  • If one window is open, use that window, regardless of opened account.
  • If multiple windows are open, use the last focused one (if there is a way to determine that).

What? I assumed IDs were universal 😄 That's going to get confusing.

Yes, they are different from server to server. Try opening https://$DOMAIN/api/v1/statuses/10 with the domains of two Mastodon servers (like mastodon.social and fosstodon.org).

But since Cawbird 2 has to differentiate Twitter from Mastodon, and Mastodon from another Mastodon server, could our scheme basically be cawbird://domain/path? Just replace the https:// with cawbird://? Or does fetching from a remote server not make sense in Mastodon land?

As you probably have seen when you tried the url above, on Mastodon you can pull public information (on most servers) without authentication. So with that way it could work.

The issues are:

  • You can't use the usual librest calls, as there is no proxy.
  • You can't use any id in that post, e.g. mentions, media, polls, if the server differs from the one with your account.
    That means either you need to find the post with the search API so you have valid ids, or you have to disable any interactivity on it.

@IBBoard
Copy link
Contributor

IBBoard commented Nov 3, 2022

That logic seems sensible.

Cawbird has "which window do we open?" logic that just picks the first account if there's more than one and none are set as "startup accounts".

Yes, they are different from server to server. Try opening https://$DOMAIN/api/v1/statuses/10 with the domains of two Mastodon servers (like mastodon.social and fosstodon.org).

Ah, yeah, I guess I wasn't thinking it through. That makes sense if it takes simple numbers. But I assumed that they would use something like snowflake IDs and so you wouldn't get the wrong post (which is what I thought you meant by "can we ensure that we get the correct post") but you might not get any post. And that it it was federated then it might still know the ID.

But snowflakes assume certain knowledge about a data centre and location, which Mastodon won't have because there's no universal coordination between servers to say "I'm in region 1, data centre 5, and I'm server 42", so the uniqueness constraints of snowflake IDs fail.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Discussion A point to be discussed.
Projects
None yet
Development

No branches or pull requests

3 participants