Can't read my CVP
ajmandourah opened this issue · 9 comments
It seems like it can't read my CVP. My link contains a different port as port 80 is blocked by my VPS providers.
the link to my CVP is
Thanks
Hi @ajmandourah,
Can you try adding CORS support to your json response? Also, do you have support for jsonp?
I'm by no means expert. I just follow the guides :(
would you mind guide me through the process.
No worries. Depending on your CVP implementation on the server, CORS can be enabled by adding a few headers to the response.
https://enable-cors.org/server.html is a good resource for adding CORS support.
JSONP support is another method for getting around the cross-origin warnings from the browser. However, the server needs to implement support for serving jsonp.
I think you might be using Flask, so here is an example of adding a decorator to support jsonp:
https://github.com/corydolphin/flask-jsonpify
Or a flask-extention:
https://github.com/corydolphin/flask-jsonpify
Hope that helps!
I have implemented Jsonp using flask-jsonpify and I have st CORS for my nginx by adding
add_header 'Access-Control-Allow-Origin' *;
but its not showing "not found"
check it here
http://medgamers.duckdns.org:21802/mumblewidget/index2.html
Hi @ajmandourah,
I am now seeing the following error:
x_connecturl is not defined
Can you implement the x_connecturl
property to the server and channel formats?
https://wiki.mumble.info/wiki/Channel_Viewer_Protocol#JSON
Here is a working example for reference:
https://guildbit.com/server/cvp/a1722c92-368e-4506-9ea2-22be00ca8129/
I'm actually a noob in this. I used Flaskcvp to generate the json. would you mind telling me what line shall I add to the script itself for it to work. Would be really thankful if a little explanation included so I can teach my self also.
Thanks :)
Hi @ajmandourah,
No problem. I'm not sure what your backend code looks like, but here's how I implemented it on guildbit and murmur-rest:
https://github.com/alfg/guildbit/blob/master/app/controllers/server.py#L155
https://github.com/alfg/murmur-rest/blob/master/app/api.py#L688
The mumble-widget uses the x_connecturl
property as a direct connect link when you click on the server name. It should just be a link to the host:port and optionally the version number.
I implemented the x_connecturl and now it just show me the channels which have users on it. other channelst are not visable.
def getChannel(channel): fields = ["id", "name", "parent", "links", "description", "temporary", "position"] data = dict(zip(fields, [getattr(channel.c, field) for field in fields])) data['channels'] = [ getChannel(subchan) for subchan in channel.children ] data['users'] = [ getUser(user) for user in channel.users ] data['x_connecturl'] = "mumble://medgamers.duckdns.org:21801" return data
serv = { 'x_connecturl': "mumble://medgamers.duckdns.org:21801", 'id': srv_id, 'name': "Medgamers", 'root': getChannel(tree) }
I don't know if its wrong doing it that way, I'm really a beginner in python.
Thank you for your time btw.. really appreciated.
EDIT: I cant seem to get the codes above to look neat. sorry for that
Hi @ajmandourah,
Seems like it's working! Good job!
The mumble widget only displays channels with active users by design.
And no worries! Glad to help. Let me know if you have any other questions. Otherwise feel free to go ahead and close the issue.