parent
bd167b48d5
commit
e515276e15
10 changed files with 93 additions and 63 deletions
|
@ -144,6 +144,7 @@
|
|||
"node-sass": "^4.7.2",
|
||||
"node-sass-json-importer": "^3.1.3",
|
||||
"nprogress": "0.2.0",
|
||||
"object-assign-deep": "^0.3.1",
|
||||
"on-build-webpack": "^0.1.0",
|
||||
"os-utils": "0.0.14",
|
||||
"progress-bar-webpack-plugin": "^1.11.0",
|
||||
|
|
|
@ -118,7 +118,6 @@ export const pack = (
|
|||
let _user: any;
|
||||
|
||||
const fields = opts.detail ? {
|
||||
settings: false
|
||||
} : {
|
||||
settings: false,
|
||||
client_settings: false,
|
||||
|
@ -173,6 +172,7 @@ export const pack = (
|
|||
// Visible via only the official client
|
||||
if (!opts.includeSecrets) {
|
||||
delete _user.email;
|
||||
delete _user.settings;
|
||||
delete _user.client_settings;
|
||||
}
|
||||
|
||||
|
|
|
@ -136,8 +136,7 @@ export default async (req: express.Request, res: express.Response) => {
|
|||
auto_watch: true
|
||||
},
|
||||
client_settings: {
|
||||
home: homeData,
|
||||
show_donation: false
|
||||
home: homeData
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Vue from 'vue';
|
||||
import { EventEmitter } from 'eventemitter3';
|
||||
import * as merge from 'object-assign-deep';
|
||||
|
||||
import { host, apiUrl, swPublickey, version, lang, googleMapsApiKey } from '../config';
|
||||
import Progress from './scripts/loading';
|
||||
|
@ -284,6 +285,13 @@ export default class MiOS extends EventEmitter {
|
|||
// フェッチが完了したとき
|
||||
const fetched = me => {
|
||||
if (me) {
|
||||
// デフォルトの設定をマージ
|
||||
me.client_settings = Object.assign({
|
||||
fetchOnScroll: true,
|
||||
showMaps: true,
|
||||
showPostFormOnTopOfTl: false
|
||||
}, me.client_settings);
|
||||
|
||||
// ローカルストレージにキャッシュ
|
||||
localStorage.setItem('me', JSON.stringify(me));
|
||||
}
|
||||
|
@ -313,7 +321,7 @@ export default class MiOS extends EventEmitter {
|
|||
|
||||
// 後から新鮮なデータをフェッチ
|
||||
fetchme(cachedMe.token, freshData => {
|
||||
Object.assign(cachedMe, freshData);
|
||||
merge(cachedMe, freshData);
|
||||
});
|
||||
} else {
|
||||
// Get token from cookie
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import * as merge from 'object-assign-deep';
|
||||
|
||||
import Stream from './stream';
|
||||
import MiOS from '../../mios';
|
||||
|
||||
|
@ -18,7 +20,10 @@ export default class Connection extends Stream {
|
|||
|
||||
// 自分の情報が更新されたとき
|
||||
this.on('i_updated', i => {
|
||||
Object.assign(me, i);
|
||||
if (os.debug) {
|
||||
console.log('I updated:', i);
|
||||
}
|
||||
merge(me, i);
|
||||
});
|
||||
|
||||
// トークンが再生成されたとき
|
||||
|
|
|
@ -148,6 +148,8 @@ export default Vue.extend({
|
|||
|
||||
// Draw map
|
||||
if (this.p.geo) {
|
||||
const shouldShowMap = (this as any).os.isSignedIn ? (this as any).os.i.client_settings.showMaps : true;
|
||||
if (shouldShowMap) {
|
||||
(this as any).os.getGoogleMaps().then(maps => {
|
||||
const uluru = new maps.LatLng(this.p.geo.latitude, this.p.geo.longitude);
|
||||
const map = new maps.Map(this.$refs.map, {
|
||||
|
@ -160,6 +162,7 @@ export default Vue.extend({
|
|||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fetchContext() {
|
||||
|
@ -348,6 +351,9 @@ export default Vue.extend({
|
|||
width 100%
|
||||
height 300px
|
||||
|
||||
&:empty
|
||||
display none
|
||||
|
||||
> .mk-url-preview
|
||||
margin-top 8px
|
||||
|
||||
|
|
|
@ -162,6 +162,8 @@ export default Vue.extend({
|
|||
|
||||
// Draw map
|
||||
if (this.p.geo) {
|
||||
const shouldShowMap = (this as any).os.isSignedIn ? (this as any).os.i.client_settings.showMaps : true;
|
||||
if (shouldShowMap) {
|
||||
(this as any).os.getGoogleMaps().then(maps => {
|
||||
const uluru = new maps.LatLng(this.p.geo.latitude, this.p.geo.longitude);
|
||||
const map = new maps.Map(this.$refs.map, {
|
||||
|
@ -174,6 +176,7 @@ export default Vue.extend({
|
|||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.decapture(true);
|
||||
|
@ -467,6 +470,9 @@ export default Vue.extend({
|
|||
width 100%
|
||||
height 300px
|
||||
|
||||
&:empty
|
||||
display none
|
||||
|
||||
> .tags
|
||||
margin 4px 0 0 0
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
<section class="web" v-show="page == 'web'">
|
||||
<h1>動作</h1>
|
||||
<mk-switch v-model="fetchOnScroll" @change="onChangeFetchOnScroll" text="スクロールで自動読み込み">
|
||||
<mk-switch v-model="os.i.client_settings.fetchOnScroll" @change="onChangeFetchOnScroll" text="スクロールで自動読み込み">
|
||||
<span>ページを下までスクロールしたときに自動で追加のコンテンツを読み込みます。</span>
|
||||
</mk-switch>
|
||||
</section>
|
||||
|
@ -31,6 +31,9 @@
|
|||
<button class="ui button" @click="customizeHome">ホームをカスタマイズ</button>
|
||||
</div>
|
||||
<mk-switch v-model="os.i.client_settings.showPostFormOnTopOfTl" @change="onChangeShowPostFormOnTopOfTl" text="タイムライン上部に投稿フォームを表示する"/>
|
||||
<mk-switch v-model="os.i.client_settings.showMaps" @change="onChangeShowMaps" text="マップの自動展開">
|
||||
<span>位置情報が添付された投稿のマップを自動的に展開します。</span>
|
||||
</mk-switch>
|
||||
</section>
|
||||
|
||||
<section class="web" v-show="page == 'web'">
|
||||
|
@ -71,7 +74,7 @@
|
|||
|
||||
<section class="notification" v-show="page == 'notification'">
|
||||
<h1>通知</h1>
|
||||
<mk-switch v-model="autoWatch" @change="onChangeAutoWatch" text="投稿の自動ウォッチ">
|
||||
<mk-switch v-model="os.i.settings.auto_watch" @change="onChangeAutoWatch" text="投稿の自動ウォッチ">
|
||||
<span>リアクションしたり返信したりした投稿に関する通知を自動的に受け取るようにします。</span>
|
||||
</mk-switch>
|
||||
</section>
|
||||
|
@ -193,8 +196,6 @@ export default Vue.extend({
|
|||
version,
|
||||
latestVersion: undefined,
|
||||
checkingForUpdate: false,
|
||||
fetchOnScroll: true,
|
||||
autoWatch: true,
|
||||
enableSounds: localStorage.getItem('enableSounds') == 'true',
|
||||
lang: localStorage.getItem('lang') || '',
|
||||
preventUpdate: localStorage.getItem('preventUpdate') == 'true',
|
||||
|
@ -228,20 +229,6 @@ export default Vue.extend({
|
|||
(this as any).os.getMeta().then(meta => {
|
||||
this.meta = meta;
|
||||
});
|
||||
|
||||
if ((this as any).os.i.settings.auto_watch != null) {
|
||||
this.autoWatch = (this as any).os.i.settings.auto_watch;
|
||||
this.$watch('os.i.settings.auto_watch', v => {
|
||||
this.autoWatch = v;
|
||||
});
|
||||
}
|
||||
|
||||
if ((this as any).os.i.client_settings.fetchOnScroll != null) {
|
||||
this.fetchOnScroll = (this as any).os.i.client_settings.fetchOnScroll;
|
||||
this.$watch('os.i.client_settings.fetchOnScroll', v => {
|
||||
this.fetchOnScroll = v;
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
customizeHome() {
|
||||
|
@ -265,6 +252,12 @@ export default Vue.extend({
|
|||
value: v
|
||||
});
|
||||
},
|
||||
onChangeShowMaps(v) {
|
||||
(this as any).api('i/update_client_setting', {
|
||||
name: 'showMaps',
|
||||
value: v
|
||||
});
|
||||
},
|
||||
onChangeDisableViaMobile(v) {
|
||||
(this as any).api('i/update_client_setting', {
|
||||
name: 'disableViaMobile',
|
||||
|
|
|
@ -144,6 +144,8 @@ export default Vue.extend({
|
|||
|
||||
// Draw map
|
||||
if (this.p.geo) {
|
||||
const shouldShowMap = (this as any).os.isSignedIn ? (this as any).os.i.client_settings.showMaps : true;
|
||||
if (shouldShowMap) {
|
||||
(this as any).os.getGoogleMaps().then(maps => {
|
||||
const uluru = new maps.LatLng(this.p.geo.latitude, this.p.geo.longitude);
|
||||
const map = new maps.Map(this.$refs.map, {
|
||||
|
@ -156,6 +158,7 @@ export default Vue.extend({
|
|||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fetchContext() {
|
||||
|
@ -349,6 +352,9 @@ export default Vue.extend({
|
|||
width 100%
|
||||
height 200px
|
||||
|
||||
&:empty
|
||||
display none
|
||||
|
||||
> .mk-url-preview
|
||||
margin-top 8px
|
||||
|
||||
|
|
|
@ -137,6 +137,8 @@ export default Vue.extend({
|
|||
|
||||
// Draw map
|
||||
if (this.p.geo) {
|
||||
const shouldShowMap = (this as any).os.isSignedIn ? (this as any).os.i.client_settings.showMaps : true;
|
||||
if (shouldShowMap) {
|
||||
(this as any).os.getGoogleMaps().then(maps => {
|
||||
const uluru = new maps.LatLng(this.p.geo.latitude, this.p.geo.longitude);
|
||||
const map = new maps.Map(this.$refs.map, {
|
||||
|
@ -149,6 +151,7 @@ export default Vue.extend({
|
|||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.decapture(true);
|
||||
|
@ -448,6 +451,9 @@ export default Vue.extend({
|
|||
width 100%
|
||||
height 200px
|
||||
|
||||
&:empty
|
||||
display none
|
||||
|
||||
> .app
|
||||
font-size 12px
|
||||
color #ccc
|
||||
|
|
Loading…
Reference in a new issue