mirror of
https://github.com/xfgryujk/blivechat.git
synced 2025-03-31 06:30:07 +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):
|
class MainHandler(tornado.web.StaticFileHandler):
|
||||||
"""为了使用Vue Router的history模式,把所有请求转发到index.html"""
|
"""为了使用Vue Router的history模式,把不存在的文件请求转发到index.html"""
|
||||||
async def get(self, *args, **kwargs):
|
async def get(self, path, include_body=True):
|
||||||
await super().get('index.html', *args, **kwargs)
|
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
|
# noinspection PyAbstractClass
|
||||||
|
@ -66,7 +66,7 @@
|
|||||||
|
|
||||||
<el-divider></el-divider>
|
<el-divider></el-divider>
|
||||||
<el-form-item :label="$t('home.roomUrl')">
|
<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-button type="primary" @click="copyUrl">{{$t('home.copy')}}</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
@ -107,6 +107,14 @@ export default {
|
|||||||
delete query.roomId
|
delete query.roomId
|
||||||
let resolved = this.$router.resolve({name: 'room', params: {roomId: this.form.roomId}, query})
|
let resolved = this.$router.resolve({name: 'room', params: {roomId: this.form.roomId}, query})
|
||||||
return `${window.location.protocol}//${window.location.host}${resolved.href}`
|
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: {
|
watch: {
|
||||||
|
4
main.py
4
main.py
@ -24,9 +24,7 @@ routes = [
|
|||||||
(r'/server_info', api.main.ServerInfoHandler),
|
(r'/server_info', api.main.ServerInfoHandler),
|
||||||
(r'/chat', api.chat.ChatHandler),
|
(r'/chat', api.chat.ChatHandler),
|
||||||
|
|
||||||
(r'/((css|fonts|img|js|static)/.*)', tornado.web.StaticFileHandler, {'path': WEB_ROOT}),
|
(r'/(.*)', api.main.MainHandler, {'path': WEB_ROOT, 'default_filename': 'index.html'})
|
||||||
(r'/(favicon\.ico)', tornado.web.StaticFileHandler, {'path': WEB_ROOT}),
|
|
||||||
(r'/.*', api.main.MainHandler, {'path': WEB_ROOT})
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user