draft
This commit is contained in:
parent
2d9610cd92
commit
479d2a4fac
@ -26,13 +26,15 @@ export interface DropboxConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type WebdavAuthType = "digest" | "basic";
|
export type WebdavAuthType = "digest" | "basic";
|
||||||
|
export type WebdavDepthType = "auto_unknown" | "auto_1" | "auto_infinity" | "manual_1" | "manual_infinity";
|
||||||
|
|
||||||
export interface WebdavConfig {
|
export interface WebdavConfig {
|
||||||
address: string;
|
address: string;
|
||||||
username: string;
|
username: string;
|
||||||
password: string;
|
password: string;
|
||||||
authType: WebdavAuthType;
|
authType: WebdavAuthType;
|
||||||
manualRecursive: boolean;
|
manualRecursive: boolean; // deprecated in 0.3.6, use depth
|
||||||
|
depth?: WebdavDepthType;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OnedriveConfig {
|
export interface OnedriveConfig {
|
||||||
|
|||||||
@ -564,6 +564,9 @@ export default class RemotelySavePlugin extends Plugin {
|
|||||||
if (this.settings.webdav.manualRecursive === undefined) {
|
if (this.settings.webdav.manualRecursive === undefined) {
|
||||||
this.settings.webdav.manualRecursive = false;
|
this.settings.webdav.manualRecursive = false;
|
||||||
}
|
}
|
||||||
|
if (this.settings.webdav.depth === undefined) {
|
||||||
|
this.settings.webdav.depth = "auto_unknown";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async saveSettings() {
|
async saveSettings() {
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import {
|
|||||||
API_VER_REQURL,
|
API_VER_REQURL,
|
||||||
SUPPORTED_SERVICES_TYPE,
|
SUPPORTED_SERVICES_TYPE,
|
||||||
WebdavAuthType,
|
WebdavAuthType,
|
||||||
|
WebdavDepthType,
|
||||||
} from "./baseTypes";
|
} from "./baseTypes";
|
||||||
import { exportVaultSyncPlansToFiles } from "./debugMode";
|
import { exportVaultSyncPlansToFiles } from "./debugMode";
|
||||||
import { exportQrCodeUri } from "./importExport";
|
import { exportQrCodeUri } from "./importExport";
|
||||||
@ -1073,25 +1074,35 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
|
|||||||
});
|
});
|
||||||
|
|
||||||
new Setting(webdavDiv)
|
new Setting(webdavDiv)
|
||||||
.setName("server supports infinity propfind or not")
|
.setName("depth header sent to servers")
|
||||||
.setDesc(
|
.setDesc(
|
||||||
"The plugin needs to get all files and folders recursively using probfind. If your webdav server only supports depth='1' (such as NGINX), you need to adjust the setting here, then the plugin consumes more network requests, but better than not working."
|
"Webdav servers should be configured to allow requests with header Depth being '1' or 'infinity'. The plugin needs to know this info. If you are not sure what's this, choose \"auto\"."
|
||||||
)
|
)
|
||||||
.addDropdown((dropdown) => {
|
.addDropdown((dropdown) => {
|
||||||
dropdown.addOption("infinity", "supports depth='infinity'");
|
dropdown.addOption("auto", "auto detect");
|
||||||
dropdown.addOption("1", "only supports depth='1'");
|
dropdown.addOption("manual_1", "only supports depth='1'");
|
||||||
|
dropdown.addOption("manual_infinity", "only supports depth='infinity'");
|
||||||
|
|
||||||
type Depth = "1" | "infinity";
|
let initVal = "auto";
|
||||||
|
const autoOptions: Set<WebdavDepthType> = new Set(["auto_unknown", "auto_1", "auto_infinity"]);
|
||||||
|
if (autoOptions.has(this.plugin.settings.webdav.depth)) {
|
||||||
|
initVal = "auto";
|
||||||
|
} else {
|
||||||
|
initVal = this.plugin.settings.webdav.depth || "auto";
|
||||||
|
}
|
||||||
|
|
||||||
|
type DepthOption = "auto" | "manual_1" | "manual_infinity"
|
||||||
dropdown
|
dropdown
|
||||||
.setValue(
|
.setValue( initVal)
|
||||||
this.plugin.settings.webdav.manualRecursive === false
|
.onChange(async (val: DepthOption) => {
|
||||||
? "infinity"
|
if (val === "auto") {
|
||||||
: "1"
|
this.plugin.settings.webdav.depth = "auto_unknown";
|
||||||
)
|
this.plugin.settings.webdav.manualRecursive = false;
|
||||||
.onChange(async (val: Depth) => {
|
} else if (val === "manual_1") {
|
||||||
if (val === "1") {
|
this.plugin.settings.webdav.depth = "manual_1";
|
||||||
this.plugin.settings.webdav.manualRecursive = true;
|
this.plugin.settings.webdav.manualRecursive = true;
|
||||||
} else if (val === "infinity") {
|
} else if (val === "manual_infinity") {
|
||||||
|
this.plugin.settings.webdav.depth = "manual_infinity";
|
||||||
this.plugin.settings.webdav.manualRecursive = false;
|
this.plugin.settings.webdav.manualRecursive = false;
|
||||||
}
|
}
|
||||||
await this.plugin.saveSettings();
|
await this.plugin.saveSettings();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user