Mirror of @tangled.org/core. Running on a Raspberry Pi Zero 2 (Please be gentle).
0
fork

Configure Feed

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

appview/models: move db.PublicKey into models

Signed-off-by: oppiliappan <me@oppi.li>

+35 -28
+2 -1
appview/commitverify/verify.go
··· 5 5 6 6 "github.com/go-git/go-git/v5/plumbing/object" 7 7 "tangled.org/core/appview/db" 8 + "tangled.org/core/appview/models" 8 9 "tangled.org/core/crypto" 9 10 "tangled.org/core/types" 10 11 ) ··· 46 45 func GetVerifiedCommits(e db.Execer, emailToDid map[string]string, ndCommits []types.NiceDiff) (VerifiedCommits, error) { 47 46 vcs := VerifiedCommits{} 48 47 49 - didPubkeyCache := make(map[string][]db.PublicKey) 48 + didPubkeyCache := make(map[string][]models.PublicKey) 50 49 51 50 for _, commit := range ndCommits { 52 51 c := commit.Commit
+7 -26
appview/db/pubkeys.go
··· 1 1 package db 2 2 3 3 import ( 4 - "encoding/json" 4 + "tangled.org/core/appview/models" 5 5 "time" 6 6 ) 7 7 ··· 29 29 return err 30 30 } 31 31 32 - type PublicKey struct { 33 - Did string `json:"did"` 34 - Key string `json:"key"` 35 - Name string `json:"name"` 36 - Rkey string `json:"rkey"` 37 - Created *time.Time 38 - } 39 - 40 - func (p PublicKey) MarshalJSON() ([]byte, error) { 41 - type Alias PublicKey 42 - return json.Marshal(&struct { 43 - Created string `json:"created"` 44 - *Alias 45 - }{ 46 - Created: p.Created.Format(time.RFC3339), 47 - Alias: (*Alias)(&p), 48 - }) 49 - } 50 - 51 - func GetAllPublicKeys(e Execer) ([]PublicKey, error) { 52 - var keys []PublicKey 32 + func GetAllPublicKeys(e Execer) ([]models.PublicKey, error) { 33 + var keys []models.PublicKey 53 34 54 35 rows, err := e.Query(`select key, name, did, rkey, created from public_keys`) 55 36 if err != nil { ··· 39 58 defer rows.Close() 40 59 41 60 for rows.Next() { 42 - var publicKey PublicKey 61 + var publicKey models.PublicKey 43 62 var createdAt string 44 63 if err := rows.Scan(&publicKey.Key, &publicKey.Name, &publicKey.Did, &publicKey.Rkey, &createdAt); err != nil { 45 64 return nil, err ··· 56 75 return keys, nil 57 76 } 58 77 59 - func GetPublicKeysForDid(e Execer, did string) ([]PublicKey, error) { 60 - var keys []PublicKey 78 + func GetPublicKeysForDid(e Execer, did string) ([]models.PublicKey, error) { 79 + var keys []models.PublicKey 61 80 62 81 rows, err := e.Query(`select did, key, name, rkey, created from public_keys where did = ?`, did) 63 82 if err != nil { ··· 66 85 defer rows.Close() 67 86 68 87 for rows.Next() { 69 - var publicKey PublicKey 88 + var publicKey models.PublicKey 70 89 var createdAt string 71 90 if err := rows.Scan(&publicKey.Did, &publicKey.Key, &publicKey.Name, &publicKey.Rkey, &createdAt); err != nil { 72 91 return nil, err
+25
appview/models/pubkey.go
··· 1 + package models 2 + 3 + import ( 4 + "encoding/json" 5 + "time" 6 + ) 7 + 8 + type PublicKey struct { 9 + Did string `json:"did"` 10 + Key string `json:"key"` 11 + Name string `json:"name"` 12 + Rkey string `json:"rkey"` 13 + Created *time.Time 14 + } 15 + 16 + func (p PublicKey) MarshalJSON() ([]byte, error) { 17 + type Alias PublicKey 18 + return json.Marshal(&struct { 19 + Created string `json:"created"` 20 + *Alias 21 + }{ 22 + Created: p.Created.Format(time.RFC3339), 23 + Alias: (*Alias)(&p), 24 + }) 25 + }
+1 -1
appview/pages/pages.go
··· 303 303 304 304 type UserKeysSettingsParams struct { 305 305 LoggedInUser *oauth.User 306 - PubKeys []db.PublicKey 306 + PubKeys []models.PublicKey 307 307 Tabs []map[string]any 308 308 Tab string 309 309 }