Add indexer pubkey, fix all subscription prefixes

This commit is contained in:
franzap
2026-03-31 15:19:23 -03:00
parent 299ab59363
commit 3b8435c909
19 changed files with 39 additions and 14 deletions
+6
View File
@@ -5,6 +5,12 @@ const kZapstoreAppIdentifier = 'dev.zapstore.app';
const kZapstorePubkey =
'78ce6faa72264387284e647ba6938995735ec8c7d5c5a65737e55130f026307d';
/// Additional trusted relay pubkeys for relay-signed apps
const kTrustedRelayPubkeys = {
kZapstorePubkey,
'fd2d438d5c0b419179b67ce4e8ae72a170aeca3045acccbe7661a5e1b5f0b7b1',
};
/// Franzap's public key for curation sets
const kFranzapPubkey =
'726a1e261cc6474674e8285e3951b3bb139be9a773d1acf49dc868db861a1c11';
+1
View File
@@ -312,6 +312,7 @@ Future<void> onSignInSuccess(Ref ref) async {
await storage.query(
RequestFilter<ContactList>(authors: {pubkey}).toRequest(),
source: const RemoteSource(relays: 'social', stream: false),
subscriptionPrefix: 'app-contact-list',
);
}
+1
View File
@@ -179,6 +179,7 @@ class _AppDetailContent extends HookConsumerWidget {
relays: {'social', 'vertex'},
cachedFor: Duration(hours: 2),
),
subscriptionPrefix: 'app-detail-profile',
),
);
final author = switch (authorState) {
+1
View File
@@ -149,6 +149,7 @@ class _AppStackContent extends HookConsumerWidget {
relays: {'social', 'vertex'},
cachedFor: Duration(hours: 2),
),
subscriptionPrefix: 'app-stack-profile',
),
);
final author = authorState.models.firstOrNull;
+1
View File
@@ -112,6 +112,7 @@ class _AuthenticationSection extends ConsumerWidget {
stream: false,
cachedFor: Duration(hours: 2),
),
subscriptionPrefix: 'app-profile-detail',
),
);
final profile = profileState.models.firstOrNull;
+7 -5
View File
@@ -30,6 +30,7 @@ class UserScreen extends HookConsumerWidget {
relays: {'social', 'vertex'},
cachedFor: Duration(hours: 2),
),
subscriptionPrefix: 'app-user-profile',
),
);
final profile = profileState.models.firstOrNull;
@@ -55,8 +56,8 @@ class UserScreen extends HookConsumerWidget {
),
);
// For Zapstore pubkey, only show Zapstore's own apps (not relay-signed ones)
final apps = pubkey == kZapstorePubkey
// For trusted relay pubkeys, only show Zapstore's own apps (not relay-signed ones)
final apps = kTrustedRelayPubkeys.contains(pubkey)
? userAppsState.models.where((a) => a.isZapstoreApp).toList()
: userAppsState.models;
@@ -75,7 +76,7 @@ class UserScreen extends HookConsumerWidget {
),
},
source: LocalAndRemoteSource(stream: false, relays: 'social'),
subscriptionPrefix: 'user-screen-stacks',
subscriptionPrefix: 'app-user-stacks',
schemaFilter: appStackEventFilter,
),
);
@@ -210,7 +211,7 @@ class _UserZapsList extends HookConsumerWidget {
query<Zap>(
tags: allAppTags,
source: const LocalAndRemoteSource(relays: 'social'),
subscriptionPrefix: 'user-screen-app-zaps',
subscriptionPrefix: 'app-user-app-zaps',
),
);
@@ -220,7 +221,7 @@ class _UserZapsList extends HookConsumerWidget {
query<Zap>(
tags: {'#e': metadataIds},
source: const LocalAndRemoteSource(relays: 'social'),
subscriptionPrefix: 'user-screen-metadata-zaps',
subscriptionPrefix: 'app-user-metadata-zaps',
),
)
: null;
@@ -253,6 +254,7 @@ class _UserZapsList extends HookConsumerWidget {
relays: {'social', 'vertex'},
cachedFor: Duration(hours: 2),
),
subscriptionPrefix: 'app-user-profiles',
),
);
final profilesMap = {for (final p in profilesState.models) p.pubkey: p};
+1 -1
View File
@@ -25,7 +25,7 @@ final bookmarksProvider = FutureProvider<Set<String>>((ref) async {
relays: 'social',
stream: false,
),
subscriptionPrefix: 'user-saved-apps',
subscriptionPrefix: 'app-user-saved-apps',
),
);
@@ -1329,6 +1329,7 @@ abstract class PackageManager extends StateNotifier<PackageManagerState> {
try {
final results = await storage.query(
RequestFilter<FileMetadata>(ids: {metadataId}).toRequest(),
subscriptionPrefix: 'app-file-metadata',
);
if (results.isNotEmpty) return results.first;
} catch (_) {}
@@ -1340,6 +1341,7 @@ abstract class PackageManager extends StateNotifier<PackageManagerState> {
try {
final results = await storage.query(
RequestFilter<FileMetadata>(search: hash).toRequest(),
subscriptionPrefix: 'app-file-metadata-search',
);
if (results.isNotEmpty) return results.first;
} catch (_) {}
+1 -1
View File
@@ -215,7 +215,7 @@ class UpdatePollerNotifier extends Notifier<UpdatePollerState> {
cachedFor: Duration(hours: 2),
stream: false,
),
subscriptionPrefix: 'updates-profiles',
subscriptionPrefix: 'app-updates-profiles',
),
);
}
+2 -2
View File
@@ -19,8 +19,8 @@ extension AppExt on App {
/// Whether this app is one of Zapstore's own apps
bool get isZapstoreApp => identifier == kZapstoreAppIdentifier;
/// Whether this app is signed by Zapstore pubkey
bool get isSignedByZapstore => pubkey == kZapstorePubkey;
/// Whether this app is signed by a trusted relay pubkey
bool get isSignedByZapstore => kTrustedRelayPubkeys.contains(pubkey);
/// Whether this app is "relay signed" - indexed by Zapstore but not a Zapstore app itself
bool get isRelaySigned => isSignedByZapstore && !isZapstoreApp;
+1
View File
@@ -181,6 +181,7 @@ class AppCard extends HookConsumerWidget {
relays: {'social', 'vertex'},
cachedFor: Duration(hours: 2),
),
subscriptionPrefix: 'app-card-profile',
),
);
+2 -1
View File
@@ -296,7 +296,7 @@ class _ZappersListSection extends ConsumerWidget {
'#e': {metadataId},
},
source: const LocalAndRemoteSource(relays: 'social'),
subscriptionPrefix: 'metadata-zaps',
subscriptionPrefix: 'app-metadata-zaps',
),
)
: null;
@@ -327,6 +327,7 @@ class _ZappersListSection extends ConsumerWidget {
relays: {'social', 'vertex'},
cachedFor: Duration(hours: 2),
),
subscriptionPrefix: 'app-zapper-profiles',
),
);
final profilesMap = {
+1
View File
@@ -122,6 +122,7 @@ class AppStackContainer extends HookConsumerWidget {
stream: false,
cachedFor: Duration(hours: 1),
),
subscriptionPrefix: 'app-stack-contacts',
),
)
: null;
+1 -1
View File
@@ -289,7 +289,7 @@ class _AddToStackDialogSignedIn extends HookConsumerWidget {
stack.apps.query(source: const LocalSource()),
},
source: const LocalAndRemoteSource(relays: 'social', stream: false),
subscriptionPrefix: 'user-stacks-dialog',
subscriptionPrefix: 'app-user-stacks-dialog',
// Filter at query level: exclude saved-apps stack and stacks with no app references
schemaFilter: (event) {
final tags = event['tags'] as List?;
+3 -1
View File
@@ -73,7 +73,7 @@ class StackCommentsSection extends HookConsumerWidget {
'#A': {stack.id},
},
source: LocalAndRemoteSource(stream: true, relays: 'social'),
subscriptionPrefix: 'stack-comments',
subscriptionPrefix: 'app-stack-comments',
and: (comment) => {comment.replies.query()},
),
);
@@ -274,6 +274,7 @@ class _ThreadedCommentCard extends HookConsumerWidget {
stream: false,
cachedFor: Duration(hours: 2),
),
subscriptionPrefix: 'app-comment-profile',
),
);
final author = authorState.models.firstOrNull;
@@ -718,6 +719,7 @@ class _ReplyComposer extends HookConsumerWidget {
stream: false,
cachedFor: Duration(hours: 2),
),
subscriptionPrefix: 'app-reply-profile',
),
);
final parentAuthor = switch (parentAuthorState) {
+1
View File
@@ -393,6 +393,7 @@ class ProfileEntityWidget extends ConsumerWidget {
relays: {'social', 'vertex'},
cachedFor: Duration(hours: 2),
),
subscriptionPrefix: 'app-note-profile',
),
);
+1
View File
@@ -25,6 +25,7 @@ class InstallAlertDialog extends HookConsumerWidget {
relays: {'social', 'vertex'},
cachedFor: Duration(hours: 2),
),
subscriptionPrefix: 'app-install-profile',
),
);
final publisher = switch (publisherState) {
@@ -372,6 +372,7 @@ class LatestReleasesNotifier extends StateNotifier<LatestReleasesState> {
},
).toRequest(),
source: const LocalAndRemoteSource(stream: false),
subscriptionPrefix: 'app-latest-older',
);
if (olderPage.isNotEmpty) {
@@ -384,6 +385,7 @@ class LatestReleasesNotifier extends StateNotifier<LatestReleasesState> {
.toList(),
),
source: const RemoteSource(stream: false),
subscriptionPrefix: 'app-latest-releases',
);
// Load file metadata for the releases (old format)
@@ -396,6 +398,7 @@ class LatestReleasesNotifier extends StateNotifier<LatestReleasesState> {
.toList(),
),
source: const RemoteSource(stream: false),
subscriptionPrefix: 'app-latest-metadata',
);
// Load software assets for the releases (new format)
await ref.storage.query(
@@ -406,6 +409,7 @@ class LatestReleasesNotifier extends StateNotifier<LatestReleasesState> {
.toList(),
),
source: const RemoteSource(stream: false),
subscriptionPrefix: 'app-latest-assets',
);
}
@@ -230,7 +230,7 @@ class RelevantWhoFollowContainer extends HookConsumerWidget {
authors: {signedInPubkey},
limit: 1,
source: const LocalAndRemoteSource(relays: 'social', stream: false),
subscriptionPrefix: 'user-contacts',
subscriptionPrefix: 'app-user-contacts',
),
);
@@ -378,7 +378,7 @@ final relevantWhoFollowProvider = FutureProvider.autoDispose
final profiles = await storage.query<Profile>(
Request([RequestFilter(authors: response.pubkeys)]),
source: const LocalAndRemoteSource(relays: 'social', stream: false),
subscriptionPrefix: 'verify-reputation-profiles',
subscriptionPrefix: 'app-reputation-profiles',
);
return profiles;
}