mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-29 04:22:24 -05:00 
			
		
		
		
	[feature] add support for hinting via api/v_/instance preferred image / video max sizes (#3505)
* add support for hinting via api/v_/instance endpoints a preferred image / video size limit * fix tests expecting old default values
This commit is contained in:
		
					parent
					
						
							
								8f288f1689
							
						
					
				
			
			
				commit
				
					
						f3b2eca8b8
					
				
			
		
					 8 changed files with 161 additions and 44 deletions
				
			
		|  | @ -1225,6 +1225,56 @@ func GetMediaEmojiRemoteMaxSize() bytesize.Size { return global.GetMediaEmojiRem | |||
| // SetMediaEmojiRemoteMaxSize safely sets the value for global configuration 'MediaEmojiRemoteMaxSize' field | ||||
| func SetMediaEmojiRemoteMaxSize(v bytesize.Size) { global.SetMediaEmojiRemoteMaxSize(v) } | ||||
| 
 | ||||
| // GetMediaImageSizeHint safely fetches the Configuration value for state's 'MediaImageSizeHint' field | ||||
| func (st *ConfigState) GetMediaImageSizeHint() (v bytesize.Size) { | ||||
| 	st.mutex.RLock() | ||||
| 	v = st.config.MediaImageSizeHint | ||||
| 	st.mutex.RUnlock() | ||||
| 	return | ||||
| } | ||||
| 
 | ||||
| // SetMediaImageSizeHint safely sets the Configuration value for state's 'MediaImageSizeHint' field | ||||
| func (st *ConfigState) SetMediaImageSizeHint(v bytesize.Size) { | ||||
| 	st.mutex.Lock() | ||||
| 	defer st.mutex.Unlock() | ||||
| 	st.config.MediaImageSizeHint = v | ||||
| 	st.reloadToViper() | ||||
| } | ||||
| 
 | ||||
| // MediaImageSizeHintFlag returns the flag name for the 'MediaImageSizeHint' field | ||||
| func MediaImageSizeHintFlag() string { return "media-image-size-hint" } | ||||
| 
 | ||||
| // GetMediaImageSizeHint safely fetches the value for global configuration 'MediaImageSizeHint' field | ||||
| func GetMediaImageSizeHint() bytesize.Size { return global.GetMediaImageSizeHint() } | ||||
| 
 | ||||
| // SetMediaImageSizeHint safely sets the value for global configuration 'MediaImageSizeHint' field | ||||
| func SetMediaImageSizeHint(v bytesize.Size) { global.SetMediaImageSizeHint(v) } | ||||
| 
 | ||||
| // GetMediaVideoSizeHint safely fetches the Configuration value for state's 'MediaVideoSizeHint' field | ||||
| func (st *ConfigState) GetMediaVideoSizeHint() (v bytesize.Size) { | ||||
| 	st.mutex.RLock() | ||||
| 	v = st.config.MediaVideoSizeHint | ||||
| 	st.mutex.RUnlock() | ||||
| 	return | ||||
| } | ||||
| 
 | ||||
| // SetMediaVideoSizeHint safely sets the Configuration value for state's 'MediaVideoSizeHint' field | ||||
| func (st *ConfigState) SetMediaVideoSizeHint(v bytesize.Size) { | ||||
| 	st.mutex.Lock() | ||||
| 	defer st.mutex.Unlock() | ||||
| 	st.config.MediaVideoSizeHint = v | ||||
| 	st.reloadToViper() | ||||
| } | ||||
| 
 | ||||
| // MediaVideoSizeHintFlag returns the flag name for the 'MediaVideoSizeHint' field | ||||
| func MediaVideoSizeHintFlag() string { return "media-video-size-hint" } | ||||
| 
 | ||||
| // GetMediaVideoSizeHint safely fetches the value for global configuration 'MediaVideoSizeHint' field | ||||
| func GetMediaVideoSizeHint() bytesize.Size { return global.GetMediaVideoSizeHint() } | ||||
| 
 | ||||
| // SetMediaVideoSizeHint safely sets the value for global configuration 'MediaVideoSizeHint' field | ||||
| func SetMediaVideoSizeHint(v bytesize.Size) { global.SetMediaVideoSizeHint(v) } | ||||
| 
 | ||||
| // GetMediaLocalMaxSize safely fetches the Configuration value for state's 'MediaLocalMaxSize' field | ||||
| func (st *ConfigState) GetMediaLocalMaxSize() (v bytesize.Size) { | ||||
| 	st.mutex.RLock() | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue