Skip to content

Commit

Permalink
Merge pull request #61 from pczchen/master
Browse files Browse the repository at this point in the history
repair timeout logic (console.go)
  • Loading branch information
shibingli committed Jan 5, 2020
2 parents 5bf9ba9 + b174b88 commit 9543982
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ bin/apibox

.vscode/tasks.json

bin/apibox

run
*/run.go
/bin/apibox
log/
src/github.com/
Expand Down
5 changes: 5 additions & 0 deletions bin/compile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

GOPATH=/home/cczdev/workspaces/webconsole

(cd $GOPATH/src/apibox.club/apibox; GOPATH=$GOPATH go build; mv apibox $GOPATH/bin)
15 changes: 7 additions & 8 deletions src/apibox.club/website/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,11 @@ func (c *Console) ConsoleMainPage(w http.ResponseWriter, r *http.Request) {
user_name := strings.TrimSpace(de_vm_info_arr[0])
user_pwd := strings.TrimSpace(de_vm_info_arr[1])
vm_addr := strings.TrimSpace(de_vm_info_arr[2])
vm_time := strings.TrimSpace(de_vm_info_arr[3])
vm_time := strings.TrimSpace(de_vm_info_arr[3])

now := time.Now()
start, _ := time.Parse("2006-01-02 15:04:05", vm_time)
du, _ := time.ParseDuration("-8h")
start = start.Add(du) //("2006-01-02 15:04:05")
start, _ := time.Parse(Time.RFC3339, vm_time)

url_timeout, err := time.ParseDuration(Conf.Web.UrlTimeout)
if nil != err {
url_timeout, _ = time.ParseDuration("60s")
Expand Down Expand Up @@ -403,10 +402,10 @@ func (c *Console) ConsoleLogin(w http.ResponseWriter, r *http.Request) {
user_name := ctx.GetFormValue("user_name")
user_pwd := ctx.GetFormValue("user_pwd")
vm_addr := ctx.GetFormValue("vm_addr")
vm_cid := ctx.GetFormValue("vm_cid")
vm_time := time.Now().Format("2006-01-02 15:04:05")
vm_cid := ctx.GetFormValue("vm_cid")
vm_time := time.Now().Format(Time.RFC3339)

apibox.Log_Debug(user_name,user_pwd,vm_addr,vm_cid,vm_time)
apibox.Log_Debug(user_name,user_pwd,vm_addr,vm_cid,vm_time)

if vm_cid == "" {
vm_cid = "none"
Expand Down Expand Up @@ -443,7 +442,7 @@ func (c *Console) ConsoleLogin(w http.ResponseWriter, r *http.Request) {
ssh_info = append(ssh_info, user_name)
ssh_info = append(ssh_info, user_pwd)
ssh_info = append(ssh_info, vm_addr)
ssh_info = append(ssh_info, vm_time)
ssh_info = append(ssh_info, vm_time)
ssh_info = append(ssh_info, vm_cid)
b64_ssh_info, err := apibox.AESEncode(strings.Join(ssh_info, "\n"), aesKey)
if nil != err {
Expand Down
Binary file modified static/images/favicon.ico
Binary file not shown.
Binary file added static/images/favicon.ico.bak
Binary file not shown.
2 changes: 1 addition & 1 deletion template/default/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ <h4 class="text-light header">Web Console</h4>
});
</script>

</html>
</html>

0 comments on commit 9543982

Please sign in to comment.