Files
silo-server/internal/jellycompat/handlers_system.go
5afe56cfc0 feat(jellycompat): add runtime-managed Jellyfin Web compatibility (#77)
* feat(jellycompat): install web assets at runtime

* fix(jellycompat): recover stale web operation locks

* fix(jellycompat): harden web component management

* feat(admin): refine compat settings and restart status

* chore(dev): add hot-reload docker compose stack

* fix(dev): include npm in hot-reload backend

* feat(admin): refine Jellyfin compatibility settings

* feat(settings): improve jellyfin proxy summary

* feat(settings): improve jellyfin web controls

* fix(settings): update jellyfin web removal status

* fix(settings): enable jellyfin web after install

* feat(jellycompat): auto-select web ui version

* test(api): update rate limit handler setup

* feat(jellycompat): refine web ui install onboarding

* fix(jellycompat): address web ui install review issues

* fix(onboarding): mirror jellyfin api runtime status

* fix(admin): remove global restart banner

* fix(settings): gate restart required tracking

* fix(jellyfin): ignore live settings for restart status

* fix(jellyfin): avoid restart for live compat settings

* fix(subtitles): normalize AI language codes

* fix(catalog): support partial title search tokens

* feat(branding): add white-label customization

* Add push relay engineering plan

- Document relay API contracts, APNs/FCM behavior, auth, storage, and ops
- Capture implementation plan, provider references, decisions, and README

---------

Co-authored-by: Quick <31828688+Quick104@users.noreply.github.com>
2026-06-15 09:34:08 -04:00

86 lines
2.8 KiB
Go

package jellycompat
import (
"net/http"
"github.com/Silo-Server/silo-server/internal/config"
)
type publicSystemInfoResponse struct {
LocalAddress string `json:"LocalAddress"`
ServerName string `json:"ServerName"`
Version string `json:"Version"`
ProductName string `json:"ProductName"`
ID string `json:"Id"`
StartupWizardCompleted bool `json:"StartupWizardCompleted"`
}
type brandingConfigurationResponse struct {
LoginDisclaimer string `json:"LoginDisclaimer"`
}
type endpointInfoResponse struct {
IsLocal bool `json:"IsLocal"`
IsInNetwork bool `json:"IsInNetwork"`
Address string `json:"Address,omitempty"`
}
// SystemHandler serves Jellyfin setup/system endpoints.
type SystemHandler struct {
cfg func() *config.Config
}
// NewSystemHandler creates a new system handler. The config provider is
// invoked per request so public URL / server name / emulated version
// changes apply without restart.
func NewSystemHandler(cfg func() *config.Config) *SystemHandler {
return &SystemHandler{cfg: cfg}
}
// HandlePublicInfo serves GET /System/Info/Public.
func (h *SystemHandler) HandlePublicInfo(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, h.systemInfo())
}
// HandleInfo serves GET /System/Info.
func (h *SystemHandler) HandleInfo(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, h.systemInfo())
}
// HandleBrandingConfiguration serves GET /Branding/Configuration.
func (h *SystemHandler) HandleBrandingConfiguration(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, brandingConfigurationResponse{
LoginDisclaimer: "Silo provides Jellyfin-compatible app support. Silo is not affiliated with or endorsed by the Jellyfin project.",
})
}
// HandleQuickConnectEnabled serves GET /QuickConnect/Enabled.
func (h *SystemHandler) HandleQuickConnectEnabled(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, false)
}
// HandleEndpoint serves GET /System/Endpoint.
func (h *SystemHandler) HandleEndpoint(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, endpointInfoResponse{
IsLocal: true,
IsInNetwork: true,
Address: h.cfg().JellyfinCompat.PublicURL,
})
}
// HandlePing serves GET /System/Ping.
func (h *SystemHandler) HandlePing(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}
func (h *SystemHandler) systemInfo() publicSystemInfoResponse {
return publicSystemInfoResponse{
LocalAddress: h.cfg().JellyfinCompat.PublicURL,
ServerName: h.cfg().JellyfinCompat.ServerName,
Version: h.cfg().JellyfinCompat.EmulatedServerVersion,
ProductName: "Jellyfin Server",
ID: h.cfg().JellyfinCompat.ServerID,
StartupWizardCompleted: true,
}
}