Updated nextcloud neon api to latest

This commit is contained in:
Elias Müller 2023-08-08 20:26:53 +02:00
parent 86c3a397da
commit 45a829082b
6 changed files with 9 additions and 9 deletions

View File

@ -740,7 +740,7 @@
<entry key="nextcloud"> <entry key="nextcloud">
<value> <value>
<list> <list>
<option value="$USER_HOME$/.pub-cache/git/nextcloud-neon-dc54d2f0c2b5641f3a81a7af8e585482111ce1fc/packages/nextcloud/lib" /> <option value="$USER_HOME$/.pub-cache/git/nextcloud-neon-9a42bdb3a0ef1e3dbd62f746fb0fe75856be66a3/packages/nextcloud/lib" />
</list> </list>
</value> </value>
</entry> </entry>
@ -1295,7 +1295,7 @@
<CLASSES> <CLASSES>
<root url="file://$USER_HOME$/.pub-cache/git/flowder-1ddd171a763c4f1ba09b95e34e35e2e5cf0d1bba//lib" /> <root url="file://$USER_HOME$/.pub-cache/git/flowder-1ddd171a763c4f1ba09b95e34e35e2e5cf0d1bba//lib" />
<root url="file://$USER_HOME$/.pub-cache/git/nextcloud-neon-50d607e278061992659e4fdbc03a9d9fe0f04a77/packages/dynamite/dynamite_runtime/lib" /> <root url="file://$USER_HOME$/.pub-cache/git/nextcloud-neon-50d607e278061992659e4fdbc03a9d9fe0f04a77/packages/dynamite/dynamite_runtime/lib" />
<root url="file://$USER_HOME$/.pub-cache/git/nextcloud-neon-dc54d2f0c2b5641f3a81a7af8e585482111ce1fc/packages/nextcloud/lib" /> <root url="file://$USER_HOME$/.pub-cache/git/nextcloud-neon-9a42bdb3a0ef1e3dbd62f746fb0fe75856be66a3/packages/nextcloud/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/_fe_analyzer_shared-62.0.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/_fe_analyzer_shared-62.0.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/analyzer-6.0.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/analyzer-6.0.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/animated_digit-3.2.1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/animated_digit-3.2.1/lib" />

View File

@ -13,7 +13,7 @@ class ListFiles extends WebdavApi<ListFilesParams> {
@override @override
Future<ListFilesResponse> run() async { Future<ListFilesResponse> run() async {
List<WebDavFile> davFiles = (await (await WebdavApi.webdav).ls(params.path)).toWebDavFiles((await WebdavApi.webdav)); List<WebDavFile> davFiles = (await (await WebdavApi.webdav).propfind(params.path)).toWebDavFiles();
davFiles.removeWhere((element) => element.path == "/${params.path}/" || element.path == "/"); // somehow the current working folder is also listed, it is filtered here. davFiles.removeWhere((element) => element.path == "/${params.path}/" || element.path == "/"); // somehow the current working folder is also listed, it is filtered here.
Set<CacheableFile> files = davFiles.map((e) => CacheableFile.fromDavFile(e)).toSet(); Set<CacheableFile> files = davFiles.map((e) => CacheableFile.fromDavFile(e)).toSet();

View File

@ -18,7 +18,7 @@ abstract class WebdavApi<T> extends ApiRequest {
static Future<String> webdavConnectString = buildWebdavConnectString(); static Future<String> webdavConnectString = buildWebdavConnectString();
static Future<WebDavClient> establishWebdavConnection() async { static Future<WebDavClient> establishWebdavConnection() async {
return NextcloudClient("https://${EndpointData().nextcloud().full()}", username: AccountData().getUsername(), password: AccountData().getPassword(), loginName: AccountData().getUsername()).webdav; return NextcloudClient("https://${EndpointData().nextcloud().full()}", password: AccountData().getPassword(), loginName: AccountData().getUsername()).webdav;
} }
static Future<String> buildWebdavConnectString() async { static Future<String> buildWebdavConnectString() async {

View File

@ -43,8 +43,8 @@ class _FileUploadDialogState extends State<FileUploadDialog> {
setState(() { setState(() {
state = FileUploadState.checkConflict; state = FileUploadState.checkConflict;
}); });
await (await WebdavApi.webdav).mkdirs(widget.remotePath.join("/")); await (await WebdavApi.webdav).mkcol(widget.remotePath.join("/"));
List<WebDavResponse> result = (await webdavClient.ls(widget.remotePath.join("/"))).responses; List<WebDavResponse> result = (await webdavClient.propfind(widget.remotePath.join("/"))).responses;
if(result.any((element) => element.href!.endsWith("/$targetFileName"))) { if(result.any((element) => element.href!.endsWith("/$targetFileName"))) {
setState(() { setState(() {
state = FileUploadState.conflict; state = FileUploadState.conflict;
@ -57,7 +57,7 @@ class _FileUploadDialogState extends State<FileUploadDialog> {
} }
} }
Future<HttpClientResponse> uploadTask = webdavClient.upload(File(widget.localPath).readAsBytesSync(), fullRemotePath); Future<HttpClientResponse> uploadTask = webdavClient.putFile(File(widget.localPath), FileStat.statSync(widget.localPath), fullRemotePath); // TODO use onProgress from putFile
uploadTask.then((value) => Future<HttpClientResponse?>.value(value)).catchError((e) { uploadTask.then((value) => Future<HttpClientResponse?>.value(value)).catchError((e) {
setState(() { setState(() {
state = FileUploadState.error; state = FileUploadState.error;

View File

@ -189,7 +189,7 @@ class _FilesState extends State<Files> {
}, child: const Text("Abbrechen")), }, child: const Text("Abbrechen")),
TextButton(onPressed: () { TextButton(onPressed: () {
WebdavApi.webdav.then((webdav) { WebdavApi.webdav.then((webdav) {
webdav.mkdirs("${widget.path.join("/")}/${inputController.text}").then((value) => _query()); webdav.mkcol("${widget.path.join("/")}/${inputController.text}").then((value) => _query());
}); });
Navigator.of(context).pop(); Navigator.of(context).pop();
}, child: const Text("Ordner erstellen")), }, child: const Text("Ordner erstellen")),

View File

@ -56,7 +56,7 @@ dependencies:
git: git:
url: https://github.com/provokateurin/nextcloud-neon url: https://github.com/provokateurin/nextcloud-neon
path: packages/nextcloud path: packages/nextcloud
ref: dc54d2f0c2b5641f3a81a7af8e585482111ce1fc ref: 9a42bdb3a0ef1e3dbd62f746fb0fe75856be66a3
flutter_launcher_icons: ^0.13.1 flutter_launcher_icons: ^0.13.1
pretty_json: ^2.0.0 pretty_json: ^2.0.0
cached_network_image: ^3.2.3 cached_network_image: ^3.2.3