douyin-release-gate / verify (push) Failing after 18m54s
Add Douyin notification polling, event details, and manual multi-account private messaging. Refine environment memory settings, account operations, login collection recovery, and message UI; update tests and documentation.
34 lines
1.0 KiB
Go
34 lines
1.0 KiB
Go
package api
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"git.ipao.vip/rogee/creator-hub/internal/creator"
|
|
hub "git.ipao.vip/rogee/creator-hub/internal/environment"
|
|
"github.com/gofiber/fiber/v3"
|
|
)
|
|
|
|
// Existing fingerprint endpoints use a flat fingerprint object. Memory-only
|
|
// requests must not replace an omitted fingerprint with its zero value.
|
|
func decodeEnvironmentSettings(c fiber.Ctx) (*hub.Fingerprint, *int, error) {
|
|
var input struct {
|
|
hub.Fingerprint
|
|
MemoryLimitMB *int `json:"memory_limit_mb"`
|
|
}
|
|
if err := decodeCreator(c, &input); err != nil {
|
|
return nil, nil, err
|
|
}
|
|
var fields map[string]json.RawMessage
|
|
if err := json.Unmarshal(c.Body(), &fields); err != nil {
|
|
return nil, nil, creator.ErrInvalid
|
|
}
|
|
if value, present := fields["memory_limit_mb"]; present && string(value) == "null" {
|
|
return nil, nil, creator.ErrInvalid
|
|
}
|
|
delete(fields, "memory_limit_mb")
|
|
if len(fields) == 0 && input.MemoryLimitMB != nil {
|
|
return nil, input.MemoryLimitMB, nil
|
|
}
|
|
return &input.Fingerprint, input.MemoryLimitMB, nil
|
|
}
|