Add Lua plugin host, built-in amazon plugin and dibs check.
Sandboxed gopher-lua with time, memory and call-stack limits from [sandbox], a goquery-backed doc API, price parsing, and the 'check', 'plugin test' and 'fixtures' commands. Sellers are first_party, fulfilled (shipped by the shop) or third_party, and items accept fulfilled by default; used-only offers are not available. Plugin tests run on real pages that 'dibs fixtures' fetches into an untracked directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f90ef18f90
commit
bb010356a0
28 files changed
+2096
-26
No files matched your search
@@ -102,15 +102,25 @@ func (c *Client) Get(ctx context.Context, rawURL string) (*Response, error) {
|
||||
if err != nil { return nil, fmt.Errorf("reading body: %w", err) }
|
||||
if int64(len(data)) > c.maxBody { return nil, fmt.Errorf("%w: more than %d bytes", ErrBodyTooLarge, c.maxBody) }
|
||||
|
||||
r := &Response{
|
||||
URL: rawURL,
|
||||
FinalURL: resp.Request.URL.String(),
|
||||
Status: resp.StatusCode,
|
||||
Header: stdhttp.Header(resp.Header),
|
||||
Body: data,
|
||||
Elapsed: time.Since(start),
|
||||
}
|
||||
r.Verdict, r.Challenge = classify(r.Status, r.Header, r.FinalURL, r.Body)
|
||||
r := NewResponse(rawURL, resp.Request.URL.String(), resp.StatusCode, stdhttp.Header(resp.Header), data)
|
||||
r.Elapsed = time.Since(start)
|
||||
|
||||
return r, nil
|
||||
}
|
||||
|
||||
// NewResponse builds and classifies a Response for a page obtained another
|
||||
// way, such as a saved fixture or the browser fallback.
|
||||
func NewResponse(rawURL, finalURL string, status int, header stdhttp.Header, body []byte) *Response {
|
||||
if header == nil { header = stdhttp.Header{} }
|
||||
|
||||
r := &Response{
|
||||
URL: rawURL,
|
||||
FinalURL: finalURL,
|
||||
Status: status,
|
||||
Header: header,
|
||||
Body: body,
|
||||
}
|
||||
r.Verdict, r.Challenge = classify(r.Status, r.Header, r.FinalURL, r.Body)
|
||||
|
||||
return r
|
||||
}
|
||||
Reference in new issue
Block a user