Closed yanxiaowuchris closed 5 years ago
web页面https是最好的加密方式 ,其它都不怎么安全的。
你可以这样使用,不支持跨域, var target_window = window.open('https://webssh.domain.com'); target_window.wssh.connect(ip, port, username, password);
好的,我试试看,非常感谢,刚才下拉最新的代码
已支持跨域链接了, 只要服务端有这个origin
就行。
服务器启动时传个跨域的域名网址,
wssh --origin='http://www.example.com'
浏览器端代码示例,
var target_window = window.open('https://webssh.domain.com');
target_window.postMessage('hostname|port|username|password', '*');
// target_window.postMessage(JSON.stringify(['hostname', 'port', 'username', 'password']), '*');
已经加上了通过url传递参数的功能。 示例请看README。
能否支持命令也拼接到url串里面,登录后,直接执行url里面的命令,谢谢。
@sky800719
已经加了, 示例如下
http://localhost:8888/?command=ls -l
Cross-domain links are supported, as long as the server has this
origin
. A cross-domain domain name URL is sent when the server starts.wssh --origin='http://www.example.com'
Browser-side code example,
var target_window = window.open('https://webssh.domain.com'); target_window.postMessage('hostname|port|username|password', '*'); // target_window.postMessage(JSON.stringify(['hostname', 'port', 'username', 'password']), '*');
Hi I have tried this.. It doesnt seem to work.. :(
How can I pass the parameters from another page to webssh by using only pure javascript without exposing the credentials to the URL? :(
I tried to call the webssh api directly from another page to get the SSH websocket id as in:
{status: null, id: "139931239474768", encoding: "UTF-8"}
But I don't know how to pass it back to webssh to open an ssh window by just using the ID..
:(
@huashengdun can you help me with this please?
Cross-domain links are supported, as long as the server has this
origin
. A cross-domain domain name URL is sent when the server starts.wssh --origin='http://www.example.com'
Browser-side code example,
var target_window = window.open('https://webssh.domain.com'); target_window.postMessage('hostname|port|username|password', '*'); // target_window.postMessage(JSON.stringify(['hostname', 'port', 'username', 'password']), '*');
Hi I have tried this.. It doesnt seem to work.. :(
You need to wait for the webssh page fully loaded, then execute window.postMessage.
我所希望的使用方式: 在我的web页面中,提供一个按钮,点击后,使用下面的方式 window.open("http://wsship:port/api?hostname=xx&port=xx&username=xx&password=xxx") 参数最好使用post,最好使用某种方式加密。
不知能否支持上述需求,谢谢!