new: webdav sync test

This commit is contained in:
lollipopkit
2023-12-04 14:21:20 +08:00
parent 2dc86a9da2
commit 38cdef9458
18 changed files with 109 additions and 50 deletions

View File

@@ -16,6 +16,17 @@ abstract final class Webdav {
pwd: Stores.setting.webdavPwd.fetch(),
);
static Future<String?> test(String url, String user, String pwd) async {
final client = WebdavClient(url: url, user: user, pwd: pwd);
try {
await client.ping();
return null;
} catch (e, s) {
Loggers.app.warning('Webdav test failed', e, s);
return e.toString();
}
}
static Future<WebdavErr?> upload({
required String relativePath,
String? localPath,