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