From 0b59d0e3b539df0c4ec8312c8f00919ddb70abf7 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Mon, 10 Apr 2023 11:47:27 -0600 Subject: [PATCH] Strip codes from auto sig for summary --- core/activitypub/actor.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/activitypub/actor.js b/core/activitypub/actor.js index 45fadf2c..16af216f 100644 --- a/core/activitypub/actor.js +++ b/core/activitypub/actor.js @@ -13,6 +13,8 @@ const ActivityPubSettings = require('./settings'); const ActivityPubObject = require('./object'); const { ActivityStreamMediaType, Collections } = require('./const'); const Config = require('../config').get; +const { stripMciColorCodes } = require('../color_codes'); +const { stripAnsiControlCodes } = require('../string_util'); // deps const _ = require('lodash'); @@ -107,6 +109,11 @@ module.exports = class Actor extends ActivityPubObject { } }; + const summary = stripMciColorCodes( + stripAnsiControlCodes(user.getProperty(UserProps.AutoSignature) || ''), + { mode: 'nonAsciiPrintable' } + ); + const obj = { id: userActorId, type: 'Person', @@ -121,7 +128,7 @@ module.exports = class Actor extends ActivityPubObject { outbox: Endpoints.outbox(user), followers: Endpoints.followers(user), following: Endpoints.following(user), - summary: user.getProperty(UserProps.AutoSignature) || '', + summary, url: Endpoints.profile(user), manuallyApprovesFollowers: userSettings.manuallyApprovesFollowers, discoverable: userSettings.discoverable,