app.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package user
  5. import (
  6. "net/http"
  7. api "github.com/gogs/go-gogs-client"
  8. "gogs.io/gogs/internal/context"
  9. "gogs.io/gogs/internal/db"
  10. "gogs.io/gogs/internal/db/errors"
  11. )
  12. func ListAccessTokens(c *context.APIContext) {
  13. tokens, err := db.ListAccessTokens(c.User.ID)
  14. if err != nil {
  15. c.Error(err, "list access tokens")
  16. return
  17. }
  18. apiTokens := make([]*api.AccessToken, len(tokens))
  19. for i := range tokens {
  20. apiTokens[i] = &api.AccessToken{Name: tokens[i].Name, Sha1: tokens[i].Sha1}
  21. }
  22. c.JSONSuccess(&apiTokens)
  23. }
  24. func CreateAccessToken(c *context.APIContext, form api.CreateAccessTokenOption) {
  25. t := &db.AccessToken{
  26. UID: c.User.ID,
  27. Name: form.Name,
  28. }
  29. if err := db.NewAccessToken(t); err != nil {
  30. if errors.IsAccessTokenNameAlreadyExist(err) {
  31. c.ErrorStatus(http.StatusUnprocessableEntity, err)
  32. } else {
  33. c.Error(err, "new access token")
  34. }
  35. return
  36. }
  37. c.JSON(http.StatusCreated, &api.AccessToken{Name: t.Name, Sha1: t.Sha1})
  38. }
PANIC: session(release): write data/sessions/1/7/17839a24b80efb71: no space left on device

PANIC

session(release): write data/sessions/1/7/17839a24b80efb71: no space left on device
github.com/go-macaron/session@v0.0.0-20190805070824-1a3cdc6f5659/session.go:199 (0x8b2934)
gopkg.in/macaron.v1@v1.3.9/context.go:79 (0x83d0a0)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/context.go:112 (0x84fdb5)
gopkg.in/macaron.v1@v1.3.9/recovery.go:161 (0x84fda8)
gopkg.in/macaron.v1@v1.3.9/logger.go:40 (0x840c73)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/router.go:187 (0x850fc6)
gopkg.in/macaron.v1@v1.3.9/router.go:303 (0x8493e5)
gopkg.in/macaron.v1@v1.3.9/macaron.go:220 (0x841fca)
net/http/server.go:2836 (0x7a79b2)
net/http/server.go:1924 (0x7a341b)
runtime/asm_amd64.s:1373 (0x46f9f0)