This commit is contained in:
Vanessa 2022-11-12 11:05:04 +08:00
parent a14f700373
commit 62a5d1a339
3 changed files with 26 additions and 10 deletions

View file

@ -67,6 +67,14 @@ const renderProvider = (provider: number) => {
<div>Region</div> <div>Region</div>
<div class="fn__hr"></div> <div class="fn__hr"></div>
<input id="region" class="b3-text-field fn__block" value="${window.siyuan.config.sync.s3.region}"> <input id="region" class="b3-text-field fn__block" value="${window.siyuan.config.sync.s3.region}">
</div>
<div class="b3-label b3-label--noborder">
<div>Addressing</div>
<div class="fn__hr"></div>
<select class="b3-select fn__block" id="pathStyle">
<option ${window.siyuan.config.sync.s3.pathStyle ? "selected" : ""} value="${window.siyuan.config.sync.s3.pathStyle}">Path-style</option>
<option ${window.siyuan.config.sync.s3.pathStyle ? "selected" : ""} value="${window.siyuan.config.sync.s3.pathStyle}">Virtual-hosted-style</option>
</select>
</div>`; </div>`;
} }
return `${tip} return `${tip}
@ -94,13 +102,21 @@ const renderProvider = (provider: number) => {
<div class="fn__flex-center fn__size200">Region</div> <div class="fn__flex-center fn__size200">Region</div>
<div class="fn__space"></div> <div class="fn__space"></div>
<input id="region" class="b3-text-field fn__flex-1" value="${window.siyuan.config.sync.s3.region}"> <input id="region" class="b3-text-field fn__flex-1" value="${window.siyuan.config.sync.s3.region}">
</label>
<label class="b3-label b3-label--noborder fn__flex">
<div class="fn__flex-center fn__size200">Addressing</div>
<div class="fn__space"></div>
<select class="b3-select fn__flex-1" id="pathStyle">
<option ${window.siyuan.config.sync.s3.pathStyle ? "selected" : ""} value="${window.siyuan.config.sync.s3.pathStyle}">Path-style</option>
<option ${window.siyuan.config.sync.s3.pathStyle ? "selected" : ""} value="${window.siyuan.config.sync.s3.pathStyle}">Virtual-hosted-style</option>
</select>
</label>`; </label>`;
} else if (provider === 3) { } else if (provider === 3) {
const tip = `<div class="b3-label b3-label--inner"> const tip = `<div class="b3-label b3-label--inner">
${window.siyuan.languages.syncThirdPartyProviderWebDAVIntro} ${window.siyuan.languages.syncThirdPartyProviderWebDAVIntro}
<div class="fn__hr"></div> <div class="fn__hr"></div>
${window.siyuan.languages.syncThirdPartyProviderTip} ${window.siyuan.languages.syncThirdPartyProviderTip}
</div>` </div>`;
if (isMobile()) { if (isMobile()) {
return `${tip} return `${tip}
<div class="b3-label b3-label--noborder"> <div class="b3-label b3-label--noborder">
@ -200,6 +216,7 @@ const bindProviderEvent = () => {
accessKey: (providerPanelElement.querySelector("#accessKey") as HTMLInputElement).value, accessKey: (providerPanelElement.querySelector("#accessKey") as HTMLInputElement).value,
secretKey: (providerPanelElement.querySelector("#secretKey") as HTMLInputElement).value, secretKey: (providerPanelElement.querySelector("#secretKey") as HTMLInputElement).value,
bucket: (providerPanelElement.querySelector("#bucket") as HTMLInputElement).value, bucket: (providerPanelElement.querySelector("#bucket") as HTMLInputElement).value,
pathStyle: (providerPanelElement.querySelector("#pathStyle") as HTMLInputElement).value === "true",
region: (providerPanelElement.querySelector("#region") as HTMLInputElement).value, region: (providerPanelElement.querySelector("#region") as HTMLInputElement).value,
}; };
fetchPost("/api/sync/setSyncProviderS3", {s3}, () => { fetchPost("/api/sync/setSyncProviderS3", {s3}, () => {

View file

@ -435,15 +435,13 @@ ${accountHTML}
event.stopPropagation(); event.stopPropagation();
break; break;
} else if (target.id === "menuSync") { } else if (target.id === "menuSync") {
if (!needSubscribe()) { closePanel();
closePanel(); modelElement.style.top = "0";
modelElement.style.top = "0"; modelElement.querySelector(".toolbar__icon").innerHTML = '<use xlink:href="#iconCloud"></use>';
modelElement.querySelector(".toolbar__icon").innerHTML = '<use xlink:href="#iconCloud"></use>'; modelElement.querySelector(".toolbar__text").textContent = window.siyuan.languages.cloud;
modelElement.querySelector(".toolbar__text").textContent = window.siyuan.languages.cloud; modelMainElement.innerHTML = repos.genHTML();
modelMainElement.innerHTML = repos.genHTML(); repos.element = modelMainElement;
repos.element = modelMainElement; repos.bindEvent();
repos.bindEvent();
}
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
break; break;

View file

@ -335,6 +335,7 @@ declare interface IConfig {
provider: number provider: number
s3: { s3: {
endpoint: string endpoint: string
pathStyle: boolean
accessKey: string accessKey: string
secretKey: string secretKey: string
bucket: string bucket: string