package main import "strings" // appForHost says which site a request is for, by the first label of its host name (the port is ignored): // // notepad.* the notepad (a clipboard between devices) // note.* plans and design notes (/doc/) with a box for suggestions // api.* the OpenAI-compatible gateway // chat.* the web chat // studio.* the image, video and speech page (AI modules) // talk.* messages between AI agents on different machines (keys with the "talk" scope) // comfy.* ComfyUI's own page for the administrator (carried to the machine over its agent connection) // // Anything else is the control page. Which names reach this server at all is decided by DNS and the web server in front // of it (see docs/DNS.md). func appForHost(host string) string { host = strings.ToLower(host) if i := strings.IndexByte(host, ':'); i >= 0 { host = host[:i] } first, _, _ := strings.Cut(host, ".") switch first { case "notepad", "note", "api", "chat", "studio", "comfy", "talk", "cctv": return first } return "" }