bug fix with url context

master
Steve L. Nyemba 5 years ago
parent 3599fff083
commit 176b4af9ae

@ -9,14 +9,19 @@
* @param id service identifier * @param id service identifier
* @param key callback/ user key * @param key callback/ user key
*/ */
jx.cloudview = { popup:null,cache: {},oauth:{},host:'the-phi.com',protocol:'https'} jx.cloudview = { popup:null,cache: {},oauth:{},url:'https://the-phi.com/cloud-view',host:'the-phi.com',protocol:'https'}
jx.cloudview.init = function(host,protocol){ jx.cloudview.init = function(url,redir_url){//host,protocol){
jx.cloudview.host = host // jx.cloudview.host = host
jx.cloudview.protocol = protocol // jx.cloudview.protocol = protocol
jx.cloudview.url = url.trim()
if(redir_url != null){
jx.cloudview.redirect_url = redir_url
}
} }
jx.cloudview.oauth.init = function (id, key,callback,err) { jx.cloudview.oauth.init = function (id, key,callback,err) {
var url = ":protocol://:host/cloud-view/" +id+"/get" // var url = ":protocol://:host/cloud-view/" +id+"/get"
url = url.replace(/:protocol/,jx.cloudview.protocol).replace(/:host/,jx.cloudview.host) // url = url.replace(/:protocol/,jx.cloudview.protocol).replace(/:host/,jx.cloudview.host)
var url = jx.cloudview.url
var httpclient = HttpClient.instance() var httpclient = HttpClient.instance()
httpclient.setHeader("platform",navigator.appName) httpclient.setHeader("platform",navigator.appName)
@ -27,9 +32,12 @@ jx.cloudview.oauth.init = function (id, key,callback,err) {
var url = x.responseText var url = x.responseText
if(url.match(/^http.+$/)){ if(url.match(/^http.+$/)){
var oauth_uri = url.match(/redirect_uri=(.+)&/)[1]; var oauth_uri = url.match(/redirect_uri=(.+)&/)[1];
url = url.replace(oauth_uri, key) url = url.replace(oauth_uri, key)
jx.cloudview.handler = null jx.cloudview.handler = null
jx.cloudview.popup = window.open(url, 'oauth', 'width=405, height=900') jx.cloudview.popup = window.open(url, 'oauth', 'width=405, height=900')
jx.cloudview.popup.focus() jx.cloudview.popup.focus()

Loading…
Cancel
Save