this repo has no description

style: go fmt

Changed files
+19 -19
cmd
feedweb
mostliked
pkg
+7 -7
cmd/feedweb/did.go
···
const NgrokHostname = "routinely-right-barnacle.ngrok-free.app"
type DidDocument struct {
-
Context []string `json:"@context"`
-
ID string `json:"id"`
+
Context []string `json:"@context"`
+
ID string `json:"id"`
Services []DidService `json:"service"`
}
type DidService struct {
-
ID string `json:"id"`
-
ServiceType string `json:"type"`
+
ID string `json:"id"`
+
ServiceType string `json:"type"`
ServiceEndpoint string `json:"serviceEndpoint"`
}
func didDoc(c echo.Context) error {
doc := DidDocument{
Context: []string{"https://www.w3.org/ns/did/v1"},
-
ID: `did:web:` + NgrokHostname,
+
ID: `did:web:` + NgrokHostname,
Services: []DidService{
DidService{
-
ID: "#bsky_fg",
-
ServiceType: "BskyFeedGenerator",
+
ID: "#bsky_fg",
+
ServiceType: "BskyFeedGenerator",
ServiceEndpoint: `https://` + NgrokHostname,
},
},
+3 -3
cmd/feedweb/main.go
···
type SkeletonRequest struct {
Feed string `query:"feed"`
-
Limit string `query:"limit"`
+
Limit string `query:"limit"`
Cursor string `query:"cursor"`
}
···
}
var generators = FeedLookup{
-
"at://did:plc:4nsduwlpivpuur4mqkbfvm6a/app.bsky.feed.generator/most-liked": mostliked.Feed,
+
"at://did:plc:4nsduwlpivpuur4mqkbfvm6a/app.bsky.feed.generator/most-liked": mostliked.Feed,
"at://did:plc:4nsduwlpivpuur4mqkbfvm6a/app.bsky.feed.generator/most-liked-dev": mostliked.Feed,
}
···
}
type gen struct {
-
DID string `json:"did"`
+
DID string `json:"did"`
Feeds []feed `json:"feeds"`
}
+2 -2
cmd/mostliked/main.go
···
package main
import (
+
"context"
"database/sql"
"log"
"os"
"os/signal"
"syscall"
-
"context"
"github.com/edavis/bsky-feeds/pkg/mostliked"
"github.com/gorilla/websocket"
_ "github.com/mattn/go-sqlite3"
)
-
//const JetstreamUrl = `wss://jetstream1.us-west.bsky.network/subscribe?wantedCollections=app.bsky.feed.post&wantedCollections=app.bsky.feed.like&cursor=1728846514000000`
+
// const JetstreamUrl = `wss://jetstream1.us-west.bsky.network/subscribe?wantedCollections=app.bsky.feed.post&wantedCollections=app.bsky.feed.like&cursor=1728846514000000`
const JetstreamUrl = `ws://localhost:6008/subscribe?wantedCollections=app.bsky.feed.post&wantedCollections=app.bsky.feed.like`
func main() {
+2 -2
pkg/mostliked/generator.go
···
import (
"context"
"database/sql"
+
"fmt"
"log"
"strconv"
"strings"
-
"fmt"
appbsky "github.com/bluesky-social/indigo/api/bsky"
"github.com/edavis/bsky-feeds/pkg/feeds"
···
)
type PostRow struct {
-
Uri string
+
Uri string
}
func getPosts(ctx context.Context, dbCnx *sql.DB, langs []string, limit, offset int) ([]PostRow, error) {
+5 -5
pkg/mostliked/handler.go
···
go trimPostsTable(ctx, queries)
var (
-
dbTx *sql.Tx
-
queriesTx *db.Queries
-
txOpen bool
-
err error
+
dbTx *sql.Tx
+
queriesTx *db.Queries
+
txOpen bool
+
err error
eventCount int
)
···
}
eventCount += 1
-
if eventCount % 1000 == 0 {
+
if eventCount%1000 == 0 {
if err := dbTx.Commit(); err != nil {
log.Printf("commit failed: %v\n", err)
} else {