mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-13 10:44:20 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
c08aec57fb
25 changed files with 228 additions and 131 deletions
|
|
@ -89,25 +89,20 @@ export const about = {
|
|||
${window.siyuan.languages.about2}
|
||||
<div class="b3-label__text">${window.siyuan.languages.about3.replace("${port}", location.port)}</div>
|
||||
${(() => {
|
||||
const ipv4Codes: string[] = [];
|
||||
const ipv6Codes: string[] = [];
|
||||
for (const ip of window.siyuan.config.localIPs) {
|
||||
if (!ip.trim()) {
|
||||
const serverAddrs: string[] = [];
|
||||
for (const serverAddr of window.siyuan.config.serverAddrs) {
|
||||
if (!serverAddr.trim()) {
|
||||
break;
|
||||
}
|
||||
if (ip.startsWith("[") && ip.endsWith("]")) {
|
||||
ipv6Codes.push(`<code class="fn__code">${ip}</code>`);
|
||||
} else {
|
||||
ipv4Codes.push(`<code class="fn__code">${ip}</code>`);
|
||||
}
|
||||
|
||||
serverAddrs.push(`<code class="fn__code">${serverAddr}</code>`);
|
||||
}
|
||||
return `<div class="b3-label__text${ipv4Codes.length ? "" : " fn__none"}">${ipv4Codes.join(" ")}</div>
|
||||
<div class="b3-label__text${ipv6Codes.length ? "" : " fn__none"}">${ipv6Codes.join(" ")}</div>`;
|
||||
return `<div class="b3-label__text">${serverAddrs.join(" ")}</div>`;
|
||||
})()}
|
||||
<div class="b3-label__text">${window.siyuan.languages.about18}</div>
|
||||
</div>
|
||||
<div class="fn__space"></div>
|
||||
<button data-type="open" data-url="http://${window.siyuan.config.system.networkServe ? window.siyuan.config.localIPs[0] : "127.0.0.1"}:${location.port}" class="b3-button b3-button--outline fn__size200 fn__flex-center">
|
||||
<button data-type="open" data-url="${window.siyuan.config.system.networkServe ? window.siyuan.config.serverAddrs[0] : "http://127.0.0.1:"+ location.port}" class="b3-button b3-button--outline fn__size200 fn__flex-center">
|
||||
<svg><use xlink:href="#iconLink"></use></svg>${window.siyuan.languages.about4}
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -275,13 +270,16 @@ ${checkUpdateHTML}
|
|||
});
|
||||
});
|
||||
about.element.querySelector("#vacuumDataIndex").addEventListener("click", () => {
|
||||
fetchPost("/api/system/vacuumDataIndex", {}, () => {});
|
||||
fetchPost("/api/system/vacuumDataIndex", {}, () => {
|
||||
});
|
||||
});
|
||||
about.element.querySelector("#rebuildDataIndex").addEventListener("click", () => {
|
||||
fetchPost("/api/system/rebuildDataIndex", {}, () => {});
|
||||
fetchPost("/api/system/rebuildDataIndex", {}, () => {
|
||||
});
|
||||
});
|
||||
about.element.querySelector("#clearTempFiles").addEventListener("click", () => {
|
||||
fetchPost("/api/system/clearTempFiles", {}, () => {});
|
||||
fetchPost("/api/system/clearTempFiles", {}, () => {
|
||||
});
|
||||
});
|
||||
about.element.querySelector("#exportLog").addEventListener("click", () => {
|
||||
fetchPost("/api/system/exportLog", {}, (response) => {
|
||||
|
|
|
|||
|
|
@ -229,17 +229,13 @@ ${window.siyuan.languages.publishServiceAuthAccounts}
|
|||
if (port === 0) {
|
||||
publishAddresses.innerText = window.siyuan.languages.publishServiceNotStarted;
|
||||
} else {
|
||||
publishAddresses.innerHTML = `<ul class="b3-list fn__flex-1" style="padding: 2px 0;">${
|
||||
window.siyuan.config.localIPs
|
||||
.filter(ip => !(ip.startsWith("[") && ip.endsWith("]")))
|
||||
.map(ip => `<li><code class="fn__code">${ip}:${port}</code></li>`)
|
||||
.join("")
|
||||
}${
|
||||
window.siyuan.config.localIPs
|
||||
.filter(ip => (ip.startsWith("[") && ip.endsWith("]")))
|
||||
.map(ip => `<li><code class="fn__code">${ip}:${port}</code></li>`)
|
||||
.join("")
|
||||
}</ul>`;
|
||||
publishAddresses.innerHTML = `<div class="b3-label__text">${
|
||||
window.siyuan.config.serverAddrs
|
||||
.map(serverAddr => {
|
||||
serverAddr = serverAddr.substring(0, serverAddr.lastIndexOf(":"));
|
||||
return `<code class="fn__code">${serverAddr}:${port}</code>`
|
||||
}).join(" ")
|
||||
}</div>`;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -33,6 +33,10 @@ export const initMessage = () => {
|
|||
|
||||
// type: info/error; timeout: 0 手动关闭;-1 永不关闭
|
||||
export const showMessage = (message: string, timeout = 6000, type = "info", messageId?: string) => {
|
||||
if (!message) {
|
||||
return;
|
||||
}
|
||||
|
||||
const messagesElement = document.getElementById("message").firstElementChild;
|
||||
if (!messagesElement) {
|
||||
let tempMessages = document.getElementById("tempMessage");
|
||||
|
|
|
|||
|
|
@ -12,11 +12,6 @@ import {setKey} from "../../sync/syncGuide";
|
|||
import {isBrowser} from "../../util/functions";
|
||||
|
||||
export const initAbout = () => {
|
||||
if (!window.siyuan.config.localIPs || window.siyuan.config.localIPs.length === 0 ||
|
||||
(window.siyuan.config.localIPs.length === 1 && window.siyuan.config.localIPs[0] === "")) {
|
||||
window.siyuan.config.localIPs = ["127.0.0.1"];
|
||||
}
|
||||
|
||||
openModel({
|
||||
title: window.siyuan.languages.about,
|
||||
icon: "iconInfo",
|
||||
|
|
@ -32,26 +27,20 @@ export const initAbout = () => {
|
|||
<div class="b3-label">
|
||||
${window.siyuan.languages.about2}
|
||||
<div class="fn__hr"></div>
|
||||
<a target="_blank" href="http://${window.siyuan.config.system.networkServe ? window.siyuan.config.localIPs[0] : "127.0.0.1"}:${location.port}" class="b3-button b3-button--outline fn__block">
|
||||
<a target="_blank" href="${window.siyuan.config.system.networkServe ? window.siyuan.config.serverAddrs[0] : "http://127.0.0.1:" + location.port}" class="b3-button b3-button--outline fn__block">
|
||||
<svg><use xlink:href="#iconLink"></use></svg>${window.siyuan.languages.about4}
|
||||
</a>
|
||||
<div class="b3-label__text">${window.siyuan.languages.about3.replace("${port}", location.port)}</div>
|
||||
<div class="fn__hr"></div>
|
||||
${(() => {
|
||||
const ipv4Codes: string[] = [];
|
||||
const ipv6Codes: string[] = [];
|
||||
for (const ip of window.siyuan.config.localIPs) {
|
||||
if (!ip.trim()) {
|
||||
const serverAddrs: string[] = [];
|
||||
for (const serverAddr of window.siyuan.config.serverAddrs) {
|
||||
if (!serverAddr.trim()) {
|
||||
break;
|
||||
}
|
||||
if (ip.startsWith("[") && ip.endsWith("]")) {
|
||||
ipv6Codes.push(`<code class="fn__code">${ip}</code>`);
|
||||
} else {
|
||||
ipv4Codes.push(`<code class="fn__code">${ip}</code>`);
|
||||
}
|
||||
serverAddrs.push(`<code class="fn__code">${serverAddr}</code>`);
|
||||
}
|
||||
return `<div class="b3-label__text${ipv4Codes.length ? "" : " fn__none"}">${ipv4Codes.join(" ")}</div>
|
||||
<div class="b3-label__text${ipv6Codes.length ? "" : " fn__none"}">${ipv6Codes.join(" ")}</div>`;
|
||||
return `<div class="b3-label__text">${serverAddrs.join(" ")}</div>`;
|
||||
})()}
|
||||
<div class="fn__hr"></div>
|
||||
<div class="b3-label__text">${window.siyuan.languages.about18}</div>
|
||||
|
|
@ -320,17 +309,20 @@ export const initAbout = () => {
|
|||
event.stopPropagation();
|
||||
break;
|
||||
} else if (target.id === "vacuumDataIndex") {
|
||||
fetchPost("/api/system/vacuumDataIndex", {}, () => {});
|
||||
fetchPost("/api/system/vacuumDataIndex", {}, () => {
|
||||
});
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
} else if (target.id === "rebuildDataIndex") {
|
||||
fetchPost("/api/system/rebuildDataIndex", {}, () => {});
|
||||
fetchPost("/api/system/rebuildDataIndex", {}, () => {
|
||||
});
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
} else if (target.id === "clearTempFiles") {
|
||||
fetchPost("/api/system/clearTempFiles", {}, () => {});
|
||||
fetchPost("/api/system/clearTempFiles", {}, () => {
|
||||
});
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
|
|
|
|||
4
app/src/types/config.d.ts
vendored
4
app/src/types/config.d.ts
vendored
|
|
@ -52,9 +52,9 @@ declare namespace Config {
|
|||
*/
|
||||
langs: ILang[];
|
||||
/**
|
||||
* A list of the IP addresses of the devices on which the kernel resides
|
||||
* A list of the kernel server addresses
|
||||
*/
|
||||
localIPs: string[];
|
||||
serverAddrs: string[];
|
||||
/**
|
||||
* Log level
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue