summaryrefslogtreecommitdiff
path: root/src/client/app/common
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2018-08-30 03:56:51 +0900
committerGitHub <noreply@github.com>2018-08-30 03:56:51 +0900
commit4e11da98d90c1c44fce1abaf63c248896feff03a (patch)
treecbe91363f87a3cc29b142433c16e4b16ccf2aa7d /src/client/app/common
parentNew translations ja-JP.yml (French) (diff)
parent:art: (diff)
downloadmisskey-4e11da98d90c1c44fce1abaf63c248896feff03a.tar.gz
misskey-4e11da98d90c1c44fce1abaf63c248896feff03a.tar.bz2
misskey-4e11da98d90c1c44fce1abaf63c248896feff03a.zip
Merge branch 'develop' into l10n_develop
Diffstat (limited to 'src/client/app/common')
-rw-r--r--src/client/app/common/views/components/nav.vue4
-rw-r--r--src/client/app/common/views/components/url-preview.vue187
-rw-r--r--src/client/app/common/views/filters/bytes.ts8
-rw-r--r--src/client/app/common/views/widgets/donation.vue15
4 files changed, 117 insertions, 97 deletions
diff --git a/src/client/app/common/views/components/nav.vue b/src/client/app/common/views/components/nav.vue
index 1f745bf69d..27e66358e4 100644
--- a/src/client/app/common/views/components/nav.vue
+++ b/src/client/app/common/views/components/nav.vue
@@ -26,8 +26,8 @@ export default Vue.extend({
},
created() {
(this as any).os.getMeta().then(meta => {
- if (meta.repositoryUrl) this.repositoryUrl = meta.repositoryUrl;
- if (meta.feedbackUrl) this.feedbackUrl = meta.feedbackUrl;
+ if (meta.maintainer.repository_url) this.repositoryUrl = meta.maintainer.repository_url;
+ if (meta.maintainer.feedback_url) this.feedbackUrl = meta.maintainer.feedback_url;
});
}
});
diff --git a/src/client/app/common/views/components/url-preview.vue b/src/client/app/common/views/components/url-preview.vue
index be69012737..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,102 +163,27 @@ 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>
<style lang="stylus" scoped>
-.twitter
+.player
position relative
width 100%
diff --git a/src/client/app/common/views/filters/bytes.ts b/src/client/app/common/views/filters/bytes.ts
index 3afb11e9ae..f7a1b2690f 100644
--- a/src/client/app/common/views/filters/bytes.ts
+++ b/src/client/app/common/views/filters/bytes.ts
@@ -1,8 +1,10 @@
import Vue from 'vue';
Vue.filter('bytes', (v, digits = 0) => {
- const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
- if (v == 0) return '0Byte';
+ const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
+ if (v == 0) return '0';
+ const isMinus = v < 0;
+ if (isMinus) v = -v;
const i = Math.floor(Math.log(v) / Math.log(1024));
- return (v / Math.pow(1024, i)).toFixed(digits).replace(/\.0+$/, '') + sizes[i];
+ return (isMinus ? '-' : '') + (v / Math.pow(1024, i)).toFixed(digits).replace(/\.0+$/, '') + sizes[i];
});
diff --git a/src/client/app/common/views/widgets/donation.vue b/src/client/app/common/views/widgets/donation.vue
index 470576d5e6..544ca1bd9d 100644
--- a/src/client/app/common/views/widgets/donation.vue
+++ b/src/client/app/common/views/widgets/donation.vue
@@ -2,9 +2,9 @@
<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="https://syuilo.com">@syuilo</a>
+ <a :href="meta.maintainer.url">{{ meta.maintainer.name }}</a>
{{ '%i18n:@text%'.substr('%i18n:@text%'.indexOf('}') + 1) }}
</p>
</article>
@@ -15,6 +15,17 @@
import define from '../../../common/define-widget';
export default define({
name: 'donation'
+}).extend({
+ data() {
+ return {
+ meta: null
+ };
+ },
+ created() {
+ (this as any).os.getMeta().then(meta => {
+ this.meta = meta;
+ });
+ }
});
</script>