mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Start browser on server start (#1832)
* Start browser on server start * Add config option for opening browser
This commit is contained in:
committed by
GitHub
parent
29b14ab4fc
commit
87036a07bc
@@ -4,9 +4,12 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"runtime/pprof"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -391,6 +394,34 @@ func (s *singleton) Migrate(ctx context.Context, input models.MigrateInput) erro
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *singleton) IsDesktop() bool {
|
||||
// check if running under root
|
||||
if os.Getuid() == 0 {
|
||||
return false
|
||||
}
|
||||
// check if started by init, e.g. stash is a *nix systemd service / MacOS launchd service
|
||||
if os.Getppid() == 1 {
|
||||
return false
|
||||
}
|
||||
if IsServerDockerized() {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func IsServerDockerized() bool {
|
||||
if runtime.GOOS == "linux" {
|
||||
_, dockerEnvErr := os.Stat("/.dockerenv")
|
||||
cgroups, _ := ioutil.ReadFile("/proc/self/cgroup")
|
||||
if os.IsExist(dockerEnvErr) || strings.Contains(string(cgroups), "docker") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (s *singleton) GetSystemStatus() *models.SystemStatus {
|
||||
status := models.SystemStatusEnumOk
|
||||
dbSchema := int(database.Version())
|
||||
|
||||
Reference in New Issue
Block a user