about.go 741 B

123456789101112131415161718192021222324252627282930313233
  1. package libamuse
  2. import (
  3. "notabug.org/apiote/amuse/accounts"
  4. "notabug.org/apiote/gott"
  5. )
  6. func renderAbout(args ...interface{}) interface{} {
  7. result := args[1].(*Result)
  8. languages := result.languages
  9. renderer := result.renderer
  10. result.page = renderer.RenderAbout(languages)
  11. return gott.Tuple(args)
  12. }
  13. func ShowAbout(language, mimetype string, auth accounts.Authentication) (string, error) {
  14. auth.Necessary = false
  15. r, err := gott.
  16. NewResult(gott.Tuple{&RequestData{language: language, mimetype: mimetype, auth: auth}, &Result{}}).
  17. Bind(parseLanguage).
  18. Bind(verifyToken).
  19. Bind(createRenderer).
  20. Map(renderAbout).
  21. Finish()
  22. if err != nil {
  23. return "", err
  24. } else {
  25. return r.(gott.Tuple)[1].(*Result).page, nil
  26. }
  27. }