Phase 3: Go hygiene pass, runtime PUID/PGID, fork README
continuous-integration/drone/push Build encountered an error

Go:
- staticcheck 399 -> 0 with staticcheck.conf (style checks ST1000/1003/
  1005/1016/1020/1021/1022 excluded; error strings are shown in the UI).
- io/ioutil and rand.Seed removed; CloseNotifier kept with a lint-ignore
  until the Phase 2 context rewrite.
- Dead code deleted: Auto handler, getStreamByChannelID, updateXEPG,
  indexOfInt, jsonToMapInt64, removeOldSystemData, randomTime, and the
  commented-out blocks in struct-buffer.go and internal/authentication.
- Duplicates folded: cacheImagesInBackground(), one addErrorToStream().
- Bugs found by SA4006/SA5001: os.Create handle leaked per ffmpeg segment
  (buffer.go), http.NewRequest error unchecked (buffer.go), xepg.json
  migration wrote null on read error (migrate.go), WriteUserData errors
  silently dropped (authentication.go), defer Close before error check
  (buffer.go, toolchain.go). checkFilePermission results were discarded;
  an unwritable config or temp dir is now fatal at start-up.
- gofmt applied repo-wide; Drone runs gofmt check and staticcheck.

Docker:
- Entrypoint starts as root, applies PUID/PGID (falls back to XTEVE_UID/
  XTEVE_GID, then image defaults), fixes config ownership only when it
  differs, then drops to xteve via su-exec. --user starts skip all of it.
- /xteve removed from LEGACY_CONFIG_DIRS (it is the parent of the default).
- mwader/static-ffmpeg pinned to 7.1.1; VOLUME /xteve/config.
- Compose files pull registry.coadcorp.com/nathan/xteve:latest, use
  PUID/PGID/TZ, and explain that SSDP needs host networking.
- .dockerignore excludes the npm toolchain (bundle stays in html/js).

Docs: README rewritten for the fork (about, registry, compose, env vars,
security notes); README-DEV gains a container section.
This commit is contained in:
2026-09-26 12:57:43 +10:00
parent ddc70e170a
commit 504ea3f9f4
38 changed files with 1034 additions and 1382 deletions
+58 -64
View File
@@ -12,7 +12,7 @@ import (
func showInfo(str string) {
if System.Flag.Info == true {
if System.Flag.Info {
return
}
@@ -39,7 +39,6 @@ func showInfo(str string) {
}
return
}
func showDebug(str string, level int) {
@@ -73,7 +72,6 @@ func showDebug(str string, level int) {
}
return
}
func showHighlight(str string) {
@@ -105,7 +103,6 @@ func showHighlight(str string) {
addNotification(notification)
return
}
func showWarning(errCode int) {
@@ -121,7 +118,6 @@ func showWarning(errCode int) {
WebScreenLog.Warnings++
mutex.Unlock()
return
}
// ShowError : Zeigt die Fehlermeldungen in der Konsole
@@ -139,7 +135,6 @@ func ShowError(err error, errCode int) {
WebScreenLog.Errors++
mutex.Unlock()
return
}
func printLogOnScreen(logMsg string, logType string) {
@@ -211,7 +206,6 @@ func logCleanUp() {
WebScreenLog.Log = logs
return
}
// Fehlercodes
@@ -224,79 +218,79 @@ func getErrMsg(errCode int) (errMsg string) {
// Errors
case 1001:
errMsg = fmt.Sprintf("Web server could not be started.")
errMsg = "Web server could not be started."
case 1002:
errMsg = fmt.Sprintf("No local IP address found.")
errMsg = "No local IP address found."
case 1003:
errMsg = fmt.Sprintf("Invalid xml")
errMsg = "Invalid xml"
case 1004:
errMsg = fmt.Sprintf("File not found")
errMsg = "File not found"
case 1005:
errMsg = fmt.Sprintf("Invalid M3U file, an extended M3U file is required.")
errMsg = "Invalid M3U file, an extended M3U file is required."
case 1006:
errMsg = fmt.Sprintf("No playlist!")
errMsg = "No playlist!"
case 1007:
errMsg = fmt.Sprintf("XEPG requires an XMLTV file.")
errMsg = "XEPG requires an XMLTV file."
case 1010:
errMsg = fmt.Sprintf("Invalid file compression")
errMsg = "Invalid file compression"
case 1011:
errMsg = fmt.Sprintf("Data is corrupt or unavailable, %s now uses an older version of this file", System.Name)
case 1012:
errMsg = fmt.Sprintf("Invalid formatting of the time")
errMsg = "Invalid formatting of the time"
case 1013:
errMsg = fmt.Sprintf("Invalid settings file (settings.json), file must be at least version %s", System.Compatibility)
case 1014:
errMsg = fmt.Sprintf("Invalid filter rule")
errMsg = "Invalid filter rule"
case 1020:
errMsg = fmt.Sprintf("Data could not be saved, invalid keyword")
errMsg = "Data could not be saved, invalid keyword"
// Datenbank Update
case 1030:
errMsg = fmt.Sprintf("Invalid settings file (%s)", System.File.Settings)
case 1031:
errMsg = fmt.Sprintf("Database error. The database version of your settings is not compatible with this version.")
errMsg = "Database error. The database version of your settings is not compatible with this version."
// M3U Parser
case 1050:
errMsg = fmt.Sprintf("Invalid duration specification in the M3U8 playlist.")
errMsg = "Invalid duration specification in the M3U8 playlist."
case 1060:
errMsg = fmt.Sprintf("Invalid characters found in the tvg parameters, streams with invalid parameters were skipped.")
errMsg = "Invalid characters found in the tvg parameters, streams with invalid parameters were skipped."
// Dateisystem
case 1070:
errMsg = fmt.Sprintf("Folder could not be created.")
errMsg = "Folder could not be created."
case 1071:
errMsg = fmt.Sprintf("File could not be created")
errMsg = "File could not be created"
case 1072:
errMsg = fmt.Sprintf("File not found")
errMsg = "File not found"
// Backup
case 1090:
errMsg = fmt.Sprintf("Automatic backup failed")
errMsg = "Automatic backup failed"
// Websockets
case 1100:
errMsg = fmt.Sprintf("WebUI build error")
errMsg = "WebUI build error"
case 1101:
errMsg = fmt.Sprintf("WebUI request error")
errMsg = "WebUI request error"
case 1102:
errMsg = fmt.Sprintf("WebUI response error")
errMsg = "WebUI response error"
// PMS Guide Numbers
case 1200:
errMsg = fmt.Sprintf("Could not create file")
errMsg = "Could not create file"
// Stream URL Fehler
case 1201:
errMsg = fmt.Sprintf("Plex stream error")
errMsg = "Plex stream error"
case 1202:
errMsg = fmt.Sprintf("Steaming URL could not be found in any playlist")
errMsg = "Steaming URL could not be found in any playlist"
case 1203:
errMsg = fmt.Sprintf("Steaming URL could not be found in any playlist")
errMsg = "Steaming URL could not be found in any playlist"
case 1204:
errMsg = fmt.Sprintf("Streaming was stopped by third party transcoder (FFmpeg / VLC)")
errMsg = "Streaming was stopped by third party transcoder (FFmpeg / VLC)"
// Warnings
case 2000:
@@ -304,86 +298,86 @@ func getErrMsg(errCode int) (errMsg string) {
case 2001:
errMsg = fmt.Sprintf("%s has loaded more than %d streams. Use the filter to reduce the number of streams.", System.Name, System.UnfilteredChannelLimit)
case 2002:
errMsg = fmt.Sprintf("PMS can not play m3u8 streams")
errMsg = "PMS can not play m3u8 streams"
case 2003:
errMsg = fmt.Sprintf("PMS can not play streams over RTSP.")
errMsg = "PMS can not play streams over RTSP."
case 2004:
errMsg = fmt.Sprintf("Buffer is disabled for this stream.")
errMsg = "Buffer is disabled for this stream."
case 2005:
errMsg = fmt.Sprintf("There are no channels mapped, use the mapping menu to assign EPG data to the channels.")
errMsg = "There are no channels mapped, use the mapping menu to assign EPG data to the channels."
case 2010:
errMsg = fmt.Sprintf("No valid streaming URL")
errMsg = "No valid streaming URL"
case 2020:
errMsg = fmt.Sprintf("FFmpeg binary was not found. Check the FFmpeg binary path in the xTeVe settings.")
errMsg = "FFmpeg binary was not found. Check the FFmpeg binary path in the xTeVe settings."
case 2021:
errMsg = fmt.Sprintf("VLC binary was not found. Check the VLC path binary in the xTeVe settings.")
errMsg = "VLC binary was not found. Check the VLC path binary in the xTeVe settings."
case 2099:
errMsg = fmt.Sprintf("Updates have been disabled by the developer")
errMsg = "Updates have been disabled by the developer"
// Tuner
case 2105:
errMsg = "The number of tuners has changed, you have to delete " + System.Name + " in Plex / Emby HDHR and set it up again."
case 2106:
errMsg = fmt.Sprintf("This function is only available with XEPG as EPG source")
errMsg = "This function is only available with XEPG as EPG source"
case 2110:
errMsg = fmt.Sprintf("Don't run this as Root!")
errMsg = "Don't run this as Root!"
case 2300:
errMsg = fmt.Sprintf("No channel logo found in the XMLTV or M3U file.")
errMsg = "No channel logo found in the XMLTV or M3U file."
case 2301:
errMsg = fmt.Sprintf("XMLTV file no longer available, channel has been deactivated.")
errMsg = "XMLTV file no longer available, channel has been deactivated."
case 2302:
errMsg = fmt.Sprintf("Channel ID in the XMLTV file has changed. Channel has been deactivated.")
errMsg = "Channel ID in the XMLTV file has changed. Channel has been deactivated."
// Benutzerauthentifizierung
case 3000:
errMsg = fmt.Sprintf("Database for user authentication could not be initialized.")
errMsg = "Database for user authentication could not be initialized."
case 3001:
errMsg = fmt.Sprintf("The user has no authorization to load the channels.")
errMsg = "The user has no authorization to load the channels."
// Buffer
case 4000:
errMsg = fmt.Sprintf("Connection to streaming source was interrupted.")
errMsg = "Connection to streaming source was interrupted."
case 4001:
errMsg = fmt.Sprintf("Too many errors connecting to the provider. Streaming is canceled.")
errMsg = "Too many errors connecting to the provider. Streaming is canceled."
case 4002:
errMsg = fmt.Sprintf("New URL for the redirect to the streaming server is missing")
errMsg = "New URL for the redirect to the streaming server is missing"
case 4003:
errMsg = fmt.Sprintf("Server sends an incompatible content-type")
errMsg = "Server sends an incompatible content-type"
case 4004:
errMsg = fmt.Sprintf("This error message comes from the provider")
errMsg = "This error message comes from the provider"
case 4005:
errMsg = fmt.Sprintf("Temporary buffer files could not be deleted")
errMsg = "Temporary buffer files could not be deleted"
case 4006:
errMsg = fmt.Sprintf("Server connection timeout")
errMsg = "Server connection timeout"
// Buffer (M3U8)
case 4050:
errMsg = fmt.Sprintf("Invalid M3U8 file")
errMsg = "Invalid M3U8 file"
case 4051:
errMsg = fmt.Sprintf("#EXTM3U header is missing")
errMsg = "#EXTM3U header is missing"
// Caching
case 4100:
errMsg = fmt.Sprintf("Unknown content type for downloaded image")
errMsg = "Unknown content type for downloaded image"
case 4101:
errMsg = fmt.Sprintf("Invalid URL, original URL is used for this image")
errMsg = "Invalid URL, original URL is used for this image"
// API
case 5000:
errMsg = fmt.Sprintf("Invalid API command")
errMsg = "Invalid API command"
// Update Server
case 6001:
errMsg = fmt.Sprintf("Ivalid key")
errMsg = "Ivalid key"
case 6002:
errMsg = fmt.Sprintf("Update failed")
errMsg = "Update failed"
case 6003:
errMsg = fmt.Sprintf("Update server not available")
errMsg = "Update server not available"
case 6004:
errMsg = fmt.Sprintf("xTeVe update available")
errMsg = "xTeVe update available"
default:
errMsg = fmt.Sprintf("Unknown error / warning (%d)", errCode)