From 67cc24c4d92b6ec0151bb7a5051cbc12468571ac Mon Sep 17 00:00:00 2001 From: Believethehype Date: Wed, 3 May 2023 18:13:18 +0200 Subject: [PATCH] added nostr.build NIP94 --- .../com/vitorpamplona/amethyst/ui/actions/NewMediaModel.kt | 2 ++ .../com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt | 2 ++ .../com/vitorpamplona/amethyst/ui/actions/NewPostView.kt | 3 +++ .../vitorpamplona/amethyst/ui/actions/NewPostViewModel.kt | 2 +- app/src/main/res/values/strings.xml | 5 ++++- 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaModel.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaModel.kt index b21629737..9827c6bb2 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaModel.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaModel.kt @@ -44,6 +44,8 @@ open class NewMediaModel : ViewModel() { selectedServer = ServersAvailable.IMGUR_NIP_94 } else if (selectedServer == ServersAvailable.NOSTRIMG) { selectedServer = ServersAvailable.NOSTRIMG_NIP_94 + } else if (selectedServer == ServersAvailable.NOSTR_BUILD) { + selectedServer = ServersAvailable.NOSTR_BUILD_NIP_94 } } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt index 477ca586d..c1489f126 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt @@ -116,6 +116,7 @@ fun ImageVideoPost(postViewModel: NewMediaModel, acc: Account) { val fileServers = listOf( Triple(ServersAvailable.IMGUR_NIP_94, stringResource(id = R.string.upload_server_imgur_nip94), stringResource(id = R.string.upload_server_imgur_nip94_explainer)), Triple(ServersAvailable.NOSTRIMG_NIP_94, stringResource(id = R.string.upload_server_nostrimg_nip94), stringResource(id = R.string.upload_server_nostrimg_nip94_explainer)), + Triple(ServersAvailable.NOSTR_BUILD_NIP_94, stringResource(id = R.string.upload_server_nostrbuild_nip94), stringResource(id = R.string.upload_server_nostrbuild_nip94_explainer)), Triple(ServersAvailable.NIP95, stringResource(id = R.string.upload_server_relays_nip95), stringResource(id = R.string.upload_server_relays_nip95_explainer)) ) @@ -192,6 +193,7 @@ fun ImageVideoPost(postViewModel: NewMediaModel, acc: Account) { if (postViewModel.selectedServer == ServersAvailable.NOSTRIMG_NIP_94 || postViewModel.selectedServer == ServersAvailable.IMGUR_NIP_94 || + postViewModel.selectedServer == ServersAvailable.NOSTR_BUILD_NIP_94 || postViewModel.selectedServer == ServersAvailable.NIP95 ) { Row( diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostView.kt index c008952dd..370bf8728 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostView.kt @@ -590,6 +590,7 @@ enum class ServersAvailable { NOSTRIMG, IMGUR_NIP_94, NOSTRIMG_NIP_94, + NOSTR_BUILD_NIP_94, NIP95 } @@ -613,6 +614,7 @@ fun ImageVideoDescription( Triple(ServersAvailable.NOSTR_BUILD, stringResource(id = R.string.upload_server_nostrbuild), stringResource(id = R.string.upload_server_nostrbuild_explainer)), Triple(ServersAvailable.IMGUR_NIP_94, stringResource(id = R.string.upload_server_imgur_nip94), stringResource(id = R.string.upload_server_imgur_nip94_explainer)), Triple(ServersAvailable.NOSTRIMG_NIP_94, stringResource(id = R.string.upload_server_nostrimg_nip94), stringResource(id = R.string.upload_server_nostrimg_nip94_explainer)), + Triple(ServersAvailable.NOSTR_BUILD_NIP_94, stringResource(id = R.string.upload_server_nostrbuild_nip94), stringResource(id = R.string.upload_server_nostrbuild_nip94_explainer)), Triple(ServersAvailable.NIP95, stringResource(id = R.string.upload_server_relays_nip95), stringResource(id = R.string.upload_server_relays_nip95_explainer)) ) @@ -742,6 +744,7 @@ fun ImageVideoDescription( if (selectedServer == ServersAvailable.NOSTRIMG_NIP_94 || selectedServer == ServersAvailable.IMGUR_NIP_94 || + selectedServer == ServersAvailable.NOSTR_BUILD_NIP_94 || selectedServer == ServersAvailable.NIP95 ) { Row( diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostViewModel.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostViewModel.kt index c5353035c..42590becc 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostViewModel.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostViewModel.kt @@ -148,7 +148,7 @@ open class NewPostViewModel : ViewModel() { context = context, contentResolver = contentResolver, onSuccess = { imageUrl, mimeType -> - if (server == ServersAvailable.IMGUR_NIP_94 || server == ServersAvailable.NOSTRIMG_NIP_94) { + if (server == ServersAvailable.IMGUR_NIP_94 || server == ServersAvailable.NOSTRIMG_NIP_94 || server == ServersAvailable.NOSTR_BUILD_NIP_94) { createNIP94Record(imageUrl, mimeType, description) } else { isUploadingImage = false diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5f2094740..cbc905e1d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -334,7 +334,7 @@ Uploads to NostrImg. NostrImg can change your image at any time nostr.build- less secure - Uploads to Nostr.build. Nostr.build can change your image at any time + Uploads to nostr.build. Nostr.build can change your image at any time Verifiable Imgur (NIP-94) Protects from Imgur modifying the content afterwards. This is a new NIP: other clients might not see the image @@ -342,6 +342,9 @@ Verifiable NostrImg (NIP-94) Protects from NostrImg modifying the content afterwards. This is a new NIP: other clients might not see the image + Verifiable Nostr.build (NIP-94) + Protects from Nostr.build modifying the content afterwards. This is a new NIP: other clients might not see the image + Your relays (NIP-95) Files are uploaded to and hosted by relays. They are free from a fixed url (third-party dependency). Make sure to have a NIP-95 relay in your relay list