From 22d80e3af2dda7b1a9ca7eab326e17cb99a8a142 Mon Sep 17 00:00:00 2001
From: John Smith
Date: Sun, 6 Apr 2025 16:23:52 +0800
Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E6=B7=BB=E5=8A=A0=E8=87=AA?=
=?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=A8=A1=E6=9D=BF=E9=85=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/src/api/main.js | 4 +
frontend/src/lang/en.js | 7 +
frontend/src/lang/ja.js | 7 +
frontend/src/lang/zh.js | 7 +
frontend/src/views/Home/TemplateSelect.vue | 177 ++++++++++++++++++
.../src/views/{Home.vue => Home/index.vue} | 6 +
6 files changed, 208 insertions(+)
create mode 100644 frontend/src/views/Home/TemplateSelect.vue
rename frontend/src/views/{Home.vue => Home/index.vue} (98%)
diff --git a/frontend/src/api/main.js b/frontend/src/api/main.js
index 4fd822a..bec9d78 100644
--- a/frontend/src/api/main.js
+++ b/frontend/src/api/main.js
@@ -9,3 +9,7 @@ export async function uploadEmoticon(file) {
body.set('file', file)
return (await axios.post('/api/emoticon', body)).data
}
+
+export async function getTemplates() {
+ return (await axios.get('/api/templates')).data
+}
diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js
index 8b1bb4c..f9bd434 100644
--- a/frontend/src/lang/en.js
+++ b/frontend/src/lang/en.js
@@ -65,6 +65,13 @@ export default {
addEmoticon: 'Add emote',
emoticonFileTooLarge: 'File size is too large. Max size is 1MB',
+ template: 'Custom HTML Templates',
+ templateDefaultTitle: 'Default',
+ templateDefaultDescription: 'A YouTube-style template that can be styled with custom CSS. Choose this if you are unfamiliar with custom HTML templates, otherwise your custom CSS will not take effect',
+ templateCustomUrlTitle: 'Enter template URL',
+ templateCustomUrlDescription: 'For templates not listed, you can manually enter the URL provided by the author here',
+ author: 'Author: ',
+
urlTooLong: 'The room URL is too long, and will be truncated by Livehime (but not by OBS)',
roomUrlUpdated: 'The room URL is updated. Remember to copy it again',
roomUrl: 'Room URL',
diff --git a/frontend/src/lang/ja.js b/frontend/src/lang/ja.js
index dddf0ec..957c4f0 100644
--- a/frontend/src/lang/ja.js
+++ b/frontend/src/lang/ja.js
@@ -65,6 +65,13 @@ export default {
addEmoticon: 'スタンプを追加',
emoticonFileTooLarge: 'ファイルサイズが大きすぎます。最大サイズは1MBです',
+ template: 'カスタムHTMLテンプレート',
+ templateDefaultTitle: 'デフォルト',
+ templateDefaultDescription: 'YouTube風のテンプレートで、カスタムCSSでスタイルを変更できます。カスタムHTMLテンプレートの機能に慣れていない場合はこれを選択してください。そうでない場合、カスタムCSSが適用されない',
+ templateCustomUrlTitle: 'テンプレートURLを入力',
+ templateCustomUrlDescription: 'リストにないテンプレートは、作者が提供するURLをここで手動で入力できます',
+ author: '作者:',
+
urlTooLong: 'ルームのURLが長すぎて、直播姬によって切り詰められます(ただし、OBSでは切り詰められません)',
roomUrlUpdated: 'ルームのURLが更新されました。再度コピーすることをお忘れなく',
roomUrl: 'ルームのURL',
diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js
index 8dfe91f..2cf8355 100644
--- a/frontend/src/lang/zh.js
+++ b/frontend/src/lang/zh.js
@@ -65,6 +65,13 @@ export default {
addEmoticon: '添加表情',
emoticonFileTooLarge: '文件尺寸太大,最大1MB',
+ template: '自定义HTML模板',
+ templateDefaultTitle: '默认',
+ templateDefaultDescription: '仿YouTube风格的模板,可以用自定义CSS修改样式。如果你不了解自定义HTML模板的功能,就选择这个,否则自定义CSS不会生效',
+ templateCustomUrlTitle: '输入模板URL',
+ templateCustomUrlDescription: '没有列出的模板,也可以在这里手动输入作者提供的URL',
+ author: '作者:',
+
urlTooLong: '房间URL太长了,会被直播姬截断(OBS不会)',
roomUrlUpdated: '房间URL已更新,记得重新复制',
roomUrl: '房间URL',
diff --git a/frontend/src/views/Home/TemplateSelect.vue b/frontend/src/views/Home/TemplateSelect.vue
new file mode 100644
index 0000000..cfdeda0
--- /dev/null
+++ b/frontend/src/views/Home/TemplateSelect.vue
@@ -0,0 +1,177 @@
+
+
+
+
+
+
+
{{ $t('home.templateDefaultTitle') }}
+
+
{{ $t('home.templateDefaultDescription') }}
+
+
+
+
+
+
+
{{ $t('home.templateCustomUrlTitle') }}
+
+
{{ $t('home.templateCustomUrlDescription') }}
+
+
+
+
+
+
+
+
+
+
{{ template.name }}
+ {{ template.version }}
+ {{ $t('home.author') }}{{ template.author }}
+
+
{{ template.description }}
+
URL: {{ template.url }}
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home/index.vue
similarity index 98%
rename from frontend/src/views/Home.vue
rename to frontend/src/views/Home/index.vue
index 7ccf991..2957112 100644
--- a/frontend/src/views/Home.vue
+++ b/frontend/src/views/Home/index.vue
@@ -217,6 +217,10 @@
{{$t('home.addEmoticon')}}
+
+
+
+
@@ -249,12 +253,14 @@
import _ from 'lodash'
import download from 'downloadjs'
+import TemplateSelect from './TemplateSelect'
import { mergeConfig } from '@/utils'
import * as mainApi from '@/api/main'
import * as chatConfig from '@/api/chatConfig'
export default {
name: 'Home',
+ components: { TemplateSelect },
data() {
return {
serverConfig: {