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