mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
test: add more logs
This commit is contained in:
@@ -124,19 +124,22 @@ Actors.assert = async (ids, options = {}) => {
|
|||||||
const followersUrlMap = new Map();
|
const followersUrlMap = new Map();
|
||||||
const pubKeysMap = new Map();
|
const pubKeysMap = new Map();
|
||||||
const categories = new Set();
|
const categories = new Set();
|
||||||
console.log(' 4b9a', Date.now() - start);
|
console.log(' 4b9a', Date.now() - start, ids);
|
||||||
let actors = await Promise.all(ids.map(async (id) => {
|
let actors = await Promise.all(ids.map(async (id) => {
|
||||||
try {
|
try {
|
||||||
|
console.log(' 4b9a1', Date.now() - start, id);
|
||||||
activitypub.helpers.log(`[activitypub/actors] Processing ${id}`);
|
activitypub.helpers.log(`[activitypub/actors] Processing ${id}`);
|
||||||
const actor = (typeof id === 'object' && id.hasOwnProperty('id')) ? id : await activitypub.get('uid', 0, id, { cache: process.env.CI === 'true' });
|
const actor = (typeof id === 'object' && id.hasOwnProperty('id')) ? id : await activitypub.get('uid', 0, id, { cache: process.env.CI === 'true' });
|
||||||
|
console.log(' 4b9a2', Date.now() - start, id);
|
||||||
// webfinger backreference check
|
// webfinger backreference check
|
||||||
const { hostname: domain } = new URL(id);
|
const { hostname: domain } = new URL(id);
|
||||||
const { actorUri: canonicalId } = await activitypub.helpers.query(`${actor.preferredUsername}@${domain}`);
|
const { actorUri: canonicalId } = await activitypub.helpers.query(`${actor.preferredUsername}@${domain}`);
|
||||||
|
console.log(' 4b9a3', Date.now() - start, id);
|
||||||
if (id !== canonicalId) {
|
if (id !== canonicalId) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let typeOk = false;
|
let typeOk = false;
|
||||||
if (Array.isArray(actor.type)) {
|
if (Array.isArray(actor.type)) {
|
||||||
typeOk = actor.type.some(type => activitypub._constants.acceptableActorTypes.has(type));
|
typeOk = actor.type.some(type => activitypub._constants.acceptableActorTypes.has(type));
|
||||||
@@ -149,7 +152,7 @@ Actors.assert = async (ids, options = {}) => {
|
|||||||
categories.add(actor.id);
|
categories.add(actor.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log(' 4b9a4', Date.now() - start, id);
|
||||||
if (
|
if (
|
||||||
!typeOk ||
|
!typeOk ||
|
||||||
!activitypub._constants.requiredActorProps.every(prop => actor.hasOwnProperty(prop))
|
!activitypub._constants.requiredActorProps.every(prop => actor.hasOwnProperty(prop))
|
||||||
@@ -169,7 +172,7 @@ Actors.assert = async (ids, options = {}) => {
|
|||||||
// no action required
|
// no action required
|
||||||
activitypub.helpers.log(`[activitypub/actor.assert] Unable to retrieve follower counts for ${actor.id}`);
|
activitypub.helpers.log(`[activitypub/actor.assert] Unable to retrieve follower counts for ${actor.id}`);
|
||||||
}
|
}
|
||||||
|
console.log(' 4b9a5', Date.now() - start, id);
|
||||||
// Save url for backreference
|
// Save url for backreference
|
||||||
const url = Array.isArray(actor.url) ? actor.url.shift() : actor.url;
|
const url = Array.isArray(actor.url) ? actor.url.shift() : actor.url;
|
||||||
if (url && url !== actor.id) {
|
if (url && url !== actor.id) {
|
||||||
@@ -186,6 +189,7 @@ Actors.assert = async (ids, options = {}) => {
|
|||||||
|
|
||||||
return actor;
|
return actor;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.log('any errors?', e.message);
|
||||||
if (e.code === 'ap_get_410') {
|
if (e.code === 'ap_get_410') {
|
||||||
const exists = await user.exists(id);
|
const exists = await user.exists(id);
|
||||||
if (exists) {
|
if (exists) {
|
||||||
|
|||||||
Reference in New Issue
Block a user