this repo has no description smallweb.run
smallweb
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

add support for reading public SSH keys from the user's .ssh directory

pomdtr f3dbb790 f984a5ed

+27
+27
cmd/up.go
··· 139 139 if flags.sshAddr != "" { 140 140 server := ssh.Server{ 141 141 PublicKeyHandler: func(ctx ssh.Context, key ssh.PublicKey) bool { 142 + sshDir := filepath.Join(os.Getenv("HOME"), ".ssh") 143 + entries, err := os.ReadDir(sshDir) 144 + if err != nil && !errors.Is(err, os.ErrNotExist) { 145 + fmt.Fprintf(os.Stderr, "failed to read ssh directory: %v\n", err) 146 + return false 147 + } 148 + 149 + for _, entry := range entries { 150 + if filepath.Ext(entry.Name()) != ".pub" { 151 + continue 152 + } 153 + 154 + pubKeyBytes, err := os.ReadFile(filepath.Join(sshDir, entry.Name())) 155 + if err != nil { 156 + continue 157 + } 158 + 159 + pubKey, _, _, _, err := gossh.ParseAuthorizedKey(pubKeyBytes) 160 + if err != nil { 161 + continue 162 + } 163 + 164 + if ssh.KeysEqual(pubKey, key) { 165 + return true 166 + } 167 + } 168 + 142 169 for _, authorizedKeysPath := range []string{ 143 170 filepath.Join(os.Getenv("HOME"), ".ssh", "authorized_keys"), 144 171 filepath.Join(k.String("dir"), ".smallweb", "authorized_keys"),