mirror of
				https://github.com/photoprism/photoprism.git
				synced 2025-10-31 12:16:39 +08:00 
			
		
		
		
	 82d61d1f93
			
		
	
	82d61d1f93
	
	
	
		
			
			Animated GIFs are transcoded to AVC because it is much smaller and thus also suitable for long/large animations. In addition, this commit adds support for more metadata fields such as frame rate, number of frames, file capture timestamp (unix milliseconds), media type, and software version. Support for SVG files can later be implemented in a similar way.
		
			
				
	
	
		
			67 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			67 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package api
 | |
| 
 | |
| import (
 | |
| 	"net/http"
 | |
| 
 | |
| 	"github.com/gin-gonic/gin"
 | |
| 	"github.com/photoprism/photoprism/internal/acl"
 | |
| 	"github.com/photoprism/photoprism/internal/event"
 | |
| 	"github.com/photoprism/photoprism/internal/i18n"
 | |
| 	"github.com/photoprism/photoprism/internal/service"
 | |
| )
 | |
| 
 | |
| // GET /api/v1/settings
 | |
| func GetSettings(router *gin.RouterGroup) {
 | |
| 	router.GET("/settings", func(c *gin.Context) {
 | |
| 		s := Auth(SessionID(c), acl.ResourceSettings, acl.ActionRead)
 | |
| 
 | |
| 		if s.Invalid() {
 | |
| 			AbortUnauthorized(c)
 | |
| 			return
 | |
| 		}
 | |
| 
 | |
| 		if settings := service.Config().Settings(); settings != nil {
 | |
| 			c.JSON(http.StatusOK, settings)
 | |
| 		} else {
 | |
| 			Abort(c, http.StatusNotFound, i18n.ErrNotFound)
 | |
| 		}
 | |
| 	})
 | |
| }
 | |
| 
 | |
| // POST /api/v1/settings
 | |
| func SaveSettings(router *gin.RouterGroup) {
 | |
| 	router.POST("/settings", func(c *gin.Context) {
 | |
| 		s := Auth(SessionID(c), acl.ResourceSettings, acl.ActionUpdate)
 | |
| 
 | |
| 		if s.Invalid() {
 | |
| 			AbortUnauthorized(c)
 | |
| 			return
 | |
| 		}
 | |
| 
 | |
| 		conf := service.Config()
 | |
| 
 | |
| 		if conf.DisableSettings() {
 | |
| 			AbortUnauthorized(c)
 | |
| 			return
 | |
| 		}
 | |
| 
 | |
| 		settings := conf.Settings()
 | |
| 
 | |
| 		if err := c.BindJSON(settings); err != nil {
 | |
| 			AbortBadRequest(c)
 | |
| 			return
 | |
| 		}
 | |
| 
 | |
| 		if err := settings.Save(conf.SettingsYaml()); err != nil {
 | |
| 			c.AbortWithStatusJSON(http.StatusInternalServerError, err)
 | |
| 			return
 | |
| 		}
 | |
| 
 | |
| 		UpdateClientConfig()
 | |
| 
 | |
| 		event.InfoMsg(i18n.MsgSettingsSaved)
 | |
| 
 | |
| 		c.JSON(http.StatusOK, settings)
 | |
| 	})
 | |
| }
 |