mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Plugin hooks (#1452)
* Refactor session and plugin code * Add context to job tasks * Show hooks in plugins page * Refactor session management
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
||||
"github.com/stashapp/stash/pkg/models"
|
||||
"github.com/stashapp/stash/pkg/plugin"
|
||||
"github.com/stashapp/stash/pkg/scraper"
|
||||
"github.com/stashapp/stash/pkg/session"
|
||||
"github.com/stashapp/stash/pkg/sqlite"
|
||||
"github.com/stashapp/stash/pkg/utils"
|
||||
)
|
||||
@@ -31,6 +32,8 @@ type singleton struct {
|
||||
FFMPEGPath string
|
||||
FFProbePath string
|
||||
|
||||
SessionStore *session.Store
|
||||
|
||||
JobManager *job.Manager
|
||||
|
||||
PluginCache *plugin.Cache
|
||||
@@ -100,6 +103,11 @@ func Initialize() *singleton {
|
||||
if cfgFile != "" {
|
||||
cfgFile = cfgFile + " "
|
||||
}
|
||||
|
||||
// create temporary session store - this will be re-initialised
|
||||
// after config is complete
|
||||
instance.SessionStore = session.NewStore(cfg)
|
||||
|
||||
logger.Warnf("config file %snot found. Assuming new system...", cfgFile)
|
||||
}
|
||||
|
||||
@@ -179,6 +187,8 @@ func (s *singleton) PostInit() error {
|
||||
|
||||
s.Paths = paths.NewPaths(s.Config.GetGeneratedPath())
|
||||
s.RefreshConfig()
|
||||
s.SessionStore = session.NewStore(s.Config)
|
||||
s.PluginCache.RegisterSessionStore(s.SessionStore)
|
||||
|
||||
if err := s.PluginCache.LoadPlugins(); err != nil {
|
||||
logger.Errorf("Error reading plugin configs: %s", err.Error())
|
||||
|
||||
Reference in New Issue
Block a user