mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-19 17:56:39 +08:00
change ACCESS_KEY header to ACCESS-KEY, add test env file
This commit is contained in:
parent
296d83c3a1
commit
00db78b446
@ -188,7 +188,7 @@ func corsMiddleware() gin.HandlerFunc {
|
|||||||
c.Header("Access-Control-Allow-Origin", origin)
|
c.Header("Access-Control-Allow-Origin", origin)
|
||||||
c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, UPDATE")
|
c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, UPDATE")
|
||||||
//允许跨域设置可以返回其他子段,可以自定义字段
|
//允许跨域设置可以返回其他子段,可以自定义字段
|
||||||
c.Header("Access-Control-Allow-Headers", "Authorization, Content-Length, Content-Type, ChatGPT-TOKEN, ACCESS_KEY")
|
c.Header("Access-Control-Allow-Headers", "Authorization, Content-Length, Content-Type, ChatGPT-TOKEN, ACCESS-KEY")
|
||||||
// 允许浏览器(客户端)可以解析的头部 (重要)
|
// 允许浏览器(客户端)可以解析的头部 (重要)
|
||||||
c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers")
|
c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers")
|
||||||
//设置缓存时间
|
//设置缓存时间
|
||||||
@ -223,7 +223,7 @@ func AuthorizeMiddleware(s *Server) gin.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(c.Request.URL.Path, "/api/config") {
|
if strings.HasPrefix(c.Request.URL.Path, "/api/config") {
|
||||||
accessKey := c.GetHeader("ACCESS_KEY")
|
accessKey := c.GetHeader("ACCESS-KEY")
|
||||||
if accessKey != strings.TrimSpace(s.Config.AccessKey) {
|
if accessKey != strings.TrimSpace(s.Config.AccessKey) {
|
||||||
c.Abort()
|
c.Abort()
|
||||||
c.JSON(http.StatusOK, types.BizVo{Code: types.NotAuthorized, Message: "No Permissions"})
|
c.JSON(http.StatusOK, types.BizVo{Code: types.NotAuthorized, Message: "No Permissions"})
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
VUE_APP_API_HOST=https://chat-plus.net
|
NODE_ENV = 'production'
|
||||||
VUE_APP_WS_HOST=wss://chat-plus.net
|
VUE_APP_API_HOST=https://www.r9it.com
|
||||||
|
VUE_APP_WS_HOST=wss://www.r9it.com
|
||||||
|
@ -569,7 +569,7 @@ export default defineComponent({
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0
|
bottom: 0
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: start;
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-flow: column;
|
flex-flow: column;
|
||||||
|
|
||||||
|
@ -888,7 +888,7 @@ export default defineComponent({
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0
|
bottom: 0
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: start;
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-flow: column;
|
flex-flow: column;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ module.exports = defineConfig({
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
publicPath: process.env.NODE_ENV === 'production' ? '/chat' : '/',
|
publicPath: '/chat',
|
||||||
outputDir: '../dist',
|
outputDir: '../dist',
|
||||||
crossorigin: "anonymous",
|
crossorigin: "anonymous",
|
||||||
devServer: {
|
devServer: {
|
||||||
|
Loading…
Reference in New Issue
Block a user