Files
observer/server/common/apk_store.go
T
2026-08-25 16:52:55 +08:00

25 lines
786 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package common
import (
"context"
"path/filepath"
"github.com/gogf/gf/v2/frame/g"
)
// APK 存储约定:Android 版本下发上传的 APK 存固定文件名(上传即覆盖,原子重命名),
// 目录下永远只保留最新一个文件;下载由 main.go 静态托管 /download/<ApkFilename>
// URL 固定,客户端拼 apiBaseUrl 访问。
const ApkFilename = "observer-latest.apk"
// ApkDir APK 上传目录:config.yml app.apkDir(默认 ./workspace,与 ./data 平级,
// docker-compose 挂载持久化)
func ApkDir(ctx context.Context) string {
return g.Cfg().MustGet(ctx, "app.apkDir", "./workspace").String()
}
// ApkFilePath 最新 APK 完整路径
func ApkFilePath(ctx context.Context) string {
return filepath.Join(ApkDir(ctx), ApkFilename)
}