This commit is contained in:
van
2026-03-23 23:56:45 +08:00
parent e63ab42c41
commit 1b41508013
3 changed files with 32 additions and 5 deletions

View File

@@ -50,7 +50,8 @@ server {
# ========== 重要后端API代理配置 ==========
# 将所有API请求代理到后端服务器解决混合内容问题
# 注意:这里的路径需要与前端 VUE_APP_BASE_API 配置一致
location /jarvis-api/ {
# ^~ 表示命中前缀后不再尝试正则 location避免被其它规则干扰
location ^~ /jarvis-api/ {
proxy_pass http://127.0.0.1:30313/; # 后端服务地址
# 请求头设置
@@ -81,7 +82,10 @@ server {
client_max_body_size 100M;
}
# 腾讯文档OAuth回调接口(必须放在 /jarvis-api/ 之后location / 之前
# OAuth 回调须放在 /jarvis-api/ 之后location / 之前
# 切勿重复定义同名 location例如两个 /wps365-callback仅第一个生效
# 腾讯文档 OAuth 回调
location /tendoc-callback {
proxy_pass http://127.0.0.1:30313/tendoc-callback;
@@ -110,7 +114,29 @@ server {
client_max_body_size 100M;
}
# 金山文档 OAuth 回调(须放在 /jarvis-api/ 之后location / 之前
# 金山文档:旧回调路径(后端 302 → /kdocs-callback仅过渡用后台建议改为 /kdocs-callback
location /wps365-callback {
proxy_pass http://127.0.0.1:30313/wps365-callback;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header Content-Type $content_type;
proxy_set_header Content-Length $content_length;
proxy_pass_request_headers on;
proxy_pass_request_body on;
proxy_http_version 1.1;
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
client_max_body_size 100M;
}
# 金山文档 OAuth 回调(与 kdocs.redirect-uri、开放平台登记一致
location /kdocs-callback {
proxy_pass http://127.0.0.1:30313/kdocs-callback;

View File

@@ -174,7 +174,8 @@ export default {
try {
const response = await getKdocsTokenStatus(this.userId)
if (response.code === 200) {
this.isAuthorized = response.data.hasToken && response.data.isValid
// 有 token 即视为已授权isValid 单独展示(避免 expires_in 缺失时误判未保存)
this.isAuthorized = !!response.data.hasToken
this.tokenInfo = response.data
if (response.data.userId) {
this.userId = response.data.userId

View File

@@ -132,7 +132,7 @@ export default {
try {
const response = await getKdocsTokenStatus(this.userId)
if (response.code === 200) {
this.isAuthorized = response.data.hasToken && response.data.isValid
this.isAuthorized = !!response.data.hasToken
if (this.isAuthorized) {
this.loadUserInfo()
}