-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(worker/activitypub): implement mastodon worker to transform AP objects #431
feat(worker/activitypub): implement mastodon worker to transform AP objects #431
Conversation
…ith 'Create' type (transform to activities in SocialPost and Social Comments)
…reate','Announce', 'Like') with test cases
e496004
to
53f97b9
Compare
config/config_test.go
Outdated
@@ -33,6 +34,10 @@ endpoints: | |||
url: https://rpc.ankr.com/eth | |||
http_headers: | |||
user-agent: rss3-node | |||
mastodon: | |||
url: https://30.10.000.00:9092/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
url: https://30.10.000.00:9092/ | |
The endpoint should be defined in the configuration file rather than hardcoding them. Sensitive information like this should not appear in the code, as it poses a security risk. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The url is a mock url used for the config test. Changed its value to https://0.0.0.0:9092/ for better view.
case "Create": | ||
err := w.handleActivityPubCreate(ctx, activityPubTask.Message, activity) | ||
if err != nil { | ||
return nil, fmt.Errorf("error occured in handleActivityPubCreate") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return nil, fmt.Errorf("error occured in handleActivityPubCreate") | |
wrap the specific error | |
Consider changing to: | |
return nil, fmt.Errorf("error occurred in handleActivityPubCreate: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and typo occured
-> occcurred
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved.
return nil, fmt.Errorf("error occurred in handleActivityPubLike: %w", err) | ||
} | ||
default: | ||
zap.L().Debug("unsupported type", zap.String("type", activityPubTask.Message.Type)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zap.L().Debug("unsupported type", zap.String("type", activityPubTask.Message.Type)) | |
using Info level instead of Debug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved.
if err != nil { | ||
return nil, fmt.Errorf("error occured in handleActivityPubCreate") | ||
} | ||
case "Announce": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case "Announce": | |
using an enumeration is better. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defined message types in the mastodon provider type file, and used the enumeration here
internal/engine/worker/federated/activitypub/mastodon/worker.go
Outdated
Show resolved
Hide resolved
|
||
// Check if the Note is a reply to another post | ||
// If true, then make it an activity SocialComment object | ||
if parentID, ok := noteObject["inReplyTo"].(string); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if parentID, ok := noteObject["inReplyTo"].(string); ok { | |
using constants for magic strings like "Note", "inReplyTo" |
internal/engine/worker/federated/activitypub/mastodon/worker.go
Outdated
Show resolved
Hide resolved
internal/node/indexer/server.go
Outdated
case network.ActivityPubSource: | ||
instance.monitorClient, err = monitor.NewActivityPubClient(config.EndpointID, config.Parameters) | ||
if err != nil { | ||
return nil, fmt.Errorf("new arweave monitorClient: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return nil, fmt.Errorf("new arweave monitorClient: %w", err) | |
incorrect error info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved.
…data-source' branch
749225c
into
feat/integrate-activitypub-mastodon-data-source
…bjects (#431) fix: include federated schema in decentralzied schema fix: replace federated schema paths with decentralized fix: fix lint errors fix: remove Type field from config file fix: set and apply the defaultStartTime value pulled from VSL feat: initialize ActivityPub network client for monitoring service fix: resolve the issue of missing module params in func fetchWorkerInfo fix: fix lint error fix: add nil check case to debug fix: fix the typo in extracting mastodon endpoint fix: add missing ActivityPub network souce cases feat: support the processing of Worker Status for independent federated workers fix: debug for missing mastodon worker status fix: initialize mastodon worker status successfully fix: add `index count` to mastodon worker status fix: combine federated handles functions into one feat(deploy): add mastodon worker template for deployment (#554)
Summary
Checklist
Does this PR introduce a breaking change?
Other information