From 0160549dbec6386cf43e6b0130e6bc1d3b4490b2 Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 22 Sep 2019 17:18:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=A0=87=E8=AE=B0=E7=94=A8HS?= =?UTF-8?q?L=E3=80=81=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blivedm | 2 +- .../components/ChatRenderer/TextMessage.vue | 7 +++--- frontend/src/views/StyleGenerator/index.vue | 2 +- frontend/src/views/StyleGenerator/stylegen.js | 22 ++++++++++--------- views/chat.py | 4 ++-- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/blivedm b/blivedm index 22b159e..922d4d6 160000 --- a/blivedm +++ b/blivedm @@ -1 +1 @@ -Subproject commit 22b159e0cb3e4a5d715f21f7c9078ae7f54775b4 +Subproject commit 922d4d6615f9cc906d308657362d6fb1d4c8168f diff --git a/frontend/src/components/ChatRenderer/TextMessage.vue b/frontend/src/components/ChatRenderer/TextMessage.vue index addb020..b07a095 100644 --- a/frontend/src/components/ChatRenderer/TextMessage.vue +++ b/frontend/src/components/ChatRenderer/TextMessage.vue @@ -31,8 +31,9 @@ import AuthorBadge from './AuthorBadge.vue' import * as constants from './constants' import utils from '@/utils' -const REPEATED_MARK_COLOR_START = [64, 158, 255] -const REPEATED_MARK_COLOR_END = [245, 108, 108] +// HSL +const REPEATED_MARK_COLOR_START = [210, 100.0, 62.5] +const REPEATED_MARK_COLOR_END = [360, 87.3, 69.2] export default { name: 'TextMessage', @@ -69,7 +70,7 @@ export default { color[i] = REPEATED_MARK_COLOR_START[i] + (REPEATED_MARK_COLOR_END[i] - REPEATED_MARK_COLOR_START[i]) * t } } - return `rgb(${color.join(', ')})` + return `hsl(${color[0]}, ${color[1]}%, ${color[2]}%)` } } } diff --git a/frontend/src/views/StyleGenerator/index.vue b/frontend/src/views/StyleGenerator/index.vue index 70b78e7..b577b36 100644 --- a/frontend/src/views/StyleGenerator/index.vue +++ b/frontend/src/views/StyleGenerator/index.vue @@ -280,7 +280,7 @@ const EXAMPLE_MESSAGES = [ }, { ...paidMessageTemplate, id: nextId++, - authorName: '夏色祭保护协会会长', + authorName: '夏色祭保護協会会長', price: 28, content: 'Sent 礼花x1' } diff --git a/frontend/src/views/StyleGenerator/stylegen.js b/frontend/src/views/StyleGenerator/stylegen.js index 4aa8f74..5ac7ca9 100644 --- a/frontend/src/views/StyleGenerator/stylegen.js +++ b/frontend/src/views/StyleGenerator/stylegen.js @@ -63,6 +63,8 @@ export const DEFAULT_CONFIG = { reverseSlide: false } +const FALLBACK_FONTS = ', "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "\\5FAE\\8F6F\\96C5\\9ED1", SimHei, Arial, sans-serif' + export function setLocalConfig (config) { config = mergeConfig(config, DEFAULT_CONFIG) window.localStorage.stylegenConfig = JSON.stringify(config) @@ -105,7 +107,7 @@ yt-live-chat-author-chip #author-name { /* Outlines */ yt-live-chat-renderer * { ${getShowOutlinesStyle(config)} - font-family: "${config.messageFont}", "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "\\5FAE\\8F6F\\96C5\\9ED1", SimHei, Arial, sans-serif; + font-family: "${config.messageFont}"${FALLBACK_FONTS}; font-size: ${config.messageFontSize}px !important; line-height: ${config.messageLineHeight}px !important; } @@ -116,11 +118,11 @@ yt-live-chat-legacy-paid-message-renderer #content { } /* Hide scrollbar. */ -yt-live-chat-item-list-renderer #items{ +yt-live-chat-item-list-renderer #items { overflow: hidden !important; } -yt-live-chat-item-list-renderer #item-scroller{ +yt-live-chat-item-list-renderer #item-scroller { overflow: hidden !important; } @@ -164,7 +166,7 @@ yt-live-chat-text-message-renderer #chat-badges { yt-live-chat-text-message-renderer #timestamp { display: ${config.showTime ? 'inline' : 'none'} !important; ${config.timeColor ? `color: ${config.timeColor} !important;` : ''} - font-family: "${config.timeFont}", "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "\\5FAE\\8F6F\\96C5\\9ED1", SimHei, Arial, sans-serif; + font-family: "${config.timeFont}"${FALLBACK_FONTS}; font-size: ${config.timeFontSize}px !important; line-height: ${config.timeLineHeight || config.timeFontSize}px !important; } @@ -188,7 +190,7 @@ yt-live-chat-text-message-renderer yt-live-chat-author-badge-renderer[type="memb /* Channel names. */ yt-live-chat-text-message-renderer #author-name { ${config.userNameColor ? `color: ${config.userNameColor} !important;` : ''} - font-family: "${config.userNameFont}", "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "\\5FAE\\8F6F\\96C5\\9ED1", SimHei, Arial, sans-serif; + font-family: "${config.userNameFont}"${FALLBACK_FONTS}; font-size: ${config.userNameFontSize}px !important; line-height: ${config.userNameLineHeight || config.userNameFontSize}px !important; } @@ -199,7 +201,7 @@ ${getShowColonStyle(config)} yt-live-chat-text-message-renderer #message, yt-live-chat-text-message-renderer #message * { ${config.messageColor ? `color: ${config.messageColor} !important;` : ''} - font-family: "${config.messageFont}", "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "\\5FAE\\8F6F\\96C5\\9ED1", SimHei, Arial, sans-serif; + font-family: "${config.messageFont}"${FALLBACK_FONTS}; font-size: ${config.messageFontSize}px !important; line-height: ${config.messageLineHeight || config.messageFontSize}px !important; } @@ -214,7 +216,7 @@ yt-live-chat-paid-message-renderer #author-name *, yt-live-chat-legacy-paid-message-renderer #event-text, yt-live-chat-legacy-paid-message-renderer #event-text * { ${config.firstLineColor ? `color: ${config.firstLineColor} !important;` : ''} - font-family: "${config.firstLineFont}", "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "\\5FAE\\8F6F\\96C5\\9ED1", SimHei, Arial, sans-serif; + font-family: "${config.firstLineFont}"${FALLBACK_FONTS}; font-size: ${config.firstLineFontSize}px !important; line-height: ${config.firstLineLineHeight || config.firstLineFontSize}px !important; } @@ -224,7 +226,7 @@ yt-live-chat-paid-message-renderer #purchase-amount *, yt-live-chat-legacy-paid-message-renderer #detail-text, yt-live-chat-legacy-paid-message-renderer #detail-text * { ${config.secondLineColor ? `color: ${config.secondLineColor} !important;` : ''} - font-family: "${config.secondLineFont}", "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "\\5FAE\\8F6F\\96C5\\9ED1", SimHei, Arial, sans-serif; + font-family: "${config.secondLineFont}"${FALLBACK_FONTS}; font-size: ${config.secondLineFontSize}px !important; line-height: ${config.secondLineLineHeight || config.secondLineFontSize}px !important; } @@ -232,7 +234,7 @@ yt-live-chat-legacy-paid-message-renderer #detail-text * { yt-live-chat-paid-message-renderer #content, yt-live-chat-paid-message-renderer #content * { ${config.scContentColor ? `color: ${config.scContentColor} !important;` : ''} - font-family: "${config.scContentFont}", "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "\\5FAE\\8F6F\\96C5\\9ED1", SimHei, Arial, sans-serif; + font-family: "${config.scContentFont}"${FALLBACK_FONTS}; font-size: ${config.scContentFontSize}px !important; line-height: ${config.scContentLineHeight || config.scContentFontSize}px !important; } @@ -273,7 +275,7 @@ yt-live-chat-ticker-paid-message-item-renderer *, yt-live-chat-ticker-sponsor-item-renderer, yt-live-chat-ticker-sponsor-item-renderer * { ${config.secondLineColor ? `color: ${config.secondLineColor} !important;` : ''} - font-family: "${config.secondLineFont}", "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "\\5FAE\\8F6F\\96C5\\9ED1", SimHei, Arial, sans-serif; + font-family: "${config.secondLineFont}"${FALLBACK_FONTS}; } yt-live-chat-mode-change-message-renderer, diff --git a/views/chat.py b/views/chat.py index ea74d4f..13556a0 100644 --- a/views/chat.py +++ b/views/chat.py @@ -48,8 +48,8 @@ async def get_avatar_url(user_id): return DEFAULT_AVATAR_URL if _last_avatar_failed_time is not None: - if (cur_time - _last_avatar_failed_time).total_seconds() < 4 * 60 + 3: - # 5分钟以内被ban,解封大约要15分钟 + if (cur_time - _last_avatar_failed_time).total_seconds() < 3 * 60 + 3: + # 3分钟以内被ban,解封大约要15分钟 return DEFAULT_AVATAR_URL else: _last_avatar_failed_time = None