Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ designs/*
output/*
packaged/*
.idea/*
.omx

### Linux ###
*~
Expand Down
4 changes: 4 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
compressionLevel: mixed

enableGlobalCache: false

nodeLinker: node-modules
90 changes: 89 additions & 1 deletion custom-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,39 @@

<body>
<script src="supporter.js"></script>
<style>
#main {
padding: 10px 12px;
}

#timer {
width: 100% !important;
max-width: 100%;
}

#dialog-buttons {
width: 100% !important;
display: flex;
justify-content: flex-end;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}

#dialog-buttons .btn {
white-space: nowrap;
flex: 0 0 auto;
}
</style>
<div class="d-flex mx-auto text-dark" id="main">
<div id="timer" class="justify-content-left align-content-left text-left"
style="transform: translateY(2px); width: 210px; -webkit-app-region: drag; -webkit-user-select: none;">
<p class="small text-grey font-weight-bolder" style="margin-left: 0" id="dialog-title">wnr</p>
<div id="dialog-spinner" class="d-none mb-2">
<div class="spinner-border spinner-border-sm text-primary" role="status"></div>
</div>
<p id="dialog-msg" class="small" style="line-height: 1.5">Message</p>
<p id="dialog-detail" class="small text-muted d-none" style="line-height: 1.5"></p>
<div id="dialog-buttons" style="width:210px" class="text-right">
<a type="button" id="dialog-cancel" class="btn btn-outline-secondary btn-sm text-right d-none"
style="font-size: 12px"
Expand All @@ -43,22 +71,82 @@
<script>
let executeAfter = "";
let msgNode = $("#dialog-msg");
let detailNode = $("#dialog-detail");
let currentDialogKind = "default";
let currentExitSessionId = null;

function ok() {
if (currentDialogKind === "exit-sync") {
ipc.send("custom-dialog-action", { action: "primary", exitSessionId: currentExitSessionId });
return;
}
ipc.send("custom-dialog", { mode: "off", executeAfter: executeAfter });
}

function button3() {
if (currentDialogKind === "exit-sync") {
ipc.send("custom-dialog-action", { action: "tertiary", exitSessionId: currentExitSessionId });
return;
}
ipc.send("custom-dialog", { mode: "button3_update", executeAfter: executeAfter });
}

function cancel() {
if (currentDialogKind === "exit-sync") {
ipc.send("custom-dialog-action", { action: "secondary", exitSessionId: currentExitSessionId });
return;
}
ipc.send("custom-dialog", { mode: "cancel" });
}

ipc.on("dialog-init", function (event, message) {
if (message.dialogKind === "exit-sync") {
if (currentExitSessionId != null && message.exitSessionId < currentExitSessionId) {
return;
}
currentDialogKind = "exit-sync";
currentExitSessionId = message.exitSessionId;
$("#dialog-title").text(message.title);
$("#dialog-msg").text(message.msg);
if (message.detail) detailNode.text(message.detail).removeClass("d-none");
else detailNode.text("").addClass("d-none");
$("#dialog-button-3").addClass("d-none");
$("#timer").css("width", "100%");
$("#dialog-buttons").css("width", "100%");

if (message.state === "syncing") {
$("#dialog-spinner").removeClass("d-none");
$("#dialog-ok").addClass("d-none");
$("#dialog-cancel").addClass("d-none");
$("#dialog-button-3").addClass("d-none");
document.onkeydown = function () {};
} else {
$("#dialog-spinner").addClass("d-none");
$("#dialog-ok").removeClass("d-none").text(message.primaryLabel || i18n.__('ok'));
$("#dialog-cancel").removeClass("d-none").text(message.secondaryLabel || i18n.__('cancel'));
if (message.tertiaryLabel) {
$("#dialog-button-3").removeClass("d-none").text(message.tertiaryLabel);
} else {
$("#dialog-button-3").addClass("d-none");
}
document.onkeydown = function (event1) {
Comment thread
XimingZheng marked this conversation as resolved.
let ev = document.all ? window.event : event1;
if ((ev.keyCode || ev.which) === 13) {
ok();
}
}
}

ipc.send("custom-dialog-fit", Math.round((msgNode.height() + detailNode.height()) / parseFloat(msgNode.css('line-height'))));
return;
}

currentDialogKind = "default";
currentExitSessionId = null;
$("#dialog-title").text(message.title);
$("#dialog-msg").text(message.msg);
detailNode.text("").addClass("d-none");
$("#dialog-spinner").addClass("d-none");
executeAfter = message.executeAfter;
ipc.send("custom-dialog-fit", Math.round(msgNode.height() / parseFloat(msgNode.css('line-height'))));
document.onkeydown = function () {
Expand Down Expand Up @@ -94,4 +182,4 @@
<script src="renderer.js"></script>
</body>

</html>
</html>
64 changes: 62 additions & 2 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,67 @@
"hotkey-for-miniMode": "Hotkey for mini mode: ",
"hotkey-failed": "Failed. Try another? ",
"data-management": "App data management",
"data-management-tip": "Delete, backup or import your preferences and statistics data.",
"data-management-tip": "Delete, backup, import, manually sync, or use WebDAV to sync your preferences and statistics data.",
"webdav-sync": "WebDAV sync",
"webdav-sync-msg": "WebDAV sync: ",
"webdav-sync-tip": "Manually upload or download your core data through WebDAV. Credentials stay on this device.",
"webdav-sync-url": "Server URL",
"webdav-sync-username": "Username",
"webdav-sync-password": "Password",
"webdav-sync-password-saved": "Password saved",
"webdav-sync-password-not-saved": "Password not saved",
"webdav-sync-remote-path": "Remote folder path",
"webdav-sync-remote-path-placeholder": "Relative to the WebDAV root, e.g. apps/wnr",
"webdav-sync-enabled": "Enable cloud sync",
"webdav-sync-enabled-tip": "When enabled, wnr may pull from WebDAV on startup, push local changes automatically, and guard exit with cloud sync checks.",
"webdav-sync-test": "Test connection",
"webdav-sync-upload": "Upload to WebDAV",
"webdav-sync-download": "Download from WebDAV",
"webdav-sync-testing": "Testing WebDAV connection...",
"webdav-sync-uploading": "Uploading data to WebDAV...",
"webdav-sync-downloading": "Downloading data from WebDAV...",
"webdav-sync-auto-enabled": "Automatic sync is enabled: startup pulls from WebDAV, runtime local changes push back automatically.",
"webdav-sync-auto-disabled": "Automatic sync is disabled until WebDAV is fully configured.",
"webdav-sync-user-disabled": "Cloud sync is off. Startup sync, automatic push, and exit sync protection are disabled.",
"webdav-sync-auto-awaiting-initial-sync": "Automatic sync will stay off until the first manual upload or download completes.",
"webdav-sync-startup-status": "Startup sync: ",
"webdav-sync-last-push-status": "Last auto-push: ",
"webdav-sync-auto-idle": "Automatic sync is idle.",
"webdav-sync-startup-failed": "Startup sync failed. Continuing with local data.",
"webdav-sync-autopush-running": "Automatic sync is pushing local changes...",
"webdav-sync-autopush-failed": "Automatic sync failed while pushing local changes.",
"webdav-sync-show-details": "Show details",
"webdav-sync-hide-details": "Hide details",
"webdav-sync-missing-config": "Please complete the WebDAV URL, username, password, and remote folder path.",
"webdav-sync-invalid-url": "The WebDAV URL is invalid.",
"webdav-sync-https-required": "WebDAV URL must use HTTPS.",
"webdav-sync-auth-failed": "WebDAV authentication failed.",
"webdav-sync-path-missing": "The configured WebDAV folder does not exist.",
"webdav-sync-path-error": "Failed to prepare the WebDAV folder.",
"webdav-sync-connection-failed": "Failed to connect to the WebDAV server.",
"webdav-sync-timeout": "WebDAV request timed out.",
"webdav-sync-connection-ok": "WebDAV connection succeeded.",
"webdav-sync-upload-ok": "Uploaded core data to WebDAV successfully.",
"webdav-sync-download-ok": "Downloaded core data from WebDAV successfully.",
"webdav-sync-upload-failed": "Failed to upload data to WebDAV.",
"webdav-sync-download-failed": "Failed to download data from WebDAV.",
"webdav-sync-invalid-remote": "The remote WebDAV data is invalid.",
"webdav-sync-remote-missing": "The remote WebDAV file is missing:",
"webdav-sync-confirm-upload": "Remote WebDAV files already exist. Continue and overwrite them?",
"webdav-sync-confirm-download": "Downloading from WebDAV will overwrite your local settings, statistics, and recap. Continue?",
"webdav-sync-exit-syncing-title": "Syncing cloud data before exit",
"webdav-sync-exit-syncing-message": "Please wait while wnr syncs your latest local changes to WebDAV.",
"webdav-sync-exit-failed-title": "Cloud sync failed before exit",
"webdav-sync-exit-failed-message": "wnr could not sync your latest local changes to WebDAV before exiting.",
"webdav-sync-exit-initial-choice-title": "Choose how to reconcile cloud data before exit",
"webdav-sync-exit-initial-choice-message": "Cloud data already exists on WebDAV. Before exiting, choose whether wnr should upload your local data to overwrite the cloud copy or download the cloud copy to replace local data.",
"webdav-sync-exit-timeout-title": "Sync timed out before exit",
"webdav-sync-exit-timeout-message": "wnr is still trying to sync your latest local changes to WebDAV before exiting.",
"webdav-sync-exit-upload-local": "Upload local data",
"webdav-sync-exit-download-cloud": "Download cloud data",
"webdav-sync-exit-wait": "Keep waiting",
"webdav-sync-exit-force-quit": "Force quit",
"webdav-sync-exit-retry": "Retry sync",
"locker": "Lock mode (parent control)",
"locker-mode": "Lock mode",
"locker-tip": "In lock mode, you will not be able to edit preferences or exit wnr. Also, exiting from a counting timer will need the password. ",
Expand Down Expand Up @@ -439,4 +499,4 @@
"increase-1-minute": "Increase 1 minute",
"decrease-15-seconds": "Decrease 15 seconds",
"increase-15-seconds": "Increase 15 seconds"
}
}
64 changes: 62 additions & 2 deletions locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,67 @@
"hotkey-for-miniMode": "打开 MINI 模式的快捷键",
"hotkey-failed": "设置失败,换个按键组合试试看吧。",
"data-management": "应用数据管理",
"data-management-tip": "清除、备份和导入设置项和统计数据。",
"data-management-tip": "清除、备份、导入、手动同步设置项和统计数据,或使用 WebDAV 同步这些数据。",
"webdav-sync": "WebDAV 同步",
"webdav-sync-msg": "WebDAV 同步:",
"webdav-sync-tip": "通过 WebDAV 手动上传或下载核心数据。连接凭据仅保存在当前设备。",
"webdav-sync-url": "服务器地址",
"webdav-sync-username": "用户名",
"webdav-sync-password": "密码",
"webdav-sync-password-saved": "密码已保存",
"webdav-sync-password-not-saved": "密码未保存",
"webdav-sync-remote-path": "远程文件夹路径",
"webdav-sync-remote-path-placeholder": "相对于 WebDAV 根目录,例如 apps/wnr",
"webdav-sync-enabled": "启用云端数据同步",
"webdav-sync-enabled-tip": "开启后,wnr 会在启动时尝试从 WebDAV 拉取数据、在运行时自动回推本地变更,并在退出前执行云端同步保护。",
"webdav-sync-test": "测试连接",
"webdav-sync-upload": "上传到 WebDAV",
"webdav-sync-download": "从 WebDAV 下载",
"webdav-sync-testing": "正在测试 WebDAV 连接...",
"webdav-sync-uploading": "正在上传数据到 WebDAV...",
"webdav-sync-downloading": "正在从 WebDAV 下载数据...",
"webdav-sync-auto-enabled": "自动同步已启用:启动时从 WebDAV 拉取,运行时本地变更会自动回推。",
"webdav-sync-auto-disabled": "WebDAV 未完整配置前,自动同步不会启用。",
"webdav-sync-user-disabled": "云端数据同步已关闭。启动同步、自动回推和退出前同步保护均不会执行。",
"webdav-sync-auto-awaiting-initial-sync": "首次手动上传或下载完成前,自动同步会保持关闭。",
"webdav-sync-startup-status": "启动同步:",
"webdav-sync-last-push-status": "最近一次自动回推:",
"webdav-sync-auto-idle": "自动同步处于空闲状态。",
"webdav-sync-startup-failed": "启动同步失败,已继续使用本地数据。",
"webdav-sync-autopush-running": "自动同步正在回推本地变更...",
"webdav-sync-autopush-failed": "自动同步回推本地变更失败。",
"webdav-sync-show-details": "显示详细信息",
"webdav-sync-hide-details": "隐藏详细信息",
"webdav-sync-missing-config": "请完整填写 WebDAV 地址、用户名、密码和远程文件夹路径。",
"webdav-sync-invalid-url": "WebDAV 地址无效。",
"webdav-sync-https-required": "WebDAV 地址必须使用 HTTPS。",
"webdav-sync-auth-failed": "WebDAV 认证失败。",
"webdav-sync-path-missing": "配置的 WebDAV 文件夹不存在。",
"webdav-sync-path-error": "准备 WebDAV 文件夹失败。",
"webdav-sync-connection-failed": "连接 WebDAV 服务器失败。",
"webdav-sync-timeout": "WebDAV 请求超时。",
"webdav-sync-connection-ok": "WebDAV 连接成功。",
"webdav-sync-upload-ok": "核心数据已成功上传到 WebDAV。",
"webdav-sync-download-ok": "核心数据已成功从 WebDAV 下载。",
"webdav-sync-upload-failed": "上传数据到 WebDAV 失败。",
"webdav-sync-download-failed": "从 WebDAV 下载数据失败。",
"webdav-sync-invalid-remote": "远端 WebDAV 数据无效。",
"webdav-sync-remote-missing": "远端 WebDAV 文件缺失:",
"webdav-sync-confirm-upload": "远端 WebDAV 文件已存在,是否继续覆盖?",
"webdav-sync-confirm-download": "从 WebDAV 下载会覆盖本地设置、统计和回顾数据,是否继续?",
"webdav-sync-exit-syncing-title": "正在同步云数据后退出",
"webdav-sync-exit-syncing-message": "请稍候,wnr 正在把你最新的本地变更同步到 WebDAV。",
"webdav-sync-exit-failed-title": "退出前云同步失败",
"webdav-sync-exit-failed-message": "wnr 在退出前未能把你最新的本地变更同步到 WebDAV。",
"webdav-sync-exit-initial-choice-title": "退出前请先处理云端数据",
"webdav-sync-exit-initial-choice-message": "检测到 WebDAV 上已经存在云端数据。退出前,请选择将本地数据上传并覆盖云端,或下载云端数据并替换本地数据。",
"webdav-sync-exit-timeout-title": "退出前同步超时",
"webdav-sync-exit-timeout-message": "wnr 正在尝试把你最新的本地变更同步到 WebDAV 后再退出。",
"webdav-sync-exit-upload-local": "上传本地数据",
"webdav-sync-exit-download-cloud": "下载云端数据",
"webdav-sync-exit-wait": "继续等待",
"webdav-sync-exit-force-quit": "强制退出",
"webdav-sync-exit-retry": "重试同步",
"locker": "锁定模式(家长控制)",
"locker-mode": "锁定模式",
"locker-tip": "打开锁定模式后,将无法修改设置,无法随意退出程序。如果自控力较弱,不妨让别人输入密码。",
Expand Down Expand Up @@ -434,4 +494,4 @@
"custom": "自定义",
"custom-notify-sound": "自定义提示音",
"input-url": "输入路径"
}
}
Loading
Loading