Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
webssh
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
郑天保
webssh
Commits
9a49c9e5
Commit
9a49c9e5
authored
Aug 21, 2018
by
Sheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use localStorage
parent
f09ba9ec
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
5 deletions
+33
-5
main.js
webssh/static/js/main.js
+25
-1
index.html
webssh/templates/index.html
+8
-4
No files found.
webssh/static/js/main.js
View file @
9a49c9e5
...
...
@@ -7,9 +7,31 @@ jQuery(function($){
var
status
=
$
(
'#status'
),
btn
=
$
(
'.btn-primary'
),
style
=
{};
style
=
{},
names
=
[
'hostname'
,
'port'
,
'username'
,
'password'
];
function
store_items
(
names
,
data
)
{
var
i
,
name
;
for
(
i
=
0
;
i
<
names
.
length
;
i
++
)
{
name
=
names
[
i
];
window
.
localStorage
.
setItem
(
name
,
data
.
get
(
name
));
}
}
function
restore_items
(
names
)
{
var
i
,
name
,
value
;
for
(
i
=
0
;
i
<
names
.
length
;
i
++
)
{
name
=
names
[
i
];
value
=
window
.
localStorage
.
getItem
(
name
)
||
''
;
$
(
'#'
+
name
).
val
(
value
);
}
}
restore_items
(
names
);
function
parse_xterm_style
()
{
var
text
=
$
(
'.xterm-helpers style'
).
text
();
var
arr
=
text
.
split
(
'xterm-normal-char{width:'
);
...
...
@@ -236,6 +258,8 @@ jQuery(function($){
return
;
}
store_items
(
names
,
data
);
status
.
text
(
''
);
btn
.
prop
(
'disabled'
,
true
);
...
...
webssh/templates/index.html
View file @
9a49c9e5
...
...
@@ -17,6 +17,9 @@
margin-top
:
20px
;
}
.btn-danger
{
margin-left
:
5px
;
}
</style>
</head>
<body>
...
...
@@ -25,21 +28,21 @@
<div
class=
"row"
>
<div
class=
"col"
>
<label
for=
"Hostname"
>
Hostname
</label>
<input
class=
"form-control"
type=
"text"
name=
"hostname"
value=
""
required
>
<input
class=
"form-control"
type=
"text"
id=
"hostname"
name=
"hostname"
value=
""
required
>
</div>
<div
class=
"col"
>
<label
for=
"Port"
>
Port
</label>
<input
class=
"form-control"
type=
"number"
name=
"port"
min=
1
max=
65535
value=
""
required
>
<input
class=
"form-control"
type=
"number"
id=
"port"
name=
"port"
min=
1
max=
65535
value=
""
required
>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col"
>
<label
for=
"Username"
>
Username
</label>
<input
class=
"form-control"
type=
"text"
name=
"username"
value=
""
required
>
<input
class=
"form-control"
type=
"text"
id=
"username"
name=
"username"
value=
""
required
>
</div>
<div
class=
"col"
>
<label
for=
"Username"
>
Private Key
</label>
<input
class=
"form-control"
type=
"file"
name=
"privatekey"
value=
""
>
<input
class=
"form-control"
type=
"file"
id=
"privatekey"
name=
"privatekey"
value=
""
>
</div>
</div>
<div
class=
"row"
>
...
...
@@ -53,6 +56,7 @@
</div>
{% module xsrf_form_html() %}
<button
type=
"submit"
class=
"btn btn-primary"
>
Connect
</button>
<button
type=
"reset"
class=
"btn btn-danger"
>
Reset
</button>
</form>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment