summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandomChars <random@chars.jp>2021-08-20 15:01:37 +0900
committerRandomChars <random@chars.jp>2021-08-20 15:01:37 +0900
commit85879c9436b9779c2c038995f9b6291a7513fd5b (patch)
treeebb4169f9c382fb0e918630a682cd614c4ca7cd8
parent8142d554bd3de7419a455e27904d0d369f1b0bee (diff)
move image pages under /imagev0.8.5
-rw-r--r--api.go48
-rw-r--r--api/paths.go56
2 files changed, 52 insertions, 52 deletions
diff --git a/api.go b/api.go
index f199bae..4f329cd 100644
--- a/api.go
+++ b/api.go
@@ -286,6 +286,30 @@ func registerAPI() {
context.JSON(http.StatusOK, image)
})
+ router.GET(api.ImagePage, func(context *gin.Context) {
+ context.String(http.StatusOK, strconv.Itoa(instance.PageTotal(store.ImageRootPageVariant)))
+ })
+
+ router.GET(api.ImagePageField, func(context *gin.Context) {
+ param := context.Param("entry")
+ entry, err := strconv.Atoi(param)
+ if err != nil {
+ context.JSON(http.StatusBadRequest, api.Error{Error: err.Error()})
+ return
+ }
+ context.JSON(http.StatusOK, instance.Page(store.ImageRootPageVariant, entry))
+ })
+
+ router.GET(api.ImagePageImage, func(context *gin.Context) {
+ param := context.Param("entry")
+ entry, err := strconv.Atoi(param)
+ if err != nil {
+ context.JSON(http.StatusBadRequest, api.Error{Error: err.Error()})
+ return
+ }
+ context.JSON(http.StatusOK, instance.PageImages(store.ImageRootPageVariant, entry))
+ })
+
router.GET(api.ImageField, func(context *gin.Context) {
context.JSON(http.StatusOK, instance.ImageSnowflake(context.Param("flake")))
})
@@ -508,30 +532,6 @@ func registerAPI() {
}
instance.TagType(context.Param("tag"), payload.Type)
})
-
- router.GET(api.Page, func(context *gin.Context) {
- context.String(http.StatusOK, strconv.Itoa(instance.PageTotal(store.ImageRootPageVariant)))
- })
-
- router.GET(api.PageField, func(context *gin.Context) {
- param := context.Param("entry")
- entry, err := strconv.Atoi(param)
- if err != nil {
- context.JSON(http.StatusBadRequest, api.Error{Error: err.Error()})
- return
- }
- context.JSON(http.StatusOK, instance.Page(store.ImageRootPageVariant, entry))
- })
-
- router.GET(api.PageImage, func(context *gin.Context) {
- param := context.Param("entry")
- entry, err := strconv.Atoi(param)
- if err != nil {
- context.JSON(http.StatusBadRequest, api.Error{Error: err.Error()})
- return
- }
- context.JSON(http.StatusOK, instance.PageImages(store.ImageRootPageVariant, entry))
- })
}
func getUser(context *gin.Context) (store.User, bool) {
diff --git a/api/paths.go b/api/paths.go
index 5738d92..13fd584 100644
--- a/api/paths.go
+++ b/api/paths.go
@@ -1,32 +1,32 @@
package api
const (
- Base = "/api"
- SingleUser = Base + "/single_user"
- Image = Base + "/image"
- ImageField = Image + "/:flake"
- ImageFile = ImageField + "/file"
- ImagePreview = ImageField + "/preview"
- ImageTag = ImageField + "/tag"
- ImageTagField = ImageTag + "/:tag"
- Tag = Base + "/tag"
- TagField = Tag + "/:tag"
- TagInfo = TagField + "/info"
- TagPage = TagField + "/page"
- TagPageField = TagPage + "/:entry"
- TagPageImage = TagPageField + "/image"
- Page = Base + "/page"
- PageField = Page + "/:entry"
- PageImage = PageField + "/image"
- Search = Base + "/search"
- SearchField = Search + "/:tags"
- User = Base + "/user"
- UserThis = User + "/this"
- UserField = User + "/:flake"
- UserSecret = UserField + "/secret"
- UserImage = UserField + "/image"
- UserPassword = UserField + "/password"
- Username = Base + "/username"
- UsernameField = Username + "/:name"
- UsernameAuth = UsernameField + "/auth"
+ Base = "/api"
+ SingleUser = Base + "/single_user"
+ Image = Base + "/image"
+ ImagePage = Image + "/page"
+ ImagePageField = ImagePage + "/:entry"
+ ImagePageImage = ImagePageField + "/image"
+ ImageField = Image + "/:flake"
+ ImageFile = ImageField + "/file"
+ ImagePreview = ImageField + "/preview"
+ ImageTag = ImageField + "/tag"
+ ImageTagField = ImageTag + "/:tag"
+ Tag = Base + "/tag"
+ TagField = Tag + "/:tag"
+ TagInfo = TagField + "/info"
+ TagPage = TagField + "/page"
+ TagPageField = TagPage + "/:entry"
+ TagPageImage = TagPageField + "/image"
+ Search = Base + "/search"
+ SearchField = Search + "/:tags"
+ User = Base + "/user"
+ UserThis = User + "/this"
+ UserField = User + "/:flake"
+ UserSecret = UserField + "/secret"
+ UserImage = UserField + "/image"
+ UserPassword = UserField + "/password"
+ Username = Base + "/username"
+ UsernameField = Username + "/:name"
+ UsernameAuth = UsernameField + "/auth"
)