自动补充 MLS 一次性密钥包
This commit is contained in:
1 parent
6b728a0996
commit
cf8129f4aa
8 files changed
+69
-11
No files matched your search
@@ -51,6 +51,18 @@ func (a *API) publishPackage(w http.ResponseWriter, r *http.Request, _ string, i
|
||||
}
|
||||
}
|
||||
|
||||
func (a *API) packageStatus(w http.ResponseWriter, r *http.Request, _ string, identity account.Identity) {
|
||||
if !a.limit(w, r, "package-status:"+identity.Device.ID, 60) {
|
||||
return
|
||||
}
|
||||
available, err := a.delivery.AvailablePackages(r.Context(), identity.Device.ID)
|
||||
if err != nil {
|
||||
unavailable(w, err)
|
||||
return
|
||||
}
|
||||
respond(w, 200, map[string]int{"available": available})
|
||||
}
|
||||
|
||||
func (a *API) claimPackage(w http.ResponseWriter, r *http.Request, _ string, identity account.Identity) {
|
||||
id, device := strings.ToLower(r.PathValue("id")), strings.ToLower(r.PathValue("device"))
|
||||
if !uuidPattern.MatchString(id) || !uuidPattern.MatchString(device) {
|
||||
|
||||
Reference in new issue
Block a user