fix: enforce application limits and signature format

This commit is contained in:
hectorzhao
2026-07-22 16:29:22 +08:00
parent cd085d2712
commit a09036c67b
20 changed files with 479 additions and 79 deletions
+2
View File
@@ -6,6 +6,7 @@ const capabilityLabels = [
['uplinkQueryEnabled', '上行查询'],
['receiptWebhookEnabled', '回执回调'],
['uplinkWebhookEnabled', '上行回调'],
['credentialSelfServiceEnabled', '客户端自助密钥'],
] as const;
const deliveryModeLabels: Record<string, string> = {
@@ -20,6 +21,7 @@ export function formatHttpApiParams(response: HttpApiConfigResponse, origin: str
const baseUrl = `${origin.replace(/\/$/, '')}/api/openapi/v1`;
return [
`应用名称: ${response.applicationName ?? response.applicationId}`,
`AppID: ${response.applicationId}`,
`HTTP接口: ${config?.enabled ? '开通' : '关闭'}`,
`基础地址: ${baseUrl}`,
`接口文档: ${origin.replace(/\/$/, '')}/api/client-docs`,
+6
View File
@@ -5,6 +5,12 @@ export function formatSmsSignature(name?: string | null) {
return innerName ? `${innerName}` : '';
}
export function isCompleteSmsSignature(name?: string | null) {
const value = (name ?? '').trim();
const match = value.match(/^【([^【】]+)】$/);
return Boolean(match && match[1] === match[1].trim());
}
export function replaceLeadingSmsSignature(content: string, signatureName?: string | null) {
const body = content.replace(LEADING_SMS_SIGNATURE, '');
return `${formatSmsSignature(signatureName)}${body}`;