webssh

Web based ssh client https://github.com/huashengdun/webssh webssh.huashengdun.org/
git clone http://git.hanabi.in/repos/webssh.git
Log | Files | Refs | README | LICENSE

commit 3a09484621b95d29989990845c4d18352dfc9504
parent 7e0937a0821b2ee85d0c2bd4f97cdd4ee4722114
Author: Sheng <webmaster0115@gmail.com>
Date:   Sat, 18 May 2019 16:36:21 +0800

Added function decode_uri

Diffstat:
Mwebssh/static/js/main.js | 16+++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/webssh/static/js/main.js b/webssh/static/js/main.js @@ -85,6 +85,16 @@ jQuery(function($){ restore_items(fields); + function decode_uri(uri) { + try { + return decodeURI(uri); + } catch(e) { + console.error(e); + } + return ''; + } + + function parse_url_data(string, filter_keys) { var i, pair, key, val, map = {}, @@ -92,8 +102,8 @@ jQuery(function($){ for (i = 0; i < arr.length; i++) { pair = arr[i].split('='); - key = pair[0].toLowerCase(); - val = pair[1]; + key = pair[0].trim().toLowerCase(); + val = pair[1] && pair[1].trim(); if (filter_keys.indexOf(key) !== -1) { map[key] = val; @@ -660,7 +670,7 @@ jQuery(function($){ url_data = parse_url_data( - window.location.search.substring(1) + '&' + window.location.hash.substring(1), + decode_uri(window.location.search.substring(1)) + '&' + decode_uri(window.location.hash.substring(1)), fields.concat(['password', 'bgcolor', 'title']) ); console.log(url_data);