mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 Official data sync counts the number of cloud storage API calls https://github.com/siyuan-note/siyuan/issues/8048
This commit is contained in:
parent
9a975b6cc7
commit
78a5c05d28
4 changed files with 12 additions and 2 deletions
|
|
@ -176,6 +176,8 @@ const bindProviderEvent = () => {
|
|||
<ul class="b3-list">
|
||||
<li class="b3-list-item" style="cursor: auto;">${window.siyuan.languages.upload}<span class="fn__space"></span><span class="ft__on-surface">${response.data.hTrafficUploadSize}</span></li>
|
||||
<li class="b3-list-item" style="cursor: auto;">${window.siyuan.languages.download}<span class="fn__space"></span><span class="ft__on-surface">${response.data.hTrafficDownloadSize}</span></li>
|
||||
<li class="b3-list-item" style="cursor: auto;">API GET<span class="fn__space"></span><span class="ft__on-surface">${response.data.hTrafficAPIGet}</span></li>
|
||||
<li class="b3-list-item" style="cursor: auto;">API PUT<span class="fn__space"></span><span class="ft__on-surface">${response.data.hTrafficAPIPut}</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>`;
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ func getCloudSpace(c *gin.Context) {
|
|||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
sync, backup, hSize, hAssetSize, hTotalSize, exchangeSize, hTrafficUploadSize, hTrafficDownloadSize, err := model.GetCloudSpace()
|
||||
sync, backup, hSize, hAssetSize, hTotalSize, exchangeSize, hTrafficUploadSize, hTrafficDownloadSize, htrafficAPIGet, hTrafficAPIPut, err := model.GetCloudSpace()
|
||||
if nil != err {
|
||||
ret.Code = 1
|
||||
ret.Msg = err.Error()
|
||||
|
|
@ -100,6 +100,8 @@ func getCloudSpace(c *gin.Context) {
|
|||
"hExchangeSize": exchangeSize,
|
||||
"hTrafficUploadSize": hTrafficUploadSize,
|
||||
"hTrafficDownloadSize": hTrafficDownloadSize,
|
||||
"hTrafficAPIGet": htrafficAPIGet,
|
||||
"hTrafficAPIPut": hTrafficAPIPut,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ type User struct {
|
|||
UserSiYuanAssetSize float64 `json:"userSiYuanAssetSize"`
|
||||
UserTrafficUpload float64 `json:"userTrafficUpload"`
|
||||
UserTrafficDownload float64 `json:"userTrafficDownload"`
|
||||
UserTrafficAPIGet float64 `json:"userTrafficAPIGet"`
|
||||
UserTrafficAPIPut float64 `json:"userTrafficAPIPut"`
|
||||
UserTrafficTime float64 `json:"userTrafficTime"`
|
||||
UserSiYuanSubscriptionPlan float64 `json:"userSiYuanSubscriptionPlan"` // -1:未订阅,0:标准订阅,1:教育订阅,2:试用
|
||||
UserSiYuanSubscriptionStatus float64 `json:"userSiYuanSubscriptionStatus"` // -1:未订阅,0:订阅可用,1:订阅封禁,2:订阅过期
|
||||
|
|
|
|||
|
|
@ -1599,7 +1599,7 @@ type Sync struct {
|
|||
SaveDir string `json:"saveDir"` // 本地同步数据存放目录路径
|
||||
}
|
||||
|
||||
func GetCloudSpace() (s *Sync, b *Backup, hSize, hAssetSize, hTotalSize, hExchangeSize, hTrafficUploadSize, hTrafficDownloadSize string, err error) {
|
||||
func GetCloudSpace() (s *Sync, b *Backup, hSize, hAssetSize, hTotalSize, hExchangeSize, hTrafficUploadSize, hTrafficDownloadSize, hTrafficAPIGet, hTrafficAPIPut string, err error) {
|
||||
stat, err := getCloudSpaceOSS()
|
||||
if nil != err {
|
||||
err = errors.New(Conf.Language(30) + " " + err.Error())
|
||||
|
|
@ -1630,6 +1630,8 @@ func GetCloudSpace() (s *Sync, b *Backup, hSize, hAssetSize, hTotalSize, hExchan
|
|||
hExchangeSize = "-"
|
||||
hTrafficUploadSize = "-"
|
||||
hTrafficDownloadSize = "-"
|
||||
hTrafficAPIGet = "-"
|
||||
hTrafficAPIPut = "-"
|
||||
if conf.ProviderSiYuan == Conf.Sync.Provider {
|
||||
s.HSize = humanize.Bytes(uint64(syncSize))
|
||||
b.HSize = humanize.Bytes(uint64(backupSize))
|
||||
|
|
@ -1639,6 +1641,8 @@ func GetCloudSpace() (s *Sync, b *Backup, hSize, hAssetSize, hTotalSize, hExchan
|
|||
hExchangeSize = humanize.Bytes(uint64(Conf.User.UserSiYuanPointExchangeRepoSize))
|
||||
hTrafficUploadSize = humanize.Bytes(uint64(Conf.User.UserTrafficUpload))
|
||||
hTrafficDownloadSize = humanize.Bytes(uint64(Conf.User.UserTrafficDownload))
|
||||
hTrafficAPIGet = fmt.Sprintf("%d", int(Conf.User.UserTrafficAPIGet))
|
||||
hTrafficAPIPut = fmt.Sprintf("%d", int(Conf.User.UserTrafficAPIPut))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue