-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ampache support #60
Comments
pulling in @sezuan as you did some on the old music app as well - THX |
@DeepDiver1975 If we support ampache we weaken the ownCloud infrastructure, because I have to save unsalted password hashes. (Rainbow tables, ...) |
Because of how Ampache API does authentication, the password handling will be made a whole lot less secure. IMO the API must be turned off by default and administrators must be warned when activating the API in the app admin settings. Also turning off the API should drop the stored newly hashed passwords. |
Current state: see #91 |
Pull request was merged a while ago: #91 :) |
I was just trying to test out this ampache with the new music app in OC7 RC2 but Just Player on Android keeps telling me that UserID/password might be wrong. Why is that? I put the full address in (http://mydomain.com/cloud/index.php/apps/music/ampache/server/xml.server.php), used my username and generated a password. Tomahawk on windows PC also can't connect. I can listen in my browser on windows though. |
@MU7L3Y What version of the music app do you use? |
I clicked download zip from here: |
@MU7L3Y I didn't tested the current master branch with ampache players yet ... I'm currently too busy to test and package a new release. Maybe give 0.2 a try: https://github.com/owncloud/music/releases/tag/v0.2 |
I just tried 0.2 and I can get Just Player on Android to connect and it finds all my music. It won't play anything though. |
@MU7L3Y That's weird. With "all music" do you mean the music you see in the webinterface or the audio files you upload to your ownCloud? |
@MorrisJobke I mean Tomahawk doesn't show all the music in my ownCloud. The ownCloud web interface shows it all. |
@MorrisJobke I've had this error in my admin panel too. Just thought I'd let you know.
Also with Tomahawk: it tells me the correct amount of music files in my cloud as seen here: |
@MorrisJobke I've just tried 0.3 with OC 7.0.1 and all my music is now found in Tomahawk and it seems to work, thanks. Can't get Just Player to work though....well it connects and lists all my music but playback doesn't work very well but that could be a problem with Just Player and not the music app. It plays some songs but the song it says it's playing is not actually the right one. Not really sure how it's supposed to work...but it's not very good. Have you tried? I also get this error in my admin panel which repeats with every cron job:
One more thing I've found is that when playing in the OC interface, the progress bar of the current song moves along and I can see it buffer the song but I can't skip forward or back by clicking on it even though there is a hand there? Thanks for all your hard work, I'm enjoying listening to my music nonetheless. |
@MU7L3Y I also have seen this issue. A fix is just ahead, but not in the current master branch yet. |
I've not experienced that. I need to check against that. |
Ok thanks |
I will reopen this issue, to not forget about you changes. For the next time, simply open a new issue ;) |
@MorrisJobke I just updated to 0.3.3 and now I have no errors in my admin panel which is great, thanks! I still can't skip forward or back by clicking on the progress bar even though there is a hand there but no biggy as I don't do that often. I've tried again with Just Player and it still doesn't really work but then I tried the ampache.net app and it seems to at least play my songs. It doesn't list them in the correct order though so I'm assuming this is a problem with the app and not the music app? |
Then I need to retest with Just Player. But I can remind that it uses some different HTTP verbs. I will have a look.
I don't have seen a way to specify the order. This is most likely up to the app |
@MorrisJobke Thanks, Edit: Corrected the typo in the app's name. |
@Zykino Okay, I have now implemented providing "All tracks" as a playlist in the Ampache API. The feature shall be included in the next release which will probably be published within 1-3 weeks. Edit: The release v0.9.0 with this feature is now out, a bit sooner than I expected :). |
AFAICT Ampache has a feature called "channels" (https://github.com/ampache/ampache/wiki/Channels) which is sort of a "poor man's Icecast server", and which I would find immensely useful. Is this also possible with the Ampache implementation within the Music app? I haven't been able to find any references... |
@floe Sorry, that's not supported in the Music app. The "real" Ampache server provides some half a dozen different protocols so that it can serve as replacement for many different servers. The Music app, on the other hand, provides only the Ampache XML protocol. |
Thanks for the quick response :-) Any ideas whether there's something similar available for Nextcloud? If not, no worries... |
Sorry, too-unspecific question earlier. I've been googling around, and it seems that this functionality is currently not available for Nextcloud. I think it would be a nice addition, though - can you maybe give me a pointer where I could hack this in? After some code browsing, it seems that |
@floe I'm not really at all familiar with Icecast so I'm only guessing here. But I assume that Icecast has a protocol of its own which consists of HTTP requests and responses. You probably can't just hack it to any existing module but you should create new modules to handle the protocol. It may of course be educative to look how the Ampache protocol has been implemented on top of the Music app. I'm not the original author of this part of the code, but it works roughly like this:
|
Thanks, this is quite helpful. FWIW, the Icecast "protocol" is not much more than MP3 frames with a few extra headers over HTTP, there's an old PHP implementation in just 100 LOC (https://github.com/gadgetguru/PHP-Streaming-Audio). I'll have a look if I can put together an alpha for testing using an existing playlist. |
I also get 401 - Invalid password, with the logs even with debug level showing nothing more than
(I've tried using "Amplify", "Power Ampache" and "Amdroid" on Android, Amarok on Linux; I've copy&pasted the password displayed in the app, so no typos :/) |
@marcelklehr Apart from actually having incorrect password, the Ampache login may fail also because of differences in the system time of the client and the server: to succeed, the client clock must not be more than 100 seconds ahead of the server clock and not more than 6000 seconds behind it. Could this be your problem? That 100 seconds is actually quite tight requirement; I think we could loosen that to e.g. 10 minutes without compromising the security too much. Ideally, the client should query the server's current time and use that on Ampache handshake instead of its own local time, and this would eliminate the need for the clocks to be in sync. But at least Power Ampache doesn't seem to do this, and we can't fix this on the server. |
@paulijar Interesting. The clocks are within 10s of each other, though, afaict. When I use the Ampache URL with |
@marcelklehr Yeah, the 401 indicates that at least the request has reached the Music app. The call probably gets blocked already earlier if the message is just Do you see any message in addition to the code 401? Looking at the code, it seems to me that 401 can be emitted with five different messages: |
Yep, it's the passphrase mismatch. I've tried to reproduce this with curl in the terminal:
yields
EDIT: Simplified the code :) I'm on nextcloud 13.0.6 if that helps. |
So, I couldn't stop myself from debugging a little and it turns out that in my case, the array of hashes is empty, which is why the login fails. I also know why: I'm using the LDAP user backend and for some reason because of that my userid in the nextcloud database is some kind of numeric id instead of the identifier I login with. If I use the numeric ID, ampache login succeeds. 🎉 |
@marcelklehr Okay, thanks for debugging, that's an interesting piece of information! I'm not familiar with the LDAP integration of Nextcloud/ownCloud but I now read some online documentation. It was stated here that, by default, the internal user name for LDAP users will be the UUID of the user. I believe that it would be possible for the Music app to map the LDAP user name to the internal name on Nextcloud using the API method ILDAPProvider::getUserName. However, there doesn't seem to be equivalent API on ownCloud. Hence, it would probably be easiest if we just show the (internal) user name on the Music app settings page. Maybe not the neatest possible solution but should be sufficient to make the Ampache feature usable also for the LDAP users. |
@paulijar yep, I agree :) 👍 |
In case the user has been logged in via LDAP, the internal username on ownCloud/Nextcloud may differ from the login name. To access the Ampache API, the user has to use this internal username but previously there was no easy way to know this. refs owncloud#60
In the Ampache handshake, it was previously checked that the timestamp supplied by the client in not more than 100 seconds ahead of the system time of the server. In case the client is using its own system clock to create the timestamp and the client and/or the server does not synchronize its time from the network, it could quite easily happen that the local times of client and server differ by more than 100 seconds. The handshake failed in such cases. Now we allow the the timestamps to differ at maximum by 10 minutes. That shouldn't compromise the security in any significant manner but will make the handshake more robust against small clock deviations. refs #60
@marcelklehr The new Music app release v0.9.1 now shows also the username when a new Ampache password is generated. I didn't care to setup LDAP just to be able to test this, so if you could give it a try I would appreciate your feedback. |
@paulijar 🎉 Works like a charm, thanks :) |
Hello, Cannot connect with my account, seems like if we are using an account with a dot it doesn't work. |
I this possible to run this API behind reverse proxy? It works with PowerAmpache but only directly otherwise application hangs. |
I have no idea, but aren't proxies supposed to be invisible for both clients and servers? So if the proxy is doing its job properly, then the Music app should see the proxy just as any other client app and PowerAmpache should see the proxy just the same as any actual Ampache server. |
Theoretically. In practice not every kind of communication can be serve that way, but ampache seems to use some kind of xml files which are ok to pass through reverse proxy. |
It's working pretty good, thanks. |
@jakobroehrl Nope, using the ownCloud password with the Ampache API is not possible now or in the future. There are technical and security reasons for this. |
@paulijar Thank you! |
@jakobroehrl It mostly depends on which client you want to use. Or were you planning to implement your own client? There are a few music player applications which can connect to remote server via Ampache API. I guess there are some players supporting WebDAV, too, but I'm not familiar with those. The Ampache API of the Music app serves the files organized by the scanned metadata. Meanwhile, the WebDAV API of ownCloud reveals them organized by the directory hierarchy. This is probably the most significant difference in the capabilities of the APIs. |
After a year of inactivity, I think it's time to close this bundle issue of miscellaneous Ampache problems and requests. Any future bug reports and feature requests should be filed in their own, more specific github issues. |
credits to @DeepDiver1975
The text was updated successfully, but these errors were encountered: