From a1692ebc7cfa7b3c6943d552ae059261fa5d18d3 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 17 May 2018 16:24:01 +0900 Subject: モバイル版のウィジェット復活 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/app/common/scripts/streaming/home.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/client/app/common') diff --git a/src/client/app/common/scripts/streaming/home.ts b/src/client/app/common/scripts/streaming/home.ts index 32685f3c2c..09d830bece 100644 --- a/src/client/app/common/scripts/streaming/home.ts +++ b/src/client/app/common/scripts/streaming/home.ts @@ -48,6 +48,17 @@ export class HomeStream extends Stream { } }); + this.on('mobile_home_updated', x => { + if (x.home) { + os.store.commit('settings/setMobileHome', x.home); + } else { + os.store.commit('settings/setMobileHomeWidget', { + id: x.id, + data: x.data + }); + } + }); + // トークンが再生成されたとき // このままではMisskeyが利用できないので強制的にサインアウトさせる this.on('my_token_regenerated', () => { -- cgit v1.2.3-freya From e1672e539b3d62929ee2db1d79307ed207d81c5d Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 17 May 2018 23:18:24 +0900 Subject: :art: --- src/client/app/common/views/components/url-preview.vue | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/client/app/common') diff --git a/src/client/app/common/views/components/url-preview.vue b/src/client/app/common/views/components/url-preview.vue index 3bae6e5078..028b911e24 100644 --- a/src/client/app/common/views/components/url-preview.vue +++ b/src/client/app/common/views/components/url-preview.vue @@ -126,16 +126,21 @@ root(isDark) line-height 16px vertical-align top + @media (max-width 700px) + > .thumbnail + position relative + width 100% + height 100px + + & + article + left 0 + width 100% + @media (max-width 500px) font-size 8px - border none > .thumbnail - width 70px - - & + article - left 70px - width calc(100% - 70px) + height 70px > article padding 8px -- cgit v1.2.3-freya From 89a58dc5964f4df8c54c9c216d8fff3a63d86462 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 17 May 2018 23:38:35 +0900 Subject: 添付されたメディアのURLは省略して表示するように MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/app/common/scripts/can-hide-text.ts | 16 ++++++++++++++++ src/client/app/desktop/views/components/notes.note.vue | 18 ++++++++++++++++-- src/client/app/mobile/views/components/note.vue | 15 ++++++++++++++- src/models/drive-file.ts | 1 + 4 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 src/client/app/common/scripts/can-hide-text.ts (limited to 'src/client/app/common') diff --git a/src/client/app/common/scripts/can-hide-text.ts b/src/client/app/common/scripts/can-hide-text.ts new file mode 100644 index 0000000000..4a4be8d9d0 --- /dev/null +++ b/src/client/app/common/scripts/can-hide-text.ts @@ -0,0 +1,16 @@ +export default function(note) { + if (note.text == null) return true; + + let txt = note.text; + + if (note.media) { + note.media.forEach(file => { + txt = txt.replace(file.url, ''); + if (file.src) txt = txt.replace(file.src, ''); + }); + + if (txt == '') return true; + } + + return false; +} diff --git a/src/client/app/desktop/views/components/notes.note.vue b/src/client/app/desktop/views/components/notes.note.vue index 057c3c0956..3ecef33d9a 100644 --- a/src/client/app/desktop/views/components/notes.note.vue +++ b/src/client/app/desktop/views/components/notes.note.vue @@ -44,7 +44,7 @@
(この投稿は非公開です) %fa:reply% - + RP:
@@ -94,6 +94,7 @@ + + diff --git a/src/client/app/common/views/components/index.ts b/src/client/app/common/views/components/index.ts index 69fed00c74..c1a7bc61d7 100644 --- a/src/client/app/common/views/components/index.ts +++ b/src/client/app/common/views/components/index.ts @@ -3,6 +3,7 @@ import Vue from 'vue'; import signin from './signin.vue'; import signup from './signup.vue'; import forkit from './forkit.vue'; +import acct from './acct.vue'; import avatar from './avatar.vue'; import nav from './nav.vue'; import noteHtml from './note-html'; @@ -29,6 +30,7 @@ import welcomeTimeline from './welcome-timeline.vue'; Vue.component('mk-signin', signin); Vue.component('mk-signup', signup); Vue.component('mk-forkit', forkit); +Vue.component('mk-acct', acct); Vue.component('mk-avatar', avatar); Vue.component('mk-nav', nav); Vue.component('mk-note-html', noteHtml); diff --git a/src/client/app/desktop/views/components/note-detail.sub.vue b/src/client/app/desktop/views/components/note-detail.sub.vue index 24550c4e94..32119da50d 100644 --- a/src/client/app/desktop/views/components/note-detail.sub.vue +++ b/src/client/app/desktop/views/components/note-detail.sub.vue @@ -5,7 +5,7 @@
{{ note.user | userName }} - @{{ note.user | acct }} +
diff --git a/src/client/app/desktop/views/components/note-detail.vue b/src/client/app/desktop/views/components/note-detail.vue index a0e3915149..bda53db918 100644 --- a/src/client/app/desktop/views/components/note-detail.vue +++ b/src/client/app/desktop/views/components/note-detail.vue @@ -28,7 +28,7 @@
{{ p.user | userName }} - @{{ p.user | acct }} + diff --git a/src/client/app/desktop/views/components/note-preview.vue b/src/client/app/desktop/views/components/note-preview.vue index d04abfc5a7..2b4eff8e2f 100644 --- a/src/client/app/desktop/views/components/note-preview.vue +++ b/src/client/app/desktop/views/components/note-preview.vue @@ -4,7 +4,7 @@
{{ note.user | userName }} - @{{ note.user | acct }} + diff --git a/src/client/app/desktop/views/components/notes.note.sub.vue b/src/client/app/desktop/views/components/notes.note.sub.vue index 575d605203..503982b1a8 100644 --- a/src/client/app/desktop/views/components/notes.note.sub.vue +++ b/src/client/app/desktop/views/components/notes.note.sub.vue @@ -4,7 +4,7 @@
{{ note.user | userName }} - @{{ note.user | acct }} +
%fa:mobile-alt% diff --git a/src/client/app/desktop/views/components/notes.note.vue b/src/client/app/desktop/views/components/notes.note.vue index 3ecef33d9a..44121684ee 100644 --- a/src/client/app/desktop/views/components/notes.note.vue +++ b/src/client/app/desktop/views/components/notes.note.vue @@ -17,7 +17,7 @@
{{ p.user | userName }} bot - @{{ p.user | acct }} +
via {{ p.app.name }} %fa:mobile-alt% -- cgit v1.2.3-freya From 1075e3a0050e44f03dde8fadc79872d974a75b0f Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 18 May 2018 15:31:28 +0900 Subject: 透過画像のレンダリングを改善 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/app/common/views/components/avatar.vue | 2 +- src/client/app/desktop/views/components/drive.file.vue | 4 ++-- src/client/app/desktop/views/components/media-image.vue | 2 +- src/client/app/desktop/views/pages/user/user.header.vue | 2 +- src/client/app/mobile/views/components/drive.file-detail.vue | 2 +- src/client/app/mobile/views/components/drive.file.vue | 2 +- src/client/app/mobile/views/components/media-image.vue | 2 +- src/client/app/mobile/views/pages/user.vue | 2 +- src/services/drive/add-file.ts | 5 ++++- 9 files changed, 13 insertions(+), 10 deletions(-) (limited to 'src/client/app/common') diff --git a/src/client/app/common/views/components/avatar.vue b/src/client/app/common/views/components/avatar.vue index a4648c272e..8ec359e83c 100644 --- a/src/client/app/common/views/components/avatar.vue +++ b/src/client/app/common/views/components/avatar.vue @@ -23,7 +23,7 @@ export default Vue.extend({ computed: { style(): any { return { - backgroundColor: this.user.avatarColor ? `rgb(${ this.user.avatarColor.join(',') })` : null, + backgroundColor: this.user.avatarColor && this.user.avatarColor.length == 3 ? `rgb(${ this.user.avatarColor.join(',') })` : null, backgroundImage: `url(${ this.user.avatarUrl }?thumbnail)`, borderRadius: (this as any).clientSettings.circleIcons ? '100%' : null }; diff --git a/src/client/app/desktop/views/components/drive.file.vue b/src/client/app/desktop/views/components/drive.file.vue index 39881711fa..d8b8420ece 100644 --- a/src/client/app/desktop/views/components/drive.file.vue +++ b/src/client/app/desktop/views/components/drive.file.vue @@ -50,7 +50,7 @@ export default Vue.extend({ return `${this.file.name}\n${this.file.type} ${Vue.filter('bytes')(this.file.datasize)}`; }, background(): string { - return this.file.properties.avgColor + return this.file.properties.avgColor && this.file.properties.avgColor.length == 3 ? `rgb(${this.file.properties.avgColor.join(',')})` : 'transparent'; } @@ -129,7 +129,7 @@ export default Vue.extend({ }, onThumbnailLoaded() { - if (this.file.properties.avgColor) { + if (this.file.properties.avgColor && this.file.properties.avgColor.length == 3) { anime({ targets: this.$refs.thumbnail, backgroundColor: `rgba(${this.file.properties.avgColor.join(',')}, 0)`, diff --git a/src/client/app/desktop/views/components/media-image.vue b/src/client/app/desktop/views/components/media-image.vue index e5803cc36e..b98a4707ec 100644 --- a/src/client/app/desktop/views/components/media-image.vue +++ b/src/client/app/desktop/views/components/media-image.vue @@ -26,7 +26,7 @@ export default Vue.extend({ computed: { style(): any { return { - 'background-color': this.image.properties.avgColor ? `rgb(${this.image.properties.avgColor.join(',')})` : 'transparent', + 'background-color': this.image.properties.avgColor && this.image.properties.avgColor.length == 3 ? `rgb(${this.image.properties.avgColor.join(',')})` : 'transparent', 'background-image': this.raw ? `url(${this.image.url})` : `url(${this.image.url}?thumbnail&size=512)` }; } diff --git a/src/client/app/desktop/views/pages/user/user.header.vue b/src/client/app/desktop/views/pages/user/user.header.vue index 60dc15b15d..edb248dac7 100644 --- a/src/client/app/desktop/views/pages/user/user.header.vue +++ b/src/client/app/desktop/views/pages/user/user.header.vue @@ -29,7 +29,7 @@ export default Vue.extend({ style(): any { if (this.user.bannerUrl == null) return {}; return { - backgroundColor: this.user.bannerColor ? `rgb(${ this.user.bannerColor.join(',') })` : null, + backgroundColor: this.user.bannerColor && this.user.bannerColor.length == 3 ? `rgb(${ this.user.bannerColor.join(',') })` : null, backgroundImage: `url(${ this.user.bannerUrl })` }; } diff --git a/src/client/app/mobile/views/components/drive.file-detail.vue b/src/client/app/mobile/views/components/drive.file-detail.vue index 764822e98c..ddf17d2723 100644 --- a/src/client/app/mobile/views/components/drive.file-detail.vue +++ b/src/client/app/mobile/views/components/drive.file-detail.vue @@ -86,7 +86,7 @@ export default Vue.extend({ return this.file.type.split('/')[0]; }, style(): any { - return this.file.properties.avgColor ? { + return this.file.properties.avgColor && this.file.properties.avgColor.length == 3 ? { 'background-color': `rgb(${ this.file.properties.avgColor.join(',') })` } : {}; } diff --git a/src/client/app/mobile/views/components/drive.file.vue b/src/client/app/mobile/views/components/drive.file.vue index 7d1957042b..94c8ae3535 100644 --- a/src/client/app/mobile/views/components/drive.file.vue +++ b/src/client/app/mobile/views/components/drive.file.vue @@ -42,7 +42,7 @@ export default Vue.extend({ }, thumbnail(): any { return { - 'background-color': this.file.properties.avgColor ? `rgb(${this.file.properties.avgColor.join(',')})` : 'transparent', + 'background-color': this.file.properties.avgColor && this.file.properties.avgColor.length == 3 ? `rgb(${this.file.properties.avgColor.join(',')})` : 'transparent', 'background-image': `url(${this.file.url}?thumbnail&size=128)` }; } diff --git a/src/client/app/mobile/views/components/media-image.vue b/src/client/app/mobile/views/components/media-image.vue index 92d1cdc6f5..9e0f8e5f7e 100644 --- a/src/client/app/mobile/views/components/media-image.vue +++ b/src/client/app/mobile/views/components/media-image.vue @@ -18,7 +18,7 @@ export default Vue.extend({ computed: { style(): any { return { - 'background-color': this.image.properties.avgColor ? `rgb(${this.image.properties.avgColor.join(',')})` : 'transparent', + 'background-color': this.image.properties.avgColor && this.image.properties.avgColor.length == 3 ? `rgb(${this.image.properties.avgColor.join(',')})` : 'transparent', 'background-image': this.raw ? `url(${this.image.url})` : `url(${this.image.url}?thumbnail&size=512)` }; } diff --git a/src/client/app/mobile/views/pages/user.vue b/src/client/app/mobile/views/pages/user.vue index 27482dc215..f43454f9db 100644 --- a/src/client/app/mobile/views/pages/user.vue +++ b/src/client/app/mobile/views/pages/user.vue @@ -84,7 +84,7 @@ export default Vue.extend({ style(): any { if (this.user.bannerUrl == null) return {}; return { - backgroundColor: this.user.bannerColor ? `rgb(${ this.user.bannerColor.join(',') })` : null, + backgroundColor: this.user.bannerColor && this.user.bannerColor.length == 3 ? `rgb(${ this.user.bannerColor.join(',') })` : null, backgroundImage: `url(${ this.user.bannerUrl })` }; } diff --git a/src/services/drive/add-file.ts b/src/services/drive/add-file.ts index efabe345d1..bcd5bee512 100644 --- a/src/services/drive/add-file.ts +++ b/src/services/drive/add-file.ts @@ -171,6 +171,9 @@ const addFile = async ( log('calculate average color...'); + const info = await prominence(gm(fs.createReadStream(path), name)).identify(); + const isTransparent = info ? info['Channel depth'].Alpha != null : false; + const buffer = await prominence(gm(fs.createReadStream(path), name) .setFormat('ppm') .resize(1, 1)) // 1pxのサイズに縮小して平均色を取得するというハック @@ -182,7 +185,7 @@ const addFile = async ( log(`average color is calculated: ${r}, ${g}, ${b}`); - return [r, g, b]; + return isTransparent ? [r, g, b, 255] : [r, g, b]; })(), // folder (async () => { -- cgit v1.2.3-freya