diff --git a/amethyst/src/androidTest/java/com/vitorpamplona/amethyst/ImageUploadTesting.kt b/amethyst/src/androidTest/java/com/vitorpamplona/amethyst/ImageUploadTesting.kt index 96f956ab5..495c1ed7a 100644 --- a/amethyst/src/androidTest/java/com/vitorpamplona/amethyst/ImageUploadTesting.kt +++ b/amethyst/src/androidTest/java/com/vitorpamplona/amethyst/ImageUploadTesting.kt @@ -86,23 +86,23 @@ class ImageUploadTesting { val result = BlossomUploader() .uploadImage( - inputStream, - initialHash, - paylod.size, - "filename.png", - "image/png", + inputStream = inputStream, + hash = initialHash, + length = paylod.size, + baseFileName = "filename.png", + contentType = "image/png", alt = null, sensitiveContent = null, - server, + serverBaseUrl = server.baseUrl, forceProxy = { false }, - createBlossomUploadAuth = account::createBlossomUploadAuth, + httpAuth = account::createBlossomUploadAuth, context = InstrumentationRegistry.getInstrumentation().targetContext, ) assertEquals("image/png", result.type) assertEquals(paylod.size.toLong(), result.size) assertEquals(initialHash, result.sha256) - assertEquals("${server.baseUrl}/$initialHash", result.url) + assertEquals("${server.baseUrl}/$initialHash", result.url?.removeSuffix(".png")) val imageData: ByteArray = ImageDownloader().waitAndGetImage(result.url!!, false) @@ -128,15 +128,15 @@ class ImageUploadTesting { val result = Nip96Uploader() .uploadImage( - inputStream, - paylod.size.toLong(), - "image/png", + inputStream = inputStream, + length = paylod.size.toLong(), + contentType = "image/png", alt = null, sensitiveContent = null, - serverInfo, + server = serverInfo, forceProxy = { false }, onProgress = {}, - createHTTPAuthorization = account::createHTTPAuthorization, + httpAuth = account::createHTTPAuthorization, context = InstrumentationRegistry.getInstrumentation().targetContext, ) @@ -154,19 +154,23 @@ class ImageUploadTesting { return } - FileHeader.prepare( - imageData, - "image/png", - null, - onReady = { + val prepared = + FileHeader.prepare( + imageData, + "image/png", + null, + ) + + prepared.fold( + onSuccess = { if (dim != null) { - assertEquals("${server.name}: Invalid dimensions", it.dim, dim) + assertEquals("${server.name}: Invalid dimensions", it.dim.toString(), dim.toString()) } if (size != null) { assertEquals("${server.name}: Invalid size", it.size.toString(), size) } }, - onError = { fail("${server.name}: It should not fail") }, + onFailure = { fail("${server.name}: It should not fail") }, ) // delay(1000) @@ -225,6 +229,7 @@ class ImageUploadTesting { } @Test() + @Ignore("Returns invalid image size") fun testNostrPic() = runBlocking { testBase(ServerName("nostpic.com", "https://nostpic.com", ServerType.NIP96)) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/mediaServers/ServerName.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/mediaServers/ServerName.kt index 0eeeb6654..9574f0c5c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/mediaServers/ServerName.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/mediaServers/ServerName.kt @@ -35,11 +35,10 @@ enum class ServerType { val DEFAULT_MEDIA_SERVERS: List = listOf( ServerName("Nostr.Build", "https://nostr.build", ServerType.NIP96), - ServerName("NostrCheck.me", "https://nostrcheck.me", ServerType.NIP96), - ServerName("NostPic", "https://nostpic.com", ServerType.NIP96), + ServerName("NostrCheck.me (NIP-96)", "https://nostrcheck.me", ServerType.NIP96), ServerName("Sovbit", "https://files.sovbit.host", ServerType.NIP96), ServerName("Void.cat", "https://void.cat", ServerType.NIP96), ServerName("Satellite (Paid)", "https://cdn.satellite.earth", ServerType.Blossom), ServerName("NostrCheck.me (Blossom)", "https://cdn.nostrcheck.me", ServerType.Blossom), - ServerName("Primal", "https://blossom.primal.net", ServerType.Blossom), + ServerName("Nostr.Download", "https://nostr.download", ServerType.Blossom), )