Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ var Template = `
<a href="/news"><img src="/news.png"><span class="label">News</span></a>
<a href="/video"%s><img src="/video.png"><span class="label">Video</span></a>
<a id="nav-wallet" href="/wallet"><img src="/wallet.png"><span class="label">Wallet</span></a>
<a id="nav-terminal" href="/terminal"><img src="/terminal.png"><span class="label">Terminal</span></a>
</div>
<div class="nav-bottom">
<div id="nav-username" style="display: none;"></div>
Expand Down
Binary file added app/html/terminal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"mu/home"
"mu/mail"
"mu/news"
"mu/terminal"
"mu/user"
"mu/video"
"mu/wallet"
Expand Down Expand Up @@ -110,6 +111,8 @@ func main() {
"/status": false, // Public - server health status
"/docs": false, // Public - documentation
"/about": false, // Public - about page

"/terminal": true, // Require auth for terminal
}

// Static assets should not require authentication
Expand Down Expand Up @@ -197,6 +200,10 @@ func main() {
// presence WebSocket endpoint
http.HandleFunc("/presence", user.PresenceHandler)

// terminal - web based shell (admin only)
http.HandleFunc("/terminal", terminal.Handler)
http.HandleFunc("/terminal/ws", terminal.WSHandler)

// presence ping endpoint
http.HandleFunc("/ping", func(w http.ResponseWriter, r *http.Request) {
_, acc, err := auth.RequireSession(r)
Expand Down Expand Up @@ -230,7 +237,8 @@ func main() {
!strings.HasSuffix(r.URL.Path, ".js") &&
!strings.HasSuffix(r.URL.Path, ".png") &&
!strings.HasSuffix(r.URL.Path, ".ico") &&
!strings.HasPrefix(r.URL.Path, "/chat/ws") {
!strings.HasPrefix(r.URL.Path, "/chat/ws") &&
!strings.HasPrefix(r.URL.Path, "/terminal/ws") {
app.Log("http", "%s %s %s %v", r.Method, r.URL.Path, r.RemoteAddr, time.Since(start))
}
}()
Expand Down
Loading