Closed ChucKN0risK closed 1 year ago
Hi @ChucKN0risK, should be working now in v1.2.1 :+1:
Seems like there were some issues with browser support for my dependencies, v1.3.2 is now working for me (the export is named SubsonicAPI
, that used to be incorrect in the README)
No worries! I fixed that error in v1.3.2
, depending on your package manager, it might still have the old .1 version installed.
Sorry for removing my previous messages. After trying several things they didn't seem to be relevant anymore. I've just updated to 1.3.2
.
I'm running airsonic-advanced locally on localhost:4040
and I now have this issue:
I don't think it's related to your package though. Do you agree?
Yes, I think you need to configure your local server to set the correct CORS headers, which are needed to interact with APIs on other domains (including other ports). I'm using this library with navidrome, which seems to allow CORS access.
By using your example code based on navidrome I'm indeed able to receive 10 songs.
I tried the replacing the url and my credentials while using navidrome but it still shows the same issue.
const api = new SubsonicAPI({
url: 'http://localhost:4040',
type: 'navidrome', // or 'generic' or 'subsonic'
});
await api.login({
username: 'admin',
password: 'lucho',
});
const { randomSongs } = await api.getRandomSongs();
console.log(randomSongs);
The demo server in the example replies to OPTIONS preflight requests and adds a cors header, you probably need to run your subsonic server through a reverse proxy and configure it to do this aswell, https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
Thanks for your input. I'll check this out 🙏
Hi @explodingcamera ✌️
After installing the package with npm in the following project I get the following error:
Did I miss something?