On 29/09/2018 03:05, Paul Cuzner wrote: > > Hi, > > I have a REST API that's running on localhost (flask app) that I'd like > to access with a cockpit plugin. I've done a few initial tests but I'm > finding it difficult to navigate the CORS and Content-Security-Policy - > so before I invest any more time in this, I thought I'd ask the dumb > question first.> > Is this goal achievable? Can a cockpit plugin access a REST API running > on the same host - if so, could someone provide some guidance, or point > me at some docs?
Yes, but access it with cockpit.http() to access HTTP/REST services on the local machine via cockpit-bridge ... rather than directly accessing them from the browser. Does that work? Do you control the javascript code that makes the request? https://cockpit-project.org/guide/latest/cockpit-http.html If not, we may need to help make a shim around XMLHttpRequest (to wrap cockpit.http() ... similar to how we've made a shim around WebSocket (to wrap cockpit.channel() [1]). Stef [1] https://github.com/cockpit-project/cockpit/blob/master/examples/gtk-broadway/gtk.html#L14 > > I'm testing on Fedora, but the longer term goal is to use RHEL. > > Any help appreciated! > > Paul C > > > _______________________________________________ > cockpit-devel mailing list -- cockpit-devel@lists.fedorahosted.org > To unsubscribe send an email to cockpit-devel-le...@lists.fedorahosted.org > Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html > List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines > List Archives: > https://lists.fedorahosted.org/archives/list/cockpit-devel@lists.fedorahosted.org > -- Stef Walter Platform Engineering Red Hat _______________________________________________ cockpit-devel mailing list -- cockpit-devel@lists.fedorahosted.org To unsubscribe send an email to cockpit-devel-le...@lists.fedorahosted.org Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/cockpit-devel@lists.fedorahosted.org