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

This commit is contained in:
Vanessa 2024-04-27 15:39:10 +08:00
commit 4a0bfa4b8e
12 changed files with 45 additions and 24 deletions

View file

@ -16,14 +16,18 @@ import {setKey} from "../sync/syncGuide";
export const about = {
element: undefined as Element,
genHTML: () => {
return `<label class="fn__flex b3-label${isBrowser() || window.siyuan.config.system.isMicrosoftStore || "std" !== window.siyuan.config.system.container || "linux" === window.siyuan.config.system.os ? " fn__none" : ""}">
return `<div class="fn__flex b3-label config__item${isBrowser() || window.siyuan.config.system.isMicrosoftStore || "std" !== window.siyuan.config.system.container || "linux" === window.siyuan.config.system.os ? " fn__none" : ""}">
<div class="fn__flex-1">
${window.siyuan.languages.autoLaunch}
<div class="b3-label__text">${window.siyuan.languages.autoLaunchTip}</div>
</div>
<div class="fn__space"></div>
<input class="b3-switch fn__flex-center" id="autoLaunch" type="checkbox"${window.siyuan.config.system.autoLaunch ? " checked" : ""}>
</label>
<span class="fn__space"></span>
<select class="b3-select fn__flex-center fn__size200" id="autoLaunch">
<option value="0" ${window.siyuan.config.system.autoLaunch === 0 ? "selected" : ""}>${window.siyuan.languages.autoLaunchMode0}</option>
<option value="1" ${window.siyuan.config.system.autoLaunch === 1 ? "selected" : ""}>${window.siyuan.languages.autoLaunchMode1}</option>
<option value="2" ${window.siyuan.config.system.autoLaunch === 2 ? "selected" : ""}>${window.siyuan.languages.autoLaunchMode2}</option>
</select>
</div>
<label class="fn__flex b3-label${isBrowser() || window.siyuan.config.system.isMicrosoftStore || window.siyuan.config.system.container !== "std" ? " fn__none" : ""}">
<div class="fn__flex-1">
${window.siyuan.languages.autoDownloadUpdatePkg}
@ -348,9 +352,10 @@ export const about = {
/// #if !BROWSER
const autoLaunchElement = about.element.querySelector("#autoLaunch") as HTMLInputElement;
autoLaunchElement.addEventListener("change", () => {
fetchPost("/api/system/setAutoLaunch", {autoLaunch: autoLaunchElement.checked}, () => {
window.siyuan.config.system.autoLaunch = autoLaunchElement.checked;
ipcRenderer.send(Constants.SIYUAN_AUTO_LAUNCH, {openAtLogin: autoLaunchElement.checked});
const autoLaunchMode = parseInt(autoLaunchElement.value)
fetchPost("/api/system/setAutoLaunch", {autoLaunch: autoLaunchMode}, () => {
window.siyuan.config.system.autoLaunch = autoLaunchMode;
ipcRenderer.send(Constants.SIYUAN_AUTO_LAUNCH, {openAtLogin: 0 != autoLaunchMode});
});
});
/// #endif

View file

@ -1351,8 +1351,11 @@ declare namespace Config {
appDir: string;
/**
* Boot automatically
* - `0`: Do not boot automatically
* - `1`: Boot automatically
* - `2`: Boot automatically + Minimize UI
*/
autoLaunch: boolean;
autoLaunch: number;
/**
* The absolute path of the `conf` directory of the current workspace
*/