diff options
| author | Nasha Hiramiya <git@hiramiya.me> | 2018-08-30 21:03:00 +0100 |
|---|---|---|
| committer | Nasha Hiramiya <git@hiramiya.me> | 2018-08-30 21:03:00 +0100 |
| commit | 5deb1bf40e09c842cde1ade1d4fd074187521856 (patch) | |
| tree | 1ab7e0dc20601627896414d1bba17f0a324e9072 /src/client | |
| parent | Merge pull request #3 from syuilo/develop (diff) | |
| parent | 8.16.0 (diff) | |
| download | sharkey-5deb1bf40e09c842cde1ade1d4fd074187521856.tar.gz sharkey-5deb1bf40e09c842cde1ade1d4fd074187521856.tar.bz2 sharkey-5deb1bf40e09c842cde1ade1d4fd074187521856.zip | |
Merge remote-tracking branch 'upstream/develop' into develop
Diffstat (limited to 'src/client')
19 files changed, 173 insertions, 116 deletions
diff --git a/src/client/app/common/views/components/url-preview.vue b/src/client/app/common/views/components/url-preview.vue index 4ddc137ed1..242d9ba5c6 100644 --- a/src/client/app/common/views/components/url-preview.vue +++ b/src/client/app/common/views/components/url-preview.vue @@ -28,18 +28,99 @@ import Vue from 'vue'; import { url as misskeyUrl } from '../../../config'; +// THIS IS THE WHITELIST FOR THE EMBED PLAYER +const whiteList = [ + 'afreecatv.com', + 'aparat.com', + 'applemusic.com', + 'amazon.com', + 'awa.fm', + 'bandcamp.com', + 'bbc.co.uk', + 'beatport.com', + 'bilibili.com', + 'boomstream.com', + 'breakers.tv', + 'cam4.com', + 'cavelis.net', + 'chaturbate.com', + 'cnn.com', + 'cybergame.tv', + 'dailymotion.com', + 'deezer.com', + 'djlive.pl', + 'e-onkyo.com', + 'eventials.com', + 'facebook.com', + 'fc2.com', + 'gameplank.tv', + 'goodgame.ru', + 'google.com', + 'hardtunes.com', + 'instagram.com', + 'johnnylooch.com', + 'kexp.org', + 'lahzenegar.com', + 'liveedu.tv', + 'livetube.cc', + 'livestream.com', + 'meridix.com', + 'mixcloud.com', + 'mixer.com', + 'mobcrush.com', + 'mylive.in.th', + 'myspace.com', + 'netflix.com', + 'newretrowave.com', + 'nhk.or.jp', + 'nicovideo.jp', + 'nico.ms', + 'noisetrade.com', + 'nood.tv', + 'npr.org', + 'openrec.tv', + 'pandora.com', + 'pandora.tv', + 'picarto.tv', + 'pscp.tv', + 'restream.io', + 'reverbnation.com', + 'sermonaudio.com', + 'smashcast.tv', + 'songkick.com', + 'soundcloud.com', + 'spinninrecords.com', + 'spotify.com', + 'stitcher.com', + 'stream.me', + 'switchboard.live', + 'tunein.com', + 'twitcasting.tv', + 'twitch.tv', + 'twitter.com', + 'vaughnlive.tv', + 'veoh.com', + 'vimeo.com', + 'watchpeoplecode.com', + 'web.tv', + 'youtube.com', + 'youtu.be' +]; + export default Vue.extend({ props: { url: { type: String, require: true }, + detail: { type: Boolean, required: false, default: false } }, + data() { return { fetching: true, @@ -57,6 +138,7 @@ export default Vue.extend({ misskeyUrl }; }, + created() { const url = new URL(this.url); @@ -81,97 +163,22 @@ export default Vue.extend({ } return; } + fetch('/url?url=' + encodeURIComponent(this.url)).then(res => { res.json().then(info => { - if (info.url != null) { - this.title = info.title; - this.description = info.description; - this.thumbnail = info.thumbnail; - this.icon = info.icon; - this.sitename = info.sitename; - this.fetching = false; - if ([ // THIS IS THE WHITELIST FOR THE EMBED PLAYER - 'afreecatv.com', - 'aparat.com', - 'applemusic.com', - 'amazon.com', - 'awa.fm', - 'bandcamp.com', - 'bbc.co.uk', - 'beatport.com', - 'bilibili.com', - 'boomstream.com', - 'breakers.tv', - 'cam4.com', - 'cavelis.net', - 'chaturbate.com', - 'cnn.com', - 'cybergame.tv', - 'dailymotion.com', - 'deezer.com', - 'djlive.pl', - 'e-onkyo.com', - 'eventials.com', - 'facebook.com', - 'fc2.com', - 'gameplank.tv', - 'goodgame.ru', - 'google.com', - 'hardtunes.com', - 'instagram.com', - 'johnnylooch.com', - 'kexp.org', - 'lahzenegar.com', - 'liveedu.tv', - 'livetube.cc', - 'livestream.com', - 'meridix.com', - 'mixcloud.com', - 'mixer.com', - 'mobcrush.com', - 'mylive.in.th', - 'myspace.com', - 'netflix.com', - 'newretrowave.com', - 'nhk.or.jp', - 'nicovideo.jp', - 'nico.ms', - 'noisetrade.com', - 'nood.tv', - 'npr.org', - 'openrec.tv', - 'pandora.com', - 'pandora.tv', - 'picarto.tv', - 'pscp.tv', - 'restream.io', - 'reverbnation.com', - 'sermonaudio.com', - 'smashcast.tv', - 'songkick.com', - 'soundcloud.com', - 'spinninrecords.com', - 'spotify.com', - 'stitcher.com', - 'stream.me', - 'switchboard.live', - 'tunein.com', - 'twitcasting.tv', - 'twitch.tv', - 'twitter.com', - 'vaughnlive.tv', - 'veoh.com', - 'vimeo.com', - 'watchpeoplecode.com', - 'web.tv', - 'youtube.com', - 'youtu.be' - ].some(x => x == url.hostname || url.hostname.endsWith(`.${x}`))) - this.player = info.player; - } // info.url - }) // json - }); // fetch - } // created + if (info.url == null) return; + this.title = info.title; + this.description = info.description; + this.thumbnail = info.thumbnail; + this.icon = info.icon; + this.sitename = info.sitename; + this.fetching = false; + if (whiteList.some(x => x == url.hostname || url.hostname.endsWith(`.${x}`))) { + this.player = info.player; + } + }) + }); + } }); </script> diff --git a/src/client/app/common/views/widgets/donation.vue b/src/client/app/common/views/widgets/donation.vue index b1352e803e..544ca1bd9d 100644 --- a/src/client/app/common/views/widgets/donation.vue +++ b/src/client/app/common/views/widgets/donation.vue @@ -2,7 +2,7 @@ <div class="mkw-donation" :data-mobile="platform == 'mobile'"> <article> <h1>%fa:heart%%i18n:@title%</h1> - <p> + <p v-if="meta"> {{ '%i18n:@text%'.substr(0, '%i18n:@text%'.indexOf('{')) }} <a :href="meta.maintainer.url">{{ meta.maintainer.name }}</a> {{ '%i18n:@text%'.substr('%i18n:@text%'.indexOf('}') + 1) }} diff --git a/src/client/app/config.ts b/src/client/app/config.ts index 74b9ea21c8..a326c521db 100644 --- a/src/client/app/config.ts +++ b/src/client/app/config.ts @@ -4,6 +4,7 @@ declare const _THEME_COLOR_: string; declare const _COPYRIGHT_: string; declare const _VERSION_: string; declare const _CODENAME_: string; +declare const _ENV_: string; const address = new URL(location.href); @@ -18,3 +19,4 @@ export const themeColor = _THEME_COLOR_; export const copyright = _COPYRIGHT_; export const version = _VERSION_; export const codename = _CODENAME_; +export const env = _ENV_; diff --git a/src/client/app/desktop/api/update-avatar.ts b/src/client/app/desktop/api/update-avatar.ts index f07dc623f2..e9d92d1eb1 100644 --- a/src/client/app/desktop/api/update-avatar.ts +++ b/src/client/app/desktop/api/update-avatar.ts @@ -6,9 +6,9 @@ import ProgressDialog from '../views/components/progress-dialog.vue'; export default (os: OS) => { const cropImage = file => new Promise((resolve, reject) => { - - var regex = RegExp('\.(jpg|jpeg|png|gif|webp|bmp|tiff)$') - if(!regex.test(file.name) ) { + + const regex = RegExp('\.(jpg|jpeg|png|gif|webp|bmp|tiff)$'); + if (!regex.test(file.name) ) { os.apis.dialog({ title: '%fa:info-circle% %i18n:desktop.invalid-filetype%', text: null, @@ -16,9 +16,9 @@ export default (os: OS) => { text: '%i18n:common.got-it%' }] }); - reject + reject(); } - + const w = os.new(CropWindow, { image: file, title: '%i18n:desktop.avatar-crop-title%', diff --git a/src/client/app/desktop/api/update-banner.ts b/src/client/app/desktop/api/update-banner.ts index 5af6ea88d2..e8fa35149b 100644 --- a/src/client/app/desktop/api/update-banner.ts +++ b/src/client/app/desktop/api/update-banner.ts @@ -6,10 +6,9 @@ import ProgressDialog from '../views/components/progress-dialog.vue'; export default (os: OS) => { const cropImage = file => new Promise((resolve, reject) => { - - var regex = RegExp('\.(jpg|jpeg|png|gif|webp|bmp|tiff)$') - if(!regex.test(file.name) ) { + const regex = RegExp('\.(jpg|jpeg|png|gif|webp|bmp|tiff)$'); + if (!regex.test(file.name) ) { os.apis.dialog({ title: '%fa:info-circle% %i18n:desktop.invalid-filetype%', text: null, @@ -17,9 +16,9 @@ export default (os: OS) => { text: '%i18n:common.got-it%' }] }); - reject + reject(); } - + const w = os.new(CropWindow, { image: file, title: '%i18n:desktop.banner-crop-title%', diff --git a/src/client/app/desktop/views/components/charts.vue b/src/client/app/desktop/views/components/charts.vue index e400aebbb7..c4e92e429f 100644 --- a/src/client/app/desktop/views/components/charts.vue +++ b/src/client/app/desktop/views/components/charts.vue @@ -88,7 +88,9 @@ export default Vue.extend({ }, created() { - (this as any).api('chart').then(chart => { + (this as any).api('chart', { + limit: 32 + }).then(chart => { this.chart = chart; }); }, @@ -580,6 +582,6 @@ export default Vue.extend({ > div > * display block - height 300px + height 320px </style> diff --git a/src/client/app/desktop/views/components/note-detail.vue b/src/client/app/desktop/views/components/note-detail.vue index 227bcc349d..1ba4a9a447 100644 --- a/src/client/app/desktop/views/components/note-detail.vue +++ b/src/client/app/desktop/views/components/note-detail.vue @@ -47,7 +47,7 @@ </div> <mk-poll v-if="p.poll" :note="p"/> <mk-url-preview v-for="url in urls" :url="url" :key="url" :detail="true"/> - <a class="location" v-if="p.geo" :href="`http://maps.google.com/maps?q=${p.geo.coordinates[1]},${p.geo.coordinates[0]}`" target="_blank">%fa:map-marker-alt% %i18n:@location%</a> + <a class="location" v-if="p.geo" :href="`https://maps.google.com/maps?q=${p.geo.coordinates[1]},${p.geo.coordinates[0]}`" target="_blank">%fa:map-marker-alt% %i18n:@location%</a> <div class="map" v-if="p.geo" ref="map"></div> <div class="renote" v-if="p.renote"> <mk-note-preview :note="p.renote"/> diff --git a/src/client/app/desktop/views/components/notes.note.vue b/src/client/app/desktop/views/components/notes.note.vue index 87acf7974d..7592ae3905 100644 --- a/src/client/app/desktop/views/components/notes.note.vue +++ b/src/client/app/desktop/views/components/notes.note.vue @@ -32,7 +32,7 @@ <mk-media-list :media-list="p.media"/> </div> <mk-poll v-if="p.poll" :note="p" ref="pollViewer"/> - <a class="location" v-if="p.geo" :href="`http://maps.google.com/maps?q=${p.geo.coordinates[1]},${p.geo.coordinates[0]}`" target="_blank">%fa:map-marker-alt% 位置情報</a> + <a class="location" v-if="p.geo" :href="`https://maps.google.com/maps?q=${p.geo.coordinates[1]},${p.geo.coordinates[0]}`" target="_blank">%fa:map-marker-alt% 位置情報</a> <div class="map" v-if="p.geo" ref="map"></div> <div class="renote" v-if="p.renote"> <mk-note-preview :note="p.renote"/> diff --git a/src/client/app/desktop/views/components/ui.header.nav.vue b/src/client/app/desktop/views/components/ui.header.nav.vue index f01aade306..6292b764c6 100644 --- a/src/client/app/desktop/views/components/ui.header.nav.vue +++ b/src/client/app/desktop/views/components/ui.header.nav.vue @@ -11,7 +11,7 @@ <li class="deck" :class="{ active: $route.name == 'deck' }" @click="goToTop"> <router-link to="/deck"> %fa:columns% - <p>%i18n:@deck% <small>(beta)</small></p> + <p>%i18n:@deck%</p> </router-link> </li> <li class="messaging"> diff --git a/src/client/app/desktop/views/components/ui.header.vue b/src/client/app/desktop/views/components/ui.header.vue index 6de4eaf744..ac8a6c7765 100644 --- a/src/client/app/desktop/views/components/ui.header.vue +++ b/src/client/app/desktop/views/components/ui.header.vue @@ -1,5 +1,6 @@ <template> <div class="header"> + <p class="warn" v-if="env != 'production'">%i18n:common.do-not-use-in-production%</p> <mk-special-message/> <div class="main" ref="main"> <div class="backdrop"></div> @@ -28,6 +29,7 @@ <script lang="ts"> import Vue from 'vue'; import * as anime from 'animejs'; +import { env } from '../../../config'; import XNav from './ui.header.nav.vue'; import XSearch from './ui.header.search.vue'; @@ -43,7 +45,13 @@ export default Vue.extend({ XAccount, XNotifications, XPost, - XClock, + XClock + }, + + data() { + return { + env: env + }; }, mounted() { @@ -119,6 +127,15 @@ root(isDark) width 100% box-shadow 0 1px 1px rgba(#000, 0.075) + > .warn + display block + margin 0 + padding 4px + text-align center + font-size 12px + background #f00 + color #fff + > .main height 48px diff --git a/src/client/app/desktop/views/pages/deck/deck.note.vue b/src/client/app/desktop/views/pages/deck/deck.note.vue index c7df715a05..e6d062eac9 100644 --- a/src/client/app/desktop/views/pages/deck/deck.note.vue +++ b/src/client/app/desktop/views/pages/deck/deck.note.vue @@ -32,7 +32,7 @@ <mk-media-list :media-list="p.media"/> </div> <mk-poll v-if="p.poll" :note="p" ref="pollViewer"/> - <a class="location" v-if="p.geo" :href="`http://maps.google.com/maps?q=${p.geo.coordinates[1]},${p.geo.coordinates[0]}`" target="_blank">%fa:map-marker-alt% %i18n:@location%</a> + <a class="location" v-if="p.geo" :href="`https://maps.google.com/maps?q=${p.geo.coordinates[1]},${p.geo.coordinates[0]}`" target="_blank">%fa:map-marker-alt% %i18n:@location%</a> <div class="renote" v-if="p.renote"> <mk-note-preview :note="p.renote" :mini="true"/> </div> diff --git a/src/client/app/desktop/views/pages/stats/stats.vue b/src/client/app/desktop/views/pages/stats/stats.vue index 6fcbf069ee..41005b6398 100644 --- a/src/client/app/desktop/views/pages/stats/stats.vue +++ b/src/client/app/desktop/views/pages/stats/stats.vue @@ -60,5 +60,5 @@ export default Vue.extend({ font-size 70% > div - max-width 800px + max-width 850px </style> diff --git a/src/client/app/init.ts b/src/client/app/init.ts index 18f510ea24..cf97957400 100644 --- a/src/client/app/init.ts +++ b/src/client/app/init.ts @@ -19,8 +19,8 @@ import { version, codename, lang } from './config'; let elementLocale; switch (lang) { - case 'ja': elementLocale = ElementLocaleJa; break; - case 'en': elementLocale = ElementLocaleEn; break; + case 'ja-JP': elementLocale = ElementLocaleJa; break; + case 'en-US': elementLocale = ElementLocaleEn; break; default: elementLocale = ElementLocaleEn; break; } diff --git a/src/client/app/mobile/views/components/note-detail.vue b/src/client/app/mobile/views/components/note-detail.vue index 317f08dcfa..f9996f9da6 100644 --- a/src/client/app/mobile/views/components/note-detail.vue +++ b/src/client/app/mobile/views/components/note-detail.vue @@ -45,7 +45,7 @@ </div> <mk-poll v-if="p.poll" :note="p"/> <mk-url-preview v-for="url in urls" :url="url" :key="url" :detail="true"/> - <a class="location" v-if="p.geo" :href="`http://maps.google.com/maps?q=${p.geo.coordinates[1]},${p.geo.coordinates[0]}`" target="_blank">%fa:map-marker-alt% %i18n:@location%</a> + <a class="location" v-if="p.geo" :href="`https://maps.google.com/maps?q=${p.geo.coordinates[1]},${p.geo.coordinates[0]}`" target="_blank">%fa:map-marker-alt% %i18n:@location%</a> <div class="map" v-if="p.geo" ref="map"></div> <div class="renote" v-if="p.renote"> <mk-note-preview :note="p.renote"/> diff --git a/src/client/app/mobile/views/components/note.vue b/src/client/app/mobile/views/components/note.vue index 8fc8af7f8d..d0cea135f9 100644 --- a/src/client/app/mobile/views/components/note.vue +++ b/src/client/app/mobile/views/components/note.vue @@ -33,7 +33,7 @@ </div> <mk-poll v-if="p.poll" :note="p" ref="pollViewer"/> <mk-url-preview v-for="url in urls" :url="url" :key="url"/> - <a class="location" v-if="p.geo" :href="`http://maps.google.com/maps?q=${p.geo.coordinates[1]},${p.geo.coordinates[0]}`" target="_blank">%fa:map-marker-alt% %i18n:@location%</a> + <a class="location" v-if="p.geo" :href="`https://maps.google.com/maps?q=${p.geo.coordinates[1]},${p.geo.coordinates[0]}`" target="_blank">%fa:map-marker-alt% %i18n:@location%</a> <div class="map" v-if="p.geo" ref="map"></div> <div class="renote" v-if="p.renote"> <mk-note-preview :note="p.renote"/> diff --git a/src/client/app/mobile/views/components/ui.header.vue b/src/client/app/mobile/views/components/ui.header.vue index a616586c56..c9b3ab51ae 100644 --- a/src/client/app/mobile/views/components/ui.header.vue +++ b/src/client/app/mobile/views/components/ui.header.vue @@ -1,5 +1,6 @@ <template> -<div class="header"> +<div class="header" ref="root"> + <p class="warn" v-if="env != 'production'">%i18n:common.do-not-use-in-production%</p> <mk-special-message/> <div class="main" ref="main"> <div class="backdrop"></div> @@ -20,6 +21,7 @@ <script lang="ts"> import Vue from 'vue'; import * as anime from 'animejs'; +import { env } from '../../../config'; export default Vue.extend({ props: ['func'], @@ -27,7 +29,8 @@ export default Vue.extend({ return { hasGameInvitation: false, connection: null, - connectionId: null + connectionId: null, + env: env }; }, computed: { @@ -39,7 +42,7 @@ export default Vue.extend({ } }, mounted() { - this.$store.commit('setUiHeaderHeight', 48); + this.$store.commit('setUiHeaderHeight', this.$refs.root.offsetHeight); if (this.$store.getters.isSignedIn) { this.connection = (this as any).os.stream.getConnection(); @@ -133,6 +136,15 @@ root(isDark) height 3px background $theme-color + > .warn + display block + margin 0 + padding 4px + text-align center + font-size 12px + background #f00 + color #fff + > .main color rgba(#fff, 0.9) diff --git a/src/client/app/mobile/views/components/ui.vue b/src/client/app/mobile/views/components/ui.vue index 7e2d39f259..d2af15d235 100644 --- a/src/client/app/mobile/views/components/ui.vue +++ b/src/client/app/mobile/views/components/ui.vue @@ -31,7 +31,14 @@ export default Vue.extend({ connectionId: null }; }, + watch: { + '$store.state.uiHeaderHeight'() { + this.$el.style.paddingTop = this.$store.state.uiHeaderHeight + 'px'; + } + }, mounted() { + this.$el.style.paddingTop = this.$store.state.uiHeaderHeight + 'px'; + if (this.$store.getters.isSignedIn) { this.connection = (this as any).os.stream.getConnection(); this.connectionId = (this as any).os.stream.use(); diff --git a/src/client/app/mobile/views/pages/settings.vue b/src/client/app/mobile/views/pages/settings.vue index 6b82be099d..7437eb8b47 100644 --- a/src/client/app/mobile/views/pages/settings.vue +++ b/src/client/app/mobile/views/pages/settings.vue @@ -42,6 +42,12 @@ </ui-card> <ui-card> + <div slot="title">%fa:volume-up% %i18n:@sound%</div> + + <ui-switch v-model="enableSounds">%i18n:@enable-sounds%</ui-switch> + </ui-card> + + <ui-card> <div slot="title">%fa:language% %i18n:@lang%</div> <ui-select v-model="lang" placeholder="%i18n:@auto%"> @@ -142,6 +148,11 @@ export default Vue.extend({ get() { return this.$store.state.device.lang; }, set(value) { this.$store.commit('device/set', { key: 'lang', value }); } }, + + enableSounds: { + get() { return this.$store.state.device.enableSounds; }, + set(value) { this.$store.commit('device/set', { key: 'enableSounds', value }); } + }, }, mounted() { diff --git a/src/client/app/store.ts b/src/client/app/store.ts index 0f3ff4a380..469563495f 100644 --- a/src/client/app/store.ts +++ b/src/client/app/store.ts @@ -13,7 +13,7 @@ const defaultSettings = { showMaps: true, showPostFormOnTopOfTl: false, suggestRecentHashtags: true, - showClockOnHeader: false, + showClockOnHeader: true, circleIcons: true, gradientWindowHeader: false, showReplyTarget: true, |