refactor(interaction): separate view and update logic into modular files

- Extract slug editing logic to slug.go (slugView/slugUpdate)
- Extract commands menu logic to commands.go (commandsView/commandsUpdate)
- Extract coming soon modal to coming_soon.go (comingSoonView/comingSoonUpdate)
- Extract main dashboard logic to dashboard.go (dashboardView/dashboardUpdate)
- Create model.go for shared model struct and helper functions
- Replace math/rand with crypto/rand for random subdomain generation
- Remove legacy TLS cipher suite configuration
This commit is contained in:
2026-01-17 17:30:21 +07:00
parent 6969d6823a
commit 6587dc0f39
9 changed files with 702 additions and 623 deletions
+6 -2
View File
@@ -291,7 +291,11 @@ func (s *session) HandleHTTPForward(req *ssh.Request, portToBind uint16) {
}
}
randomString := random.GenerateRandomString(20)
randomString, err := random.GenerateRandomString(20)
if err != nil {
fail(fmt.Sprintf("Failed to create slug: %s", err), nil)
return
}
key := types.SessionKey{Id: randomString, Type: types.HTTP}
if !s.registry.Register(key, s) {
fail(fmt.Sprintf("Failed to register client with slug: %s", randomString), nil)
@@ -299,7 +303,7 @@ func (s *session) HandleHTTPForward(req *ssh.Request, portToBind uint16) {
}
buf := new(bytes.Buffer)
err := binary.Write(buf, binary.BigEndian, uint32(portToBind))
err = binary.Write(buf, binary.BigEndian, uint32(portToBind))
if err != nil {
fail(fmt.Sprintf("Failed to write port to buffer: %v", err), &key)
return