avoid unsealing unconfirmed topics

This commit is contained in:
balzack 2025-01-11 23:12:44 -08:00
parent 2103dd6ec6
commit b4777e87b5
2 changed files with 2 additions and 5 deletions

View File

@ -414,14 +414,12 @@ export class FocusModule implements Focus {
for (const asset of files) {
for (const transform of asset.transforms) {
if (transform.type === TransformType.Thumb && transform.thumb) {
console.log("GET THUMB??");
const assetItem = {
assetId: `${assetItems.length}`,
encrytped: true,
hosting: HostingMode.Inline,
inline: await transform.thumb(),
}
console.log("GOT THUMB!!");
appAsset.push({appId: transform.appId, assetId: assetItem.assetId});
assetItems.push(assetItem);
} else if (transform.type === TransformType.Copy) {
@ -591,7 +589,6 @@ console.log("GOT THUMB!!");
await this.setRemoteChannelTopicSubject(topicId, type, updated);
}
} catch (err) {
console.log("THROWING!");
this.log.error(err);
await this.removeRemoteChannelTopic(topicId);
throw new Error('failed to add topic');
@ -866,7 +863,7 @@ console.log("THROWING!");
}
private async unsealTopicDetail(item: TopicItem): Promise<boolean> {
if (item.detail.sealed && !item.unsealedDetail && this.sealEnabled && this.channelKey && this.crypto) {
if (item.detail.status === 'confirmed' && item.detail.sealed && !item.unsealedDetail && this.sealEnabled && this.channelKey && this.crypto) {
try {
const { messageEncrypted, messageIv } = item.detail.data;
if (!messageEncrypted || !messageIv) {

View File

@ -657,7 +657,7 @@ export class StreamModule {
}
private async unsealChannelSummary(channelId: string, item: ChannelItem): Promise<boolean> {
if (item.unsealedSummary == null && item.summary.dataType === 'sealedtopic' && this.seal && this.crypto) {
if (item.unsealedSummary == null && item.summary.status === 'confirmed' && item.summary.dataType === 'sealedtopic' && this.seal && this.crypto) {
try {
if (!item.channelKey) {
const { seals } = JSON.parse(item.detail.data);