Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:sparkles: Show wallpaper clock before lock screen sign-in https://github.com/siyuan-note/siyuan/issues/20797

Daniel6bc1e0e12b86
diff --git a/app/appearance/langs/ar.json b/app/appearance/langs/ar.json
index 2b78d81306..bf3e6098b2 100644
--- a/app/appearance/langs/ar.json
+++ b/app/appearance/langs/ar.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "انقر أو اضغط على مفتاح لتسجيل الدخول",
"loadAllAndSelectAll": "تحميل المستند بالكامل وتحديد الكل",
"autoFitRowHeight": "ملاءمة ارتفاع الصف تلقائيًا",
"backlinkDatabaseFields": "حقول قاعدة البيانات",
diff --git a/app/appearance/langs/de.json b/app/appearance/langs/de.json
index eb87ede567..2452b9b064 100644
--- a/app/appearance/langs/de.json
+++ b/app/appearance/langs/de.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "Zum Anmelden klicken oder eine Taste drücken",
"loadAllAndSelectAll": "Gesamtes Dokument laden und alles auswählen",
"autoFitRowHeight": "Zeilenhöhe automatisch anpassen",
"backlinkDatabaseFields": "Datenbankfelder",
diff --git a/app/appearance/langs/en.json b/app/appearance/langs/en.json
index 5ce9c0b532..b8b9b67bf1 100644
--- a/app/appearance/langs/en.json
+++ b/app/appearance/langs/en.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "Click or press a key to sign in",
"loadAllAndSelectAll": "Load full document and select all",
"autoFitRowHeight": "Auto-fit row height",
"backlinkDatabaseFields": "Database fields",
diff --git a/app/appearance/langs/es.json b/app/appearance/langs/es.json
index 3bc171cf20..44946842eb 100644
--- a/app/appearance/langs/es.json
+++ b/app/appearance/langs/es.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "Haz clic o pulsa una tecla para iniciar sesión",
"loadAllAndSelectAll": "Cargar el documento completo y seleccionar todo",
"autoFitRowHeight": "Ajustar automáticamente la altura de fila",
"backlinkDatabaseFields": "Campos de la base de datos",
diff --git a/app/appearance/langs/fr.json b/app/appearance/langs/fr.json
index 503d58131a..05e22e6c48 100644
--- a/app/appearance/langs/fr.json
+++ b/app/appearance/langs/fr.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "Cliquez ou appuyez sur une touche pour vous connecter",
"loadAllAndSelectAll": "Charger le document entier et tout sélectionner",
"autoFitRowHeight": "Ajuster automatiquement la hauteur de ligne",
"backlinkDatabaseFields": "Champs de la base de données",
diff --git a/app/appearance/langs/he.json b/app/appearance/langs/he.json
index fcc21edcbe..8ccdcc120b 100644
--- a/app/appearance/langs/he.json
+++ b/app/appearance/langs/he.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "יש ללחוץ על המסך או על מקש כדי להיכנס",
"loadAllAndSelectAll": "טעינת המסמך המלא ובחירת הכול",
"autoFitRowHeight": "התאמה אוטומטית של גובה השורה",
"backlinkDatabaseFields": "שדות מסד נתונים",
diff --git a/app/appearance/langs/hi.json b/app/appearance/langs/hi.json
index 6c93919205..43538d2a8f 100644
--- a/app/appearance/langs/hi.json
+++ b/app/appearance/langs/hi.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "लॉगिन करने के लिए क्लिक करें या कोई कुंजी दबाएँ",
"loadAllAndSelectAll": "पूरा दस्तावेज़ लोड करें और सभी चुनें",
"autoFitRowHeight": "पंक्ति की ऊँचाई अपने आप समायोजित करें",
"backlinkDatabaseFields": "डेटाबेस फ़ील्ड",
diff --git a/app/appearance/langs/id.json b/app/appearance/langs/id.json
index 97eb47d43a..55dd1579b3 100644
--- a/app/appearance/langs/id.json
+++ b/app/appearance/langs/id.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "Klik atau tekan tombol untuk masuk",
"loadAllAndSelectAll": "Muat seluruh dokumen dan pilih semua",
"autoFitRowHeight": "Sesuaikan tinggi baris secara otomatis",
"backlinkDatabaseFields": "Bidang basis data",
diff --git a/app/appearance/langs/it.json b/app/appearance/langs/it.json
index db0e5b70bb..36d6496250 100644
--- a/app/appearance/langs/it.json
+++ b/app/appearance/langs/it.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "Fai clic o premi un tasto per accedere",
"loadAllAndSelectAll": "Carica l'intero documento e seleziona tutto",
"autoFitRowHeight": "Adatta automaticamente l’altezza della riga",
"backlinkDatabaseFields": "Campi del database",
diff --git a/app/appearance/langs/ja.json b/app/appearance/langs/ja.json
index 3379cca70f..ce82f58dd6 100644
--- a/app/appearance/langs/ja.json
+++ b/app/appearance/langs/ja.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "クリックまたはキーを押してログイン",
"loadAllAndSelectAll": "全文を読み込んですべて選択",
"autoFitRowHeight": "行の高さを自動調整",
"backlinkDatabaseFields": "データベースのフィールド",
diff --git a/app/appearance/langs/ko.json b/app/appearance/langs/ko.json
index 90072c31bf..1008ff9bf2 100644
--- a/app/appearance/langs/ko.json
+++ b/app/appearance/langs/ko.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "화면을 클릭하거나 키를 눌러 로그인",
"loadAllAndSelectAll": "전체 문서를 불러오고 모두 선택",
"autoFitRowHeight": "행 높이 자동 맞춤",
"backlinkDatabaseFields": "데이터베이스 필드",
diff --git a/app/appearance/langs/nl.json b/app/appearance/langs/nl.json
index 1913dcd4e5..38dc78dfb4 100644
--- a/app/appearance/langs/nl.json
+++ b/app/appearance/langs/nl.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "Klik of druk op een toets om aan te melden",
"loadAllAndSelectAll": "Volledig document laden en alles selecteren",
"autoFitRowHeight": "Rijhoogte automatisch aanpassen",
"backlinkDatabaseFields": "Databasevelden",
diff --git a/app/appearance/langs/pl.json b/app/appearance/langs/pl.json
index 9836371872..9ace76d1f1 100644
--- a/app/appearance/langs/pl.json
+++ b/app/appearance/langs/pl.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "Kliknij lub naciśnij klawisz, aby się zalogować",
"loadAllAndSelectAll": "Wczytaj cały dokument i zaznacz wszystko",
"autoFitRowHeight": "Automatycznie dopasuj wysokość wiersza",
"backlinkDatabaseFields": "Pola bazy danych",
diff --git a/app/appearance/langs/pt-BR.json b/app/appearance/langs/pt-BR.json
index 791a65bf7d..d3b4970a98 100644
--- a/app/appearance/langs/pt-BR.json
+++ b/app/appearance/langs/pt-BR.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "Clique ou pressione uma tecla para entrar",
"loadAllAndSelectAll": "Carregar o documento completo e selecionar tudo",
"autoFitRowHeight": "Ajustar automaticamente a altura da linha",
"backlinkDatabaseFields": "Campos do banco de dados",
diff --git a/app/appearance/langs/ru.json b/app/appearance/langs/ru.json
index fdc001aa2d..4344d74808 100644
--- a/app/appearance/langs/ru.json
+++ b/app/appearance/langs/ru.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "Нажмите на экран или клавишу для входа",
"loadAllAndSelectAll": "Загрузить весь документ и выделить всё",
"autoFitRowHeight": "Автоподбор высоты строки",
"backlinkDatabaseFields": "Поля базы данных",
diff --git a/app/appearance/langs/sk.json b/app/appearance/langs/sk.json
index e138c5ada7..e6d1049a9e 100644
--- a/app/appearance/langs/sk.json
+++ b/app/appearance/langs/sk.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "Prihláste sa kliknutím alebo stlačením klávesu",
"loadAllAndSelectAll": "Načítať celý dokument a vybrať všetko",
"autoFitRowHeight": "Automaticky prispôsobiť výšku riadka",
"backlinkDatabaseFields": "Polia databázy",
diff --git a/app/appearance/langs/sr.json b/app/appearance/langs/sr.json
index 0c3758012a..2becb9b217 100644
--- a/app/appearance/langs/sr.json
+++ b/app/appearance/langs/sr.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "Кликните или притисните тастер за пријављивање",
"loadAllAndSelectAll": "Учитај цео документ и изабери све",
"autoFitRowHeight": "Аутоматски прилагоди висину реда",
"backlinkDatabaseFields": "Поља базе података",
diff --git a/app/appearance/langs/th.json b/app/appearance/langs/th.json
index ee64b6f3b3..09803a70bd 100644
--- a/app/appearance/langs/th.json
+++ b/app/appearance/langs/th.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "คลิกหรือกดปุ่มเพื่อเข้าสู่ระบบ",
"loadAllAndSelectAll": "โหลดเอกสารทั้งหมดและเลือกทั้งหมด",
"autoFitRowHeight": "ปรับความสูงของแถวโดยอัตโนมัติ",
"backlinkDatabaseFields": "ฟิลด์ฐานข้อมูล",
diff --git a/app/appearance/langs/tr.json b/app/appearance/langs/tr.json
index 0783a695df..82c128b677 100644
--- a/app/appearance/langs/tr.json
+++ b/app/appearance/langs/tr.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "Giriş yapmak için tıklayın veya bir tuşa basın",
"loadAllAndSelectAll": "Belgenin tamamını yükle ve tümünü seç",
"autoFitRowHeight": "Satır yüksekliğini otomatik sığdır",
"backlinkDatabaseFields": "Veritabanı alanları",
diff --git a/app/appearance/langs/uk.json b/app/appearance/langs/uk.json
index 821e6d0d82..850049d963 100644
--- a/app/appearance/langs/uk.json
+++ b/app/appearance/langs/uk.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "Натисніть на екран або клавішу для входу",
"loadAllAndSelectAll": "Завантажити весь документ і виділити все",
"autoFitRowHeight": "Автоматично підібрати висоту рядка",
"backlinkDatabaseFields": "Поля бази даних",
diff --git a/app/appearance/langs/zh-CN.json b/app/appearance/langs/zh-CN.json
index 7eff886a3f..1da9b7d66e 100644
--- a/app/appearance/langs/zh-CN.json
+++ b/app/appearance/langs/zh-CN.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "点击屏幕或按键以登录",
"loadAllAndSelectAll": "加载全文并全选",
"autoFitRowHeight": "自适应行高",
"backlinkDatabaseFields": "数据库字段",
diff --git a/app/appearance/langs/zh-TW.json b/app/appearance/langs/zh-TW.json
index b55635c0f3..86f95d2d9e 100644
--- a/app/appearance/langs/zh-TW.json
+++ b/app/appearance/langs/zh-TW.json
@@ -1,4 +1,5 @@
{
+ "lockScreenReveal": "點擊畫面或按鍵以登入",
"loadAllAndSelectAll": "載入全文並全選",
"autoFitRowHeight": "自動調整列高",
"backlinkDatabaseFields": "資料庫欄位",
diff --git a/app/electron/remote-auth.html b/app/electron/remote-auth.html
index f22af1f1ed..545d92cdeb 100644
--- a/app/electron/remote-auth.html
+++ b/app/electron/remote-auth.html
@@ -78,7 +78,7 @@
overflow: auto;
overflow-wrap: anywhere;
padding: 16px 24px;
- width: 328px;
+ width: 480px;
}
@media (prefers-color-scheme: dark) {
@@ -138,10 +138,72 @@
font-size: 12px;
min-height: 18px;
}
+
+ #lockScreenCover {
+ align-items: flex-start;
+ background: transparent;
+ border: 0;
+ box-sizing: border-box;
+ color: #fff;
+ cursor: pointer;
+ display: flex;
+ flex-direction: column;
+ font: inherit;
+ height: calc(100% - 32px);
+ justify-content: flex-end;
+ left: 0;
+ margin: 0;
+ padding: 24px clamp(24px, 6vw, 96px) max(40px, 12vh);
+ position: fixed;
+ text-align: left;
+ text-shadow: 0 2px 8px #000, 0 0 24px #000;
+ top: 32px;
+ width: 100%;
+ z-index: 2;
+ }
+
+ #lockScreenCover[hidden] {
+ display: none;
+ }
+
+ #lockScreenCover:focus-visible {
+ outline: 2px solid #fff;
+ outline-offset: -8px;
+ }
+
+ #lockScreenTime {
+ font-size: clamp(48px, 9vw, 112px);
+ font-variant-numeric: tabular-nums;
+ line-height: 1.15;
+ }
+
+ #lockScreenDate {
+ font-size: clamp(18px, 2.5vw, 28px);
+ margin-top: 8px;
+ }
+
+ #lockScreenHint {
+ font-size: 14px;
+ margin-top: 24px;
+ }
+
+ body.wallpaper-cover main {
+ visibility: hidden;
+ }
+
+ body.has-wallpaper h1 {
+ margin: 0 0 12px;
+ font-size: 24px;
+ }
</style>
</head>
<body>
<img id="lockScreenWallpaper" alt="" hidden>
+<button id="lockScreenCover" type="button" aria-labelledby="lockScreenHint" hidden>
+ <time id="lockScreenTime" aria-live="off"></time>
+ <span id="lockScreenDate"></span>
+ <span id="lockScreenHint"></span>
+</button>
<div id="windowBar"><button id="closeWindow" type="button">×</button></div>
<main hidden>
<h1 id="title">SiYuan</h1>
@@ -161,21 +223,110 @@
<script>
const loadLockScreenWallpaper = () => {
const wallpaper = document.getElementById("lockScreenWallpaper");
+ const cover = document.getElementById("lockScreenCover");
+ const panel = document.getElementById("authPanel") || document.querySelector("main");
+ let pending = true;
+ let interacted = false;
+ let clockTimer;
+ const focusInput = () => {
+ const input = document.getElementById("authCode");
+ const target = input && !input.disabled && input.getClientRects().length ? input :
+ Array.from(panel.querySelectorAll("button:not(:disabled), a[href]")).find(item => item.getClientRects().length);
+ target?.focus({preventScroll: true});
+ return target;
+ };
+ const stopClock = () => {
+ clearInterval(clockTimer);
+ clockTimer = undefined;
+ };
+ const updateClock = () => {
+ const now = new Date();
+ const time = document.getElementById("lockScreenTime");
+ time.textContent = now.toLocaleTimeString(undefined, {hour: "2-digit", minute: "2-digit"});
+ time.dateTime = now.toISOString();
+ document.getElementById("lockScreenDate").textContent = now.toLocaleDateString(undefined,
+ {weekday: "long", month: "long", day: "numeric"});
+ };
+ const refreshClock = () => {
+ stopClock();
+ if (!cover.hidden && !document.hidden) {
+ updateClock();
+ clockTimer = setInterval(updateClock, 1000);
+ }
+ };
+ const reveal = () => {
+ interacted = true;
+ if (cover.hidden) return pending ? focusInput() : undefined;
+ cover.hidden = true;
+ panel.inert = false;
+ document.body.classList.remove("wallpaper-cover");
+ stopClock();
+ return focusInput();
+ };
+ cover.addEventListener("click", reveal);
+ document.addEventListener("pointerdown", event => {
+ if (event.target.closest("#windowBar, [data-auth-drag]")) return;
+ if (!cover.hidden) event.preventDefault();
+ reveal();
+ }, true);
+ document.addEventListener("keydown", event => {
+ if ((event.ctrlKey || event.metaKey) && !event.altKey && event.key.toLowerCase() === "v") {
+ reveal();
+ return;
+ }
+ const altGraph = event.getModifierState?.("AltGraph");
+ if ((event.ctrlKey || event.metaKey || event.altKey) && !altGraph) return;
+ const covered = !cover.hidden;
+ const target = reveal();
+ if (!covered || event.isComposing || event.key === "Process" || event.key === "Dead") return;
+ // 唤起按键不触发登录;可直接输入的首字符只写入密码框一次。
+ if (target?.type === "password" && Array.from(event.key).length === 1 && event.key !== " ") {
+ target.setRangeText(event.key, target.selectionStart, target.selectionEnd, "end");
+ target.dispatchEvent(new Event("input", {bubbles: true}));
+ }
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ }, true);
+ document.addEventListener("compositionstart", reveal, true);
+ document.addEventListener("visibilitychange", refreshClock);
+ window.addEventListener("pagehide", stopClock);
+ window.addEventListener("pageshow", refreshClock);
wallpaper.onload = () => {
+ pending = false;
wallpaper.hidden = false;
document.body.classList.add("has-wallpaper");
const background = document.getElementById("authDefaultBackground");
if (background) background.hidden = true;
+ // 慢加载不打断已经开始的输入,也不遮住密码管理器填入的内容。
+ if (!interacted && !document.getElementById("authCode")?.value) {
+ cover.hidden = false;
+ panel.inert = true;
+ document.body.classList.add("wallpaper-cover");
+ refreshClock();
+ cover.focus({preventScroll: true});
+ } else if (!interacted) {
+ focusInput();
+ }
};
wallpaper.onerror = () => {
+ pending = false;
+ const covered = !cover.hidden;
+ const shouldFocus = !interacted;
+ reveal();
wallpaper.hidden = true;
document.body.classList.remove("has-wallpaper");
const background = document.getElementById("authDefaultBackground");
if (background) background.hidden = false;
+ if (!covered && shouldFocus) focusInput();
};
wallpaper.src = "/api/system/getLockScreenWallpaper";
+ return {focus: () => {
+ if (pending) return;
+ if (cover.hidden) focusInput();
+ else cover.focus({preventScroll: true});
+ }};
};
- loadLockScreenWallpaper();
+ const lockScreenWallpaperState = loadLockScreenWallpaper();
(() => {
const params = new URLSearchParams(window.location.search);
@@ -298,8 +449,9 @@
captchaElement.placeholder = languages._kernel["175"];
document.getElementById("rememberLabel").textContent = languages._kernel["257"];
submitElement.textContent = languages._kernel["174"];
+ document.getElementById("lockScreenHint").textContent = languages.lockScreenReveal;
document.querySelector("main").hidden = false;
- authCodeElement.focus();
+ lockScreenWallpaperState.focus();
});
})();
</script>
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20201004194026-s8h2cog.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20201004194026-s8h2cog.sy
index 0ad38ab01e..bcd6251656 100644
--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20201004194026-s8h2cog.sy
+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20201004194026-s8h2cog.sy
@@ -6,7 +6,7 @@
"id": "20201004194026-s8h2cog",
"title": "Use on browser",
"type": "doc",
- "updated": "20261022093855"
+ "updated": "20261022203227"
},
"Children": [
{
@@ -352,7 +352,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261022093855-9vgq1sq",
- "updated": "20261022093855"
+ "updated": "20261022203227"
},
"Children": [
{
@@ -393,7 +393,7 @@
},
{
"Type": "NodeText",
- "Data": ", upload one JPEG, PNG or WebP image (up to 10 MiB and 16 megapixels) to customize the authentication page shown at startup and after locking. Uploading another image replaces it; click Reset to restore the default background."
+ "Data": ", upload one JPEG, PNG or WebP image (up to 10 MiB and 16 megapixels) to customize the authentication page shown at startup and after locking. Uploading another image replaces it; click Reset to restore the default background. With a custom wallpaper, the authentication page first shows the wallpaper and local time. Click, tap, or press a key to reveal the login panel; typing your password also keeps the first character. Without a wallpaper, or if the image fails to load, the usual login page appears directly."
}
]
},
diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20201004184819-nj8ibyg.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20201004184819-nj8ibyg.sy
index 763ad412c7..8cab234f63 100644
--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20201004184819-nj8ibyg.sy
+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20201004184819-nj8ibyg.sy
@@ -6,7 +6,7 @@
"id": "20201004184819-nj8ibyg",
"title": "在浏览器上使用",
"type": "doc",
- "updated": "20261022093855"
+ "updated": "20261022203227"
},
"Children": [
{
@@ -352,7 +352,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261022093855-t2z1xoy",
- "updated": "20261022093855"
+ "updated": "20261022203227"
},
"Children": [
{
@@ -393,7 +393,7 @@
},
{
"Type": "NodeText",
- "Data": " 中上传一张 JPEG、PNG 或 WebP 图片(最大 10 MiB、1600 万像素),即可自定义启动和锁屏后的认证页背景。上传新图片会替换旧图片,点击“重置”恢复默认背景。"
+ "Data": " 中上传一张 JPEG、PNG 或 WebP 图片(最大 10 MiB、1600 万像素),即可自定义启动和锁屏后的认证页背景。上传新图片会替换旧图片,点击“重置”恢复默认背景。使用自定义壁纸时,认证页先显示壁纸和本机时间;点击、触摸屏幕或按键后显示登录面板。直接键入密码时,首个字符也会进入密码框。未设置壁纸或图片加载失败时,直接显示原有登录界面。"
}
]
},
diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122523-rl8356a.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122523-rl8356a.sy
index 39050331bd..7644275fb2 100644
--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122523-rl8356a.sy
+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122523-rl8356a.sy
@@ -6,7 +6,7 @@
"id": "20211226122523-rl8356a",
"title": "在瀏覽器上使用",
"type": "doc",
- "updated": "20261022093855"
+ "updated": "20261022203227"
},
"Children": [
{
@@ -337,7 +337,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261022093855-oc11gow",
- "updated": "20261022093855"
+ "updated": "20261022203227"
},
"Children": [
{
@@ -378,7 +378,7 @@
},
{
"Type": "NodeText",
- "Data": " 中上傳一張 JPEG、PNG 或 WebP 圖片(最大 10 MiB、1600 萬像素),即可自訂啟動及鎖定後的驗證頁面背景。上傳新圖片會取代舊圖片,點擊「重置」恢復預設背景。"
+ "Data": " 中上傳一張 JPEG、PNG 或 WebP 圖片(最大 10 MiB、1600 萬像素),即可自訂啟動及鎖定後的驗證頁面背景。上傳新圖片會取代舊圖片,點擊「重置」恢復預設背景。使用自訂桌布時,驗證頁面先顯示桌布與本機時間;點擊、觸控畫面或按鍵後顯示登入面板。直接輸入密碼時,第一個字元也會進入密碼欄位。未設定桌布或圖片載入失敗時,直接顯示原有登入介面。"
}
]
},
diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-40hohog.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-40hohog.sy
index bf3e4f0092..761e44d2c4 100644
--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-40hohog.sy
+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-40hohog.sy
@@ -7,7 +7,7 @@
"id": "20240530101000-40hohog",
"title": "ブラウザ",
"type": "doc",
- "updated": "20261022093855"
+ "updated": "20261022203227"
},
"Children": [
{
@@ -369,7 +369,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261022093855-2gm31el",
- "updated": "20261022093855"
+ "updated": "20261022203227"
},
"Children": [
{
@@ -406,7 +406,7 @@
},
{
"Type": "NodeText",
- "Data": " で JPEG、PNG、WebP の画像を1枚アップロードすると(最大 10 MiB、1600万画素)、起動時やロック後の認証画面の背景を変更できます。新しい画像をアップロードすると置き換わります。「リセット」で既定の背景に戻せます。"
+ "Data": " で JPEG、PNG、WebP の画像を1枚アップロードすると(最大 10 MiB、1600万画素)、起動時やロック後の認証画面の背景を変更できます。新しい画像をアップロードすると置き換わります。「リセット」で既定の背景に戻せます。カスタム壁紙を設定すると、認証ページに壁紙と端末の時刻が先に表示されます。クリック、タップ、キー操作でログインパネルを表示します。パスワードを直接入力すると、最初の文字も入力欄に入ります。壁紙が未設定の場合や画像の読み込みに失敗した場合は、通常のログイン画面を直接表示します。"
}
]
},
diff --git a/app/stage/auth.html b/app/stage/auth.html
index ab6dffdad6..3e73e7a0ed 100644
--- a/app/stage/auth.html
+++ b/app/stage/auth.html
@@ -218,15 +218,90 @@
max-width: calc(100% - 32px);
overflow: auto;
overflow-wrap: anywhere;
- padding: 16px 24px;
+ padding: 24px;
+ width: 480px;
+ }
+
+ #lockScreenCover {
+ align-items: flex-start;
+ background: transparent;
+ border: 0;
+ box-sizing: border-box;
+ color: #fff;
+ cursor: pointer;
+ display: flex;
+ flex-direction: column;
+ font: inherit;
+ height: calc(100% - 32px);
+ justify-content: flex-end;
+ left: 0;
+ margin: 0;
+ padding: 24px clamp(24px, 6vw, 96px) max(40px, 12vh);
+ position: fixed;
+ text-align: left;
+ text-shadow: 0 2px 8px #000, 0 0 24px #000;
+ top: 32px;
+ width: 100%;
+ z-index: 2;
+ }
+
+ #lockScreenCover[hidden] {
+ display: none;
+ }
+
+ #lockScreenCover:focus-visible {
+ outline: 2px solid #fff;
+ outline-offset: -8px;
+ }
+
+ #lockScreenTime {
+ font-size: clamp(48px, 9vw, 112px);
+ font-variant-numeric: tabular-nums;
+ line-height: 1.15;
+ }
+
+ #lockScreenDate {
+ font-size: clamp(18px, 2.5vw, 28px);
+ margin-top: 8px;
+ }
+
+ #lockScreenHint {
+ font-size: 14px;
+ margin-top: 24px;
+ }
+
+ #authPanel h1 {
+ margin-bottom: 48px;
+ }
+
+ body.wallpaper-cover #authPanel {
+ visibility: hidden;
+ }
+
+ body.has-wallpaper #authPanel h1 {
+ font-size: 24px;
+ margin: 0 0 16px;
+ }
+
+ body.has-wallpaper .auth-actions > .b3-button {
+ margin-top: 8px;
+ }
+
+ body.has-wallpaper #authPanel .ft__on-surface {
+ margin: 8px 0 0;
}
</style>
</head>
<body>
<img id="lockScreenWallpaper" alt="" hidden>
-<div style="-webkit-app-region: drag;height: 32px;width: 100%;position: absolute;top: 0;z-index: 3;"></div>
+<button id="lockScreenCover" type="button" aria-labelledby="lockScreenHint" hidden>
+ <time id="lockScreenTime" aria-live="off"></time>
+ <span id="lockScreenDate"></span>
+ <span id="lockScreenHint">{{.lockScreenReveal}}</span>
+</button>
+<div data-auth-drag style="-webkit-app-region: drag;height: 32px;width: 100%;position: absolute;top: 0;z-index: 3;"></div>
<div id="authPanel" style="position: relative;z-index: 2;text-align: center">
- <h1 style="margin-bottom: 48px;color:var(--b3-theme-on-background)">{{.workspace}}</h1>
+ <h1 style="color:var(--b3-theme-on-background)">{{.workspace}}</h1>
<div id="authCodePanel"{{if not .accessAuthCodeEnabled}} style="display: none"{{end}}>
<input class="b3-text-field" id="authCode" type="password" placeholder="{{.l0}}"/><br>
<div style="position: relative;width: 240px;margin: 8px auto 0;display: none">
@@ -467,21 +542,110 @@
<script>
const loadLockScreenWallpaper = () => {
const wallpaper = document.getElementById("lockScreenWallpaper");
+ const cover = document.getElementById("lockScreenCover");
+ const panel = document.getElementById("authPanel") || document.querySelector("main");
+ let pending = true;
+ let interacted = false;
+ let clockTimer;
+ const focusInput = () => {
+ const input = document.getElementById("authCode");
+ const target = input && !input.disabled && input.getClientRects().length ? input :
+ Array.from(panel.querySelectorAll("button:not(:disabled), a[href]")).find(item => item.getClientRects().length);
+ target?.focus({preventScroll: true});
+ return target;
+ };
+ const stopClock = () => {
+ clearInterval(clockTimer);
+ clockTimer = undefined;
+ };
+ const updateClock = () => {
+ const now = new Date();
+ const time = document.getElementById("lockScreenTime");
+ time.textContent = now.toLocaleTimeString(undefined, {hour: "2-digit", minute: "2-digit"});
+ time.dateTime = now.toISOString();
+ document.getElementById("lockScreenDate").textContent = now.toLocaleDateString(undefined,
+ {weekday: "long", month: "long", day: "numeric"});
+ };
+ const refreshClock = () => {
+ stopClock();
+ if (!cover.hidden && !document.hidden) {
+ updateClock();
+ clockTimer = setInterval(updateClock, 1000);
+ }
+ };
+ const reveal = () => {
+ interacted = true;
+ if (cover.hidden) return pending ? focusInput() : undefined;
+ cover.hidden = true;
+ panel.inert = false;
+ document.body.classList.remove("wallpaper-cover");
+ stopClock();
+ return focusInput();
+ };
+ cover.addEventListener("click", reveal);
+ document.addEventListener("pointerdown", event => {
+ if (event.target.closest("#windowBar, [data-auth-drag]")) return;
+ if (!cover.hidden) event.preventDefault();
+ reveal();
+ }, true);
+ document.addEventListener("keydown", event => {
+ if ((event.ctrlKey || event.metaKey) && !event.altKey && event.key.toLowerCase() === "v") {
+ reveal();
+ return;
+ }
+ const altGraph = event.getModifierState?.("AltGraph");
+ if ((event.ctrlKey || event.metaKey || event.altKey) && !altGraph) return;
+ const covered = !cover.hidden;
+ const target = reveal();
+ if (!covered || event.isComposing || event.key === "Process" || event.key === "Dead") return;
+ // 唤起按键不触发登录;可直接输入的首字符只写入密码框一次。
+ if (target?.type === "password" && Array.from(event.key).length === 1 && event.key !== " ") {
+ target.setRangeText(event.key, target.selectionStart, target.selectionEnd, "end");
+ target.dispatchEvent(new Event("input", {bubbles: true}));
+ }
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ }, true);
+ document.addEventListener("compositionstart", reveal, true);
+ document.addEventListener("visibilitychange", refreshClock);
+ window.addEventListener("pagehide", stopClock);
+ window.addEventListener("pageshow", refreshClock);
wallpaper.onload = () => {
+ pending = false;
wallpaper.hidden = false;
document.body.classList.add("has-wallpaper");
const background = document.getElementById("authDefaultBackground");
if (background) background.hidden = true;
+ // 慢加载不打断已经开始的输入,也不遮住密码管理器填入的内容。
+ if (!interacted && !document.getElementById("authCode")?.value) {
+ cover.hidden = false;
+ panel.inert = true;
+ document.body.classList.add("wallpaper-cover");
+ refreshClock();
+ cover.focus({preventScroll: true});
+ } else if (!interacted) {
+ focusInput();
+ }
};
wallpaper.onerror = () => {
+ pending = false;
+ const covered = !cover.hidden;
+ const shouldFocus = !interacted;
+ reveal();
wallpaper.hidden = true;
document.body.classList.remove("has-wallpaper");
const background = document.getElementById("authDefaultBackground");
if (background) background.hidden = false;
+ if (!covered && shouldFocus) focusInput();
};
wallpaper.src = "/api/system/getLockScreenWallpaper";
+ return {focus: () => {
+ if (pending) return;
+ if (cover.hidden) focusInput();
+ else cover.focus({preventScroll: true});
+ }};
};
- loadLockScreenWallpaper();
+ const lockScreenWallpaperState = loadLockScreenWallpaper();
window.showKeyboardToolbar = function () {}
window.hideKeyboardToolbar = function () {}
@@ -767,9 +931,9 @@
const inputElement = document.getElementById('authCode')
const captchaElement = document.getElementById('captcha')
- inputElement.focus()
+ lockScreenWallpaperState.focus();
inputElement.addEventListener('keydown', (event) => {
- if (event.key === 'Enter') {
+ if (event.key === 'Enter' && !event.isComposing) {
submitAuth()
}
})
diff --git a/app/tests/lockScreenWallpaper.test.js b/app/tests/lockScreenWallpaper.test.js
index 5497816572..7fc485554f 100644
--- a/app/tests/lockScreenWallpaper.test.js
+++ b/app/tests/lockScreenWallpaper.test.js
@@ -3,30 +3,197 @@ const {readFileSync} = require("node:fs");
const {test} = require("node:test");
const {runInNewContext} = require("node:vm");
-for (const file of ["stage/auth.html", "electron/remote-auth.html"]) {
- test(`${file} loads the public wallpaper and restores the original background on failure`, () => {
- const source = readFileSync(file, "utf8");
- const loader = /const loadLockScreenWallpaper = \(\) => \{[\s\S]*?\n {4}\};/.exec(source);
- assert.ok(loader);
- assert.ok(source.includes('<img id="lockScreenWallpaper" alt="" hidden>'));
- const classes = new Set();
- const wallpaper = {hidden: true, src: "", onload: null, onerror: null};
- const background = file.startsWith("stage") ? {hidden: false} : null;
- runInNewContext(loader[0] + "\nloadLockScreenWallpaper();", {
- document: {
- body: {classList: {add: value => classes.add(value), remove: value => classes.delete(value)}},
- getElementById: id => id === "lockScreenWallpaper" ? wallpaper : background,
- },
- });
- assert.equal(wallpaper.src, "/api/system/getLockScreenWallpaper");
- assert.equal(wallpaper.hidden, true);
- wallpaper.onload();
- assert.equal(wallpaper.hidden, false);
- assert.ok(classes.has("has-wallpaper"));
- if (background) assert.equal(background.hidden, true);
- wallpaper.onerror();
- assert.equal(wallpaper.hidden, true);
- assert.equal(classes.has("has-wallpaper"), false);
- if (background) assert.equal(background.hidden, false);
+const sources = ["stage/auth.html", "electron/remote-auth.html"].map(file => ({file,
+ source: readFileSync(file, "utf8"),
+}));
+const loader = source => /const loadLockScreenWallpaper = \(\) => \{[\s\S]*?\n {4}\};/.exec(source)[0];
+
+const fixture = (source, passwordVisible = true) => {
+ const classes = new Set();
+ const listeners = new Map();
+ const windowListeners = new Map();
+ const timers = new Map();
+ let timerID = 0;
+ let focused;
+ let now = Date.UTC(2026, 9, 22, 12, 59);
+ const input = {type: "password", value: "", selectionStart: 0, selectionEnd: 0,
+ getClientRects: () => passwordVisible ? [{}] : [],
+ focus: () => { focused = "password"; },
+ setRangeText: text => { input.value += text; }, dispatchEvent: () => {},
+ };
+ const oidc = {getClientRects: () => [{}], focus: () => { focused = "oidc"; }};
+ const panel = {inert: false, querySelectorAll: () => [oidc]};
+ const cover = {hidden: true, focus: () => { focused = "cover"; },
+ addEventListener: (type, callback) => listeners.set("cover:" + type, callback)};
+ const wallpaper = {hidden: true};
+ const background = {hidden: false};
+ const time = {textContent: ""};
+ const date = {textContent: ""};
+ const elements = {lockScreenWallpaper: wallpaper, lockScreenCover: cover, authPanel: panel,
+ authCode: input, authDefaultBackground: background, lockScreenTime: time, lockScreenDate: date};
+ const document = {
+ hidden: false,
+ body: {classList: {add: key => classes.add(key), remove: key => classes.delete(key)}},
+ getElementById: id => elements[id],
+ addEventListener: (type, callback) => listeners.set(type, callback),
+ };
+ class Clock extends Date {
+ constructor() { super(now); }
+ }
+ const context = {document, Date: Clock, Event: class {},
+ window: {addEventListener: (type, callback) => windowListeners.set(type, callback)},
+ clearInterval: id => timers.delete(id),
+ setInterval: callback => { timers.set(++timerID, callback); return timerID; },
+ };
+ runInNewContext(loader(source) + "\nthis.controller = loadLockScreenWallpaper();", context);
+ const key = (key, extra = {}) => {
+ const event = {key, prevented: false, stopped: false,
+ preventDefault() { this.prevented = true; }, stopImmediatePropagation() { this.stopped = true; }, ...extra};
+ listeners.get("keydown")(event);
+ return event;
+ };
+ return {classes, listeners, windowListeners, timers, document, input, panel, cover, wallpaper, background, time, date,
+ controller: context.controller, key, focused: () => focused, advance: () => { now += 60_000; }};
+};
+
+test("both authentication pages share the wallpaper interaction and clock implementation", () => {
+ assert.equal(loader(sources[0].source), loader(sources[1].source));
+});
+
+test("the password Enter handler waits for IME composition to finish", () => {
+ const handler = /inputElement.addEventListener\('keydown', \(event\) => \{[\s\S]*?\n {8}\}\)/.exec(sources[0].source);
+ assert.ok(handler);
+ let keydown;
+ let submits = 0;
+ runInNewContext(handler[0], {inputElement: {addEventListener: (_type, callback) => { keydown = callback; }},
+ submitAuth: () => submits++});
+ keydown({key: "Enter", isComposing: true});
+ assert.equal(submits, 0);
+ keydown({key: "Enter", isComposing: false});
+ assert.equal(submits, 1);
+});
+
+for (const {file, source} of sources) {
+ test(`${file} shows a clock cover and keeps the first typed password character`, () => {
+ const f = fixture(source);
+ f.controller.focus();
+ assert.equal(f.focused(), undefined);
+ assert.equal(f.wallpaper.src, "/api/system/getLockScreenWallpaper");
+ f.wallpaper.onload();
+ assert.equal(f.cover.hidden, false);
+ assert.equal(f.panel.inert, true);
+ assert.ok(f.classes.has("wallpaper-cover"));
+ assert.ok(f.classes.has("has-wallpaper"));
+ assert.ok(f.time.textContent && f.date.textContent);
+ const event = f.key("A");
+ assert.ok(event.prevented && event.stopped);
+ assert.equal(f.input.value, "A");
+ assert.equal(f.focused(), "password");
+ assert.equal(f.cover.hidden, true);
+ assert.equal(f.panel.inert, false);
+ assert.equal(f.timers.size, 0);
+ assert.equal(f.key("b").prevented, false);
+ assert.equal(f.input.value, "A", "subsequent input is left to the browser");
+ });
+
+ test(`${file} wakes with click, touch, Enter, Space and Tab without submitting`, () => {
+ for (const key of ["Enter", " ", "Tab"]) {
+ const f = fixture(source);
+ f.wallpaper.onload();
+ const event = f.key(key);
+ assert.ok(event.prevented && event.stopped);
+ assert.equal(f.cover.hidden, true);
+ assert.equal(f.input.value, "");
+ }
+ for (const pointerType of ["mouse", "touch"]) {
+ const f = fixture(source);
+ f.wallpaper.onload();
+ let prevented = false;
+ f.listeners.get("pointerdown")({pointerType, target: {closest: () => false},
+ preventDefault: () => { prevented = true; }});
+ assert.equal(prevented, true, "native pointer focus must not override the password focus");
+ assert.equal(f.cover.hidden, true);
+ assert.equal(f.focused(), "password");
+ }
+ const f = fixture(source);
+ f.wallpaper.onload();
+ f.listeners.get("cover:click")();
+ assert.equal(f.cover.hidden, true);
+ });
+
+ test(`${file} respects window controls, shortcuts, IME and OIDC-only sign-in`, () => {
+ const f = fixture(source);
+ f.wallpaper.onload();
+ f.listeners.get("pointerdown")({target: {closest: () => true}});
+ assert.equal(f.cover.hidden, false);
+ assert.equal(f.key("w", {ctrlKey: true}).prevented, false);
+ assert.equal(f.cover.hidden, false);
+ assert.equal(f.key("Process", {isComposing: true}).prevented, false);
+ assert.equal(f.cover.hidden, true);
+ assert.equal(f.input.value, "");
+ const paste = fixture(source);
+ paste.wallpaper.onload();
+ assert.equal(paste.key("v", {ctrlKey: true}).prevented, false);
+ assert.equal(paste.cover.hidden, true);
+ assert.equal(paste.focused(), "password");
+ assert.equal(paste.input.value, "");
+ const oidc = fixture(source, false);
+ oidc.wallpaper.onload();
+ oidc.key("Enter");
+ assert.equal(oidc.focused(), "oidc");
+ assert.equal(oidc.input.value, "");
+ });
+
+ test(`${file} never covers input that started before the wallpaper arrived`, () => {
+ const f = fixture(source);
+ assert.equal(f.key("a").prevented, false);
+ assert.equal(f.focused(), "password", "typing during image loading already targets the password input");
+ f.input.value = "already typing";
+ f.wallpaper.onload();
+ assert.equal(f.cover.hidden, true);
+ assert.equal(f.panel.inert, false);
+ assert.equal(f.timers.size, 0);
+ const autofill = fixture(source);
+ autofill.input.value = "filled by password manager";
+ autofill.wallpaper.onload();
+ assert.equal(autofill.cover.hidden, true);
+ });
+
+ test(`${file} restores login after a missing or corrupt wallpaper`, () => {
+ for (const loaded of [false, true]) {
+ const f = fixture(source);
+ if (loaded) f.wallpaper.onload();
+ f.wallpaper.onerror();
+ assert.equal(f.cover.hidden, true);
+ assert.equal(f.panel.inert, false);
+ assert.equal(f.background.hidden, false);
+ assert.equal(f.wallpaper.hidden, true);
+ assert.equal(f.classes.has("wallpaper-cover"), false);
+ assert.equal(f.classes.has("has-wallpaper"), false);
+ assert.equal(f.focused(), "password");
+ assert.equal(f.timers.size, 0);
+ }
+ });
+
+ test(`${file} refreshes local time and suspends the clock outside the cover`, () => {
+ const f = fixture(source);
+ f.wallpaper.onload();
+ const before = f.time.textContent;
+ f.advance();
+ [...f.timers.values()][0]();
+ assert.notEqual(f.time.textContent, before);
+ f.document.hidden = true;
+ f.listeners.get("visibilitychange")();
+ assert.equal(f.timers.size, 0);
+ f.document.hidden = false;
+ f.listeners.get("visibilitychange")();
+ assert.equal(f.timers.size, 1);
+ f.windowListeners.get("pagehide")();
+ assert.equal(f.timers.size, 0);
+ f.windowListeners.get("pageshow")();
+ assert.equal(f.timers.size, 1);
+ f.key("Enter");
+ f.listeners.get("visibilitychange")();
+ assert.equal(f.timers.size, 0);
});
}
diff --git a/app/tests/lockScreenWallpaperLayout.test.js b/app/tests/lockScreenWallpaperLayout.test.js
index 5dcc2869d5..e32e754edd 100644
--- a/app/tests/lockScreenWallpaperLayout.test.js
+++ b/app/tests/lockScreenWallpaperLayout.test.js
@@ -71,6 +71,7 @@ const fixtureHTML = (file, dark) => {
.replace(/{{(?:if \.\w+|end)}}/g, "")
.replace(/{{\.workspace}}/g, "Workspace")
.replace(/{{\.l\d+}}/g, "Sign in")
+ .replace(/{{\.lockScreenReveal}}/g, "Click or press a key to sign in")
.replace("<main hidden>", "<main>");
if (dark) source = source.replace('<html style="height: 100%">', '<html class="dark" style="height: 100%">');
return source.replace("</body>", `<script>${loader}\nwindow.loadLockScreenWallpaper = loadLockScreenWallpaper;</script></body>`);
@@ -95,6 +96,22 @@ const checkLayout = async (wallpaperPresent, dark, remote) => {
check.equal(document.body.classList.contains("has-wallpaper"), wallpaperPresent);
check.equal(wallpaper.hidden, !wallpaperPresent);
const panel = document.querySelector(remote ? "main" : "#authPanel");
+ const cover = document.getElementById("lockScreenCover");
+ if (wallpaperPresent) {
+ check.equal(panel.inert, true);
+ check.equal(getComputedStyle(panel).visibility, "hidden");
+ check.equal(cover.hidden, false);
+ check.ok(document.getElementById("lockScreenTime").textContent);
+ check.ok(document.getElementById("lockScreenDate").textContent);
+ const clock = document.getElementById("lockScreenTime").getBoundingClientRect();
+ const hint = document.getElementById("lockScreenHint").getBoundingClientRect();
+ check.ok(clock.left >= 0 && hint.right <= innerWidth && hint.bottom <= innerHeight,
+ "clock and reveal hint fit narrow and short screens");
+ cover.click();
+ check.equal(panel.inert, false);
+ check.equal(cover.hidden, true);
+ check.equal(getComputedStyle(panel).visibility, "visible");
+ }
const rect = panel.getBoundingClientRect();
if (wallpaperPresent) {
check.ok(rect.left >= 0 && rect.right <= innerWidth, "login panel fits the viewport horizontally");
@@ -108,9 +125,34 @@ const checkLayout = async (wallpaperPresent, dark, remote) => {
const image = wallpaper.getBoundingClientRect();
check.equal(image.width, innerWidth);
check.equal(image.height, innerHeight);
+ if (innerWidth >= 640 && innerHeight >= 600) {
+ check.ok(rect.width > rect.height, "desktop login panel is wider than it is tall");
+ }
}
};
+const prepareKeyboardCase = async () => {
+ const wallpaper = document.getElementById("lockScreenWallpaper");
+ const canvas = document.createElement("canvas");
+ canvas.width = canvas.height = 1;
+ window.loadLockScreenWallpaper();
+ const loaded = new Promise(resolve => wallpaper.addEventListener("load", resolve, {once: true}));
+ wallpaper.src = canvas.toDataURL();
+ await loaded;
+ window.testSubmits = 0;
+ document.getElementById("authCode").addEventListener("keydown", event => {
+ if (event.key === "Enter") window.testSubmits++;
+ });
+};
+
+const assertKeyboardState = (value, submits) => {
+ const check = require("node:assert/strict");
+ check.equal(document.getElementById("lockScreenCover").hidden, true);
+ check.equal(document.getElementById("authCode").value, value);
+ check.equal(document.activeElement, document.getElementById("authCode"));
+ check.equal(window.testSubmits, submits);
+};
+
if (process.versions.electron && process.type === "browser") {
const {app, BrowserWindow, nativeTheme} = require("electron");
app.setPath("userData", process.argv[2]);
@@ -118,6 +160,9 @@ if (process.versions.electron && process.type === "browser") {
const win = new BrowserWindow({show: false, frame: false, webPreferences: {
nodeIntegration: true, contextIsolation: false, offscreen: true, backgroundThrottling: false,
}});
+ win.webContents.on("console-message", event => {
+ if (event.message.includes("AssertionError")) console.error(event.message);
+ });
try {
for (const file of ["stage/auth.html", "electron/remote-auth.html"]) {
for (const [width, height] of [[1200, 800], [320, 640], [640, 320], [320, 280]]) {
@@ -126,10 +171,40 @@ if (process.versions.electron && process.type === "browser") {
nativeTheme.themeSource = dark ? "dark" : "light";
for (const present of [false, true]) {
await win.loadURL("data:text/html;charset=utf-8," + encodeURIComponent(fixtureHTML(file, dark)));
- await win.webContents.executeJavaScript(`(${checkLayout.toString()})(${present}, ${dark}, ${file.startsWith("electron")})`);
+ await win.webContents.executeJavaScript(`(async () => {
+ try { await (${checkLayout.toString()})(${present}, ${dark}, ${file.startsWith("electron")}); }
+ catch (error) { console.error(error.stack); throw error; }
+ })()`);
}
}
}
+ win.setContentSize(1000, 700);
+ const start = async () => {
+ await win.loadURL("data:text/html;charset=utf-8," + encodeURIComponent(fixtureHTML(file, false)));
+ await win.webContents.executeJavaScript(`(${prepareKeyboardCase.toString()})()`);
+ };
+ await start();
+ for (const [type, keyCode] of [["keyDown", "A"], ["char", "a"], ["keyUp", "A"],
+ ["keyDown", "B"], ["char", "b"], ["keyUp", "B"]]) {
+ win.webContents.sendInputEvent({type, keyCode});
+ }
+ await win.webContents.executeJavaScript(`(${assertKeyboardState.toString()})("ab", 0)`);
+ await start();
+ win.webContents.sendInputEvent({type: "keyDown", keyCode: "Enter"});
+ win.webContents.sendInputEvent({type: "keyUp", keyCode: "Enter"});
+ await win.webContents.executeJavaScript(`(${assertKeyboardState.toString()})("", 0)`);
+ win.webContents.sendInputEvent({type: "keyDown", keyCode: "Enter"});
+ win.webContents.sendInputEvent({type: "keyUp", keyCode: "Enter"});
+ await win.webContents.executeJavaScript(`(${assertKeyboardState.toString()})("", 1)`);
+ await start();
+ win.webContents.sendInputEvent({type: "mouseDown", x: 40, y: 300, button: "left", clickCount: 1});
+ win.webContents.sendInputEvent({type: "mouseUp", x: 40, y: 300, button: "left", clickCount: 1});
+ await win.webContents.executeJavaScript(`(${assertKeyboardState.toString()})("", 0)`);
+ await start();
+ await win.webContents.executeJavaScript(`document.getElementById("lockScreenCover").dispatchEvent(
+ new KeyboardEvent("keydown", {key: "Process", isComposing: true, bubbles: true, cancelable: true}));`);
+ await win.webContents.insertText("\u4e2d");
+ await win.webContents.executeJavaScript(`(${assertKeyboardState.toString()})("\\u4e2d", 0)`);
}
const html = settingsHTML();
for (const name of ["base", "mobile"]) {
diff --git a/kernel/server/serve.go b/kernel/server/serve.go
index c7fd2dbbd5..696197ed0c 100644
--- a/kernel/server/serve.go
+++ b/kernel/server/serve.go
@@ -943,6 +943,7 @@ func serveAuthPage(c *gin.Context) {
"oidcEnabled": model.Conf.GetOIDC().Enabled,
"appearanceMode": confAppearanceSnapshot.Mode,
"appearanceModeOS": confAppearanceSnapshot.ModeOS,
+ "lockScreenReveal": util.I18nTerm(model.Conf.Lang, "lockScreenReveal"),
"workspace": util.WorkspaceName,
"keymapGeneralToggleWin": keymapHideWindow,
"trayMenuLangs": util.TrayMenuLangs[util.Lang],