Closed azukaar closed 1 year ago
Hey, are you using iOS or android? Where did you pull that log from with the response from the server on the mobile app?
The ping is happening like this in the mobile app. I've been meaning to try to provide a better error response here but if you are using android and can see the logcat you may be able to see that error getting logged in console.error
return this.$axios
.$get(`${address}/ping`, options)
.then((data) => data.success)
.catch((error) => {
console.error('Server check failed', error)
this.error = 'Failed to ping server'
return false
})
Hey thanks for you answer, I am indeed using Android I tried doing
adb shell
logcat | grep com.audiobookshelf.app
But I do not seem to be getting the logs from the app? (Sorry if I misunderstood you on something)
If I remove the GREP, the only thing I see that happens on click is
1805 tf_lite_classifier.cc:383] Event stream classified as kNone
But I doubt this is related
I have setup an isntance here if you want to give it a quick try @advplyr https://audiobookshelf.cosmos-cloud.io/
I tested on Android Pixel 6
Msg: Access to XMLHttpRequest at 'https://audiobookshelf.cosmos-cloud.io/ping' from origin 'http://localhost' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values 'audiobookshelf.cosmos-cloud.io, *', but only one is allowed.
OK I added a patch to prevent the origin server's headers to reach the client but I still see "failed to ping the server" Would you mind giving it another look when you can? Thanks!
Access to XMLHttpRequest at 'https://audiobookshelf.cosmos-cloud.io/ping' from origin 'http://localhost' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains the invalid value 'audiobookshelf.cosmos-cloud.io'
I think the origin will need to be *
because the mobile client (origin in this case) won't be your server address
I think you should disable that check from the mobile client no? It doesn't make sense to check the CORS header from mobile if you have no origin URL? I shouldn't set the CORS header to always be * that would defy the point of CORS to prevent other websites from requesting that URL
EDIT: I think there might be more to this as googling this issue shows only Flutter Web response? Nothing about mobile. What library are you using?
EDIT2: Are you using Flutter Web with a webview? I think that's the issue, because Flutter Mobile would not test for CORS.
(PS: just out of curiosity why not use Flutter directly?)
We had discussed this before about changing the web view http requests to native http requests. That was a bit over a year ago and I think this is a new addition to the core capacitor plugins.
This is pretty great because it intercepts the outgoing web view requests and changes them to native requests without me needing to manually update every request. This worked in my testing to ping your server.
An APK gets built for each commit if you want to test that when it is done. Hopefully this also works for all the static content. #254 might be able to get supported easier now
Nice one!! I will test right away By the way if you tested on the server, I had CORS set to *, to do some testing on my end. I just reverted it to the default
I'm actually not seeing the logs for CapacitorHttp in logcat. Did you update the server to *
for testing?
Ah bummer, then it's probably not that simple. The requests will likely need to get changed manually then
The APK is built https://github.com/advplyr/audiobookshelf-app/actions/runs/5536923526
The artifact at the bottom of the page
I reverted the CORS settings and tried with the new APK it does work now! Amazing reaction time :D
Nice! Thanks for testing, this is an improvement.
no more "failed to ping server" problem with this apk . Thanks
Edit: but ebooks does not be loaded..
This is partially updated in 0.9.66-beta. I couldn't fully implement this because of a limitation in that plugin that didn't allow for loading ebooks so you may still get cover loading issues. You shouldn't have issues logging in anymore though so let me know.
Updated all requests EXCEPT the ereader in v0.9.67-beta
I'm not sure yet how the ereader will be handled
Hello, I am the dev of Cosmos, and using it as a reverse proxy seems to not work with the ABS app and I cannot see why.
Steps to reproduce
Actual behavior
More info
First of all I have spent significant amount of time searching this and here's what I can gather:
Despite of the app not working, the server receives the ping without any issues.
If I try to go to /ping directly in the browser, it works:
And finally, I have noticed that when the mobile app requests the URL, the ABS server returns a 304 instead of a 200?
Any pointer as to what needs to be done for it to work would be appreciated as there are not additional hints / errors / etc... anywhere