Skip to content
This repository has been archived by the owner on Feb 15, 2025. It is now read-only.

Login fails on macOS: "Safari cannot open the page because the address is invalid." #23

Open
MrPowerMac opened this issue May 29, 2022 · 3 comments

Comments

@MrPowerMac
Copy link

Pretty much what it says on the tin. Upon running koneko, it correctly opens the login page in Safari and I can log in, but the mentioned error message appears and koneko never recognizes the login. Running koneko again brings up the login page as if I had never logged in.

I did test copying the link into a Chromium incognito window and logging in there, but instead of an error it just displayed a blank page.

$ koneko
sh: xdg-mime: command not found
sh: update-desktop-database: command not found
Please log to pixiv in your browser then run koneko again
<url here...>

koneko_addressinvalid

My system is running macOS 12.4, and Safari 15.5.
koneko 0.12.4 was installed with pipx 1.0.0, using Python 3.10.4 (the latter two installed via MacPorts).

@akazukin5151
Copy link
Owner

Thanks for the report. I can see that it isn't recognizing that koneko-url-login should handle the pixiv:// URI, because it's still using the linux commands.

Chromium displaying a blank page is partially "expected behavior" because it is supposed to launch koneko-url-login, but it wasn't properly registered.

I've successfully tested with a clean koneko config so I can confirm pixiv didn't change their APIs

I'll have a look at the mime type code for now, stay tuned

@MrPowerMac
Copy link
Author

Thanks for the quick response! Good to know it wasn’t due to any configuration issue on my end. I’d be happy to test anything needed.

@akazukin5151
Copy link
Owner

The code indeed only works for linux, there was no alternative commands for macOS. I think it'll be better and easier to just use the last item on the troubleshooting section: use this script and

Copy the example config to ~/.config/koneko, and add the line refresh_token=XXXX under the [Credentials] section.


IMO the time and effort it takes to do increasingly bold hacks isn't worth it, especially when I'm not familiar with macOS, but I'll keep this issue open and I still welcome any PRs to fix this.

Many solutions for macOS relies on small utility apps to do the job instead of programmatic/command line. While I can ask users to install GUIs, it just seems much more of a hassle than just using the script above.

https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app

Apple's instructions on registering a custom URI scheme is to use the xcode GUI. There are several problems with this: koneko is not written in xcode, and I don't have access to xcode.

https://stackoverflow.com/questions/1991072/how-to-handle-with-a-default-url-scheme

Threads that are several years old offer a programmatic way, through the Info.plist file. But apparently one has to register it with Objective-C

https://stackoverflow.com/questions/471581/how-to-map-a-custom-protocol-to-an-application-on-the-mac/54300716#54300716

This one offers a bit of hope. If you really want, can you try if either open scheme://test or open -a App scheme://test works?

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

No branches or pull requests

2 participants