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,
|
Action: serve,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "pds-host",
|
Name: "appview-host",
|
||||||
Usage: "method, hostname, and port of PDS instance",
|
Usage: "method, hostname, and port of PDS instance",
|
||||||
Value: "http://localhost:4849",
|
Value: "http://localhost:2584",
|
||||||
EnvVars: []string{"ATP_PDS_HOST"},
|
// retain old PDS env var for easy transition
|
||||||
},
|
EnvVars: []string{"ATP_APPVIEW_HOST", "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"},
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "mailmodo-api-key",
|
Name: "mailmodo-api-key",
|
||||||
|
|
|
@ -14,7 +14,6 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
comatproto "github.com/bluesky-social/indigo/api/atproto"
|
|
||||||
appbsky "github.com/bluesky-social/indigo/api/bsky"
|
appbsky "github.com/bluesky-social/indigo/api/bsky"
|
||||||
cliutil "github.com/bluesky-social/indigo/cmd/gosky/util"
|
cliutil "github.com/bluesky-social/indigo/cmd/gosky/util"
|
||||||
"github.com/bluesky-social/indigo/xrpc"
|
"github.com/bluesky-social/indigo/xrpc"
|
||||||
|
@ -38,9 +37,7 @@ type Server struct {
|
||||||
func serve(cctx *cli.Context) error {
|
func serve(cctx *cli.Context) error {
|
||||||
debug := cctx.Bool("debug")
|
debug := cctx.Bool("debug")
|
||||||
httpAddress := cctx.String("http-address")
|
httpAddress := cctx.String("http-address")
|
||||||
pdsHost := cctx.String("pds-host")
|
appviewHost := cctx.String("appview-host")
|
||||||
atpHandle := cctx.String("handle")
|
|
||||||
atpPassword := cctx.String("password")
|
|
||||||
mailmodoAPIKey := cctx.String("mailmodo-api-key")
|
mailmodoAPIKey := cctx.String("mailmodo-api-key")
|
||||||
mailmodoListName := cctx.String("mailmodo-list-name")
|
mailmodoListName := cctx.String("mailmodo-list-name")
|
||||||
|
|
||||||
|
@ -50,28 +47,12 @@ func serve(cctx *cli.Context) error {
|
||||||
// Mailmodo client.
|
// Mailmodo client.
|
||||||
mailmodo := NewMailmodo(mailmodoAPIKey, mailmodoListName)
|
mailmodo := NewMailmodo(mailmodoAPIKey, mailmodoListName)
|
||||||
|
|
||||||
// create a new session
|
// create a new session (no auth)
|
||||||
// TODO: does this work with no auth at all?
|
|
||||||
xrpcc := &xrpc.Client{
|
xrpcc := &xrpc.Client{
|
||||||
Client: cliutil.NewHttpClient(),
|
Client: cliutil.NewHttpClient(),
|
||||||
Host: pdsHost,
|
Host: appviewHost,
|
||||||
Auth: &xrpc.AuthInfo{
|
|
||||||
Handle: atpHandle,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
// httpd
|
||||||
var (
|
var (
|
||||||
httpTimeout = 2 * time.Minute
|
httpTimeout = 2 * time.Minute
|
||||||
|
|
|
@ -1,4 +1,2 @@
|
||||||
GOLOG_LOG_LEVEL=info
|
GOLOG_LOG_LEVEL=info
|
||||||
ATP_PDS_HOST=http://localhost:2583
|
ATP_APPVIEW_HOST=http://localhost:2584
|
||||||
ATP_AUTH_HANDLE="admin.test"
|
|
||||||
ATP_AUTH_PASSWORD="admin"
|
|
||||||
|
|
|
@ -1,4 +1,2 @@
|
||||||
GOLOG_LOG_LEVEL=info
|
GOLOG_LOG_LEVEL=info
|
||||||
ATP_PDS_HOST=https://bsky.social
|
ATP_APPVIEW_HOST=https://api.bsky.app
|
||||||
ATP_AUTH_HANDLE=TODO
|
|
||||||
ATP_AUTH_PASSWORD=TODO
|
|
||||||
|
|
Loading…
Reference in New Issue