Add Gitea restart workflow and link-style "Run again" for the public view
The server deployment cannot mount the Docker socket safely, so the web view's button now opens the Gitea page for a workflow_dispatch workflow that recreates the stack and replays the demo. Gitea handles who may run it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -45,7 +45,10 @@ var (
|
||||
logDir = "/logs"
|
||||
// The restart button needs the Docker socket; it is only enabled when the deployment says so.
|
||||
restartEnabled = os.Getenv("RESTART_ENABLED") == "1"
|
||||
re = regexp.MustCompile(`^(\d\d:\d\d:\d\d\.\d{3}) \[([a-z-]+)\] (.*)$`)
|
||||
// Without the Docker socket the page can still offer "Run again" as a link to this URL (the
|
||||
// Gitea page that runs the restart workflow); Gitea then does the authentication.
|
||||
restartURL = os.Getenv("RESTART_URL")
|
||||
re = regexp.MustCompile(`^(\d\d:\d\d:\d\d\.\d{3}) \[([a-z-]+)\] (.*)$`)
|
||||
)
|
||||
|
||||
// tail remembers how far a file has been read and any incomplete last line.
|
||||
@@ -294,7 +297,7 @@ func main() {
|
||||
json.NewEncoder(w).Encode(lines)
|
||||
})
|
||||
http.HandleFunc("/api/config", func(w http.ResponseWriter, r *http.Request) {
|
||||
json.NewEncoder(w).Encode(map[string]bool{"restart": restartEnabled})
|
||||
json.NewEncoder(w).Encode(map[string]any{"restart": restartEnabled, "restartUrl": restartURL})
|
||||
})
|
||||
http.HandleFunc("/api/restart", func(w http.ResponseWriter, r *http.Request) {
|
||||
if !restartEnabled {
|
||||
|
||||
Reference in New Issue
Block a user