2019-05-14 18:16:35 +02:00
|
|
|
package api
|
|
|
|
|
2020-01-24 01:33:04 +01:00
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
2019-05-14 18:16:35 +02:00
|
|
|
var photoIconSvg = []byte(`
|
2020-05-16 17:07:44 +02:00
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0V0z" fill="none"/>
|
|
|
|
<path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14 6 17h12l-3.86-5.14z"/></svg>`)
|
2019-06-18 06:37:10 +02:00
|
|
|
|
2020-05-13 15:36:42 +02:00
|
|
|
var videoIconSvg = []byte(`<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
|
|
|
|
<path d="M0 0h24v24H0z" fill="none"/><path d="M10 8v8l5-4-5-4zm9-5H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14z"/></svg>`)
|
|
|
|
|
2019-06-18 06:37:10 +02:00
|
|
|
var albumIconSvg = []byte(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
|
|
|
<path d="M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"/>
|
|
|
|
<path d="M0 0h24v24H0z" fill="none"/></svg>`)
|
2019-12-17 04:39:23 +01:00
|
|
|
|
|
|
|
var labelIconSvg = []byte(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
|
|
|
<path d="M0 0h24v24H0z" fill="none"/><path d="M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12l-4.37-6.16z"/></svg>`)
|
2020-01-24 01:33:04 +01:00
|
|
|
|
2020-01-29 17:41:51 +01:00
|
|
|
var brokenIconSvg = []byte(`
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
|
|
|
<path fill="none" d="M0 0h24v24H0zm0 0h24v24H0zm21 19c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2V5c0-1.1.9-2 2-2h14c1.1 0 2 .9 2 2"/>
|
|
|
|
<path fill="none" d="M0 0h24v24H0z"/>
|
|
|
|
<path d="M21 5v6.59l-3-3.01-4 4.01-4-4-4 4-3-3.01V5c0-1.1.9-2 2-2h14c1.1 0 2 .9 2 2zm-3 6.42l3 3.01V19c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2v-6.58l3 2.99 4-4 4 4 4-3.99z"/></svg>`)
|
|
|
|
|
2020-05-05 15:42:54 +02:00
|
|
|
var uncachedIconSvg = []byte(`
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/>
|
|
|
|
<path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/></svg>`)
|
|
|
|
|
2020-01-24 01:33:04 +01:00
|
|
|
// GET /api/v1/svg/*
|
|
|
|
func GetSvg(router *gin.RouterGroup) {
|
|
|
|
router.GET("/svg/photo", func(c *gin.Context) {
|
|
|
|
c.Data(http.StatusOK, "image/svg+xml", photoIconSvg)
|
|
|
|
})
|
|
|
|
|
2020-05-13 15:36:42 +02:00
|
|
|
router.GET("/svg/video", func(c *gin.Context) {
|
|
|
|
c.Data(http.StatusOK, "image/svg+xml", videoIconSvg)
|
|
|
|
})
|
|
|
|
|
2020-01-24 01:33:04 +01:00
|
|
|
router.GET("/svg/label", func(c *gin.Context) {
|
|
|
|
c.Data(http.StatusOK, "image/svg+xml", labelIconSvg)
|
|
|
|
})
|
|
|
|
|
|
|
|
router.GET("/svg/album", func(c *gin.Context) {
|
|
|
|
c.Data(http.StatusOK, "image/svg+xml", albumIconSvg)
|
|
|
|
})
|
2020-01-29 17:41:51 +01:00
|
|
|
|
2020-05-23 20:58:58 +02:00
|
|
|
router.GET("/svg/folder", func(c *gin.Context) {
|
|
|
|
c.Data(http.StatusOK, "image/svg+xml", albumIconSvg)
|
|
|
|
})
|
|
|
|
|
2020-01-29 17:41:51 +01:00
|
|
|
router.GET("/svg/broken", func(c *gin.Context) {
|
|
|
|
c.Data(http.StatusOK, "image/svg+xml", brokenIconSvg)
|
|
|
|
})
|
2020-05-05 15:42:54 +02:00
|
|
|
|
|
|
|
router.GET("/svg/uncached", func(c *gin.Context) {
|
|
|
|
c.Data(http.StatusOK, "image/svg+xml", uncachedIconSvg)
|
|
|
|
})
|
2020-01-24 01:33:04 +01:00
|
|
|
}
|