CodedOre / NewCaw

Development on Cawbird 2.0
GNU General Public License v3.0
97 stars 5 forks source link

Supports opening twitter.com links directly #54

Open spazziale opened 1 year ago

spazziale commented 1 year ago

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 commented 1 year ago

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:

spazziale commented 1 year ago

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 commented 1 year ago

How would a post or user displayed? If we would support https://github.com/CodedOre/NewCaw/issues/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 commented 1 year ago

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:


What? I assumed IDs were universal :smile: 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:

IBBoard commented 1 year ago

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.