Skip to content

Commit

Permalink
1. Update
Browse files Browse the repository at this point in the history
  • Loading branch information
red0orange committed Aug 10, 2023
1 parent 9a90aa3 commit f95e926
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion baseTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export interface WebdavConfig {
password: string;
authType: WebdavAuthType;
manualRecursive: boolean; // deprecated in 0.3.6, use depth
remoteBaseDir: string;
depth?: WebdavDepthType;
remoteBaseDir?: string;
}

export interface OnedriveConfig {
Expand Down
17 changes: 16 additions & 1 deletion main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class MyWebdavClient {
const headers = {
"Cache-Control": "no-cache",
};
console.log(webdavConfig);
this.client = createClient(webdavConfig.address, {
username: webdavConfig.username,
password: webdavConfig.password,
Expand Down Expand Up @@ -528,6 +529,7 @@ export default class WebdavFileExplorerPlugin extends Plugin {
let leaf: WorkspaceLeaf | undefined;
for (leaf of this.app.workspace.getLeavesOfType(WebdavListViewType)) {
if (leaf.view instanceof WebdavFilesListView) {
console.log('already exists');
return;
}
await leaf.setViewState({ type: 'empty' });
Expand Down Expand Up @@ -604,6 +606,20 @@ class WebdavFileExplorerSettingTab extends PluginSettingTab {
this.plugin.saveData();
}
});
new Setting(containerEl)
.setName('WebDAV: remote dir')
.setDesc('WebDAV 根路径')
.addText((text) => {
text.inputEl.setAttr('type', 'text');
text.inputEl.setAttr('placeholder', 'Obsidian');
text.setValue(this.plugin.webdavClient.webdavConfig.remoteBaseDir);
text.inputEl.onblur = (e: FocusEvent) => {
this.plugin.webdavClient.webdavConfig.remoteBaseDir = (e.target as HTMLInputElement).value;
this.plugin.updateData();
this.plugin.view.redraw();
this.plugin.saveData();
}
});
new Setting(containerEl)
.setName('Root folder path')
.setDesc('The path to the root folder to display in the file explorer')
Expand All @@ -618,7 +634,6 @@ class WebdavFileExplorerSettingTab extends PluginSettingTab {
this.plugin.saveData();
}
});

}
}

Expand Down

0 comments on commit f95e926

Please sign in to comment.