bskyweb: switch from PDS backend to AppView backend (#1065)
* bskyweb: replace PDS with AppView (no auth) * bskyweb: update example .env files for appviewzio/stable
parent
766521486c
commit
a115c17a09
|
@ -34,22 +34,11 @@ func run(args []string) {
|
|||
Action: serve,
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "pds-host",
|
||||
Name: "appview-host",
|
||||
Usage: "method, hostname, and port of PDS instance",
|
||||
Value: "http://localhost:4849",
|
||||
EnvVars: []string{"ATP_PDS_HOST"},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "handle",
|
||||
Usage: "for PDS login",
|
||||
Required: true,
|
||||
EnvVars: []string{"ATP_AUTH_HANDLE"},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "password",
|
||||
Usage: "for PDS login",
|
||||
Required: true,
|
||||
EnvVars: []string{"ATP_AUTH_PASSWORD"},
|
||||
Value: "http://localhost:2584",
|
||||
// retain old PDS env var for easy transition
|
||||
EnvVars: []string{"ATP_APPVIEW_HOST", "ATP_PDS_HOST"},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "mailmodo-api-key",
|
||||
|
|
|
@ -14,7 +14,6 @@ import (
|
|||
"syscall"
|
||||
"time"
|
||||
|
||||
comatproto "github.com/bluesky-social/indigo/api/atproto"
|
||||
appbsky "github.com/bluesky-social/indigo/api/bsky"
|
||||
cliutil "github.com/bluesky-social/indigo/cmd/gosky/util"
|
||||
"github.com/bluesky-social/indigo/xrpc"
|
||||
|
@ -38,9 +37,7 @@ type Server struct {
|
|||
func serve(cctx *cli.Context) error {
|
||||
debug := cctx.Bool("debug")
|
||||
httpAddress := cctx.String("http-address")
|
||||
pdsHost := cctx.String("pds-host")
|
||||
atpHandle := cctx.String("handle")
|
||||
atpPassword := cctx.String("password")
|
||||
appviewHost := cctx.String("appview-host")
|
||||
mailmodoAPIKey := cctx.String("mailmodo-api-key")
|
||||
mailmodoListName := cctx.String("mailmodo-list-name")
|
||||
|
||||
|
@ -50,28 +47,12 @@ func serve(cctx *cli.Context) error {
|
|||
// Mailmodo client.
|
||||
mailmodo := NewMailmodo(mailmodoAPIKey, mailmodoListName)
|
||||
|
||||
// create a new session
|
||||
// TODO: does this work with no auth at all?
|
||||
// create a new session (no auth)
|
||||
xrpcc := &xrpc.Client{
|
||||
Client: cliutil.NewHttpClient(),
|
||||
Host: pdsHost,
|
||||
Auth: &xrpc.AuthInfo{
|
||||
Handle: atpHandle,
|
||||
},
|
||||
Host: appviewHost,
|
||||
}
|
||||
|
||||
auth, err := comatproto.ServerCreateSession(context.TODO(), xrpcc, &comatproto.ServerCreateSession_Input{
|
||||
Identifier: xrpcc.Auth.Handle,
|
||||
Password: atpPassword,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
xrpcc.Auth.AccessJwt = auth.AccessJwt
|
||||
xrpcc.Auth.RefreshJwt = auth.RefreshJwt
|
||||
xrpcc.Auth.Did = auth.Did
|
||||
xrpcc.Auth.Handle = auth.Handle
|
||||
|
||||
// httpd
|
||||
var (
|
||||
httpTimeout = 2 * time.Minute
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
GOLOG_LOG_LEVEL=info
|
||||
ATP_PDS_HOST=http://localhost:2583
|
||||
ATP_AUTH_HANDLE="admin.test"
|
||||
ATP_AUTH_PASSWORD="admin"
|
||||
ATP_APPVIEW_HOST=http://localhost:2584
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
GOLOG_LOG_LEVEL=info
|
||||
ATP_PDS_HOST=https://bsky.social
|
||||
ATP_AUTH_HANDLE=TODO
|
||||
ATP_AUTH_PASSWORD=TODO
|
||||
ATP_APPVIEW_HOST=https://api.bsky.app
|
||||
|
|
Loading…
Reference in New Issue