about summary refs log tree commit diff
path: root/MatrixRoomUtils.Core/Helpers
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixRoomUtils.Core/Helpers')
-rw-r--r--MatrixRoomUtils.Core/Helpers/MediaResolver.cs6
-rw-r--r--MatrixRoomUtils.Core/Helpers/SyncHelper.cs4
2 files changed, 8 insertions, 2 deletions
diff --git a/MatrixRoomUtils.Core/Helpers/MediaResolver.cs b/MatrixRoomUtils.Core/Helpers/MediaResolver.cs
new file mode 100644
index 0000000..0869135
--- /dev/null
+++ b/MatrixRoomUtils.Core/Helpers/MediaResolver.cs
@@ -0,0 +1,6 @@
+namespace MatrixRoomUtils.Core.Helpers; 
+
+public class MediaResolver {
+    public static string ResolveMediaUri(string homeserver, string mxc) => 
+        mxc.Replace("mxc://", $"{homeserver}/_matrix/media/v3/download/");
+}
\ No newline at end of file
diff --git a/MatrixRoomUtils.Core/Helpers/SyncHelper.cs b/MatrixRoomUtils.Core/Helpers/SyncHelper.cs
index 1b9c598..eff412b 100644
--- a/MatrixRoomUtils.Core/Helpers/SyncHelper.cs
+++ b/MatrixRoomUtils.Core/Helpers/SyncHelper.cs
@@ -20,7 +20,7 @@ public class SyncHelper {
 
     public async Task<SyncResult?> Sync(string? since = null, CancellationToken? cancellationToken = null) {
         var outFileName = "sync-" +
-                          (await _storageService.CacheStorageProvider.GetAllKeys()).Count(x => x.StartsWith("sync")) +
+                          (await _storageService.CacheStorageProvider.GetAllKeysAsync()).Count(x => x.StartsWith("sync")) +
                           ".json";
         var url = "/_matrix/client/v3/sync?timeout=30000&set_presence=online";
         if (!string.IsNullOrWhiteSpace(since)) url += $"&since={since}";
@@ -29,7 +29,7 @@ public class SyncHelper {
         try {
             var res = await _homeServer._httpClient.GetFromJsonAsync<SyncResult>(url,
                 cancellationToken: cancellationToken ?? CancellationToken.None);
-            await _storageService.CacheStorageProvider.SaveObject(outFileName, res);
+            await _storageService.CacheStorageProvider.SaveObjectAsync(outFileName, res);
             Console.WriteLine($"Wrote file: {outFileName}");
             return res;
         }