mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-30 04:05:16 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
fc12ade049
8 changed files with 28 additions and 17 deletions
|
|
@ -782,7 +782,7 @@
|
|||
"24": "The network is abnormal, please try again later",
|
||||
"25": "The attribute name only supports English letters and digits",
|
||||
"26": "Please initialize the data repo key first in [Settings - About - Data repo key]",
|
||||
"27": "Data integrity check failed",
|
||||
"27": "Uploading [%v]",
|
||||
"28": "TODO",
|
||||
"29": "This feature requires <a target='_blank' href='https://ld246.com/subscribe/siyuan'>paid subscription</a> (If you have subscribed, please refresh or log in again in settings - account)",
|
||||
"30": "Failed to obtain cloud info",
|
||||
|
|
|
|||
|
|
@ -782,7 +782,7 @@
|
|||
"24": "La red es anómala, inténtalo de nuevo más tarde",
|
||||
"25": "El nombre del atributo sólo admite letras y dígitos en inglés",
|
||||
"26": "Por favor, inicialice primero la clave de repositorio de datos en [Configuración - Acerca de - Clave de repositorio de datos]",
|
||||
"27": "Falló la comprobación de la integridad de los datos",
|
||||
"27": "Subiendo [%v]",
|
||||
"28": "TODO",
|
||||
"29": "Esta función requiere una <a target='_blank' href='https://ld246.com/subscribe/siyuan'>suscripción de pago</a> (Si se ha suscrito, actualice o vuelva a conectarse en configuración - cuenta)",
|
||||
"30": "No se pudo obtener la información de la nube",
|
||||
|
|
|
|||
|
|
@ -782,7 +782,7 @@
|
|||
"24": "Le réseau est anormal, veuillez réessayer plus tard",
|
||||
"25": "Le nom de l'attribut ne supporte que les lettres et les chiffres anglais.",
|
||||
"26": "Veuillez d'abord initialiser la clé du référentiel de données dans [Paramètres - À propos - Clé du référentiel de données]",
|
||||
"27": "La vérification de l'intégrité des données a échoué",
|
||||
"27": "Téléchargement de [%v]",
|
||||
"28": "TODO",
|
||||
"29": "Cette fonctionnalité nécessite <a target='_blank' href='https://ld246.com/subscribe/siyuan'>un abonnement payant</a> (Si vous êtes déjà abonné, Rafraîchissez ou connectez - vous à nouveau dans Paramètres - compte)",
|
||||
"30": "Échec de l'obtention des informations sur le cloud",
|
||||
|
|
|
|||
|
|
@ -782,7 +782,7 @@
|
|||
"24": "網絡異常,請稍後再試",
|
||||
"25": "屬性名僅支援英文字母和阿拉伯數字",
|
||||
"26": "請先在 [設置 - 關於 - 數據倉庫密鑰] 中初始化數據倉庫密鑰",
|
||||
"27": "數據完整性校驗失敗",
|
||||
"27": "正在上傳 [%v]",
|
||||
"28": "TODO",
|
||||
"29": "該功能需要<a target='_blank' href='https://ld246.com/subscribe/siyuan'>付費訂閱</a>(如果你已經訂閱,請在設定-帳號中重繪或者重新登入)",
|
||||
"30": "獲取雲端資訊失敗",
|
||||
|
|
|
|||
|
|
@ -783,7 +783,7 @@
|
|||
"24": "网络异常,请稍后再试",
|
||||
"25": "属性名仅支持英文字母和阿拉伯数字",
|
||||
"26": "请先在 [设置 - 关于 - 数据仓库密钥] 中初始化数据仓库密钥",
|
||||
"27": "数据完整性校验失败",
|
||||
"27": "正在上传 [%v]",
|
||||
"28": "TODO",
|
||||
"29": "该功能需要<a target='_blank' href='https://ld246.com/subscribe/siyuan'>付费订阅</a>(如果你已经订阅,请在 设置 - 账号中刷新或者重新登录)",
|
||||
"30": "获取云端信息失败",
|
||||
|
|
|
|||
|
|
@ -279,6 +279,7 @@ func uploadCloud(sqlAssets []*sql.Asset) (err error) {
|
|||
uploadAbsAssets = gulu.Str.RemoveDuplicatedElem(uploadAbsAssets)
|
||||
|
||||
logging.LogInfof("uploading [%d] assets", len(uploadAbsAssets))
|
||||
msgId := util.PushMsg(fmt.Sprintf(Conf.Language(27), len(uploadAbsAssets)), 3000)
|
||||
if loadErr := LoadUploadToken(); nil != loadErr {
|
||||
util.PushMsg(loadErr.Error(), 5000)
|
||||
return
|
||||
|
|
@ -294,6 +295,10 @@ func uploadCloud(sqlAssets []*sql.Asset) (err error) {
|
|||
continue
|
||||
}
|
||||
|
||||
msg := fmt.Sprintf(Conf.Language(27), absAsset)
|
||||
util.PushStatusBar(msg)
|
||||
util.PushUpdateMsg(msgId, msg, 3000)
|
||||
|
||||
requestResult := gulu.Ret.NewResult()
|
||||
request := httpclient.NewCloudFileRequest2m()
|
||||
resp, reqErr := request.
|
||||
|
|
@ -322,6 +327,7 @@ func uploadCloud(sqlAssets []*sql.Asset) (err error) {
|
|||
completedUploadAssets = append(completedUploadAssets, relAsset)
|
||||
logging.LogInfof("uploaded asset [%s]", relAsset)
|
||||
}
|
||||
util.PushClearMsg(msgId)
|
||||
|
||||
if 0 < len(completedUploadAssets) {
|
||||
syncedAssets = readWorkspaceAssets()
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ func LoginAuth(c *gin.Context) {
|
|||
|
||||
var inputCaptcha string
|
||||
session := util.GetSession(c)
|
||||
if session.NeedCaptcha() {
|
||||
if util.NeedCaptcha() {
|
||||
captchaArg := arg["captcha"]
|
||||
if nil == captchaArg {
|
||||
ret.Code = 1
|
||||
|
|
@ -71,6 +71,11 @@ func LoginAuth(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
inputCaptcha = captchaArg.(string)
|
||||
if "" == inputCaptcha {
|
||||
ret.Code = 1
|
||||
ret.Msg = Conf.Language(21)
|
||||
return
|
||||
}
|
||||
|
||||
if strings.ToLower(session.Captcha) != strings.ToLower(inputCaptcha) {
|
||||
ret.Code = 1
|
||||
|
|
@ -84,9 +89,9 @@ func LoginAuth(c *gin.Context) {
|
|||
ret.Code = -1
|
||||
ret.Msg = Conf.Language(83)
|
||||
|
||||
session.WrongAuthCount++
|
||||
util.WrongAuthCount++
|
||||
session.Captcha = gulu.Rand.String(7)
|
||||
if session.NeedCaptcha() {
|
||||
if util.NeedCaptcha() {
|
||||
ret.Code = 1 // 需要渲染验证码
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +104,7 @@ func LoginAuth(c *gin.Context) {
|
|||
}
|
||||
|
||||
session.AccessAuthCode = authCode
|
||||
session.WrongAuthCount = 0
|
||||
util.WrongAuthCount = 0
|
||||
session.Captcha = gulu.Rand.String(7)
|
||||
if err := session.Save(c); nil != err {
|
||||
logging.LogErrorf("save session failed: " + err.Error())
|
||||
|
|
|
|||
|
|
@ -22,16 +22,16 @@ import (
|
|||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// SessionData represents the session.
|
||||
type SessionData struct {
|
||||
ID int
|
||||
AccessAuthCode string
|
||||
WrongAuthCount int
|
||||
Captcha string
|
||||
var WrongAuthCount int
|
||||
|
||||
func NeedCaptcha() bool {
|
||||
return 3 < WrongAuthCount
|
||||
}
|
||||
|
||||
func (sd *SessionData) NeedCaptcha() bool {
|
||||
return 3 < sd.WrongAuthCount
|
||||
// SessionData represents the session.
|
||||
type SessionData struct {
|
||||
AccessAuthCode string
|
||||
Captcha string
|
||||
}
|
||||
|
||||
// Save saves the current session of the specified context.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue