feat: add Playwright support for browser automation in plugins

- Updated .dockerignore and .gitignore to exclude Playwright-related files.
- Added Playwright-Go dependency in go.mod and updated go.sum.
- Implemented jsPlaywright function in js_api.go for browser-based requests.
- Enhanced README.md to document the new Playwright functionality for plugins.
This commit is contained in:
krau
2025-11-07 11:07:47 +08:00
parent f0853536d9
commit f80ecae3cc
8 changed files with 165 additions and 9 deletions

View File

@@ -121,7 +121,9 @@ func LoadPlugins(ctx context.Context, dir string) error {
vm.Set("console", jsConsole(logger))
// http fetch funcs
vm.Set("ghttp", jsGhttp(vm))
// playwright fetch func
vm.Set("playwright", jsPlaywright(vm, logger))
if _, err := vm.RunString(string(code)); err != nil {
return fmt.Errorf("error loading plugin %s: %w", e.Name(), err)
}