リモートサーバーのファイルをデータベースに保存せず、クライアントで直接表示させられるように

This commit is contained in:
syuilo
2018-05-25 20:19:14 +09:00
parent e804757d83
commit 558b897700
10 changed files with 110 additions and 60 deletions

View File

@@ -16,13 +16,18 @@ export default Vue.extend({
}
},
computed: {
lightmode(): boolean {
return this.$store.state.device.lightmode;
},
style(): any {
let url = `url(${this.image.url}?thumbnail)`;
if (this.$store.state.device.loadRemoteMedia || this.$store.state.device.lightmode) {
url = null;
} else if (this.raw || this.$store.state.device.loadRawImages) {
url = `url(${this.image.url})`;
}
return {
'background-color': this.image.properties.avgColor && this.image.properties.avgColor.length == 3 ? `rgb(${this.image.properties.avgColor.join(',')})` : 'transparent',
'background-image': this.lightmode ? null : this.raw ? `url(${this.image.url})` : `url(${this.image.url}?thumbnail&size=512)`
'background-image': url
};
}
}

View File

@@ -59,6 +59,14 @@
<md-switch v-model="clientSettings.disableViaMobile" @change="onChangeDisableViaMobile">%i18n:@disable-via-mobile%</md-switch>
</div>
<div>
<md-switch v-model="loadRawImages">%i18n:@load-raw-images%</md-switch>
</div>
<div>
<md-switch v-model="clientSettings.loadRemoteMedia" @change="onChangeLoadRemoteMedia">%i18n:@load-remote-media%</md-switch>
</div>
<div>
<md-switch v-model="lightmode">%i18n:@i-am-under-limited-internet%</md-switch>
</div>
@@ -166,6 +174,11 @@ export default Vue.extend({
set(value) { this.$store.commit('device/set', { key: 'lightmode', value }); }
},
loadRawImages: {
get() { return this.$store.state.device.loadRawImages; },
set(value) { this.$store.commit('device/set', { key: 'loadRawImages', value }); }
},
lang: {
get() { return this.$store.state.device.lang; },
set(value) { this.$store.commit('device/set', { key: 'lang', value }); }
@@ -195,6 +208,13 @@ export default Vue.extend({
});
},
onChangeLoadRemoteMedia(v) {
this.$store.dispatch('settings/set', {
key: 'loadRemoteMedia',
value: v
});
},
onChangeCircleIcons(v) {
this.$store.dispatch('settings/set', {
key: 'circleIcons',

View File

@@ -13,7 +13,9 @@ const defaultSettings = {
gradientWindowHeader: false,
showReplyTarget: true,
showMyRenotes: true,
showRenotedMyNotes: true
showRenotedMyNotes: true,
loadRemoteMedia: true,
disableViaMobile: false
};
const defaultDeviceSettings = {
@@ -26,6 +28,7 @@ const defaultDeviceSettings = {
preventUpdate: false,
debug: false,
lightmode: false,
loadRawImages: false,
postStyle: 'standard'
};