Skip to content

Commit

Permalink
fix web shell show output data bug
Browse files Browse the repository at this point in the history
  • Loading branch information
baxiry committed Sep 12, 2024
1 parent 71a87cd commit ac8a7cf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 2 additions & 4 deletions engine/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"fmt"
"strings"

//_ "github.com/mattn/go-sqlite3"

_ "modernc.org/sqlite"
)

Expand All @@ -20,7 +18,7 @@ var db *DB

func NewDB(dbName string) *DB {

newdb, err := sql.Open("sqlite", dbName) // sqlite3 whith mattn lib
newdb, err := sql.Open("sqlite", dbName)
if err != nil {
panic(err)
}
Expand All @@ -46,7 +44,7 @@ func NewDB(dbName string) *DB {

db.lastid[tableName] = lid

fmt.Println("Table Name:", tableName)
//fmt.Println("Table Name:", tableName)
}
return db
}
Expand Down
14 changes: 6 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,30 @@ func main() {

http.Handle("/static/", http.FileServer(http.FS(content)))

http.HandleFunc("/shell", shell)

// not importent
http.HandleFunc("/dev", dev)
http.HandleFunc("/", index)
http.HandleFunc("/index", shell)

http.HandleFunc("/shell", shell)
// standard endpoint
http.HandleFunc("/ws", engine.Ws)

// endpoints for speed network
http.HandleFunc("/query", engine.Request)
http.HandleFunc("/result", engine.Response)

// for pages under development
http.HandleFunc("/dev", dev)

log.Println(http.ListenAndServe(":1111", nil))
}

// redirect to shell page temporary
func dev(w http.ResponseWriter, r *http.Request) {
// TODO create index page
//http.Redirect(w, r, "http://localhost:1111/shell", http.StatusSeeOther)
f, err := content.ReadFile("static/dev.html")

if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}

fmt.Fprint(w, string(f))
}

Expand Down
6 changes: 5 additions & 1 deletion static/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ function calcHeight(value) {

let textarea = document.querySelector("textarea");
textarea.addEventListener("keyup", (e) => {
textarea.style.height = calcHeight(textarea.value) + "px";
let hi = calcHeight(textarea.value) + "px"
textarea.style.height = hi;

$("#output").css("height", "calc(100vh - "+hi+")" )
//css height: calc(100vh - 100px);
//console.log("event : ", e)
});

Expand Down

0 comments on commit ac8a7cf

Please sign in to comment.