修复:改用共享 /api Fetch 路由注册插件 RPC,兼容无 webServer 注入的 Connection(v0.2.11)

This commit is contained in:
yexi committed 2026-11-17 19:36:10 +08:00
1 parent ae6c7663fe
commit 849fc35ac5
12 files changed
+266 -46

No files matched your search

+7 -2
View File
@@ -95,7 +95,8 @@ export interface UnrestrictedCardInjected {
loadPreview: (presetId: string) => Promise<void>
}
const RPC_CHANNEL = '/dsh-unrestricted'
const RPC_CHANNEL = '/api'
const RPC_NAMESPACE = 'dsh-unrestricted'
const SETTINGS_NS = 'unrestricted'
/** Human-readable error text for the banner. */
@@ -155,7 +156,11 @@ export function createUnrestrictedController(ctx: Context) {
}
async function call<T>(endpoint: string, payload: unknown): Promise<T> {
const result = await connection.rpc.call(RPC_CHANNEL, endpoint, payload) as RpcResult<T>
const result = await connection.rpc.call(
RPC_CHANNEL,
`${RPC_NAMESPACE}/${endpoint}`,
payload,
) as RpcResult<T>
if (!result.ok) throw new Error(result.error.message)
return result.value
}