Fix profile query

This commit is contained in:
Bryan Ashby 2023-01-28 12:13:11 -07:00
parent 2f577fcada
commit 6dd9fe810f
No known key found for this signature in database
GPG Key ID: C2C1B501E4EFD994
2 changed files with 13 additions and 4 deletions

View File

@ -10,6 +10,7 @@ This document attempts to track **major** changes and additions in ENiGMA½. For
* [WebFinger](/docs/_docs/servers/contentservers/webfinger-handler.md) support. * [WebFinger](/docs/_docs/servers/contentservers/webfinger-handler.md) support.
* New users now have randomly generated avatars assigned to them that can be served up via the new System General [Web Handler](/docs/_docs/servers/contentservers/web-handlers.md). * New users now have randomly generated avatars assigned to them that can be served up via the new System General [Web Handler](/docs/_docs/servers/contentservers/web-handlers.md).
* CombatNet has shut down, so the module (`combatnet.js`) has been removed. * CombatNet has shut down, so the module (`combatnet.js`) has been removed.
* New `NewUserPrePersist` system event available to developers to 'hook' account creation and add their own properties/etc.
## 0.0.13-beta ## 0.0.13-beta
* **Note for contributors**: ENiGMA has switched to [Prettier](https://prettier.io) for formatting/style. Please see [CONTRIBUTING](CONTRIBUTING.md) and the Prettier website for more information. * **Note for contributors**: ENiGMA has switched to [Prettier](https://prettier.io) for formatting/style. Please see [CONTRIBUTING](CONTRIBUTING.md) and the Prettier website for more information.

View File

@ -5,7 +5,6 @@ const { WellKnownLocations } = require('../web');
const { const {
localActorId, localActorId,
webFingerProfileUrl, webFingerProfileUrl,
userFromActorId,
getUserProfileTemplatedBody, getUserProfileTemplatedBody,
DefaultProfileTemplate, DefaultProfileTemplate,
} = require('../../../activitypub/util'); } = require('../../../activitypub/util');
@ -78,11 +77,20 @@ exports.getModule = class WebFingerWebHandler extends WebHandlerModule {
} }
_profileRequestHandler(req, resp) { _profileRequestHandler(req, resp) {
const actorId = this.webServer.fullUrl(req).toString(); // Profile requests do not have an Actor ID available
userFromActorId(actorId, (err, localUser) => { const profileQuery = this.webServer.fullUrl(req).toString();
const accountName = this._getAccountName(profileQuery);
if (!accountName) {
this.log.warn(
`Failed to parse "account name" for profile query: ${profileQuery}`
);
return this.webServer.resourceNotFound(resp);
}
this._localUserFromWebFingerAccountName(accountName, (err, localUser) => {
if (err) { if (err) {
this.log.warn( this.log.warn(
{ error: err.message, type: 'Profile' }, { error: err.message, type: 'Profile', accountName },
'Could not fetch profile for WebFinger request' 'Could not fetch profile for WebFinger request'
); );
return this.webServer.resourceNotFound(resp); return this.webServer.resourceNotFound(resp);