feat: connect terminal service to backend

feat: put terminal service into container

refactor: separate main into terminal and websocket

feat: create zsh using commander in home

feat: pass backendUrl to container

feat: pass token to ws server to cmd-hook

feat: gen terminal access token for frontend

feat: success to connect through traefik

fix: handle invalid jwt

feat: connect to session container via traefik
This commit is contained in:
Justin Lin committed 2025-05-05 19:53:33 +08:00
1 parent 0b08a9a5d9
commit 5e81db2759
20 files changed
+281 -209

No files matched your search

+6 -2
View File
@@ -48,7 +48,11 @@ func main() {
payload.Params = params
apiEndpoint := os.Getenv("API_ENDPOINT")
backendUrl := os.Getenv("BACKEND_URL")
if backendUrl == "" {
fmt.Fprintf(os.Stderr, "BACKEND_URL is not set\n")
os.Exit(1)
}
token := os.Getenv("TOKEN")
jsonData, err := json.MarshalIndent(payload, "", " ")
@@ -58,7 +62,7 @@ func main() {
}
fmt.Println(string(jsonData))
req, err := http.NewRequest("POST", fmt.Sprintf("%s/api/v1/commands", apiEndpoint), bytes.NewBuffer(jsonData))
req, err := http.NewRequest("POST", fmt.Sprintf("%s/api/v1/commands", backendUrl), bytes.NewBuffer(jsonData))
if err != nil {
fmt.Fprintf(os.Stderr, "Error creating request: %v\n", err)
os.Exit(1)