this repo has no description
0
fork

Configure Feed

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

remove deadcode (#530)

ran `deadcode -test ./...` and deleted stuff which looked actively
confusing or misplaced, as opposed to just filling out API completeness
or work-in-progress.

authored by

bnewbold and committed by
GitHub
81f8957f a5042dca

-124
-9
automod/engine/engine.go
··· 4 4 "context" 5 5 "fmt" 6 6 "log/slog" 7 - "strings" 8 7 "time" 9 8 10 9 "github.com/bluesky-social/indigo/atproto/identity" ··· 218 217 "reject", c.effects.RejectEvent, 219 218 ) 220 219 } 221 - 222 - func splitRepoPath(path string) (string, string, error) { 223 - parts := strings.SplitN(path, "/", 3) 224 - if len(parts) != 2 { 225 - return "", "", fmt.Errorf("invalid record path: %s", path) 226 - } 227 - return parts[0], parts[1], nil 228 - }
-4
bgs/admin.go
··· 17 17 "gorm.io/gorm" 18 18 ) 19 19 20 - func (bgs *BGS) handleAdminBlockRepoStream(e echo.Context) error { 21 - panic("TODO") 22 - } 23 - 24 20 func (bgs *BGS) handleAdminSetSubsEnabled(e echo.Context) error { 25 21 enabled, err := strconv.ParseBool(e.QueryParam("enabled")) 26 22 if err != nil {
-44
lex/gen.go
··· 7 7 "bytes" 8 8 "encoding/json" 9 9 "fmt" 10 - "html/template" 11 10 "io" 12 11 "os" 13 12 "path/filepath" ··· 583 582 pf("}\n\n") 584 583 585 584 return nil 586 - } 587 - 588 - func doTemplate(w io.Writer, info interface{}, templ string) error { 589 - t := template.Must(template.New(""). 590 - Funcs(template.FuncMap{ 591 - "TODO": func(thing string) string { 592 - return "//TODO: " + thing 593 - }, 594 - }).Parse(templ)) 595 - 596 - return t.Execute(w, info) 597 585 } 598 586 599 587 func CreateHandlerStub(pkg string, impmap map[string]string, dir string, schemas []*Schema, handlers bool) error { ··· 1352 1340 } 1353 1341 } 1354 1342 1355 - func forEachProp(t TypeSchema, cb func(k string, ts TypeSchema) error) error { 1356 - var keys []string 1357 - for k := range t.Properties { 1358 - keys = append(keys, k) 1359 - } 1360 - 1361 - sort.Strings(keys) 1362 - 1363 - for _, k := range keys { 1364 - subv := t.Properties[k] 1365 - 1366 - if err := cb(k, *subv); err != nil { 1367 - return err 1368 - } 1369 - } 1370 - return nil 1371 - } 1372 - 1373 1343 func (ts *TypeSchema) writeJsonMarshalerObject(name string, w io.Writer) error { 1374 1344 return nil // no need for a special json marshaler right now 1375 1345 } ··· 1397 1367 // TODO: would be nice to add some validation... 1398 1368 return nil 1399 1369 //pf("func (t *%s) UnmarshalJSON(b []byte) (error) {\n", name) 1400 - } 1401 - 1402 - func (ts *TypeSchema) getTypeConstValueForType(ref string) (any, error) { 1403 - rr, err := ts.lookupRef(ref) 1404 - if err != nil { 1405 - return nil, err 1406 - } 1407 - 1408 - reft, ok := rr.Properties["type"] 1409 - if !ok { 1410 - return nil, nil 1411 - } 1412 - 1413 - return reft.Const, nil 1414 1370 } 1415 1371 1416 1372 func (ts *TypeSchema) writeJsonUnmarshalerEnum(name string, w io.Writer) error {
-19
pds/server.go
··· 3 3 import ( 4 4 "context" 5 5 "database/sql" 6 - "encoding/json" 7 6 "errors" 8 7 "fmt" 9 8 "net" ··· 536 535 } 537 536 } 538 537 539 - func (s *Server) handleAuth(next echo.HandlerFunc) echo.HandlerFunc { 540 - return func(c echo.Context) error { 541 - authstr := c.Request().Header.Get("Authorization") 542 - _ = authstr 543 - 544 - return nil 545 - } 546 - } 547 - 548 538 func (s *Server) getUser(ctx context.Context) (*User, error) { 549 539 u, ok := ctx.Value("user").(*User) 550 540 if !ok { ··· 554 544 //u.Did = ctx.Value("did").(string) 555 545 556 546 return u, nil 557 - } 558 - 559 - func convertRecordTo(from any, to any) error { 560 - b, err := json.Marshal(from) 561 - if err != nil { 562 - return err 563 - } 564 - 565 - return json.Unmarshal(b, to) 566 547 } 567 548 568 549 func validateEmail(email string) error {
-22
pds/type_helpers.go
··· 1 - package pds 2 - 3 - import ( 4 - "context" 5 - 6 - appbsky "github.com/bluesky-social/indigo/api/bsky" 7 - ) 8 - 9 - // TODO: this is a quick helper to transform bsky.ActorDefs_ProfileViewBasic to 10 - // bsky.ActorDefs_ProfileView, written during the lexicon refactor (March 11 - // 2023). It probably needs to be updated to actually populate all the 12 - // additional fields (eg, via additional database queries) 13 - func (s *Server) actorBasicToView(ctx context.Context, basic *appbsky.ActorDefs_ProfileViewBasic) *appbsky.ActorDefs_ProfileView { 14 - view := &appbsky.ActorDefs_ProfileView{ 15 - Avatar: basic.Avatar, 16 - Did: basic.Did, 17 - DisplayName: basic.DisplayName, 18 - Handle: basic.Handle, 19 - Viewer: basic.Viewer, 20 - } 21 - return view 22 - }
-26
util/normalize.go
··· 1 - package util 2 - 3 - import ( 4 - "fmt" 5 - "strings" 6 - ) 7 - 8 - func NormalizeHostname(hostname string) (string, error) { 9 - if len(hostname) > 255 { 10 - return "", fmt.Errorf("hostname cannot be longer than 255 characters") 11 - } 12 - 13 - hostname = strings.TrimSpace(hostname) 14 - hostname = strings.Trim(hostname, ".") 15 - 16 - if len(hostname) == 0 { 17 - return "", fmt.Errorf("hostname cannot be empty") 18 - } 19 - 20 - // Lowercase the hostname, as domain names are case-insensitive 21 - hostname = strings.ToLower(hostname) 22 - 23 - // TODO: other normalizations 24 - 25 - return hostname, nil 26 - }