diff --git a/packages/repco-core/package.json b/packages/repco-core/package.json index ad0a3441..1b16dc3e 100644 --- a/packages/repco-core/package.json +++ b/packages/repco-core/package.json @@ -27,14 +27,14 @@ "iso8601-duration": "^2.1.1", "level": "^8.0.0", "multiformats": "^11.0.2", - "repco-common": "*", "repco-activitypub": "*", + "repco-common": "*", "repco-prisma": "*", "rss-parser": "^3.12.0", "speedometer": "^1.1.0", "streamx": "^2.12.5", "uint8arrays": "^4.0.3", - "undici": "^5.28.0", + "undici": "^5.28.2", "vscode-uri": "^3.0.6", "zod": "^3.19" }, diff --git a/packages/repco-core/src/datasources/activitypub.ts b/packages/repco-core/src/datasources/activitypub.ts index 362fc905..ed0c0911 100644 --- a/packages/repco-core/src/datasources/activitypub.ts +++ b/packages/repco-core/src/datasources/activitypub.ts @@ -633,7 +633,7 @@ export class ActivityPubDataSource const category = video.category && video.category !== undefined && - this._uriLink('category', video.category.identifier) + this._uriLink('category', 'peertube:' + video.category.name) category && conceptLinks.push(category) const tags = diff --git a/packages/repco-core/src/repo/relation-finder.ts b/packages/repco-core/src/repo/relation-finder.ts index ff858bbb..4632cfdb 100644 --- a/packages/repco-core/src/repo/relation-finder.ts +++ b/packages/repco-core/src/repo/relation-finder.ts @@ -43,7 +43,6 @@ export class RelationFinder { // check if already in map: resolve now if (this.uriMap.has(value.uri)) { value.uid = this.uriMap.get(value.uri) - // BUG? NOTHING HAPPENS WITH value.uid } else { this.pendingUris.add(value.uri) if (relation) this.relsByUri.push(value.uri, relation) @@ -51,11 +50,18 @@ export class RelationFinder { } pushEntity(entity: EntityInputWithHeaders) { - const uid = entity.uid + let uid = entity.uid if (this.entities.has(uid)) return this.entities.set(uid, entity) if (entity.headers.EntityUris) { for (const uri of entity.headers.EntityUris) { + const foundUid = this.uriMap.get(uri) + if (foundUid) { + // if entity with the same uri already exists delete it from entities + this.entities.delete(uid) + uid = foundUid + break + } this.discoveredUid(uri, uid) } }