fix: IRC SPA cleanup — /motd, /query, Firefox / key, default MOTD
All checks were successful
check / check (push) Successful in 6s
All checks were successful
check / check (push) Successful in 6s
- Add default MOTD with figlet-style ASCII art for neoirc - Add MOTD server command so /motd can be re-requested - Add /motd client command to display message of the day - Add /query command to open DM tabs with optional message - Add /clear command to clear messages in current tab - Fix Firefox quick search conflict: global keydown handler captures '/' and redirects focus to the input element - Auto-focus input on SPA init and tab changes - Show MOTD on resumed sessions (new sessions get it from server automatically during creation) - Update /help with new commands - Style MOTD on login screen for better ASCII art display
This commit is contained in:
@@ -13,6 +13,14 @@ import (
|
||||
_ "github.com/joho/godotenv/autoload" // loads .env file
|
||||
)
|
||||
|
||||
const defaultMOTD = ` _ __ ___ ___ (_)_ __ ___
|
||||
| '_ \ / _ \/ _ \ | | '__/ __|
|
||||
| | | | __/ (_) || | | | (__
|
||||
|_| |_|\___|\___/ |_|_| \___|
|
||||
|
||||
Welcome to NeoIRC — IRC semantics over HTTP.
|
||||
Type /help for available commands.`
|
||||
|
||||
// Params defines the dependencies for creating a Config.
|
||||
type Params struct {
|
||||
fx.In
|
||||
@@ -62,7 +70,7 @@ func New(
|
||||
viper.SetDefault("METRICS_PASSWORD", "")
|
||||
viper.SetDefault("MAX_HISTORY", "10000")
|
||||
viper.SetDefault("MAX_MESSAGE_SIZE", "4096")
|
||||
viper.SetDefault("MOTD", "")
|
||||
viper.SetDefault("MOTD", defaultMOTD)
|
||||
viper.SetDefault("SERVER_NAME", "")
|
||||
viper.SetDefault("FEDERATION_KEY", "")
|
||||
viper.SetDefault("SESSION_IDLE_TIMEOUT", "24h")
|
||||
|
||||
@@ -670,6 +670,13 @@ func (hdlr *Handlers) dispatchCommand(
|
||||
hdlr.handleQuit(
|
||||
writer, request, sessionID, nick, body,
|
||||
)
|
||||
case "MOTD":
|
||||
hdlr.deliverMOTD(
|
||||
request, clientID, sessionID, nick,
|
||||
)
|
||||
hdlr.respondJSON(writer, request,
|
||||
map[string]string{"status": "ok"},
|
||||
http.StatusOK)
|
||||
case "PING":
|
||||
hdlr.respondJSON(writer, request,
|
||||
map[string]string{
|
||||
|
||||
Reference in New Issue
Block a user