From 09bad798705bcbe53df6b779d9627ba8f69ff3b5 Mon Sep 17 00:00:00 2001 From: Believethehype Date: Sun, 9 Apr 2023 05:31:31 +0200 Subject: [PATCH 1/6] #footstr --- .../amethyst/model/HashtagIcon.kt | 2 +- app/src/main/res/drawable/footstr.xml | 113 ++++++++++++++++++ 2 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/drawable/footstr.xml diff --git a/app/src/main/java/com/vitorpamplona/amethyst/model/HashtagIcon.kt b/app/src/main/java/com/vitorpamplona/amethyst/model/HashtagIcon.kt index f322db5da..2663a9ff8 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/model/HashtagIcon.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/model/HashtagIcon.kt @@ -14,7 +14,7 @@ fun checkForHashtagWithIcon(tag: String): HashtagIcon? { "plebs", "pleb", "plebchain" -> HashtagIcon(R.drawable.plebs, "Pleb", Color.Unspecified, Modifier.padding(2.dp, 2.dp, 0.dp, 1.dp)) "coffee", "coffeechain" -> HashtagIcon(R.drawable.coffee, "Coffee", Color.Unspecified, Modifier.padding(2.dp, 2.dp, 0.dp, 0.dp)) "skullofsatoshi" -> HashtagIcon(R.drawable.skull, "SkullofSatoshi", Color.Unspecified, Modifier.padding(2.dp, 1.dp, 0.dp, 0.dp)) - + "footstr" -> HashtagIcon(R.drawable.footstr, "Footstr", Color.Unspecified, Modifier.padding(0.dp, 1.dp, 0.dp, 0.dp)) else -> null } } diff --git a/app/src/main/res/drawable/footstr.xml b/app/src/main/res/drawable/footstr.xml new file mode 100644 index 000000000..f1150b179 --- /dev/null +++ b/app/src/main/res/drawable/footstr.xml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 9d1ab5a9b8d9b4d49d7b50897f91fdfd03b26c2a Mon Sep 17 00:00:00 2001 From: Believethehype Date: Sun, 9 Apr 2023 23:37:23 +0200 Subject: [PATCH 2/6] introduce zap types, implemented non-zaps in custom zap dialog Non-Zaps allow to tip the author of a note without using the zap mechanism (no record on the note) --- .../amethyst/service/model/LnZapEvent.kt | 7 ++++ .../amethyst/ui/note/PollNote.kt | 16 +++++--- .../amethyst/ui/note/ReactionsRow.kt | 10 +++-- .../amethyst/ui/note/ZapCustomDialog.kt | 38 ++++++++++++++----- .../ui/screen/loggedIn/AccountViewModel.kt | 12 ++++-- 5 files changed, 62 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/service/model/LnZapEvent.kt b/app/src/main/java/com/vitorpamplona/amethyst/service/model/LnZapEvent.kt index ad83690e9..ca8eedee6 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/service/model/LnZapEvent.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/service/model/LnZapEvent.kt @@ -69,4 +69,11 @@ class LnZapEvent( companion object { const val kind = 9735 } + + enum class ZapType() { + PUBLIC, + PRIVATE, // not implemented + ANONYMOUS, // not implemented + NONZAP + } } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/PollNote.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/PollNote.kt index e46645a34..6a56c847f 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/PollNote.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/PollNote.kt @@ -31,6 +31,7 @@ import androidx.compose.ui.window.Popup import androidx.navigation.NavController import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.model.Note +import com.vitorpamplona.amethyst.service.model.LnZapEvent import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange @@ -251,7 +252,8 @@ fun ZapVote( scope.launch(Dispatchers.Main) { zappingProgress = it } - } + }, + type = LnZapEvent.ZapType.PUBLIC ) } } else { @@ -378,7 +380,8 @@ fun FilteredZapAmountChoicePopup( zapMessage, context, onError, - onProgress + onProgress, + LnZapEvent.ZapType.PUBLIC ) onDismiss() } @@ -403,7 +406,8 @@ fun FilteredZapAmountChoicePopup( zapMessage, context, onError, - onProgress + onProgress, + LnZapEvent.ZapType.PUBLIC ) onDismiss() } @@ -495,7 +499,8 @@ fun ZapVoteAmountChoicePopup( "", context, onError, - onProgress + onProgress, + LnZapEvent.ZapType.PUBLIC ) onDismiss() } @@ -520,7 +525,8 @@ fun ZapVoteAmountChoicePopup( "", context, onError, - onProgress + onProgress, + LnZapEvent.ZapType.PUBLIC ) onDismiss() } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt index e90641a38..77e7ddfee 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt @@ -55,6 +55,7 @@ import coil.request.CachePolicy import coil.request.ImageRequest import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.model.Note +import com.vitorpamplona.amethyst.service.model.LnZapEvent import com.vitorpamplona.amethyst.ui.actions.NewPostView import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange @@ -363,7 +364,8 @@ fun ZapReaction( scope.launch(Dispatchers.Main) { zappingProgress = it } - } + }, + type = LnZapEvent.ZapType.PUBLIC ) } } else if (account.zapAmountChoices.size > 1) { @@ -559,7 +561,8 @@ fun ZapAmountChoicePopup( zapMessage, context, onError, - onProgress + onProgress, + LnZapEvent.ZapType.PUBLIC ) onDismiss() } @@ -584,7 +587,8 @@ fun ZapAmountChoicePopup( zapMessage, context, onError, - onProgress + onProgress, + LnZapEvent.ZapType.PUBLIC ) onDismiss() } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt index b0ea32a75..2fcde04b3 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt @@ -5,12 +5,7 @@ import androidx.compose.foundation.layout.* import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.* -import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.rememberCoroutineScope -import androidx.compose.runtime.setValue +import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -27,15 +22,16 @@ import androidx.lifecycle.viewmodel.compose.viewModel import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.model.Note +import com.vitorpamplona.amethyst.service.model.LnZapEvent import com.vitorpamplona.amethyst.ui.actions.CloseButton import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel +import com.vitorpamplona.amethyst.ui.screen.loggedIn.TextSpinner import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch class ZapOptionstViewModel : ViewModel() { private var account: Account? = null - - var customAmount by mutableStateOf(TextFieldValue("1000")) + var customAmount by mutableStateOf(TextFieldValue("21")) var customMessage by mutableStateOf(TextFieldValue("")) fun load(account: Account) { @@ -63,11 +59,21 @@ fun ZapCustomDialog(onClose: () -> Unit, account: Account, accountViewModel: Acc val context = LocalContext.current val scope = rememberCoroutineScope() val postViewModel: ZapOptionstViewModel = viewModel() - + postViewModel.load(account) LaunchedEffect(account) { postViewModel.load(account) } + var zappingProgress by remember { mutableStateOf(0f) } + + val zapTypes = listOf( + Pair(LnZapEvent.ZapType.PUBLIC, "Public"), + Pair(LnZapEvent.ZapType.NONZAP, "Non-Zap") + ) + + val zapOptions = zapTypes.map { it.second } + var selectedZapType by remember { mutableStateOf(zapTypes[0]) } + Dialog( onDismissRequest = { onClose() }, properties = DialogProperties( @@ -98,6 +104,7 @@ fun ZapCustomDialog(onClose: () -> Unit, account: Account, accountViewModel: Acc postViewModel.customMessage.text, context, onError = { + zappingProgress = 0f scope.launch { Toast .makeText(context, it, Toast.LENGTH_SHORT).show() @@ -105,8 +112,10 @@ fun ZapCustomDialog(onClose: () -> Unit, account: Account, accountViewModel: Acc }, onProgress = { scope.launch(Dispatchers.Main) { + zappingProgress = it } - } + }, + type = selectedZapType.first ) } onClose() @@ -174,6 +183,15 @@ fun ZapCustomDialog(onClose: () -> Unit, account: Account, accountViewModel: Acc .weight(1f) ) } + TextSpinner( + label = "Zap Type", + placeholder = "Public", + options = zapOptions, + onSelect = { + selectedZapType = zapTypes[it] + }, + modifier = Modifier.fillMaxWidth() + ) } } } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt index e9f777be1..513c5b150 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt @@ -14,6 +14,7 @@ import com.vitorpamplona.amethyst.model.AccountState import com.vitorpamplona.amethyst.model.Note import com.vitorpamplona.amethyst.model.User import com.vitorpamplona.amethyst.service.lnurl.LightningAddressResolver +import com.vitorpamplona.amethyst.service.model.LnZapEvent import com.vitorpamplona.amethyst.service.model.ReportEvent import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay @@ -52,7 +53,7 @@ class AccountViewModel(private val account: Account) : ViewModel() { account.delete(account.boostsTo(note)) } - fun zap(note: Note, amount: Long, pollOption: Int?, message: String, context: Context, onError: (String) -> Unit, onProgress: (percent: Float) -> Unit) { + fun zap(note: Note, amount: Long, pollOption: Int?, message: String, context: Context, onError: (String) -> Unit, onProgress: (percent: Float) -> Unit, type: LnZapEvent.ZapType) { val lud16 = note.author?.info?.lud16?.trim() ?: note.author?.info?.lud06?.trim() if (lud16.isNullOrBlank()) { @@ -60,7 +61,12 @@ class AccountViewModel(private val account: Account) : ViewModel() { return } - val zapRequest = account.createZapRequestFor(note, pollOption, message) + var zapRequest = account.createZapRequestFor(note, pollOption, message) + var zapRequestJson = zapRequest?.toJson() + + if (type == LnZapEvent.ZapType.NONZAP) { + zapRequestJson = "" + } onProgress(0.10f) @@ -68,7 +74,7 @@ class AccountViewModel(private val account: Account) : ViewModel() { lud16, amount, message, - zapRequest?.toJson(), + zapRequestJson, onSuccess = { onProgress(0.7f) if (account.hasWalletConnectSetup()) { From 726d04f0f4f5eb069d97a9e049c65b7b30d1986a Mon Sep 17 00:00:00 2001 From: Believethehype Date: Sun, 9 Apr 2023 23:39:32 +0200 Subject: [PATCH 3/6] Update HashtagIcon.kt --- .../main/java/com/vitorpamplona/amethyst/model/HashtagIcon.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/model/HashtagIcon.kt b/app/src/main/java/com/vitorpamplona/amethyst/model/HashtagIcon.kt index 2663a9ff8..082f1df69 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/model/HashtagIcon.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/model/HashtagIcon.kt @@ -14,7 +14,6 @@ fun checkForHashtagWithIcon(tag: String): HashtagIcon? { "plebs", "pleb", "plebchain" -> HashtagIcon(R.drawable.plebs, "Pleb", Color.Unspecified, Modifier.padding(2.dp, 2.dp, 0.dp, 1.dp)) "coffee", "coffeechain" -> HashtagIcon(R.drawable.coffee, "Coffee", Color.Unspecified, Modifier.padding(2.dp, 2.dp, 0.dp, 0.dp)) "skullofsatoshi" -> HashtagIcon(R.drawable.skull, "SkullofSatoshi", Color.Unspecified, Modifier.padding(2.dp, 1.dp, 0.dp, 0.dp)) - "footstr" -> HashtagIcon(R.drawable.footstr, "Footstr", Color.Unspecified, Modifier.padding(0.dp, 1.dp, 0.dp, 0.dp)) else -> null } } From 1c65334b91f636d61dd20a80e1e1a09565f5e93f Mon Sep 17 00:00:00 2001 From: Believethehype Date: Sun, 9 Apr 2023 23:39:57 +0200 Subject: [PATCH 4/6] Delete footstr.xml --- app/src/main/res/drawable/footstr.xml | 113 -------------------------- 1 file changed, 113 deletions(-) delete mode 100644 app/src/main/res/drawable/footstr.xml diff --git a/app/src/main/res/drawable/footstr.xml b/app/src/main/res/drawable/footstr.xml deleted file mode 100644 index f1150b179..000000000 --- a/app/src/main/res/drawable/footstr.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 94c41e0c6dcd51e3df78d7307816aa58c6d5bd24 Mon Sep 17 00:00:00 2001 From: Believethehype Date: Fri, 23 Jun 2023 16:10:04 +0200 Subject: [PATCH 5/6] added NIP98 Support, Added nostrcheck.me hoster --- .../vitorpamplona/amethyst/ServiceManager.kt | 2 + .../amethyst/ui/actions/ImageUploader.kt | 81 +++++++++++++++---- .../amethyst/ui/actions/NewMediaModel.kt | 2 + .../amethyst/ui/actions/NewPostView.kt | 4 + .../ui/screen/loggedIn/ChannelScreen.kt | 2 + app/src/main/res/values/strings.xml | 8 ++ 6 files changed, 85 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ServiceManager.kt b/app/src/main/java/com/vitorpamplona/amethyst/ServiceManager.kt index 3d2c1ff70..87a443de6 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ServiceManager.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ServiceManager.kt @@ -23,6 +23,7 @@ import com.vitorpamplona.amethyst.service.NostrThreadDataSource import com.vitorpamplona.amethyst.service.NostrUserProfileDataSource import com.vitorpamplona.amethyst.service.NostrVideoDataSource import com.vitorpamplona.amethyst.service.relays.Client +import com.vitorpamplona.amethyst.ui.actions.ImageUploader object ServiceManager { private var account: Account? = null @@ -66,6 +67,7 @@ object ServiceManager { NostrHomeDataSource.account = myAccount NostrChatroomListDataSource.account = myAccount NostrVideoDataSource.account = myAccount + ImageUploader.account = myAccount // Notification Elements NostrHomeDataSource.start() 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 c535d9934..cecca1b9f 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 @@ -7,19 +7,24 @@ import android.webkit.MimeTypeMap import androidx.core.net.toFile import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.vitorpamplona.amethyst.BuildConfig +import com.vitorpamplona.amethyst.model.Account +import com.vitorpamplona.amethyst.model.toHexKey import com.vitorpamplona.amethyst.service.HttpClient +import com.vitorpamplona.amethyst.service.model.Event import okhttp3.* import okhttp3.MediaType.Companion.toMediaType import okio.BufferedSink +import okio.IOException import okio.source -import java.io.IOException import java.io.InputStream +import java.security.MessageDigest +import java.util.Base64 val charPool: List = ('a'..'z') + ('A'..'Z') + ('0'..'9') fun randomChars() = List(16) { charPool.random() }.joinToString("") - object ImageUploader { + lateinit var account: Account fun uploadImage( uri: Uri, @@ -33,12 +38,11 @@ object ImageUploader { val myContentType = contentType ?: contentResolver.getType(uri) val imageInputStream = contentResolver.openInputStream(uri) - val length = size - ?: contentResolver.query(uri, null, null, null, null)?.use { - it.moveToFirst() - val sizeIndex = it.getColumnIndex(OpenableColumns.SIZE) - it.getLong(sizeIndex) - } ?: kotlin.runCatching { + val length = size ?: contentResolver.query(uri, null, null, null, null)?.use { + it.moveToFirst() + val sizeIndex = it.getColumnIndex(OpenableColumns.SIZE) + it.getLong(sizeIndex) + } ?: kotlin.runCatching { uri.toFile().length() }.getOrNull() ?: 0 @@ -58,6 +62,9 @@ object ImageUploader { ServersAvailable.NOSTRFILES_DEV, ServersAvailable.NOSTRFILES_DEV_NIP_94 -> { NostrFilesDevServer() } + ServersAvailable.NOSTRCHECK_ME, ServersAvailable.NOSTRCHECK_ME_NIP_94 -> { + NostrCheckMeServer() + } else -> { NostrBuildServer() } @@ -99,7 +106,7 @@ object ImageUploader { ) .build() - server.clientID()?.let { + server.clientID(requestBody.toString())?.let { requestBuilder.addHeader("Authorization", it) } @@ -133,6 +140,18 @@ object ImageUploader { } }) } + + fun NIP98Header(url: String, method: String, body: String): String { + var hash = "" + if (body != "") { + val sha256 = MessageDigest.getInstance("SHA-256") + hash = sha256.digest(body.toByteArray()).toHexKey() + } + var tags = listOf(listOf("u", url), listOf("method", method), listOf("payload", hash)) + var noteJson = (Event.create(account.loggedIn.privKey!!, 27235, tags, "")).toJson() + val encodedNIP98Event: String = Base64.getEncoder().encodeToString(noteJson.toByteArray()) + return "Nostr " + encodedNIP98Event + } } abstract class FileServer { @@ -140,7 +159,7 @@ abstract class FileServer { abstract fun parseUrlFromSuccess(body: String): String? abstract fun inputParameterName(contentType: String?): String - open fun clientID(): String? = null + open fun clientID(info: String): String? = null } class NostrImgServer : FileServer() { @@ -156,7 +175,7 @@ class NostrImgServer : FileServer() { return contentType?.toMediaType()?.toString()?.split("/")?.get(0) ?: "image" } - override fun clientID() = null + override fun clientID(info: String) = null } class ImgurServer : FileServer() { @@ -175,7 +194,7 @@ class ImgurServer : FileServer() { return contentType?.toMediaType()?.toString()?.split("/")?.get(0) ?: "image" } - override fun clientID() = "Client-ID e6aea87296f3f96" + override fun clientID(info: String) = "Client-ID e6aea87296f3f96" } class NostrBuildServer : FileServer() { @@ -189,7 +208,7 @@ class NostrBuildServer : FileServer() { return "fileToUpload" } - override fun clientID() = null + override fun clientID(info: String) = null } class NostrFilesDevServer : FileServer() { @@ -203,5 +222,39 @@ class NostrFilesDevServer : FileServer() { return "file" } - override fun clientID() = null + override fun clientID(info: String) = null +} + +class NostrCheckMeServer : FileServer() { + override fun postUrl(contentType: String?) = "https://nostrcheck.me/api/v1/media" + override fun parseUrlFromSuccess(body: String): String? { + val tree = jacksonObjectMapper().readTree(body) + val url = tree?.get("url")?.asText() + var id = tree?.get("id")?.asText() + var isCompleted = false + + val client = OkHttpClient() + var requrl = "https://nostrcheck.me/api/v1/media?id=" + id // + "&apikey=26d075787d261660682fb9d20dbffa538c708b1eda921d0efa2be95fbef4910a" + + val request = Request.Builder() + .url(requrl) + .addHeader("Authorization", ImageUploader.NIP98Header(requrl, "GET", "")) + .get() + .build() + + while (!isCompleted) { + val response = client.newCall(request).execute() + val body = response.body?.string() + val tree = jacksonObjectMapper().readTree(body) + isCompleted = tree?.get("status")?.asText() == "completed" + // Maybe add some wait time here + } + return url + } + + override fun inputParameterName(contentType: String?): String { + return "mediafile" + } + + override fun clientID(body: String) = ImageUploader.NIP98Header("https://nostrcheck.me/api/v1/media", "POST", body) } 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 ac3a7b403..63cee37b9 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 @@ -50,6 +50,8 @@ open class NewMediaModel : ViewModel() { selectedServer = ServersAvailable.NOSTR_BUILD_NIP_94 } else if (selectedServer == ServersAvailable.NOSTRFILES_DEV) { selectedServer = ServersAvailable.NOSTRFILES_DEV_NIP_94 + } else if (selectedServer == ServersAvailable.NOSTRCHECK_ME) { + selectedServer = ServersAvailable.NOSTRCHECK_ME_NIP_94 } } 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 c40e42a44..7969f9f2b 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 @@ -797,11 +797,13 @@ enum class ServersAvailable { NOSTR_BUILD, NOSTRIMG, NOSTRFILES_DEV, + NOSTRCHECK_ME, // IMGUR_NIP_94, NOSTRIMG_NIP_94, NOSTR_BUILD_NIP_94, NOSTRFILES_DEV_NIP_94, + NOSTRCHECK_ME_NIP_94, NIP95 } @@ -824,10 +826,12 @@ fun ImageVideoDescription( 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.NOSTRCHECK_ME, stringResource(id = R.string.upload_server_nostrcheckme), stringResource(id = R.string.upload_server_nostrcheckme_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.NOSTRCHECK_ME_NIP_94, stringResource(id = R.string.upload_server_nostrcheckme_nip94), stringResource(id = R.string.upload_server_nostrcheckme_nip94_explainer)), Triple(ServersAvailable.NIP95, stringResource(id = R.string.upload_server_relays_nip95), stringResource(id = R.string.upload_server_relays_nip95_explainer)) ) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChannelScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChannelScreen.kt index 43c89d4c4..0b28e25ed 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChannelScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChannelScreen.kt @@ -379,9 +379,11 @@ fun EditFieldRow( ServersAvailable.NOSTR_BUILD -> ServersAvailable.NOSTR_BUILD ServersAvailable.NOSTRIMG -> ServersAvailable.NOSTRIMG ServersAvailable.NOSTRFILES_DEV -> ServersAvailable.NOSTRFILES_DEV + ServersAvailable.NOSTRCHECK_ME -> ServersAvailable.NOSTRCHECK_ME ServersAvailable.NOSTR_BUILD_NIP_94 -> ServersAvailable.NOSTR_BUILD ServersAvailable.NOSTRIMG_NIP_94 -> ServersAvailable.NOSTRIMG ServersAvailable.NOSTRFILES_DEV_NIP_94 -> ServersAvailable.NOSTRFILES_DEV + ServersAvailable.NOSTRCHECK_ME_NIP_94 -> ServersAvailable.NOSTRCHECK_ME ServersAvailable.NIP95 -> ServersAvailable.NOSTR_BUILD } } else { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f78d10a78..c061fab0e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -338,6 +338,9 @@ nostrfiles.dev - trusted Nostrfiles.dev can modify the file + nostrcheck.me - trusted + nostrcheck.me can modify the file + Verifiable Imgur (NIP-94) Checks if Imgur modified the file. New NIP: other clients might not see it @@ -351,6 +354,11 @@ Verifiable Nostrfiles.dev (NIP-94) Checks if Nostrfiles.dev modified the file. New NIP: other clients might not see it + Verifiable Nostrcheck.me (NIP-94) + Checks if Nostrcheck.me 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 From bfc16d08788c914fa051228213d5248944d49198 Mon Sep 17 00:00:00 2001 From: Believethehype Date: Fri, 23 Jun 2023 16:39:40 +0200 Subject: [PATCH 6/6] added some wait time before updating status --- .../com/vitorpamplona/amethyst/ui/actions/ImageUploader.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 cecca1b9f..aa10b7fb6 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 @@ -247,7 +247,11 @@ class NostrCheckMeServer : FileServer() { val body = response.body?.string() val tree = jacksonObjectMapper().readTree(body) isCompleted = tree?.get("status")?.asText() == "completed" - // Maybe add some wait time here + try { + Thread.sleep(500) + } catch (e: InterruptedException) { + e.printStackTrace() + } } return url }