Lartsch / FediAct

Chrome/Firefox extension that simplifies interactions on other Mastodon instances than your own.
MIT License
459 stars 15 forks source link

Adding Safari support #17

Open kkostov opened 1 year ago

kkostov commented 1 year ago

Hey folks, in response to your toot https://infosec.exchange/@lartsch/109540360663111201 I'd love to try adding support for Safari!

Perhaps I could open an issue in the repo to keep track of the progress?

My first step will be to convert the extension using Xcode and check for compatibility issues that may need to be addressed.

Regarding distribution of the extension, I guess this can be done manually at first?

App Store distribution requires a developer program membership. One option is to publish it using mine, I'd be happy to do it, but that may not be the right solution. There are options to waiver the membership fee, but it's not without some paperwork πŸ™ˆ if a non-profit organization doesn't exist yet, https://developer.apple.com/support/membership-fee-waiver/.

Lartsch commented 1 year ago

Hi Konstantin, thanks again for your involvement.

It would be no issue for me if it was published using your subscription. I think most Apple users like things to be simple and installing via store would be the most user-friendly option. As I do not want to setup a non-profit, the fee waiver is not an option for me right now (but it's good to know that this option exists).

If you prefer access to the repository to create your own branch over creating a fork (in case adjustments need to made for compatibility), please let me know.

When functionality is proven, we can think about a workflow for releases that works for you.

telsin commented 1 year ago

@kkostov happy to help test if appropriate!

kkostov commented 1 year ago

@telsin that's awesome! I'm slowly resuming after the holidays and plan to pick this up in the next couple of days.

kkostov commented 1 year ago

I created a repository for the Xcode project and carried out the conversion 🎊 .

The extension converted without warnings and was ready for use β€œas is” on macOS! The pop-up also works (although some CSS changes may be needed).

Testing the extension with an actual server was not successful (yet) due to a CORS error https://github.com/kkostov/FediActSafari/issues/1 - it seems Safari is validating CORS headers for requests from service workers.

Next, I will see if it's a Safari issue or intentional and if there are configuration options available to make it ignore CORS headers for the extension (otherwise it will need a whitelist of hosts in the manifest).

kkostov commented 1 year ago

The CORS error was addressed by using the manifest for Firefox (v2).

However, fetchBearerToken() does not seem to fetch the access token. The value of text always comes back with "access_token": null":

Screenshot 2023-01-15 at 18 23 28

@Lartsch do you have any ideas as to what could be the cause of this?

I'm not sure when mastodon includes an access token in the page content, does it depend on cookies for the logged-in session?

smiba commented 1 year ago

Would love to have a Safari version of this!