From 13cf9b4176a028f296ff4c8cb9be15a95ce78ff7 Mon Sep 17 00:00:00 2001 From: wibus-wee <1596355173@qq.com> Date: Sat, 18 May 2024 23:00:26 +0800 Subject: [PATCH] fix(core): some logic --- packages/core/src/launch.ts | 4 +++- packages/modules/lemon-squeezy/share.ts | 11 ++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/core/src/launch.ts b/packages/core/src/launch.ts index 57fe543..9be2acd 100644 --- a/packages/core/src/launch.ts +++ b/packages/core/src/launch.ts @@ -110,7 +110,9 @@ export async function launch() { continue } - if (!isMatchBase(url, `${moduleItem.base}/${key}`)) + const base = typeof moduleItem.base === 'string' ? moduleItem.base : moduleItem.base.find(item => isMatchBase(url, item, false)) + console.log(`[activator] ${url} | ${base} | ${key}`) + if (!isMatchBase(url, `${base}/${key}`)) continue // 如果配置是函数,这个时候其实就没有什么特殊情况了,所以直接执行 diff --git a/packages/modules/lemon-squeezy/share.ts b/packages/modules/lemon-squeezy/share.ts index eb8b806..7570235 100644 --- a/packages/modules/lemon-squeezy/share.ts +++ b/packages/modules/lemon-squeezy/share.ts @@ -50,8 +50,13 @@ export function generateLemonSqueezyShare(licenseKey: string) { export function getLemonSqueezyLicenseKeyFromRequest() { const body = destr($request.body) as { - license_key: string + license_key?: string + licenseKey?: string } | undefined - const license_key = body?.license_key || (parseURL($request.url).params as { license_key: string }).license_key - return license_key + // const license_key = body?.license_key || (parseURL($request.url).params as { license_key: string }).license_key + const license_key = body?.license_key + || body?.licenseKey + || (parseURL($request.url).params as { license_key?: string, licenseKey?: string }).license_key + || (parseURL($request.url).params as { license_key?: string, licenseKey?: string }).licenseKey + return license_key || '' }