Dimillian / IceCubesApp

A SwiftUI Mastodon client
https://apps.apple.com/us/app/ice-cubes-for-mastodon/id6444915884
GNU Affero General Public License v3.0
5.09k stars 475 forks source link

Some instances are not supported #16

Open vggonz opened 1 year ago

vggonz commented 1 year ago

App version 0.7 (711) iOS 16.2 / iPhone 12 Pro

I can't add the account for my instance. I enter the domain "mastodon.denibol.com" but it does nothing. It's a Pleroma backend but other Mastodon clients does not have any problem loggin in. Instance metadata on https://mastodon.denibol.com/api/v1/instance image

Dimillian commented 1 year ago

Seems like Plemora don't have configuration in the root response for this API.

  public struct Configuration: Codable {
    public struct Statuses: Codable {
      public let maxCharacters: Int
      public let maxMediaAttachments: Int
    }

    public struct Polls: Codable {
      public let maxOptions: Int
      public let maxCharactersPerOption: Int
      public let minExpiration: Int
      public let maxExpiration: Int
    }

    public let statuses: Statuses
    public let polls: Polls
  }

I didn't look at the differences between Mastodon and Plemora yet, will probably add support for it down the line if i's close enough, but the difference on this API tell me it's not close enough.

vggonz commented 1 year ago

The differences between the Mastodon API and the Pleroma compatible backend are documented here: https://docs-develop.pleroma.social/backend/development/API/differences_in_mastoapi_responses/

Dimillian commented 1 year ago

Thanks! Will take a look

sbarrax commented 1 year ago

Hi @Dimillian

FE371982-C8B7-48F0-9B25-FB56873216E4 Similar problem but not the same: it says the instance is not supported…

Is there any blocking limitation on this instance?

Instance: mastodon.partecipa.digital App version: 1.0 (841) iOS 16.2 (iPhone 8)

pacorob commented 1 year ago

It would also be great if e.g. pixelfed.de or pixelfed.social would be supported.

Dimillian commented 1 year ago

Can you sign in? It's actually supposed to work as it's Mastodon API. I'll look why the timeline is not parsed.

ghost commented 1 year ago

Hello, I believe the problem is that the Instance.swift model has some items that are not present in Pleroma, or other servers that implement the Mastodon API.

I found this issue since I'm also having some trouble connecting Ice Cubes to a GoToSocial instance. GTS provides a Mastodon-compatible API, but with some missing parts. Most apps still work, though.

I did some debugging from the instance side, and I see that the app makes a request to the /api/v1/instance endpoint. Comparing the /api/v1/instance response from a GTS instance with the response from the mastodon.social instance, the missing items from the GTS response seem to be "rules" and "languages". I also tested looking at the API response from mastodon.partecipa.digital and mastodon.denibol.com, and both are also missing the "rules" array that's present in the model.

I'm not sure if there are more differences that could cause the "not supported" message to appear, since I'm not a Swift programmer and I didn't take too deep of a dive into the codebase. However, if Swift allows making items in the model optional, that could allow users to log in to those instances.

Thank you for making this app, and thanks for considering support for other server software!

Dimillian commented 1 year ago

It's perfectly fine if we make this array optional, it should be actually, I'll do that soon. Thanks for the investigation!

Dimillian commented 1 year ago

Image

Image

ghost commented 1 year ago

I probably should have mentioned my GTS instance earlier, but could you test social.quake.host as well? It's missing both the rules and languages array.

Dimillian commented 1 year ago
image

All good there too!

This new version will be available in a few hours, so everyone will be able to test

vggonz commented 1 year ago

Well, with Pleroma backend now it shows the instance info and the sign in button but it does nothing else. It seems to think for a second but nothing happen.

Dimillian commented 1 year ago

Why does Plemora want so much to do things differently? I'll take another look tomorrow and I guess I need to create a Plemora account somewhere.

joch commented 1 year ago

Well, with Pleroma backend now it shows the instance info and the sign in button but it does nothing else. It seems to think for a second but nothing happen.

Just for information, it does the same on my GoToSocial instance.

hjri commented 1 year ago

Why does Plemora want so much to do things differently? I'll take another look tomorrow and I guess I need to create a Plemora account somewhere.

if you want i can give you an account on post.ebin.club, i'm one of the Pleroma frontend developers. Our MastodonAPI has been implemented long long time ago and probably not on par with modern mastodon implementations.

Originally we used QvitterAPI but after some time switched to MastodonAPI + our own extensions due to... circumstances.

ghost commented 1 year ago

I downloaded Xcode and poked around the app a little, and discovered that changing vapidKey to an optional value in the InstanceApp.swift model is enough to be able to log in to a GoToSocial instance. However, it leads to a Hotel California situation where I can't logout because the Settings tab calls the /api/v1/preferences endpoint, which isn't implemented yet. Still, this is better than not being able to login at all, and I'd be happy with that.

Regarding Pleroma, the server is complaining that client_name and redirect_uris are missing from the /api/v1/apps call. They are there in a /api/v1/apps?client_name=[...]&redirect_uris=[...] format, which I don't know if Pleroma accepts.

Dimillian commented 1 year ago

Maybe they accept only form data? Or maybe JSON? JSON POST would be good as I already do it for stuff like status post / edit.

hjri commented 1 year ago

Should accept both form data and JSON i think, but historically PleromaFE been using form data. IIRC traditionally POST requests are using parameters in the body (i.e. form data) not in the url (like GET).

You might need to also specify scopes, too. This is one of the most pain points to us because scopes tend to change from time to time as new features are added.

here's a snippet of relevant code from PleromaFE:

  const url = `${instance}/api/v1/apps`
  const form = new window.FormData()

  form.append('client_name', `PleromaFE_${window.___pleromafe_commit_hash}_${(new Date()).toISOString()}`)
  form.append('redirect_uris', REDIRECT_URI)
  form.append('scopes', 'read write follow push admin')

  return window.fetch(url, {
    method: 'POST',
    body: form
  })

hope it helps

Dimillian commented 1 year ago

Yeah right now my client is doing URL encoded form, not as body. But i'll try to turn them to JSON to see what happens.

rjp commented 1 year ago

Yeah, Pleroma/Akkoma require POST data in the body, not the URL (which is fair since that's what the HTML spec strongly recommends.) Just fixed this for madon which made the same assumption.

agentff6600 commented 1 year ago

i can open the sign in dialog for a pixelfed instance but as soon as I authorised access the dialog closes and I am back at the sign in without the account added.

anantshri commented 1 year ago

Just an update. tested the latest release on GoToSocial instance. its working now.

perigrin commented 1 year ago

Following from @anantshri: Trying to log into my akkoma instance just spins now without moving forward.

darrinsmart commented 1 year ago

Just an update. tested the latest release on GoToSocial instance. its working now.

It didn't work for me - using GTS 0.6.0 git-f9e5ec9.

The API call to api/v1/accounts/verify_credentials was failing as the 'sensitive' field was missing from the response.

However GTS have fixed this at their end (superseriousbusiness/gotosocial/issues/1332) and after building from their git repo, I can log in and see my timeline.

Dimillian commented 1 year ago

Nice, feel like it'll be less work for me if backend actually start to be closer to Mastodon haha

iero commented 1 year ago

Link to pleroma open issue about this topic here: https://git.pleroma.social/pleroma/pleroma/-/issues/3057

catgirlinspace commented 1 year ago

Am seeing the same issue as @perigrin on https://fediverse.catgirlin.space

dwaynebradley commented 1 year ago

I just migrated to https://genserver.social and it doesn't work there either. Another Pleroma site. I'm hoping that things can be worked out here as IceCubes is by far my FAVORITE fediverse app. 😎

jaschaurbach commented 1 year ago

I hope as well that IceCubes will Support Pleroma.

The moment I hit "Anmelden" nothing happens

image

z96 commented 1 year ago

Same issue with this instance (fgc.network). Click sign in, spins for a second, nothing, then stops.

image

fyrfli commented 11 months ago

I did some digging on this issue myself because it works for gotosocial, mastodon, and firefish, but akkoma is still a problem for me (the "continue" button just has a spinning symbol like it can't connect).

Here's what I did:

first i tried watched the reverse proxy log file to see what is being sent through from icecubes. i intended to watch the instance log file too to see what was coming through - but it didn't get past the proxy. the response i get is this:

{"level":"error","ts":1691882803.5090654,"logger":"http.log.access.log4","msg":"handled request","request":{"remote_ip":"10.0.0.1","remote_port":"63745","proto":"HTTP/3.0","method":"POST","host":"dev.bkgrdclrschm.link","uri":"/api/v1/apps?client_name=IceCubesApp&redirect_uris=icecubesapp://&scopes=read%20write%20follow%20push&website=https://github.com/Dimillian/IceCubesApp","headers":{"Accept-Language":["en-GB,en;q=0.9"],"Accept-Encoding":["gzip, deflate, br"],"Accept":["*/*"],"Priority":["u=3"],"User-Agent":["IceCubesApp/1969 CFNetwork/1410.0.3 Darwin/22.6.0"]},"tls":{"resumed":false,"version":772,"cipher_suite":4867,"proto":"h3","server_name":"dev.bkgrdclrschm.link"}},"user_id":"","duration":0.004933843,"size":286,"status":400,"resp_headers":{"Content-Length":["286"],"Date":["Sat, 12 Aug 2023 23:26:42 GMT"],"Referrer-Policy":["same-origin"],"Server":["Caddy","Cowboy"],"X-Frame-Options":["DENY"],"X-Request-Id":["F3rGciCSVnI5HV8A0vIh"],"Content-Type":["application/json; charset=utf-8"],"Cache-Control":["max-age=0, private, must-revalidate"],"X-Permitted-Cross-Domain-Policies":["none"],"X-Content-Type-Options":["nosniff"],"Access-Control-Allow-Origin":["*"],"Content-Security-Policy":["upgrade-insecure-requests;style-src 'self' 'nonce-raH1Hr8EDm4Ypmd';font-src 'self';script-src 'self' 'nonce-raH1Hr8EDm4Ypmd' ;connect-src 'self' https://dev.bkgrdclrschm.link wss://dev.bkgrdclrschm.link;media-src 'self' https:;img-src 'self' data: blob: https:;default-src 'none';base-uri 'none';frame-ancestors 'none';manifest-src 'self';"],"Access-Control-Allow-Credentials":["true"],"Permissions-Policy":["interest-cohort=()"],"X-Xss-Protection":["0"],"Access-Control-Expose-Headers":["Link,X-RateLimit-Reset,X-RateLimit-Limit,X-RateLimit-Remaining,X-Request-Id,Idempotency-Key"]}}

there a few other errors as well - i captured them all here (that link expires in a week).

so then i tried to look at the /api/v1/instance data but didn't find any differences that seemed important -(those records are here for gotosocial and here for akkoma.

then i realised that i would need to go through the code to see what steps are taken and i figured i'd post up my info here before i went there because that could take me quite a while to parse.

rjp commented 11 months ago

I think this might be because Akkoma (and presumably Pleroma) instances aren't sending the short_description entry in the instance output -- which in Packages/Models/Sources/Models/Instance.swift seems to be marked as required in the Instance struct if I'm not misreading.

But that's a bit odd because it's ignoring description (which both send and is the standard in both v1 and v2 calls) in favour of short_description (which only exists in the v1 call.) Might be better to use description instead since that's required in both versions?

If I patch my Akkoma to return a short_description in the instance info, it does get to the "Sign In" button appearing but then you can't sign in for some other reason (presumably also down to other fields missing, etc.)

fyrfli commented 11 months ago

so we need to raise this with the akkoma devs then, yes?

what exactly should we say? cos i'm sure "you're not sending short_description in your sign in process" isn't going to be of much help.

rjp commented 11 months ago

I guess point them at https://docs.joinmastodon.org/entities/V1_Instance/#short_description and show that it's a required field in the V1 instance reply.

(Plus I'd be tempted to make it optional in the struct and treat it as empty if missing since it'll be a good while before Akkoma get around to fix.)

neelchauhan commented 2 months ago

I run a Akkoma server at social.monoxide.network. If I enter social.monoxide.network into Ice Cubes on macOS 14.4.1, I get an infinite loading scroller.

On Tuba (Fedora/Flatpak), Semaphore (Firefox), and Tusky (various Android ROMs) I had no issues with Akkoma. I can use a native GNOME Mastodon client on my Linux HP Envy but not a native Mac one on my M2 Air, why?