From a5c958599d58b26dc2fdac02e53605dad79eac0b Mon Sep 17 00:00:00 2001 From: atpking Date: Thu, 23 Mar 2023 14:47:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86--icon=5Fpath?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + README.md | 1 + analysis/app.go | 6 ------ api/rio_api.go | 6 +++++- constants/constants.go | 2 +- main.go | 11 +++++++++-- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 7cdc3dd..bb36c5a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ test.go *.apk *.ipa .vscode/* +michael_jordan.png \ No newline at end of file diff --git a/README.md b/README.md index 9e96927..d5da061 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ go-fir-cli 只实现了 fir-cli 的部分功能, 并无计划实现全部功能, 由于作者不善 golang, 所以大部分代码皆来自于 Copilot 和 chatGPT 生成, 作者仅在此基础上做了一些修改与调试, 以便于使用. 如果您在使用中发现任何问题, 欢迎提 issue 或者 pr. ## 更新说明 +- 0.0.8 增加了自定义图标参数 --icon_path - 0.0.7 支持了持久化登录 - 0.0.6 支持了windows平台 - 0.0.5 支持了上传进度条显示 diff --git a/analysis/app.go b/analysis/app.go index d48f627..dc45a88 100644 --- a/analysis/app.go +++ b/analysis/app.go @@ -21,12 +21,6 @@ type AppFileInfo struct { Changelog string } -type IUploadApp interface { - GetIcon() image.Image - GetAppFileInfo() map[string]string - FilePath() string -} - type UploadAppService struct { AppFileInfo *AppFileInfo FilePath string diff --git a/api/rio_api.go b/api/rio_api.go index 1cdc5cd..c0ce9a1 100644 --- a/api/rio_api.go +++ b/api/rio_api.go @@ -26,6 +26,7 @@ type FirApi struct { ApiToken string AppChangelog string Email string + CustomIconPath string QrCodePngNeed bool QrCodeAsciiNeed bool ApiAppInfo *ApiAppInfo @@ -154,7 +155,6 @@ func (f *FirApi) UploadPrepare(file string) (AppPrepareUploadData, error) { var err error if f.uploadAppService == nil { - // uploadAppService, err := analysis.NewUploadAppService(file) f.uploadAppService, err = analysis.NewUploadAppService(file) if err != nil { fmt.Println(err) @@ -305,6 +305,10 @@ func (f *FirApi) uploadAppIcon(file string, uploadingInfo AppPrepareUploadData) } iconFile := "blob" + if f.CustomIconPath != "" { + iconFile = f.CustomIconPath + } + uploadFile, _ := os.Open(iconFile) defer uploadFile.Close() diff --git a/constants/constants.go b/constants/constants.go index adac0e0..fa24116 100644 --- a/constants/constants.go +++ b/constants/constants.go @@ -1,4 +1,4 @@ package constants -const VERSION = "0.0.7" +const VERSION = "0.0.8" const USER_AGENT = "go-fir-" + VERSION diff --git a/main.go b/main.go index c2b2945..3c8502f 100644 --- a/main.go +++ b/main.go @@ -35,7 +35,7 @@ func initCli() { logoutCommand(), testWebhook(), uploadFile(), - cli.Command{ + { Name: "version", ShortName: "v", Usage: "查看 go-fir-cli 版本", @@ -44,7 +44,7 @@ func initCli() { return nil }, }, - cli.Command{ + { Name: "upgrade", Usage: "如何升级 go-fir-cli", Action: func(c *cli.Context) error { @@ -138,6 +138,12 @@ func uploadFile() cli.Command { Name: "file, f", Usage: "apk 或者 ipa 的文件路径", }, + + cli.StringFlag{ + Name: "icon_path, ip", + Usage: "如果需要自定义icon, 则这里传 icon 的路径", + }, + cli.StringFlag{ Name: "changelog, c", Usage: "app 的更新日志, 可以是文件路径, 也可以是字符串", @@ -226,6 +232,7 @@ func uploadFile() cli.Command { api := api.FirApi{ ApiToken: token, + CustomIconPath: c.String("icon_path"), AppChangelog: changelog, QrCodePngNeed: c.Bool("qrcode"), QrCodeAsciiNeed: c.Bool("qrcodeascii"),