chore: delete code no binary or test reaches
This commit is contained in:
1 parent
7986ccb3f7
commit
01acb97f96
34 files changed
+1
-1483
No files matched your search
@@ -338,10 +338,6 @@ type chatStreamSink struct {
|
||||
owner string
|
||||
}
|
||||
|
||||
func (s chatStreamSink) Delta(text string) {
|
||||
s.write(chatStreamEvent{Type: "delta", Text: text})
|
||||
}
|
||||
|
||||
func (s chatStreamSink) ToolCall(event messaging.ToolCallEvent) {
|
||||
// A dashboard_navigate call is an explicit point-the-operator-there
|
||||
// result, not tool narration, so it renders a clickable chip even when
|
||||
|
||||
@@ -11,8 +11,6 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/access"
|
||||
@@ -74,34 +72,6 @@ func DashboardURL(listen string) string {
|
||||
return "http://" + net.JoinHostPort(host, port) + "/"
|
||||
}
|
||||
|
||||
// LoadOrCreateToken returns the dashboard token, generating and persisting one
|
||||
// on first use. The token is created rather than configured so a non-loopback
|
||||
// bind cannot be brought up unprotected by omission: there is no setup step to
|
||||
// forget.
|
||||
func LoadOrCreateToken(path string) (string, error) {
|
||||
if b, err := os.ReadFile(path); err == nil {
|
||||
if tok := strings.TrimSpace(string(b)); tok != "" {
|
||||
return tok, nil
|
||||
}
|
||||
} else if !os.IsNotExist(err) {
|
||||
return "", fmt.Errorf("webui: read token: %w", err)
|
||||
}
|
||||
|
||||
raw := make([]byte, 32)
|
||||
if _, err := rand.Read(raw); err != nil {
|
||||
return "", fmt.Errorf("webui: generate token: %w", err)
|
||||
}
|
||||
tok := base64.RawURLEncoding.EncodeToString(raw)
|
||||
|
||||
if err := os.MkdirAll(filepath.Dir(path), 0o700); err != nil {
|
||||
return "", fmt.Errorf("webui: token dir: %w", err)
|
||||
}
|
||||
if err := os.WriteFile(path, []byte(tok+"\n"), 0o600); err != nil {
|
||||
return "", fmt.Errorf("webui: write token: %w", err)
|
||||
}
|
||||
return tok, nil
|
||||
}
|
||||
|
||||
// requireToken checks the request's credential: a provider-issued bearer
|
||||
// token when an identity provider is configured, else the shared token. A
|
||||
// ?t= token is moved into a cookie and the request redirected.
|
||||
|
||||
Reference in new issue
Block a user