owncloud / music

:notes: Music app for ownCloud
GNU Affero General Public License v3.0
567 stars 197 forks source link

Cordova build of Music app #200

Open jbtbnl opened 10 years ago

jbtbnl commented 10 years ago

The idea is to enable the Music app to be built with Apache Cordova so that we can have an ownCloud Music app on our mobile phones.

Since the Music app uses AngularJS the client side and server side are already separated from each other and communicate by JSON calls. To enable the Cordova app to contact the server we should add a server location, username and password setup. The rest of the (client side) codebase should ideally be the same.

jbtbnl commented 10 years ago

I've managed to isolate a HTML + JavaScript only app that runs the music app so it looks like the proposed Apache Cordova port is feasible.

One problem did come up: the music app communicates from client to server by means of XMLHTTP requests which are blocked by both client and server when the HTTP origin does not match the HTTP server location. On the client side this can be fixed by disabling web security but this isn't recommended and the ownCloud server still blocks the requests.

@MorrisJobke any idea's how to fix this? I've read somewhere that ownCloud has a remote API but it seems to be undocumented...

jbtbnl commented 10 years ago

CC @Raydiation since he seems to have experience with CORS related issues https://github.com/owncloud/news/blob/master/api/newsapi.php#L91

BernhardPosselt commented 10 years ago

And the middleware https://github.com/owncloud/news/blob/master/middleware/corsmiddleware.php

jbtbnl commented 10 years ago

Ah, great :) I am wondering if "Origin:null" which I assume Restangular is responsible for could be the reason why ownCloud denies the request?

The Music API is blocking the OPTIONS request for some reason: "Status Code:405 Method Not Allowed" is returned.