mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-09 00:56:37 +08:00
fix(frontend): call versioned CAP challenge and redeem APIs
Point the PoW solver at /api/v1/cap/{challenge,redeem} so login
verification hits the routes registered by the cap plugin.
This commit is contained in:
@@ -135,7 +135,7 @@ function solveInWorker(
|
|||||||
|
|
||||||
export async function getCapToken(scope = 'login'): Promise<string> {
|
export async function getCapToken(scope = 'login'): Promise<string> {
|
||||||
// 1. 获取难题
|
// 1. 获取难题
|
||||||
const challengeRes = await fetch('/api/cap/challenge', {
|
const challengeRes = await fetch('/api/v1/cap/challenge', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ scope }),
|
body: JSON.stringify({ scope }),
|
||||||
@@ -171,7 +171,7 @@ export async function getCapToken(scope = 'login'): Promise<string> {
|
|||||||
console.groupEnd();
|
console.groupEnd();
|
||||||
|
|
||||||
// 3. 提交答案兑换一次性凭证
|
// 3. 提交答案兑换一次性凭证
|
||||||
const redeemRes = await fetch('/api/cap/redeem', {
|
const redeemRes = await fetch('/api/v1/cap/redeem', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ token: challenge.token, solutions, scope }),
|
body: JSON.stringify({ token: challenge.token, solutions, scope }),
|
||||||
|
|||||||
Reference in New Issue
Block a user