spotless
This commit is contained in:
+2
-2
@@ -27,6 +27,7 @@ import com.vitorpamplona.amethyst.service.relayClient.reqCommand.event.EventFind
|
||||
import com.vitorpamplona.amethyst.service.relayClient.reqCommand.nwc.NWCPaymentFilterAssembler
|
||||
import com.vitorpamplona.amethyst.service.relayClient.reqCommand.user.UserFinderFilterAssembler
|
||||
import com.vitorpamplona.amethyst.service.relayClient.searchCommand.SearchFilterAssembler
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.articles.datasource.ArticlesFilterAssembler
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.privateDM.datasource.ChatroomFilterAssembler
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.publicChannels.datasource.ChannelFilterAssembler
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.rooms.datasource.ChatroomListFilterAssembler
|
||||
@@ -37,11 +38,10 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.followPacks.feed.datasource
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.geohash.datasource.GeoHashFilterAssembler
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.hashtag.datasource.HashtagFilterAssembler
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.home.datasource.HomeFilterAssembler
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.articles.datasource.ArticlesFilterAssembler
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.longs.datasource.LongsFilterAssembler
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.pictures.datasource.PicturesFilterAssembler
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.products.datasource.ProductsFilterAssembler
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.polls.datasource.PollsFilterAssembler
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.products.datasource.ProductsFilterAssembler
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.profile.datasource.UserProfileFilterAssembler
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.relay.datasource.RelayFeedFilterAssembler
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.datasource.RelayInfoNip66FilterAssembler
|
||||
|
||||
@@ -64,6 +64,7 @@ import com.vitorpamplona.amethyst.ui.note.nip22Comments.ReplyCommentPostScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.AccountSessionManager
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountSwitcherAndLeftDrawerLayout
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.articles.ArticlesScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.bookmarkgroups.default.BookmarkListScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.bookmarkgroups.display.BookmarkGroupScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.bookmarkgroups.list.ListOfBookmarkGroupsScreen
|
||||
@@ -111,18 +112,17 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.list.ListOfPeopleList
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.list.metadata.FollowPackMetadataScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.list.metadata.PeopleListMetadataScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.memberEdit.FollowListAndPackAndUserScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.articles.ArticlesScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.longs.LongsScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.newUser.ImportFollowListPickFollowsScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.newUser.ImportFollowListSelectUserScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.notifications.NotificationScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.notifications.publicMessages.NewPublicMessageScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.pictures.PicturesScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.products.ProductsScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.pinnednotes.PinnedNotesScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.polls.PollPostScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.polls.PollsScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.privacy.PrivacyOptionsScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.products.ProductsScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.profile.ProfileScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.qrcode.ShowQRScreen
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.redirect.LoadRedirectScreen
|
||||
|
||||
+2
-2
@@ -27,6 +27,7 @@ import com.vitorpamplona.amethyst.model.Note
|
||||
import com.vitorpamplona.amethyst.service.checkNotInMainThread
|
||||
import com.vitorpamplona.amethyst.ui.feeds.ChannelFeedContentState
|
||||
import com.vitorpamplona.amethyst.ui.screen.TopNavFilterState
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.articles.dal.ArticlesFeedFilter
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.rooms.dal.ChatroomListKnownFeedFilter
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.rooms.dal.ChatroomListNewFeedFilter
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.discover.nip23LongForm.DiscoverLongFormFeedFilter
|
||||
@@ -40,7 +41,6 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.drafts.dal.DraftEventsFeedF
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.home.dal.HomeConversationsFeedFilter
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.home.dal.HomeLiveFilter
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.home.dal.HomeNewThreadFeedFilter
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.articles.dal.ArticlesFeedFilter
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.longs.dal.LongsFeedFilter
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.notifications.CardFeedContentState
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.notifications.NotificationSummaryState
|
||||
@@ -48,9 +48,9 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.notifications.OpenPollsStat
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.notifications.dal.NotificationFeedFilter
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.pictures.dal.PictureFeedFilter
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.polls.dal.ClosedPollsFeedFilter
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.products.dal.ProductsFeedFilter
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.polls.dal.OpenPollsFeedFilter
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.polls.dal.PollsFeedFilter
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.products.dal.ProductsFeedFilter
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.shorts.dal.ShortsFeedFilter
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.video.dal.VideoFeedFilter
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.webBookmarks.dal.WebBookmarkFeedFilter
|
||||
|
||||
+5
-4
@@ -1469,9 +1469,11 @@ class AccountViewModel(
|
||||
kind = 9,
|
||||
description = url,
|
||||
) {
|
||||
com.vitorpamplona.quartz.nip92IMeta.imeta(imeta)
|
||||
com.vitorpamplona.quartz.nip92IMeta
|
||||
.imeta(imeta)
|
||||
if (!caption.isNullOrEmpty()) {
|
||||
com.vitorpamplona.quartz.nip31Alts.alt(caption)
|
||||
com.vitorpamplona.quartz.nip31Alts
|
||||
.alt(caption)
|
||||
}
|
||||
}
|
||||
val innerEvent = account.signer.sign<com.vitorpamplona.quartz.nip01Core.core.Event>(template)
|
||||
@@ -1479,8 +1481,7 @@ class AccountViewModel(
|
||||
account.sendMarmotGroupMessage(nostrGroupId, innerEvent, relays)
|
||||
}
|
||||
|
||||
fun marmotMediaExporterSecret(nostrGroupId: String): ByteArray? =
|
||||
account.marmotManager?.mediaExporterSecret(nostrGroupId)
|
||||
fun marmotMediaExporterSecret(nostrGroupId: String): ByteArray? = account.marmotManager?.mediaExporterSecret(nostrGroupId)
|
||||
|
||||
suspend fun createMarmotGroup(nostrGroupId: String) {
|
||||
account.createMarmotGroup(nostrGroupId)
|
||||
|
||||
+1
-1
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
package com.vitorpamplona.amethyst.ui.screen.loggedIn.notifications.dal
|
||||
|
||||
import com.vitorpamplona.amethyst.commons.model.marmotGroups.MarmotGroupChatroom
|
||||
import com.vitorpamplona.amethyst.model.Account
|
||||
import com.vitorpamplona.amethyst.model.AddressableNote
|
||||
import com.vitorpamplona.amethyst.model.LocalCache
|
||||
@@ -34,7 +35,6 @@ import com.vitorpamplona.quartz.experimental.audio.track.AudioTrackEvent
|
||||
import com.vitorpamplona.quartz.experimental.forks.IForkableEvent
|
||||
import com.vitorpamplona.quartz.experimental.nipsOnNostr.NipTextEvent
|
||||
import com.vitorpamplona.quartz.experimental.zapPolls.ZapPollEvent
|
||||
import com.vitorpamplona.amethyst.commons.model.marmotGroups.MarmotGroupChatroom
|
||||
import com.vitorpamplona.quartz.nip01Core.core.AddressableEvent
|
||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.isTaggedUser
|
||||
|
||||
+10
-9
@@ -99,12 +99,13 @@ fun buildMip04IMetaTag(
|
||||
dimensions: String? = null,
|
||||
blurhash: String? = null,
|
||||
): IMetaTag =
|
||||
IMetaTagBuilder(url).apply {
|
||||
add(Mip04Fields.MIME_TYPE, Mip04MediaEncryption.canonicalizeMimeType(mimeType))
|
||||
add(Mip04Fields.FILENAME, filename)
|
||||
add(Mip04Fields.FILE_HASH, originalFileHash.toHexKey())
|
||||
add(Mip04Fields.NONCE, nonce.toHexKey())
|
||||
add(Mip04Fields.VERSION, Mip04MediaEncryption.VERSION)
|
||||
dimensions?.let { add(Mip04Fields.DIMENSIONS, it) }
|
||||
blurhash?.let { add(Mip04Fields.BLURHASH, it) }
|
||||
}.build()
|
||||
IMetaTagBuilder(url)
|
||||
.apply {
|
||||
add(Mip04Fields.MIME_TYPE, Mip04MediaEncryption.canonicalizeMimeType(mimeType))
|
||||
add(Mip04Fields.FILENAME, filename)
|
||||
add(Mip04Fields.FILE_HASH, originalFileHash.toHexKey())
|
||||
add(Mip04Fields.NONCE, nonce.toHexKey())
|
||||
add(Mip04Fields.VERSION, Mip04MediaEncryption.VERSION)
|
||||
dimensions?.let { add(Mip04Fields.DIMENSIONS, it) }
|
||||
blurhash?.let { add(Mip04Fields.BLURHASH, it) }
|
||||
}.build()
|
||||
|
||||
+33
-15
@@ -161,14 +161,22 @@ object Mip04MediaEncryption {
|
||||
val result = ByteArray(size)
|
||||
var offset = 0
|
||||
|
||||
SCHEME_BYTES.copyInto(result, offset); offset += SCHEME_BYTES.size
|
||||
NULL_SEPARATOR.copyInto(result, offset); offset += 1
|
||||
fileHash.copyInto(result, offset); offset += fileHash.size
|
||||
NULL_SEPARATOR.copyInto(result, offset); offset += 1
|
||||
mimeBytes.copyInto(result, offset); offset += mimeBytes.size
|
||||
NULL_SEPARATOR.copyInto(result, offset); offset += 1
|
||||
filenameBytes.copyInto(result, offset); offset += filenameBytes.size
|
||||
NULL_SEPARATOR.copyInto(result, offset); offset += 1
|
||||
SCHEME_BYTES.copyInto(result, offset)
|
||||
offset += SCHEME_BYTES.size
|
||||
NULL_SEPARATOR.copyInto(result, offset)
|
||||
offset += 1
|
||||
fileHash.copyInto(result, offset)
|
||||
offset += fileHash.size
|
||||
NULL_SEPARATOR.copyInto(result, offset)
|
||||
offset += 1
|
||||
mimeBytes.copyInto(result, offset)
|
||||
offset += mimeBytes.size
|
||||
NULL_SEPARATOR.copyInto(result, offset)
|
||||
offset += 1
|
||||
filenameBytes.copyInto(result, offset)
|
||||
offset += filenameBytes.size
|
||||
NULL_SEPARATOR.copyInto(result, offset)
|
||||
offset += 1
|
||||
suffix.copyInto(result, offset)
|
||||
|
||||
return result
|
||||
@@ -190,12 +198,18 @@ object Mip04MediaEncryption {
|
||||
val result = ByteArray(size)
|
||||
var offset = 0
|
||||
|
||||
SCHEME_BYTES.copyInto(result, offset); offset += SCHEME_BYTES.size
|
||||
NULL_SEPARATOR.copyInto(result, offset); offset += 1
|
||||
fileHash.copyInto(result, offset); offset += fileHash.size
|
||||
NULL_SEPARATOR.copyInto(result, offset); offset += 1
|
||||
mimeBytes.copyInto(result, offset); offset += mimeBytes.size
|
||||
NULL_SEPARATOR.copyInto(result, offset); offset += 1
|
||||
SCHEME_BYTES.copyInto(result, offset)
|
||||
offset += SCHEME_BYTES.size
|
||||
NULL_SEPARATOR.copyInto(result, offset)
|
||||
offset += 1
|
||||
fileHash.copyInto(result, offset)
|
||||
offset += fileHash.size
|
||||
NULL_SEPARATOR.copyInto(result, offset)
|
||||
offset += 1
|
||||
mimeBytes.copyInto(result, offset)
|
||||
offset += mimeBytes.size
|
||||
NULL_SEPARATOR.copyInto(result, offset)
|
||||
offset += 1
|
||||
filenameBytes.copyInto(result, offset)
|
||||
|
||||
return result
|
||||
@@ -208,7 +222,11 @@ object Mip04MediaEncryption {
|
||||
* - Strip parameters (e.g., "; charset=utf-8")
|
||||
*/
|
||||
fun canonicalizeMimeType(mimeType: String): String =
|
||||
mimeType.trim().lowercase().substringBefore(";").trim()
|
||||
mimeType
|
||||
.trim()
|
||||
.lowercase()
|
||||
.substringBefore(";")
|
||||
.trim()
|
||||
}
|
||||
|
||||
class Mip04EncryptionResult(
|
||||
|
||||
Reference in New Issue
Block a user