Skip to content
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: support atproto source and bluesky worker #662

Merged
merged 36 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
0e2da7b
feat: support atproto client
polebug Nov 2, 2024
d850757
feat: support atproto source and bluesky worker
polebug Nov 27, 2024
904f9fb
Merge branch 'main' into feat/support-at-protocol
polebug Nov 27, 2024
73d50d8
go mod tidy
polebug Nov 27, 2024
e5d85b9
feat(source): add filtering timestamp for AT data
polebug Dec 2, 2024
7890523
feat(source): add retry logic
polebug Dec 2, 2024
cab449e
Merge branch 'main' into feat/support-at-protocol
polebug Dec 2, 2024
b9f0bd1
go mod tidy
polebug Dec 2, 2024
096929e
update protocol-go version
polebug Dec 2, 2024
71a4ca8
chore(worker): add null pointer judgment
polebug Dec 2, 2024
0086bc2
chore: deps error
brucexc Dec 2, 2024
a0777e4
chore(worker): add `social like` type
polebug Dec 4, 2024
66cc9f4
chore(worker): use default http client
polebug Dec 4, 2024
3c89026
chore(worker): fix typo
polebug Dec 4, 2024
e56a02d
chore(worker): remove useless logic
polebug Dec 4, 2024
e2294bd
chore(atproto): add `ActorGetProfile` fallback call
polebug Dec 5, 2024
f1d7115
chore(source): add fallback logic
polebug Dec 6, 2024
d670044
Merge branch 'main' into feat/support-at-protocol
polebug Dec 6, 2024
b8c9d84
go mod tidy
polebug Dec 6, 2024
8c85d88
chore: handle error
polebug Dec 6, 2024
cf9e0cd
feat(component): add atproto handler and docs
polebug Dec 10, 2024
a723fae
feat(database): support for saving bluesky profiles
polebug Dec 10, 2024
9cadbd4
Merge branch 'main' into feat/support-at-protocol
polebug Dec 10, 2024
a957318
chore: update docs
polebug Dec 10, 2024
5b83fb3
chore(worker): move bluesky worker into federated
polebug Dec 12, 2024
2fee615
chore: update config
polebug Dec 12, 2024
3fbad13
chore(core): update federated handlers API
polebug Dec 13, 2024
bc65a7b
feat(core): transform bluesky handle into did
polebug Dec 13, 2024
7163ef2
chore: add retry logic for bluesky client
polebug Dec 13, 2024
a87caa1
chore
polebug Dec 16, 2024
519b7b5
Merge branch 'main' into feat/support-at-protocol
polebug Dec 16, 2024
8eb0d11
go mod
polebug Dec 16, 2024
5150e12
fix: test
polebug Dec 16, 2024
cc0a88b
chore: add related urls
polebug Dec 16, 2024
581a14d
chore: lock pkg version
polebug Dec 17, 2024
7b9d328
chore: update bluesky client logic
polebug Dec 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ func findModuleByID(configFile *config.File, workerID string) (*config.Module, e
return module, nil
}

// Search in RSS components
if module, found := findInComponent([]*config.Module{configFile.Component.RSS}); found {
return module, nil
}
Expand Down
54 changes: 45 additions & 9 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,17 @@ component:
access_key: abc
access_code: def
federated:
network: mastodon
worker: core
- network: mastodon
worker: mastodon
endpoint: mastodon
parameters:
relay_url_list: ["https://relay.fedi.buzz/instance/mastodon.social"]
- network: bluesky
worker: bluesky
endpoint: bluesky
parameters:
username: user
password: pass

decentralized:
- network: ethereum
Expand Down Expand Up @@ -118,7 +124,7 @@ component:
}
},
"database": {
"coverage_period": 3,
"coverage_period": 3,
"uri": "postgres://postgres@localhost:5432/postgres"
},
"stream": {
Expand Down Expand Up @@ -160,12 +166,21 @@ component:
"federated": [
{
"network": "mastodon",
"worker": "core",
"worker": "mastodon",
"endpoint": "mastodon",
"parameters": {
"relay_url_list": [
"https://relay.fedi.buzz/instance/mastodon.social"
]
"relay_url_list": [
"https://relay.fedi.buzz/instance/mastodon.social"
]
}
},
{
"network": "bluesky",
"worker": "bluesky",
"endpoint": "bluesky",
"parameters": {
"username": "user",
"password": "pass"
}
}
],
Expand Down Expand Up @@ -249,12 +264,21 @@ access_code = "def"

[[component.federated]]
network = "mastodon"
worker = "core"
worker = "mastodon"
endpoint = "mastodon"

[component.federated.parameters]
relay_url_list = ["https://relay.fedi.buzz/instance/mastodon.social"]

[[component.federated]]
network = "bluesky"
worker = "bluesky"
endpoint = "bluesky"

[component.federated.parameters]
username = "user"
password = "pass"

[[component.decentralized]]
network = "ethereum"
worker = "core"
Expand Down Expand Up @@ -323,7 +347,7 @@ var configFileExpected = &File{
Federated: []*Module{
{
Network: network.Mastodon,
Worker: federated.Core,
Worker: federated.Mastodon,
EndpointID: "mastodon",
Endpoint: Endpoint{
URL: "https://newdomain.ngrok.app",
Expand All @@ -336,6 +360,18 @@ var configFileExpected = &File{
// "port": 8181, //ToDo: add port here and other places
},
},
{
Network: network.Bluesky,
Worker: federated.Bluesky,
EndpointID: "bluesky",
Endpoint: Endpoint{
URL: "bluesky",
},
Parameters: &Parameters{
"username": "user",
"password": "pass",
},
},
},
Decentralized: []*Module{
{
Expand Down
14 changes: 11 additions & 3 deletions deploy/config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,21 @@ component:
parameters:
# `concurrent_block_requests` is used to specify the number of concurrent block requests.
concurrent_block_requests: 2
# `federated` network type includes workers indexing data from federated networks such as ActivityPub.
# `federated` network type includes workers indexing data from federated networks such as ActivityPub, Atprotocol.
federated:
# mastodon
- id: mastodon-core
- id: mastodon-mastodon
network: mastodon
worker: core
worker: mastodon
endpoint: mastodon
parameters:
relay_url_list: [ "https://relay.fedi.buzz/instance/mastodon.social"]
port: 8181
# bluesky
- id: bluesky-bluesky
network: bluesky
worker: bluesky
endpoint:
parameters:
username:
password:
2 changes: 1 addition & 1 deletion docs/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
name: MIT
url: https://opensource.org/licenses/MIT
servers:
- url: http://localhost:8080
- url: http://localhost

Check warning on line 10 in docs/api.yaml

View workflow job for this annotation

GitHub Actions / generate

no-server-example.com

Server `url` should not point to example.com or localhost.

Check warning on line 10 in docs/api.yaml

View workflow job for this annotation

GitHub Actions / generate

no-server-example.com

Server `url` should not point to example.com or localhost.
description: Local development server
tags:
- name: RSS
Expand Down
1 change: 1 addition & 0 deletions docs/schemas/FederatedPlatform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ type: string
enum:
- Unknown
- Mastodon
- Bluesky
x-go-type: federated.Platform
x-go-type-skip-optional-pointer: true
x-go-type-import:
Expand Down
3 changes: 2 additions & 1 deletion docs/schemas/FederatedWorker.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
type: string
enum:
- core
- mastodon
- bluesky
x-go-type: federated.Worker
x-go-type-skip-optional-pointer: true
x-go-type-import:
Expand Down
67 changes: 62 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/rss3-network/node

go 1.22
go 1.22.4

toolchain go1.22.1
toolchain go1.22.10

replace github.com/chenzhuoyu/iasm => github.com/cloudwego/iasm v0.2.0

Expand Down Expand Up @@ -57,22 +57,27 @@ require (

require (
github.com/adrianbrad/psqldocker v1.2.1
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de
github.com/bluesky-social/indigo v0.0.0-20241212185500-749cc07bf4eb
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0
github.com/emirpasic/gods v1.18.1
github.com/getkin/kin-openapi v0.128.0
github.com/go-fed/httpsig v1.1.0
github.com/go-redsync/redsync/v4 v4.13.0
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.3
github.com/grafana/pyroscope-go v1.2.0
github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056
github.com/mitchellh/mapstructure v1.5.0
github.com/oapi-codegen/oapi-codegen/v2 v2.4.1
github.com/redis/rueidis v1.0.51
github.com/redis/rueidis/rueidiscompat v1.0.51
github.com/rss3-network/protocol-go v0.5.14
github.com/reiver/go-bsky v0.0.0-20240906205655-8c7fadb4f3bb
github.com/rss3-network/protocol-go v0.5.16
github.com/spf13/afero v1.11.0
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/vincent-petithory/dataurl v1.0.0
github.com/whyrusleeping/cbor-gen v0.2.1-0.20241030202151-b7a6831be65e
golang.org/x/net v0.32.0
)

Expand All @@ -83,12 +88,20 @@ require (
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/PuerkitoBio/goquery v1.9.2 // indirect
github.com/RussellLuo/slidingwindow v0.0.0-20200528002341-535bb99d338b // indirect
github.com/andybalholm/cascadia v1.3.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect
github.com/carlmjohnson/versioninfo v0.22.5 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cockroachdb/errors v1.11.3 // indirect
github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v1.1.2 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/containerd/continuity v0.4.3 // indirect
Expand All @@ -104,6 +117,7 @@ require (
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/getsentry/sentry-go v0.27.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
Expand All @@ -117,25 +131,53 @@ require (
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grafana/pyroscope-go/godeltaprof v0.1.8 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.5 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/golang-lru/arc/v2 v2.0.6 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/invopop/yaml v0.3.1 // indirect
github.com/ipfs/bbloom v0.0.4 // indirect
github.com/ipfs/go-block-format v0.2.0 // indirect
github.com/ipfs/go-blockservice v0.5.2 // indirect
github.com/ipfs/go-datastore v0.6.0 // indirect
github.com/ipfs/go-ipfs-blockstore v1.3.1 // indirect
github.com/ipfs/go-ipfs-ds-help v1.1.1 // indirect
github.com/ipfs/go-ipfs-exchange-interface v0.2.1 // indirect
github.com/ipfs/go-ipfs-util v0.0.3 // indirect
github.com/ipfs/go-ipld-cbor v0.1.0 // indirect
github.com/ipfs/go-ipld-format v0.6.0 // indirect
github.com/ipfs/go-ipld-legacy v0.2.1 // indirect
github.com/ipfs/go-libipfs v0.7.0 // indirect
github.com/ipfs/go-log v1.0.5 // indirect
github.com/ipfs/go-log/v2 v2.5.1 // indirect
github.com/ipfs/go-merkledag v0.11.0 // indirect
github.com/ipfs/go-metrics-interface v0.0.1 // indirect
github.com/ipfs/go-verifcid v0.0.3 // indirect
github.com/ipld/go-car v0.6.2 // indirect
github.com/ipld/go-car/v2 v2.13.1 // indirect
github.com/ipld/go-codec-dagpb v1.6.0 // indirect
github.com/ipld/go-ipld-prime v0.21.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.7.1 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/labstack/gommon v0.4.2 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
Expand All @@ -162,16 +204,26 @@ require (
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/opencontainers/runc v1.1.12 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/ory/dockertest/v3 v3.10.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/perimeterx/marshmallow v1.1.5 // indirect
github.com/petar/GoLLRB v0.0.0-20210522233825-ae3b015fd3e9 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/polydawn/refmt v0.89.1-0.20221221234430-40501e09de1f // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.60.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/reiver/go-atproto v0.0.0-20240906195827-a1832b0df821 // indirect
github.com/reiver/go-cast v0.0.0-20240904124821-be0103637c3f // indirect
github.com/reiver/go-erorr v0.0.0-20240801233437-8cbde6d1fa3f // indirect
github.com/reiver/go-fallback v0.0.0-20240906145154-1ce9eadf06a8 // indirect
github.com/reiver/go-maps v0.0.0-20240906190342-93be57f28be1 // indirect
github.com/reiver/go-reg v0.0.0-20240906195701-6e62f43c2835 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.13.1 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sethvargo/go-retry v0.3.0 // indirect
Expand All @@ -193,12 +245,16 @@ require (
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/vektah/gqlparser/v2 v2.5.11 // indirect
github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect
github.com/whyrusleeping/cbor v0.0.0-20171005072247-63513f603b11 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect
gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.50.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.30.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
Expand All @@ -207,6 +263,7 @@ require (
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.24.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect
google.golang.org/grpc v1.67.1 // indirect
Expand Down
Loading
Loading