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

Make video feeds use native content mode #301

Merged
merged 2 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion bluesky/pds_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func (c *PDSClient) DeleteRecord(
return fmt.Errorf("get xrpc client: %w", err)
}

if err := atproto.RepoDeleteRecord(ctx, xc, &atproto.RepoDeleteRecord_Input{
if _, err := atproto.RepoDeleteRecord(ctx, xc, &atproto.RepoDeleteRecord_Input{
Collection: uri.Collection,
Repo: uri.Did,
Rkey: uri.Rkey,
Expand Down
11 changes: 9 additions & 2 deletions cmd/bffctl/bsky.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,20 @@ func bskyCmd(log *slog.Logger, env *environment) *cli.Command {
meta := meta

log.Info("upserting feed", slog.String("rkey", meta.ID))
err = client.PutRecord(cctx.Context, "app.bsky.feed.generator", meta.ID, &bsky.FeedGenerator{
gen := &bsky.FeedGenerator{
Avatar: blob,
Did: fmt.Sprintf("did:web:%s", hostname),
CreatedAt: bluesky.FormatTime(time.Now().UTC()),
Description: &meta.Description,
DisplayName: meta.DisplayName,
})
}

if meta.VideoOnly {
var contentModeVideo = "app.bsky.feed.defs#contentModeVideo"
gen.ContentMode = &contentModeVideo
}

err = client.PutRecord(cctx.Context, "app.bsky.feed.generator", meta.ID, gen)
if err != nil {
return fmt.Errorf("putting feed record: %w", err)
}
Expand Down
6 changes: 6 additions & 0 deletions feed/feed.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ type Meta struct {
Priority int32
// TODO: Categories
// TODO: "Parents"

VideoOnly bool
}

type feed struct {
Expand Down Expand Up @@ -555,6 +557,7 @@ func ServiceWithDefaultFeeds(pgxStore *store.PGXStore) *Service {
DisplayName: "🐾 Hot videos",
Description: "Furry\nHottest video posts by furries across Bluesky. Contains a mix of SFW and NSFW content.\n\nJoin the furry feeds by following @furryli.st",
Priority: 100,
VideoOnly: true,
}, preScoredGenerator(preScoredGeneratorOpts{
Alg: "classic",
generatorOpts: generatorOpts{
Expand All @@ -566,6 +569,7 @@ func ServiceWithDefaultFeeds(pgxStore *store.PGXStore) *Service {
ID: "video-new",
DisplayName: "🐾 New videos",
Description: "Furry\nLatest video posts by furries across Bluesky. Contains a mix of SFW and NSFW content.\n\nJoin the furry feeds by following @furryli.st",
VideoOnly: true,
}, chronologicalGenerator(chronologicalGeneratorOpts{
generatorOpts: generatorOpts{
DisallowedHashtags: defaultDisallowedHashtags,
Expand All @@ -577,6 +581,7 @@ func ServiceWithDefaultFeeds(pgxStore *store.PGXStore) *Service {
DisplayName: "🐾 Hot videos 🌙",
Description: "Furry\nHottest NSFW video posts by furries across Bluesky. Contains only NSFW content.\n\nJoin the furry feeds by following @furryli.st",
Priority: 100,
VideoOnly: true,
}, preScoredGenerator(preScoredGeneratorOpts{
Alg: "classic",
generatorOpts: generatorOpts{
Expand All @@ -589,6 +594,7 @@ func ServiceWithDefaultFeeds(pgxStore *store.PGXStore) *Service {
ID: "video-new-nsfw",
DisplayName: "🐾 New videos 🌙",
Description: "Furry\nLatest NSFW video posts by furries across Bluesky. Contains only NSFW content.\n\nJoin the furry feeds by following @furryli.st",
VideoOnly: true,
}, chronologicalGenerator(chronologicalGeneratorOpts{
generatorOpts: generatorOpts{
DisallowedHashtags: defaultDisallowedHashtags,
Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
cloud.google.com/go/cloudsqlconn v1.5.2
connectrpc.com/connect v1.11.0
connectrpc.com/otelconnect v0.5.0
github.com/bluesky-social/indigo v0.0.0-20240908200721-58e6cb486877
github.com/bluesky-social/indigo v0.0.0-20250119185343-e1d4639a0604
github.com/bluesky-social/jetstream v0.0.0-20241031234625-0ab10bd041fe
github.com/docker/go-connections v0.4.0
github.com/golang-migrate/migrate/v4 v4.16.2
Expand All @@ -23,7 +23,7 @@ require (
github.com/testcontainers/testcontainers-go v0.21.0
github.com/testcontainers/testcontainers-go/modules/postgres v0.21.0
github.com/urfave/cli/v2 v2.26.0
github.com/whyrusleeping/cbor-gen v0.1.3-0.20240904181319-8dc02b38228c
github.com/whyrusleeping/cbor-gen v0.2.1-0.20241030202151-b7a6831be65e
go.opentelemetry.io/contrib/detectors/gcp v1.21.1
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1
go.opentelemetry.io/otel v1.21.0
Expand All @@ -42,6 +42,7 @@ require (
github.com/DataDog/zstd v1.5.5 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/RussellLuo/slidingwindow v0.0.0-20200528002341-535bb99d338b // indirect
github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874 // indirect
github.com/carlmjohnson/versioninfo v0.22.5 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cockroachdb/errors v1.11.3 // indirect
Expand Down
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bluesky-social/indigo v0.0.0-20240908200721-58e6cb486877 h1:oPM+7BOEEPi0XZ8ucya3wFnpF7pcRHo1TzvgQvCsvsM=
github.com/bluesky-social/indigo v0.0.0-20240908200721-58e6cb486877/go.mod h1:Zx9nSWgd/FxMenkJW07VKnzspxpHBdPrPmS+Fspl2I0=
github.com/bluesky-social/indigo v0.0.0-20250119185343-e1d4639a0604 h1:jnIHdRCkWYJYAGLf6JmdSF7q+80xf7seC5M3uozik0o=
github.com/bluesky-social/indigo v0.0.0-20250119185343-e1d4639a0604/go.mod h1:UPvCalsPWViUSB6t11u6jg5lF1kLLsaX5t3ybzTSyeE=
github.com/bluesky-social/jetstream v0.0.0-20241031234625-0ab10bd041fe h1:jduuyDfsiwWrPiN7psqDehepl68uxQ4UYCIgoqb1D4o=
github.com/bluesky-social/jetstream v0.0.0-20241031234625-0ab10bd041fe/go.mod h1:WiYEeyJSdUwqoaZ71KJSpTblemUCpwJfh5oVXplK6T4=
github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874 h1:N7oVaKyGp8bttX0bfZGmcGkjz7DLQXhAn3DNd3T0ous=
github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874/go.mod h1:r5xuitiExdLAJ09PR7vBVENGvp4ZuTBeWTGtxuX3K+c=
github.com/brianvoe/gofakeit/v6 v6.25.0 h1:ZpFjktOpLZUeF8q223o0rUuXtA+m5qW5srjvVi+JkXk=
github.com/brianvoe/gofakeit/v6 v6.25.0/go.mod h1:Xj58BMSnFqcn/fAQeSK+/PLtC5kSb7FJIq4JyGa8vEs=
github.com/carlmjohnson/versioninfo v0.22.5 h1:O00sjOLUAFxYQjlN/bzYTuZiS0y6fWDQjMRvwtKgwwc=
Expand Down Expand Up @@ -640,8 +642,8 @@ github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0 h1:GDDkbFiaK8jsSD
github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=
github.com/whyrusleeping/cbor v0.0.0-20171005072247-63513f603b11 h1:5HZfQkwe0mIfyDmc1Em5GqlNRzcdtlv4HTNmdpt7XH0=
github.com/whyrusleeping/cbor v0.0.0-20171005072247-63513f603b11/go.mod h1:Wlo/SzPmxVp6vXpGt/zaXhHH0fn4IxgqZc82aKg6bpQ=
github.com/whyrusleeping/cbor-gen v0.1.3-0.20240904181319-8dc02b38228c h1:UsxJNcLPfyLyVaA4iusIrsLAqJn/xh36Qgb8emqtXzk=
github.com/whyrusleeping/cbor-gen v0.1.3-0.20240904181319-8dc02b38228c/go.mod h1:pM99HXyEbSQHcosHc0iW7YFmwnscr+t9Te4ibko05so=
github.com/whyrusleeping/cbor-gen v0.2.1-0.20241030202151-b7a6831be65e h1:28X54ciEwwUxyHn9yrZfl5ojgF4CBNLWX7LR0rvBkf4=
github.com/whyrusleeping/cbor-gen v0.2.1-0.20241030202151-b7a6831be65e/go.mod h1:pM99HXyEbSQHcosHc0iW7YFmwnscr+t9Te4ibko05so=
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E=
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8=
github.com/whyrusleeping/go-did v0.0.0-20230824162731-404d1707d5d6 h1:yJ9/LwIGIk/c0CdoavpC9RNSGSruIspSZtxG3Nnldic=
Expand Down
2 changes: 1 addition & 1 deletion ingester/ingester_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func TestFirehoseIngester(t *testing.T) {
t.Cleanup(func() { wsConn.Close() })

go func() {
err := events.HandleRepoStream(ctx, wsConn, scheduler)
err := events.HandleRepoStream(ctx, wsConn, scheduler, slog.Default())
if err != nil && !strings.Contains(err.Error(), net.ErrClosed.Error()) {
require.NoError(t, err)
}
Expand Down
2 changes: 1 addition & 1 deletion testenv/testenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func StartHarness(ctx context.Context, t *testing.T) *Harness {
pds.Run(t)
t.Cleanup(pds.Cleanup)

relay := indigoTest.MustSetupRelay(t, didr)
relay := indigoTest.MustSetupRelay(t, didr, true)
relay.Run(t)
setTrialHostOnRelay(relay, pds.RawHost())

Expand Down
Loading