diff --git a/README.md b/README.md index bb53152..6ff2c58 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,6 @@ go install https://tangled.sh/@evan.jarrett.net/blup@latest ## Quick Start ```bash -# 1. Configure OAuth (one-time setup) -blup configure - # 2. Authenticate blup auth @@ -34,10 +31,6 @@ blup upload cat.jpg ``` ## Commands - -### ```blup configure``` -Set up OAuth client credentials (one-time setup) - ### ```blup auth``` Authenticate with your AT Protocol account via OAuth @@ -84,10 +77,9 @@ blup upload screenshot.png blup uses OAuth for secure authentication: -1. Run ```blup configure``` to set up OAuth client -2. Run ```blup auth``` to authenticate -3. Your browser will open for authorization -4. You're ready to upload! +1. Run ```blup auth``` to authenticate +2. Your browser will open for authorization +3. You're ready to upload! ## Building from source diff --git a/cmd/cli/main.go b/cmd/cli/main.go index 8d1a9d2..8076c3c 100644 --- a/cmd/cli/main.go +++ b/cmd/cli/main.go @@ -15,7 +15,6 @@ import ( "github.com/bluesky-social/indigo/xrpc" oauth "github.com/haileyok/atproto-oauth-golang" "github.com/spf13/cobra" - "golang.design/x/clipboard" "tangled.sh/evan.jarrett.net/blup/internal/auth" "tangled.sh/evan.jarrett.net/blup/internal/config" "tangled.sh/evan.jarrett.net/blup/internal/util" @@ -258,17 +257,7 @@ func runUpload(cmd *cobra.Command, args []string) error { } compressedUrl := fmt.Sprintf("%s/%s/%s\n", CDN, cfg.Handle, converted) - fmt.Printf("%s/%s/%s\n", CDN, authArgs.Did, blobCID) fmt.Println(compressedUrl) - - // Initialize clipboard - err = clipboard.Init() - if err != nil { - fmt.Printf("Warning: Could not initialize clipboard: %v\n", err) - } else { - clipboard.Write(clipboard.FmtText, []byte(compressedUrl)) - fmt.Println("URL copied to clipboard") - } return nil } diff --git a/go.mod b/go.mod index b4cdad4..06948ef 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ go 1.24.4 require ( github.com/bluesky-social/indigo v0.0.0-20250621010046-488d1b91889b - github.com/gen2brain/beeep v0.11.1 github.com/golang-jwt/jwt/v5 v5.2.2 github.com/haileyok/atproto-oauth-golang v0.0.3-0.20250622200753-e07caa5274a7 github.com/ipfs/go-cid v0.5.0 @@ -12,7 +11,6 @@ require ( github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c github.com/spf13/cobra v1.9.1 github.com/zalando/go-keyring v0.2.6 - golang.design/x/clipboard v0.7.1 ) require ( diff --git a/internal/auth/client-metadata.json b/internal/auth/client-metadata.json new file mode 100644 index 0000000..08d33e4 --- /dev/null +++ b/internal/auth/client-metadata.json @@ -0,0 +1,19 @@ +{ + "client_id": "https://blup.imgs.blue/oauth/client-metadata.json", + "client_name": "Blup", + "client_uri": "https://blup.imgs.blue", + "grant_types": [ + "authorization_code", + "refresh_token" + ], + "scope": "atproto transition:generic", + "response_types": [ + "code" + ], + "redirect_uris": [ + "https://blup.imgs.blue/oauth/callback" + ], + "dpop_bound_access_tokens": true, + "token_endpoint_auth_method": "none", + "application_type": "native" +} \ No newline at end of file diff --git a/internal/auth/metadata.go b/internal/auth/metadata.go new file mode 100644 index 0000000..930ad22 --- /dev/null +++ b/internal/auth/metadata.go @@ -0,0 +1,32 @@ +package auth + +import ( + _ "embed" + "encoding/json" +) + +// NOTE: if the server-side metadata changes, this file will also need to change. +//go:embed client-metadata.json +var metadataJson []byte +type ClientMetadata struct { + ClientID string `json:"client_id"` + ClientName string `json:"client_name"` + SubjectType string `json:"subject_type"` + ClientURI string `json:"client_uri"` + RedirectURIs []string `json:"redirect_uris"` + GrantTypes []string `json:"grant_types"` + ResponseTypes []string `json:"response_types"` + ApplicationType string `json:"application_type"` + DpopBoundAccessTokens bool `json:"dpop_bound_access_tokens"` + JwksURI string `json:"jwks_uri"` + Scope string `json:"scope"` + TokenEndpointAuthMethod string `json:"token_endpoint_auth_method"` + TokenEndpointAuthSigningAlg string `json:"token_endpoint_auth_signing_alg"` +} + + +func GetClientMetadata() ClientMetadata { + var cm ClientMetadata + json.Unmarshal(metadataJson, &cm) + return cm +} \ No newline at end of file diff --git a/internal/config/config.go b/internal/config/config.go index 6b16d84..053e03e 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -14,7 +14,7 @@ type Config struct { } func LoadConfig() (*Config, error) { - configPath := getConfigFile() + configPath := GetConfigFile() // Default configuration cfg := &Config{ @@ -38,7 +38,7 @@ func SaveConfig(cfg *Config) (*Config, error) { cfg.Handle = strings.TrimPrefix(cfg.Handle, "@") } - configPath := getConfigFile() + configPath := GetConfigFile() data, err := json.MarshalIndent(cfg, "", " ") if err != nil { return cfg, err @@ -47,7 +47,7 @@ func SaveConfig(cfg *Config) (*Config, error) { return cfg, os.WriteFile(configPath, data, 0600) } -func getConfigFile() string { - home, _ := os.UserHomeDir() - return filepath.Join(home, ".blup.conf") +func GetConfigFile() string { + config, _ := os.UserConfigDir() + return filepath.Join(config, ".blup.json") }