From 157b90687cdcb2cb1d31d5893b321488f055ad9d Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Thu, 12 Jan 2023 18:49:13 -0700 Subject: [PATCH] Move ActivityPub stuff under activitypub/ --- .../activity.js} | 14 +++++++------- .../{activitypub_actor.js => activitypub/actor.js} | 14 ++++++-------- core/{activitypub_db.js => activitypub/db.js} | 2 +- .../settings.js} | 0 core/{activitypub_util.js => activitypub/util.js} | 2 +- core/scanner_tossers/activitypub.js | 4 ++-- core/servers/content/web_handlers/activitypub.js | 12 ++++-------- core/servers/content/web_handlers/webfinger.js | 2 +- core/user_property.js | 2 +- 9 files changed, 23 insertions(+), 29 deletions(-) rename core/{activitypub_activity.js => activitypub/activity.js} (95%) rename core/{activitypub_actor.js => activitypub/actor.js} (97%) rename core/{activitypub_db.js => activitypub/db.js} (90%) rename core/{activitypub_settings.js => activitypub/settings.js} (100%) rename core/{activitypub_util.js => activitypub/util.js} (98%) diff --git a/core/activitypub_activity.js b/core/activitypub/activity.js similarity index 95% rename from core/activitypub_activity.js rename to core/activitypub/activity.js index 7f6dc8c2..c00fc4c5 100644 --- a/core/activitypub_activity.js +++ b/core/activitypub/activity.js @@ -4,13 +4,13 @@ const { ActivityStreamsContext, messageBodyToHtml, selfUrl, -} = require('./activitypub_util'); -const { Errors } = require('./enig_error'); -const User = require('./user'); -const Actor = require('./activitypub_actor'); -const { getISOTimestampString } = require('./database'); -const UserProps = require('./user_property'); -const { postJson } = require('./http_util'); +} = require('../activitypub/util'); +const { Errors } = require('../enig_error'); +const User = require('../user'); +const Actor = require('../activitypub/actor'); +const { getISOTimestampString } = require('../database'); +const UserProps = require('../user_property'); +const { postJson } = require('../http_util'); // deps const async = require('async'); diff --git a/core/activitypub_actor.js b/core/activitypub/actor.js similarity index 97% rename from core/activitypub_actor.js rename to core/activitypub/actor.js index 140268cf..f04ebb89 100644 --- a/core/activitypub_actor.js +++ b/core/activitypub/actor.js @@ -2,22 +2,20 @@ 'use strict'; // ENiGMA½ -const actorDb = require('./database.js').dbs.actor; -const { Errors } = require('./enig_error.js'); -const UserProps = require('./user_property'); +const { Errors } = require('../enig_error.js'); +const UserProps = require('../user_property'); const { webFingerProfileUrl, makeUserUrl, selfUrl, isValidLink, ActivityStreamsContext, -} = require('./activitypub_util'); -const Log = require('./logger').log; -const { queryWebFinger } = require('./webfinger'); -const EnigAssert = require('./enigma_assert'); +} = require('../activitypub/util'); +const Log = require('../logger').log; +const { queryWebFinger } = require('../webfinger'); +const EnigAssert = require('../enigma_assert'); // deps -const async = require('async'); const _ = require('lodash'); const https = require('https'); diff --git a/core/activitypub_db.js b/core/activitypub/db.js similarity index 90% rename from core/activitypub_db.js rename to core/activitypub/db.js index 2ba5ef36..5a6a6dbe 100644 --- a/core/activitypub_db.js +++ b/core/activitypub/db.js @@ -1,4 +1,4 @@ -const apDb = require('./database').dbs.activitypub; +const apDb = require('../database').dbs.activitypub; exports.persistToOutbox = persistToOutbox; diff --git a/core/activitypub_settings.js b/core/activitypub/settings.js similarity index 100% rename from core/activitypub_settings.js rename to core/activitypub/settings.js diff --git a/core/activitypub_util.js b/core/activitypub/util.js similarity index 98% rename from core/activitypub_util.js rename to core/activitypub/util.js index 3c4632d4..30b36b21 100644 --- a/core/activitypub_util.js +++ b/core/activitypub/util.js @@ -2,7 +2,7 @@ const { WellKnownLocations } = require('./servers/content/web'); const User = require('./user'); const { Errors, ErrorReasons } = require('./enig_error'); const UserProps = require('./user_property'); -const ActivityPubSettings = require('./activitypub_settings'); +const ActivityPubSettings = require('./activitypub/settings'); // deps const _ = require('lodash'); diff --git a/core/scanner_tossers/activitypub.js b/core/scanner_tossers/activitypub.js index e1e76114..54319a25 100644 --- a/core/scanner_tossers/activitypub.js +++ b/core/scanner_tossers/activitypub.js @@ -1,9 +1,9 @@ -const Activity = require('../activitypub_activity'); +const Activity = require('../activitypub/activity'); const Message = require('../message'); const { MessageScanTossModule } = require('../msg_scan_toss_module'); const { getServer } = require('../listening_server'); const Log = require('../logger').log; -const { persistToOutbox } = require('../activitypub_db'); +const { persistToOutbox } = require('../activitypub/db'); // deps const async = require('async'); diff --git a/core/servers/content/web_handlers/activitypub.js b/core/servers/content/web_handlers/activitypub.js index ef36a692..4ee299a4 100644 --- a/core/servers/content/web_handlers/activitypub.js +++ b/core/servers/content/web_handlers/activitypub.js @@ -4,20 +4,16 @@ const { getUserProfileTemplatedBody, DefaultProfileTemplate, accountFromSelfUrl, - selfUrl, -} = require('../../../activitypub_util'); +} = require('../../../activitypub/util'); const Config = require('../../../config').get; -const Activity = require('../../../activitypub_activity'); -const ActivityPubSettings = require('../../../activitypub_settings'); -const Actor = require('../../../activitypub_actor'); -const { postJson } = require('../../../http_util'); -const UserProps = require('../../../user_property'); +const Activity = require('../../../activitypub/activity'); +const ActivityPubSettings = require('../../../activitypub/settings'); +const Actor = require('../../../activitypub/actor'); // deps const _ = require('lodash'); const enigma_assert = require('../../../enigma_assert'); const httpSignature = require('http-signature'); -const https = require('https'); exports.moduleInfo = { name: 'ActivityPub', diff --git a/core/servers/content/web_handlers/webfinger.js b/core/servers/content/web_handlers/webfinger.js index ff345226..32d1af88 100644 --- a/core/servers/content/web_handlers/webfinger.js +++ b/core/servers/content/web_handlers/webfinger.js @@ -8,7 +8,7 @@ const { userFromAccount, getUserProfileTemplatedBody, DefaultProfileTemplate, -} = require('../../../activitypub_util'); +} = require('../../../activitypub/util'); const _ = require('lodash'); const enigma_assert = require('../../../enigma_assert'); diff --git a/core/user_property.js b/core/user_property.js index f52c8b7b..82fa6b3b 100644 --- a/core/user_property.js +++ b/core/user_property.js @@ -70,5 +70,5 @@ module.exports = { PublicKeyMain: 'public_key_main_rsa_pem', // RSA public key for user PrivateKeyMain: 'private_key_main_rsa_pem', // RSA private key (corresponding to PublicKeyMain) - ActivityPubSettings: 'activity_pub_settings', // JSON object (above); see ActivityPubSettings in activitypub_settings.js + ActivityPubSettings: 'activity_pub_settings', // JSON object (above); see ActivityPubSettings in activitypub/settings.js };