feat(admin): 添加APK管理功能

实现APK文件的上传、下载和列表功能
- 新增APKInfo数据结构
- 添加/admin/apk/upload、/admin/apk/download和/admin/apk/list路由
- 实现APK存储服务方法
- 添加相关测试用例
This commit is contained in:
2026-03-15 18:53:00 +08:00
parent a0ef7f430d
commit e629b69411
6 changed files with 279 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ import (
"encoding/pem"
"errors"
"fmt"
"io"
"mime"
"os"
"path/filepath"
@@ -67,6 +68,18 @@ func (s *UpdateService) ListReleases(runtimeVersion string) ([]model.ReleaseInfo
return s.store.ListReleases(runtimeVersion)
}
func (s *UpdateService) SaveAPK(runtimeVersion string, reader io.Reader) (string, error) {
return s.store.SaveAPK(runtimeVersion, reader)
}
func (s *UpdateService) GetAPKPath(runtimeVersion string) (string, error) {
return s.store.GetAPKPath(runtimeVersion)
}
func (s *UpdateService) ListAPKs() ([]model.APKInfo, error) {
return s.store.ListAPKs()
}
func (s *UpdateService) BuildManifestResponse(req ManifestRequest) (ManifestResponse, error) {
releasePath, err := s.store.LatestReleasePath(req.RuntimeVersion, req.Platform)
if err != nil {
@@ -338,4 +351,3 @@ func BuildMultipartMixed(parts []MultipartPart) ([]byte, string, error) {
buf.WriteString("--" + boundary + "--")
return buf.Bytes(), "multipart/mixed; boundary=" + boundary, nil
}