mirror of
https://github.com/xfgryujk/blivechat.git
synced 2024-12-27 13:20:29 +08:00
显示的房间URL改成加载器URL
This commit is contained in:
parent
d25a32beaf
commit
bfa6054899
12
api/main.py
12
api/main.py
@ -8,9 +8,15 @@ import update
|
||||
|
||||
|
||||
class MainHandler(tornado.web.StaticFileHandler):
|
||||
"""为了使用Vue Router的history模式,把所有请求转发到index.html"""
|
||||
async def get(self, *args, **kwargs):
|
||||
await super().get('index.html', *args, **kwargs)
|
||||
"""为了使用Vue Router的history模式,把不存在的文件请求转发到index.html"""
|
||||
async def get(self, path, include_body=True):
|
||||
try:
|
||||
await super().get(path, include_body)
|
||||
except tornado.web.HTTPError as e:
|
||||
if e.status_code != 404:
|
||||
raise
|
||||
# 不存在的文件请求转发到index.html,交给前端路由
|
||||
await super().get('index.html', include_body)
|
||||
|
||||
|
||||
# noinspection PyAbstractClass
|
||||
|
@ -66,7 +66,7 @@
|
||||
|
||||
<el-divider></el-divider>
|
||||
<el-form-item :label="$t('home.roomUrl')">
|
||||
<el-input ref="roomUrlInput" readonly :value="roomUrl" style="width: calc(100% - 8em); margin-right: 1em;"></el-input>
|
||||
<el-input ref="roomUrlInput" readonly :value="loaderUrl" 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>
|
||||
@ -107,6 +107,14 @@ export default {
|
||||
delete query.roomId
|
||||
let resolved = this.$router.resolve({name: 'room', params: {roomId: this.form.roomId}, query})
|
||||
return `${window.location.protocol}//${window.location.host}${resolved.href}`
|
||||
},
|
||||
loaderUrl() {
|
||||
if (this.roomUrl === '') {
|
||||
return ''
|
||||
}
|
||||
let url = new URL('https://xfgryujk.sinacloud.net/blivechat/loader.html')
|
||||
url.searchParams.append('url', this.roomUrl)
|
||||
return url.href
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
4
main.py
4
main.py
@ -24,9 +24,7 @@ routes = [
|
||||
(r'/server_info', api.main.ServerInfoHandler),
|
||||
(r'/chat', api.chat.ChatHandler),
|
||||
|
||||
(r'/((css|fonts|img|js|static)/.*)', tornado.web.StaticFileHandler, {'path': WEB_ROOT}),
|
||||
(r'/(favicon\.ico)', tornado.web.StaticFileHandler, {'path': WEB_ROOT}),
|
||||
(r'/.*', api.main.MainHandler, {'path': WEB_ROOT})
|
||||
(r'/(.*)', api.main.MainHandler, {'path': WEB_ROOT, 'default_filename': 'index.html'})
|
||||
]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user