Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2025-06-05 18:07:16 +08:00
commit 66b73fc1fa
15 changed files with 55 additions and 16 deletions

View file

@ -1596,6 +1596,7 @@
"253": "جارٍ ضغط الملف [%s]، يرجى الانتظار...",
"254": "[Region ID] معرّف المنطقة غير صحيح، يرجى الرجوع إلى وثائق مزود خدمة S3 لتكوين معرّف المنطقة",
"255": "قام الموقع المستهدف بتمكين حماية الروابط المباشرة، لذلك لا يمكن تنزيل [%d] من الموارد",
"256": "المسار المحدد [%s] يحتوي على مسار مساحة عمل رئيسي [%s]"
"256": "المسار المحدد [%s] يحتوي على مسار مساحة عمل رئيسي [%s]",
"257": "تذكرني لمدة 30 يومًا"
}
}

View file

@ -1596,6 +1596,7 @@
"253": "Datei [%s] wird komprimiert, bitte warten...",
"254": "[Region ID] Falsche Regions-ID, bitte konsultieren Sie die Dokumentation des S3-Dienstanbieters zur Konfiguration der Regions-ID",
"255": "Die Zielseite hat den Hotlink-Schutz aktiviert, daher ist es nicht möglich, [%d] Ressourcen herunterzuladen",
"256": "Der angegebene Pfad [%s] hat einen übergeordneten Arbeitsbereichspfad [%s]"
"256": "Der angegebene Pfad [%s] hat einen übergeordneten Arbeitsbereichspfad [%s]",
"257": "Erinnere dich 30 Tage an mich"
}
}

View file

@ -1596,6 +1596,7 @@
"253": "Compressing file [%s], please wait...",
"254": "[Region ID] Incorrect Region ID, please refer to the S3 service provider's documentation to configure the Region ID",
"255": "The target site has enabled hotlink protection, so it is not possible to download [%d] resources",
"256": "The specified path [%s] has a parent workspace path [%s]"
"256": "The specified path [%s] has a parent workspace path [%s]",
"257": "Remember me for 30 days"
}
}

View file

@ -1596,6 +1596,7 @@
"253": "Comprimiendo el archivo [%s], por favor espere...",
"254": "[Region ID] ID de región incorrecto, por favor consulte la documentación del proveedor de servicios S3 para configurar el ID de región",
"255": "El sitio de destino ha activado la protección contra hotlinking, por lo que no es posible descargar [%d] recursos",
"256": "La ruta especificada [%s] tiene una ruta de espacio de trabajo padre [%s]"
"256": "La ruta especificada [%s] tiene una ruta de espacio de trabajo padre [%s]",
"257": "Recuérdame durante 30 días"
}
}

View file

@ -1596,6 +1596,7 @@
"253": "Compression du fichier [%s], veuillez patienter...",
"254": "[Region ID] ID de région incorrect, veuillez consulter la documentation du fournisseur de services S3 pour configurer l'ID de région",
"255": "Le site cible a activé la protection contre le hotlinking, il est donc impossible de télécharger [%d] ressources",
"256": "Le chemin spécifié [%s] contient un chemin d'espace de travail parent [%s]"
"256": "Le chemin spécifié [%s] contient un chemin d'espace de travail parent [%s]",
"257": "Souviens-toi de moi pendant 30 jours"
}
}

View file

@ -1596,6 +1596,7 @@
"253": "דוחס את הקובץ [%s], אנא המתן...",
"254": "[Region ID] מזהה האזור שגוי, אנא עיין בתיעוד ספק שירותי S3 כדי להגדיר את מזהה האזור",
"255": "האתר היעד הפעיל הגנה על קישורים חמים, ולכן לא ניתן להוריד [%d] משאבים",
"256": "הנתיב שצוין [%s] מכיל נתיב מרחב עבודה אב [%s]"
"256": "הנתיב שצוין [%s] מכיל נתיב מרחב עבודה אב [%s]",
"257": "זכור אותי למשך 30 יום"
}
}

View file

@ -1596,6 +1596,7 @@
"253": "Compressione del file [%s], attendere prego...",
"254": "[Region ID] ID regione non corretto, si prega di consultare la documentazione del fornitore di servizi S3 per configurare l'ID regione",
"255": "Il sito di destinazione ha abilitato la protezione hotlink, quindi non è possibile scaricare [%d] risorse",
"256": "Il percorso specificato [%s] ha un percorso di spazio di lavoro padre [%s]"
"256": "Il percorso specificato [%s] ha un percorso di spazio di lavoro padre [%s]",
"257": "Ricordati di me per 30 giorni"
}
}

View file

@ -1596,6 +1596,7 @@
"253": "ファイル [%s] を圧縮しています、お待ちください...",
"254": "[Region ID] リージョンIDが正しくありません。S3サービスプロバイダーのドキュメントを参照してリージョンIDを設定してください",
"255": "ターゲットサイトはホットリンク保護を有効にしているため、[%d] 個のリソースをダウンロードできません",
"256": "指定されたパス [%s] の親にワークスペースパス [%s] が存在します"
"256": "指定されたパス [%s] の親にワークスペースパス [%s] が存在します",
"257": "30日間私を覚えていてください"
}
}

View file

@ -1596,6 +1596,7 @@
"253": "Kompresja pliku [%s], proszę czekać...",
"254": "[Region ID] Nieprawidłowy identyfikator regionu, proszę zapoznać się z dokumentacją dostawcy usług S3 w celu skonfigurowania identyfikatora regionu",
"255": "Docelowa strona włączyła ochronę przed hotlinkowaniem, [%d] zasobów nie można pobrać",
"256": "Określona ścieżka [%s] ma nadrzędną ścieżkę przestrzeni roboczej [%s]"
"256": "Określona ścieżka [%s] ma nadrzędną ścieżkę przestrzeni roboczej [%s]",
"257": "Zapamiętaj mnie na 30 dni"
}
}

View file

@ -1596,6 +1596,7 @@
"253": "Сжатие файла [%s], пожалуйста, подождите...",
"254": "[Region ID] Неправильный идентификатор региона, пожалуйста, обратитесь к документации поставщика услуг S3 для настройки идентификатора региона",
"255": "Целевой сайт включил защиту от хотлинков, [%d] ресурсов невозможно скачать",
"256": "Указанный путь [%s] имеет родительский путь рабочей области [%s]"
"256": "Указанный путь [%s] имеет родительский путь рабочей области [%s]",
"257": "Запомнить меня на 30 дней"
}
}

View file

@ -1596,6 +1596,7 @@
"253": "正在壓縮文件 [%s],請稍等...",
"254": "[Region ID] 不正確,請參考 S3 服務提供商的文檔配置地域 ID",
"255": "目標站點啟用了防盜鏈,[%d] 個資源無法下載",
"256": "指定的路徑 [%s] 父級存在工作空間路徑 [%s]"
"256": "指定的路徑 [%s] 父級存在工作空間路徑 [%s]",
"257": "記住我 30 天"
}
}

View file

@ -1596,6 +1596,7 @@
"253": "正在压缩文件 [%s],请稍等...",
"254": "[Region ID] 不正确,请参考 S3 服务提供商的文档配置地域 ID",
"255": "目标站点启用了防盗链,[%d] 个资源无法下载",
"256": "指定的路径 [%s] 父级存在工作空间路径 [%s]"
"256": "指定的路径 [%s] 父级存在工作空间路径 [%s]",
"257": "记住我 30 天"
}
}

View file

@ -184,6 +184,10 @@
<img id="captchaImg" style="top: 1px;position: absolute;height: 26px;right: 1px;cursor: pointer">
<input id="captcha" class="b3-text-field" placeholder="{{.l3}}">
</div>
<div style="width: 240px; margin: 8px auto; text-align: left; display: flex; align-items: center;">
<input type="checkbox" id="rememberMe" style="margin-right: 8px;">
<label for="rememberMe" style="color: var(--b3-theme-on-surface); font-size: 14px;">{{.l10}}</label>
</div>
<button class="b3-button" onclick="submitAuth()">{{.l1}}</button>
<div class="ft__on-surface">
{{.l2}}
@ -475,6 +479,7 @@
const submitAuth = () => {
const inputElement = document.getElementById('authCode')
const captchaElement = document.getElementById('captcha')
const rememberMeElement = document.getElementById('rememberMe')
let code = inputElement.value.trim();
if ("" === code) {
showMessage({{.l9}})
@ -489,6 +494,7 @@
body: JSON.stringify({
authCode: code,
captcha: captchaElement.value,
rememberMe: rememberMeElement.checked
}),
}).then((response) => {
return response.json()

View file

@ -27,6 +27,7 @@ import (
"time"
"github.com/88250/gulu"
ginSessions "github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin"
"github.com/gorilla/websocket"
"github.com/siyuan-note/logging"
@ -91,6 +92,13 @@ func LoginAuth(c *gin.Context) {
ret.Code = 1
ret.Msg = Conf.Language(22)
logging.LogWarnf("invalid captcha")
workspaceSession.Captcha = gulu.Rand.String(7) // https://github.com/siyuan-note/siyuan/issues/13147
if err := session.Save(c); err != nil {
logging.LogErrorf("save session failed: " + err.Error())
c.Status(http.StatusInternalServerError)
return
}
return
}
}
@ -121,7 +129,20 @@ func LoginAuth(c *gin.Context) {
workspaceSession.AccessAuthCode = authCode
util.WrongAuthCount = 0
workspaceSession.Captcha = gulu.Rand.String(7)
logging.LogInfof("auth success [ip=%s]", util.GetRemoteAddr(c.Request))
maxAge := 0 // Default session expiration (browser session)
if rememberMe, ok := arg["rememberMe"].(bool); ok && rememberMe {
// Add a 'Remember me' checkbox when logging in to save a session https://github.com/siyuan-note/siyuan/pull/14964
maxAge = 60 * 60 * 24 * 30 // 30 days
}
ginSessions.Default(c).Options(ginSessions.Options{
Path: "/",
Secure: util.SSL,
MaxAge: maxAge,
HttpOnly: true,
})
logging.LogInfof("auth success [ip=%s, maxAge=%d]", util.GetRemoteAddr(c.Request), maxAge)
if err := session.Save(c); err != nil {
logging.LogErrorf("save session failed: " + err.Error())
c.Status(http.StatusInternalServerError)

View file

@ -36,7 +36,7 @@ import (
"github.com/emersion/go-webdav/carddav"
"github.com/gin-contrib/gzip"
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/sessions/memstore"
"github.com/gin-contrib/sessions/cookie"
"github.com/gin-gonic/gin"
"github.com/mssola/useragent"
"github.com/olahol/melody"
@ -61,8 +61,7 @@ const (
)
var (
// 这里用的是内存存储,意味着重启后所有 session 会丢失,需要重新登录
sessionStore = memstore.NewStore([]byte("ATN51UlxVq1Gcvdf"))
sessionStore = cookie.NewStore([]byte("ATN51UlxVq1Gcvdf"))
HttpMethods = []string{
http.MethodGet,
@ -452,6 +451,7 @@ func serveAuthPage(c *gin.Context) {
"l7": template.HTML(model.Conf.Language(184)),
"l8": model.Conf.Language(95),
"l9": model.Conf.Language(83),
"l10": model.Conf.Language(257),
"appearanceMode": model.Conf.Appearance.Mode,
"appearanceModeOS": model.Conf.Appearance.ModeOS,
"workspace": util.WorkspaceName,