mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
Merge pull request #1228 from TriliumNext/feat_friendly-numbers-protected_session_timeout
feat: friendly numbers protected session timeout
This commit is contained in:
commit
0c43b387ce
@ -14,7 +14,8 @@ import CodeAutoReadOnlySizeOptions from "./options/code_notes/code_auto_read_onl
|
||||
import CodeMimeTypesOptions from "./options/code_notes/code_mime_types.js";
|
||||
import ImageOptions from "./options/images/images.js";
|
||||
import SpellcheckOptions from "./options/spellcheck.js";
|
||||
import PasswordOptions from "./options/password.js";
|
||||
import PasswordOptions from "./options/password/password.js";
|
||||
import ProtectedSessionTimeoutOptions from "./options/password/protected_session_timeout.js"
|
||||
import EtapiOptions from "./options/etapi.js";
|
||||
import BackupOptions from "./options/backup.js";
|
||||
import SyncOptions from "./options/sync.js";
|
||||
@ -64,7 +65,7 @@ const CONTENT_WIDGETS: Record<string, (typeof NoteContextAwareWidget)[]> = {
|
||||
_optionsCodeNotes: [VimKeyBindingsOptions, WrapLinesOptions, CodeAutoReadOnlySizeOptions, CodeMimeTypesOptions],
|
||||
_optionsImages: [ImageOptions],
|
||||
_optionsSpellcheck: [SpellcheckOptions],
|
||||
_optionsPassword: [PasswordOptions],
|
||||
_optionsPassword: [PasswordOptions, ProtectedSessionTimeoutOptions],
|
||||
_optionsEtapi: [EtapiOptions],
|
||||
_optionsBackup: [BackupOptions],
|
||||
_optionsSync: [SyncOptions],
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { t } from "../../../services/i18n.js";
|
||||
import server from "../../../services/server.js";
|
||||
import protectedSessionHolder from "../../../services/protected_session_holder.js";
|
||||
import toastService from "../../../services/toast.js";
|
||||
import OptionsWidget from "./options_widget.js";
|
||||
import type { OptionMap } from "../../../../../services/options_interface.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import server from "../../../../services/server.js";
|
||||
import protectedSessionHolder from "../../../../services/protected_session_holder.js";
|
||||
import toastService from "../../../../services/toast.js";
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
@ -32,17 +32,7 @@ const TPL = `
|
||||
<button class="save-password-button btn btn-primary">${t("password.change_password")}</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="options-section">
|
||||
<h4>${t("password.protected_session_timeout")}</h4>
|
||||
|
||||
<p>${t("password.protected_session_timeout_description")} <a class="tn-link" href="https://triliumnext.github.io/Docs/Wiki/protected-notes.html" class="external">${t("password.wiki")}</a> ${t("password.for_more_info")}</p>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="protected-session-timeout-in-seconds">${t("password.protected_session_timeout_label")}</label>
|
||||
<input id="protected-session-timeout-in-seconds" class="protected-session-timeout-in-seconds form-control options-number-input" type="number" min="60">
|
||||
</div>
|
||||
</div>`;
|
||||
`;
|
||||
|
||||
// TODO: Deduplicate
|
||||
interface ChangePasswordResponse {
|
@ -0,0 +1,30 @@
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import TimeSelector from "../time_selector.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>${t("password.protected_session_timeout")}</h4>
|
||||
|
||||
<p>${t("password.protected_session_timeout_description")} <a class="tn-link" href="https://triliumnext.github.io/Docs/Wiki/protected-notes.html" class="external">${t("password.wiki")}</a> ${t("password.for_more_info")}</p>
|
||||
<div id="time-selector-placeholder"></div>
|
||||
</div>`;
|
||||
|
||||
export default class ProtectedSessionTimeoutOptions extends TimeSelector {
|
||||
constructor() {
|
||||
super({
|
||||
widgetId: "protected-session-timeout",
|
||||
widgetLabelId: "password.protected_session_timeout_label",
|
||||
optionValueId: "protectedSessionTimeout",
|
||||
optionTimeScaleId: "protectedSessionTimeoutTimeScale",
|
||||
minimumSeconds: 60
|
||||
});
|
||||
super.doRender();
|
||||
}
|
||||
|
||||
doRender() {
|
||||
const $timeSelector = this.$widget;
|
||||
// inject TimeSelector widget template
|
||||
this.$widget = $(TPL);
|
||||
this.$widget.find("#time-selector-placeholder").replaceWith($timeSelector)
|
||||
}
|
||||
}
|
@ -1259,7 +1259,7 @@
|
||||
"protected_session_timeout_description": "保护会话超时是一个时间段,超时后保护会话会从浏览器内存中清除。这是从最后一次与保护笔记的交互开始计时的。更多信息请见",
|
||||
"wiki": "维基",
|
||||
"for_more_info": "更多信息。",
|
||||
"protected_session_timeout_label": "保护会话超时(秒)",
|
||||
"protected_session_timeout_label": "",
|
||||
"reset_confirmation": "重置密码将永久丧失对所有现受保护笔记的访问。您真的要重置密码吗?",
|
||||
"reset_success_message": "密码已重置。请设置新密码",
|
||||
"change_password_heading": "更改密码",
|
||||
|
@ -1286,7 +1286,7 @@
|
||||
"protected_session_timeout_description": "Das Zeitlimit für geschützte Sitzungen ist ein Zeitraum, nach dem die geschützte Sitzung aus dem Speicher des Browsers gelöscht wird. Dies wird ab der letzten Interaktion mit geschützten Notizen gemessen. Sehen",
|
||||
"wiki": "Wiki",
|
||||
"for_more_info": "für weitere Informationen.",
|
||||
"protected_session_timeout_label": "Zeitüberschreitung der geschützten Sitzung (in Sekunden)",
|
||||
"protected_session_timeout_label": "Zeitüberschreitung der geschützten Sitzung:",
|
||||
"reset_confirmation": "Durch das Zurücksetzen des Passworts verlierst du für immer den Zugriff auf alle Ihre bestehenden geschützten Notizen. Möchtest du das Passwort wirklich zurücksetzen?",
|
||||
"reset_success_message": "Das Passwort wurde zurückgesetzt. Bitte lege ein neues Passwort fest",
|
||||
"change_password_heading": "Kennwort ändern",
|
||||
|
@ -1286,7 +1286,7 @@
|
||||
"protected_session_timeout_description": "Protected session timeout is a time period after which the protected session is wiped from the browser's memory. This is measured from the last interaction with protected notes. See",
|
||||
"wiki": "wiki",
|
||||
"for_more_info": "for more info.",
|
||||
"protected_session_timeout_label": "Protected session timeout (in seconds)",
|
||||
"protected_session_timeout_label": "Protected session timeout:",
|
||||
"reset_confirmation": "By resetting the password you will forever lose access to all your existing protected notes. Do you really want to reset the password?",
|
||||
"reset_success_message": "Password has been reset. Please set new password",
|
||||
"change_password_heading": "Change Password",
|
||||
|
@ -1283,7 +1283,7 @@
|
||||
"protected_session_timeout_description": "El tiempo de espera de la sesión protegida es el período de tiempo después del cual la sesión protegida se borra de la memoria del navegador. Esto se mide desde la última interacción con notas protegidas. Ver",
|
||||
"wiki": "wiki",
|
||||
"for_more_info": "para más información.",
|
||||
"protected_session_timeout_label": "Tiempo de espera de sesión protegida (en segundos)",
|
||||
"protected_session_timeout_label": "Tiempo de espera de sesión protegida:",
|
||||
"reset_confirmation": "Al restablecer la contraseña, perderá para siempre el acceso a todas sus notas protegidas existentes. ¿Realmente quieres restablecer la contraseña?",
|
||||
"reset_success_message": "La contraseña ha sido restablecida. Por favor establezca una nueva contraseña",
|
||||
"change_password_heading": "Cambiar contraseña",
|
||||
|
@ -1226,7 +1226,7 @@
|
||||
"protected_session_timeout_description": "Le délai d'expiration de la session protégée est une période de temps après laquelle la session protégée est effacée de la mémoire du navigateur. Il est mesuré à partir de la dernière interaction avec des notes protégées. Voir",
|
||||
"wiki": "wiki",
|
||||
"for_more_info": "pour plus d'informations.",
|
||||
"protected_session_timeout_label": "Délai d'expiration de la session protégée (en secondes)",
|
||||
"protected_session_timeout_label": "Délai d'expiration de la session protégée :",
|
||||
"reset_confirmation": "En réinitialisant le mot de passe, vous perdrez à jamais l'accès à toutes vos notes protégées existantes. Voulez-vous vraiment réinitialiser le mot de passe ?",
|
||||
"reset_success_message": "Le mot de passe a été réinitialisé. Veuillez définir un nouveau mot de passe",
|
||||
"change_password_heading": "Changer le mot de passe",
|
||||
|
@ -923,7 +923,7 @@
|
||||
"password_mismatch": "Noile parole nu coincid.",
|
||||
"protected_session_timeout": "Timpul de expirare a sesiunii protejate",
|
||||
"protected_session_timeout_description": "Timpul de expirare a sesiunii protejate este o perioadă de timp după care sesiunea protejată este ștearsă din memoria navigatorului. Aceasta este măsurată de la timpul ultimei interacțiuni cu notițele protejate. Vezi",
|
||||
"protected_session_timeout_label": "Timpul de expirare a sesiunii protejate (în secunde)",
|
||||
"protected_session_timeout_label": "Timpul de expirare a sesiunii protejate:",
|
||||
"reset_confirmation": "Prin resetarea parolei se va pierde pentru totdeauna accesul la notițele protejate existente. Sigur doriți resetarea parolei?",
|
||||
"reset_link": "click aici pentru a o reseta.",
|
||||
"reset_success_message": "Parola a fost resetată. Setați o nouă parolă",
|
||||
|
@ -1237,7 +1237,7 @@
|
||||
"protected_session_timeout_description": "保護會話超時是一個時間段,超時後保護會話會從瀏覽器內存中清除。這是從最後一次與保護筆記的交互開始計時的。更多資訊請見",
|
||||
"wiki": "維基",
|
||||
"for_more_info": "更多資訊。",
|
||||
"protected_session_timeout_label": "保護會話超時(秒)",
|
||||
"protected_session_timeout_label": "",
|
||||
"reset_confirmation": "重置密碼將永久喪失對所有現受保護筆記的訪問。您真的要重置密碼嗎?",
|
||||
"reset_success_message": "密碼已重置。請設定新密碼",
|
||||
"change_password_heading": "更改密碼",
|
||||
|
@ -14,6 +14,7 @@ const ALLOWED_OPTIONS = new Set([
|
||||
"eraseEntitiesAfterTimeInSeconds",
|
||||
"eraseEntitiesAfterTimeScale",
|
||||
"protectedSessionTimeout",
|
||||
"protectedSessionTimeoutTimeScale",
|
||||
"revisionSnapshotTimeInterval",
|
||||
"revisionSnapshotNumberLimit",
|
||||
"zoomFactor",
|
||||
|
@ -77,6 +77,7 @@ const defaultOptions: DefaultOption[] = [
|
||||
{ name: "revisionSnapshotTimeInterval", value: "600", isSynced: true },
|
||||
{ name: "revisionSnapshotNumberLimit", value: "-1", isSynced: true },
|
||||
{ name: "protectedSessionTimeout", value: "600", isSynced: true },
|
||||
{ name: "protectedSessionTimeoutTimeScale", value: "60", isSynced: true },
|
||||
{ name: "zoomFactor", value: isWindows ? "0.9" : "1.0", isSynced: false },
|
||||
{ name: "overrideThemeFonts", value: "false", isSynced: false },
|
||||
{ name: "mainFontFamily", value: "theme", isSynced: false },
|
||||
|
@ -51,6 +51,7 @@ export interface OptionDefinitions extends KeyboardShortcutsOptions<KeyboardActi
|
||||
revisionSnapshotTimeInterval: number;
|
||||
revisionSnapshotNumberLimit: number;
|
||||
protectedSessionTimeout: number;
|
||||
protectedSessionTimeoutTimeScale: number;
|
||||
zoomFactor: number;
|
||||
mainFontSize: number;
|
||||
treeFontSize: number;
|
||||
|
Loading…
x
Reference in New Issue
Block a user