mirror of
https://github.com/xfgryujk/blivechat.git
synced 2025-02-21 17:24:34 +08:00
改API路径
This commit is contained in:
parent
4e7cc7a782
commit
7cfa94c68c
@ -111,11 +111,11 @@ server {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
# 动态API
|
||||
location = /server_info {
|
||||
location /api {
|
||||
proxy_pass http://blivechat;
|
||||
}
|
||||
# websocket
|
||||
location = /chat {
|
||||
location = /api/chat {
|
||||
proxy_pass http://blivechat;
|
||||
|
||||
# 代理websocket必须设置
|
||||
|
@ -129,7 +129,7 @@ export default {
|
||||
methods: {
|
||||
async updateServerConfig() {
|
||||
try {
|
||||
this.serverConfig = (await axios.get(`/server_info`)).data.config
|
||||
this.serverConfig = (await axios.get('/api/server_info')).data.config
|
||||
} catch (e) {
|
||||
this.$message.error('Failed to fetch server information: ' + e)
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ export default {
|
||||
const protocol = window.location.protocol === 'https:' ? 'wss' : 'ws'
|
||||
// 开发时使用localhost:12450
|
||||
const host = process.env.NODE_ENV === 'development' ? 'localhost:12450' : window.location.host
|
||||
const url = `${protocol}://${host}/chat`
|
||||
const url = `${protocol}://${host}/api/chat`
|
||||
this.websocket = new WebSocket(url)
|
||||
this.websocket.onopen = this.onWsOpen
|
||||
this.websocket.onclose = this.onWsClose
|
||||
|
4
main.py
4
main.py
@ -21,6 +21,10 @@ logger = logging.getLogger(__name__)
|
||||
WEB_ROOT = os.path.join(os.path.dirname(__file__), 'frontend', 'dist')
|
||||
|
||||
routes = [
|
||||
(r'/api/server_info', api.main.ServerInfoHandler),
|
||||
(r'/api/chat', api.chat.ChatHandler),
|
||||
|
||||
# TODO 兼容旧版,下版本移除
|
||||
(r'/server_info', api.main.ServerInfoHandler),
|
||||
(r'/chat', api.chat.ChatHandler),
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user