0 package gmi

1

2 import (

3 "gemigit/repo"

4 "github.com/pitr/gig"

5 )

6

7 func PublicFile(c gig.Context) error {

8 data, mtype, err := serveFile(c.Param("repo"), c.Param("user"),

9 c.Param("*"))

10 if err != nil {

11 return c.NoContent(gig.StatusBadRequest, err.Error())

12 }

13 return c.Blob(mtype, data)

14 }

15

16 func PublicFileContent(c gig.Context) error {

17 content, err := repo.GetPublicFile(c.Param("repo"),

18 c.Param("user"),

19 c.Param("blob"))

20 if err != nil {

21 return c.NoContent(gig.StatusBadRequest, err.Error())

22 }

23 return c.Gemini(showFileContent(content))

24 }

25

26 func PublicRefs(c gig.Context) error {

27 return showRepo(c, pageRefs, false)

28 }

29

30 func PublicLicense(c gig.Context) error {

31 return showRepo(c, pageLicense, false)

32 }

33

34 func PublicReadme(c gig.Context) error {

35 return showRepo(c, pageReadme, false)

36 }

37

38 func PublicLog(c gig.Context) error {

39 return showRepo(c, pageLog, false)

40 }

41

42 func PublicFiles(c gig.Context) error {

43 return showRepo(c, pageFiles, false)

44 }

45