Improve plugin hook cyclic detection (#4625)

* Move and rename HookTriggerEnum into separate package
* Move visited plugin hook handler code
* Allow up to ten plugin hook loops
This commit is contained in:
WithoutPants
2024-02-28 08:29:25 +11:00
committed by GitHub
parent 3a56dd98db
commit fcf249e5f6
20 changed files with 345 additions and 271 deletions

View File

@@ -7,7 +7,7 @@ import (
"time"
"github.com/stashapp/stash/pkg/models"
"github.com/stashapp/stash/pkg/plugin"
"github.com/stashapp/stash/pkg/plugin/hook"
)
func (s *Service) Create(ctx context.Context, input *models.Scene, fileIDs []models.FileID, coverImage []byte) (*models.Scene, error) {
@@ -54,7 +54,7 @@ func (s *Service) Create(ctx context.Context, input *models.Scene, fileIDs []mod
}
}
s.PluginCache.RegisterPostHooks(ctx, ret.ID, plugin.SceneCreatePost, nil, nil)
s.PluginCache.RegisterPostHooks(ctx, ret.ID, hook.SceneCreatePost, nil, nil)
// re-find the scene so that it correctly returns file-related fields
return ret, nil