解决登录显示、首页显示bug

This commit is contained in:
2026-05-19 11:06:46 +08:00
parent 2f7e097e6c
commit 00a859c551
181 changed files with 55329 additions and 998 deletions

View File

@@ -166,8 +166,8 @@ export class AkReq {
// apikey优先用传入的再 fallback 到全局 SUPA_KEY
const finalApikey = origApikey ?? (SUPA_KEY !== '' ? SUPA_KEY : null)
// AuthorizationSupabase Kong 要求所有请求都带 Authorization: Bearer <jwt>
// 匿名态Bearer <anon_key>;登录态:Bearer <access_token>
// Authorization登录态使用用户 access_token。
// 匿名态仅发送 apikey避免自托管 Kong/PostgREST 将 anon key 当作 Bearer JWT 校验,触发 401/PGRST301。
const token = this.getToken()
let finalAuth: string | null = origAuth
let authMode: string = 'none'
@@ -177,9 +177,9 @@ export class AkReq {
finalAuth = `Bearer ${token}`
authMode = 'user-token'
} else if (finalApikey != null && finalApikey !== '') {
// 匿名态:用 anon key 作为 BearerSupabase Kong 必须)
finalAuth = `Bearer ${finalApikey}`
authMode = 'anon-key'
// 匿名态:只发送 apikey不补 Authorization
finalAuth = null
authMode = 'apikey-only'
}
} else {
authMode = 'pre-set'