[feature] Move use_blurhash to app settings, enable by default (#5)

Does what it says on the tin! This serves as a decent model (imo) for how to move something from Mastodon's rather opaque server-side settings to client settings.

Reviewed-on: https://codeberg.org/superseriousbusiness/masto-fe-standalone/pulls/5
Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Co-committed-by: tobi <tobi.smethurst@protonmail.com>
This commit is contained in:
tobi
2024-12-27 11:54:18 +00:00
committed by tobi
parent 9f520d3608
commit 4df14235c6
11 changed files with 113 additions and 21 deletions
@@ -11,7 +11,7 @@ import { throttle } from 'lodash';
import { Blurhash } from 'flavours/glitch/components/blurhash';
import { Icon } from 'flavours/glitch/components/icon';
import { displayMedia, useBlurhash } from 'flavours/glitch/initial_state';
import { displayMedia } from 'flavours/glitch/initial_state';
import { isFullscreen, requestFullscreen, exitFullscreen } from '../ui/util/fullscreen';
@@ -129,6 +129,7 @@ class Video extends PureComponent {
muted: PropTypes.bool,
componentIndex: PropTypes.number,
autoFocus: PropTypes.bool,
useBlurhash: PropTypes.bool,
};
static defaultProps = {
@@ -509,8 +510,35 @@ class Video extends PureComponent {
}
render () {
const { preview, src, inline, onOpenVideo, onCloseVideo, intl, alt, lang, letterbox, fullwidth, detailed, sensitive, editable, blurhash, autoFocus } = this.props;
const { currentTime, duration, volume, buffer, dragging, paused, fullscreen, hovered, revealed } = this.state;
const {
preview,
src,
inline,
onOpenVideo,
onCloseVideo,
intl,
alt,
lang,
letterbox,
fullwidth,
detailed,
sensitive,
editable,
blurhash,
autoFocus,
useBlurhash
} = this.props;
const {
currentTime,
duration,
volume,
buffer,
dragging,
paused,
fullscreen,
hovered,
revealed
} = this.state;
const progress = Math.min((currentTime / duration) * 100, 100);
const muted = this.state.muted || volume === 0;