diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/ImageUploader.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/ImageUploader.kt
index 212522d48..1a9226a46 100644
--- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/ImageUploader.kt
+++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/ImageUploader.kt
@@ -44,6 +44,8 @@ object ImageUploader {
NostrImgServer()
} else if (server == ServersAvailable.NOSTR_BUILD) {
NostrBuildServer()
+ } else if (server == ServersAvailable.NOSTRFILES_DEV) {
+ NostrfilesDevServer()
} else {
ImgurServer()
}
@@ -176,3 +178,14 @@ class NostrBuildServer : FileServer() {
override fun clientID() = null
}
+
+class NostrfilesDevServer : FileServer() {
+ override fun postUrl(contentType: String?) = "https://nostrfiles.dev/upload_image"
+ override fun parseUrlFromSucess(body: String): String? {
+ val tree = jacksonObjectMapper().readTree(body)
+ val url = tree?.get("url")?.asText()
+ return url
+ }
+
+ override fun clientID() = null
+}
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 d15fa0c8a..73703fe6b 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
@@ -46,6 +46,8 @@ open class NewMediaModel : ViewModel() {
selectedServer = ServersAvailable.NOSTRIMG_NIP_94
} else if (selectedServer == ServersAvailable.NOSTR_BUILD) {
selectedServer = ServersAvailable.NOSTR_BUILD_NIP_94
+ } else if (selectedServer == ServersAvailable.NOSTRFILES_DEV) {
+ selectedServer = ServersAvailable.NOSTRFILES_DEV_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 c1489f126..cb01b6e80 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
@@ -109,6 +109,10 @@ fun NewMediaView(uri: Uri, onClose: () -> Unit, postViewModel: NewMediaModel, ac
}
}
+fun isNIP94Server(selectedServer: ServersAvailable?): Boolean {
+ return selectedServer == ServersAvailable.NOSTRIMG_NIP_94 || selectedServer == ServersAvailable.IMGUR_NIP_94 || selectedServer == ServersAvailable.NOSTR_BUILD_NIP_94 || selectedServer == ServersAvailable.NOSTRFILES_DEV_NIP_94
+}
+
@Composable
fun ImageVideoPost(postViewModel: NewMediaModel, acc: Account) {
val scope = rememberCoroutineScope()
@@ -117,6 +121,7 @@ fun ImageVideoPost(postViewModel: NewMediaModel, acc: Account) {
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.NOSTRFILES_DEV_NIP_94, stringResource(id = R.string.upload_server_nostrfilesdev_nip94), stringResource(id = R.string.upload_server_nostrfilesdev_nip94_explainer)),
Triple(ServersAvailable.NIP95, stringResource(id = R.string.upload_server_relays_nip95), stringResource(id = R.string.upload_server_relays_nip95_explainer))
)
@@ -191,9 +196,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 ||
+ if (isNIP94Server(postViewModel.selectedServer) ||
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 370bf8728..571565a3b 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
@@ -588,9 +588,11 @@ enum class ServersAvailable {
IMGUR,
NOSTR_BUILD,
NOSTRIMG,
+ NOSTRFILES_DEV,
IMGUR_NIP_94,
NOSTRIMG_NIP_94,
NOSTR_BUILD_NIP_94,
+ NOSTRFILES_DEV_NIP_94,
NIP95
}
@@ -612,9 +614,11 @@ fun ImageVideoDescription(
Triple(ServersAvailable.IMGUR, stringResource(id = R.string.upload_server_imgur), stringResource(id = R.string.upload_server_imgur_explainer)),
Triple(ServersAvailable.NOSTRIMG, stringResource(id = R.string.upload_server_nostrimg), stringResource(id = R.string.upload_server_nostrimg_explainer)),
Triple(ServersAvailable.NOSTR_BUILD, stringResource(id = R.string.upload_server_nostrbuild), stringResource(id = R.string.upload_server_nostrbuild_explainer)),
+ // Triple(ServersAvailable.NOSTRFILES_DEV, stringResource(id = R.string.upload_server_nostrfilesdev), stringResource(id = R.string.upload_server_nostrfilesdev_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.NOSTRFILES_DEV_NIP_94, stringResource(id = R.string.upload_server_nostrfilesdev_nip94), stringResource(id = R.string.upload_server_nostrfilesdev_nip94_explainer)),
Triple(ServersAvailable.NIP95, stringResource(id = R.string.upload_server_relays_nip95), stringResource(id = R.string.upload_server_relays_nip95_explainer))
)
@@ -742,9 +746,7 @@ fun ImageVideoDescription(
)
}
- if (selectedServer == ServersAvailable.NOSTRIMG_NIP_94 ||
- selectedServer == ServersAvailable.IMGUR_NIP_94 ||
- selectedServer == ServersAvailable.NOSTR_BUILD_NIP_94 ||
+ if (isNIP94Server(selectedServer) ||
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 488a9ce1a..ded3776fb 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
@@ -147,7 +147,7 @@ open class NewPostViewModel : ViewModel() {
server = server,
contentResolver = contentResolver,
onSuccess = { imageUrl, mimeType ->
- if (server == ServersAvailable.IMGUR_NIP_94 || server == ServersAvailable.NOSTRIMG_NIP_94 || server == ServersAvailable.NOSTR_BUILD_NIP_94) {
+ if (isNIP94Server(server)) {
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 143f5b6b1..703bb8e12 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -336,6 +336,10 @@
nostr.build - trusted
Nostr.build can modify the file
+ nostrfiles.dev - trusted
+ Nostrfiles.dev can modify the file
+
+
Verifiable Imgur (NIP-94)
Checks if Imgur modified the file. New NIP: other clients might not see it
@@ -345,6 +349,10 @@
Verifiable Nostr.build (NIP-94)
Checks if Nostr.build modified the file. New NIP: other clients might not see it
+ Verifiable Nostrfiles.dev (NIP-94)
+ Checks if Nostrfiles.dev modified the file. New NIP: other clients might not see it
+
+
Your relays (NIP-95)
Files are hosted by your relays. New NIP: check if they support