mirror of
https://github.com/xfgryujk/blivechat.git
synced 2024-12-25 20:30:28 +08:00
添加加载器URL配置
This commit is contained in:
parent
28b04f27ee
commit
4d58245ad9
@ -26,6 +26,7 @@ class ServerInfoHandler(api.base.ApiHandler):
|
||||
self.write({
|
||||
'version': update.VERSION,
|
||||
'config': {
|
||||
'enableTranslate': cfg.enable_translate
|
||||
'enableTranslate': cfg.enable_translate,
|
||||
'loaderUrl': cfg.loader_url
|
||||
}
|
||||
})
|
||||
|
@ -39,6 +39,7 @@ class AppConfig:
|
||||
self.enable_translate = True
|
||||
self.allow_translate_rooms = {}
|
||||
self.tornado_xheaders = False
|
||||
self.loader_url = ''
|
||||
|
||||
def load(self, path):
|
||||
try:
|
||||
@ -49,7 +50,7 @@ class AppConfig:
|
||||
self.database_url = app_section['database_url']
|
||||
self.enable_translate = app_section.getboolean('enable_translate')
|
||||
|
||||
allow_translate_rooms = app_section['allow_translate_rooms'].strip()
|
||||
allow_translate_rooms = app_section['allow_translate_rooms']
|
||||
if allow_translate_rooms == '':
|
||||
self.allow_translate_rooms = {}
|
||||
else:
|
||||
@ -57,6 +58,7 @@ class AppConfig:
|
||||
self.allow_translate_rooms = set(map(lambda id_: int(id_.strip()), allow_translate_rooms))
|
||||
|
||||
self.tornado_xheaders = app_section.getboolean('tornado_xheaders')
|
||||
self.loader_url = app_section['loader_url']
|
||||
|
||||
except (KeyError, ValueError):
|
||||
logger.exception('Failed to load config:')
|
||||
|
@ -12,6 +12,9 @@ allow_translate_rooms =
|
||||
# Set to true if you are using a reverse proxy server such as nginx
|
||||
tornado_xheaders = false
|
||||
|
||||
# Use a loader so that you can run OBS before blivechat. If empty, no loader is used
|
||||
loader_url = https://xfgryujk.sinacloud.net/blivechat/loader.html
|
||||
|
||||
|
||||
# DON'T modify this section
|
||||
[DEFAULT]
|
||||
@ -19,3 +22,4 @@ database_url = sqlite:///data/database.db
|
||||
enable_translate = true
|
||||
allow_translate_rooms =
|
||||
tornado_xheaders = false
|
||||
loader_url =
|
||||
|
@ -66,7 +66,7 @@
|
||||
|
||||
<el-divider></el-divider>
|
||||
<el-form-item :label="$t('home.roomUrl')">
|
||||
<el-input ref="roomUrlInput" readonly :value="loaderUrl" style="width: calc(100% - 8em); margin-right: 1em;"></el-input>
|
||||
<el-input ref="roomUrlInput" readonly :value="obsRoomUrl" style="width: calc(100% - 8em); margin-right: 1em;"></el-input>
|
||||
<el-button type="primary" @click="copyUrl">{{$t('home.copy')}}</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
@ -90,7 +90,8 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
serverConfig: {
|
||||
enableTranslate: true
|
||||
enableTranslate: true,
|
||||
loaderUrl: ''
|
||||
},
|
||||
form: {
|
||||
roomId: parseInt(window.localStorage.roomId || '1'),
|
||||
@ -108,11 +109,14 @@ export default {
|
||||
let resolved = this.$router.resolve({name: 'room', params: {roomId: this.form.roomId}, query})
|
||||
return `${window.location.protocol}//${window.location.host}${resolved.href}`
|
||||
},
|
||||
loaderUrl() {
|
||||
obsRoomUrl() {
|
||||
if (this.roomUrl === '') {
|
||||
return ''
|
||||
}
|
||||
let url = new URL('https://xfgryujk.sinacloud.net/blivechat/loader.html')
|
||||
if (this.serverConfig.loaderUrl === '') {
|
||||
return this.roomUrl
|
||||
}
|
||||
let url = new URL(this.serverConfig.loaderUrl)
|
||||
url.searchParams.append('url', this.roomUrl)
|
||||
return url.href
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user