🎨 WebDAV/S3 data sync and backup support configurable concurrent requests https://github.com/siyuan-note/siyuan/issues/12798

This commit is contained in:
Daniel 2024-10-16 19:29:11 +08:00
parent 27618dd849
commit 488e87b70b
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
9 changed files with 75 additions and 18 deletions

View file

@ -99,6 +99,11 @@ const renderProvider = (provider: number) => {
<option ${window.siyuan.config.sync.s3.skipTlsVerify ? "selected" : ""} value="true">Skip</option>
</select>
</div>
<div class="b3-label b3-label--inner fn__flex">
<div class="fn__flex-center fn__size200">Concurrent Reqs</div>
<div class="fn__space"></div>
<input id="s3ConcurrentReqs" class="b3-text-field fn__block" type="number" min="1" max="16" value="${window.siyuan.config.sync.s3.concurrentReqs}">
</div>
<div class="b3-label b3-label--inner fn__flex">
<div class="fn__flex-1"></div>
<button class="b3-button b3-button--outline fn__size200" data-action="purgeData">
@ -153,6 +158,11 @@ const renderProvider = (provider: number) => {
<option ${window.siyuan.config.sync.webdav.skipTlsVerify ? "selected" : ""} value="true">Skip</option>
</select>
</div>
<div class="b3-label b3-label--inner fn__flex">
<div class="fn__flex-center fn__size200">Concurrent Reqs</div>
<div class="fn__space"></div>
<input id="webdavConcurrentReqs" class="b3-text-field fn__block" type="number" min="1" max="16" value="${window.siyuan.config.sync.webdav.concurrentReqs}">
</div>
<div class="b3-label b3-label--inner fn__flex">
<div class="fn__flex-1"></div>
<button class="b3-button b3-button--outline fn__size200" data-action="purgeData">
@ -267,6 +277,13 @@ const bindProviderEvent = () => {
if (300 < timeout) {
timeout = 300;
}
let concurrentReqs = parseInt((providerPanelElement.querySelector("#s3ConcurrentReqs") as HTMLInputElement).value, 10);
if (1 > concurrentReqs) {
concurrentReqs = 1;
}
if (16 < concurrentReqs) {
concurrentReqs = 16;
}
(providerPanelElement.querySelector("#timeout") as HTMLInputElement).value = timeout.toString();
const s3 = {
endpoint: (providerPanelElement.querySelector("#endpoint") as HTMLInputElement).value,
@ -277,6 +294,7 @@ const bindProviderEvent = () => {
region: (providerPanelElement.querySelector("#region") as HTMLInputElement).value,
skipTlsVerify: (providerPanelElement.querySelector("#s3SkipTlsVerify") as HTMLInputElement).value === "true",
timeout: timeout,
concurrentReqs: concurrentReqs,
};
fetchPost("/api/sync/setSyncProviderS3", {s3}, () => {
window.siyuan.config.sync.s3 = s3;
@ -289,6 +307,13 @@ const bindProviderEvent = () => {
if (300 < timeout) {
timeout = 300;
}
let concurrentReqs = parseInt((providerPanelElement.querySelector("#webdavConcurrentReqs") as HTMLInputElement).value, 10);
if (1 > concurrentReqs) {
concurrentReqs = 1;
}
if (16 < concurrentReqs) {
concurrentReqs = 16;
}
(providerPanelElement.querySelector("#timeout") as HTMLInputElement).value = timeout.toString();
const webdav = {
endpoint: (providerPanelElement.querySelector("#endpoint") as HTMLInputElement).value,
@ -296,6 +321,7 @@ const bindProviderEvent = () => {
password: (providerPanelElement.querySelector("#password") as HTMLInputElement).value,
skipTlsVerify: (providerPanelElement.querySelector("#webdavSkipTlsVerify") as HTMLInputElement).value === "true",
timeout: timeout,
concurrentReqs: concurrentReqs,
};
fetchPost("/api/sync/setSyncProviderWebDAV", {webdav}, () => {
window.siyuan.config.sync.webdav = webdav;

View file

@ -1381,6 +1381,10 @@ declare namespace Config {
* Timeout (unit: seconds)
*/
timeout: number;
/**
* Concurrent requests.
*/
concurrentReqs: number;
}
/**
@ -1403,6 +1407,10 @@ declare namespace Config {
* Timeout (unit: seconds)
*/
timeout: number;
/**
* Concurrent requests.
*/
concurrentReqs: number;
/**
* Username
*/