fix(page-data): trust live API smoke and WeChat survey submit compat
Stop blocking WeChat delivery when Page Data insert works but publish quota blocks h5_publish_records; fix smoke URL missing /api; patch survey radios for WeChat X5 and detect dataset constants in admin pages. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -17,16 +17,29 @@ export function htmlUsesPageDataApi(html) {
|
||||
export function detectPageDataDatasetUsageFromHtml(html) {
|
||||
const text = String(html ?? '');
|
||||
const datasets = new Map();
|
||||
const constants = new Map();
|
||||
|
||||
for (const match of text.matchAll(/(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*['"]([^'"]+)['"]/g)) {
|
||||
constants.set(match[1], match[2]);
|
||||
}
|
||||
|
||||
function remember(name, patch) {
|
||||
const key = String(name ?? '').trim();
|
||||
if (!key) return;
|
||||
datasets.set(key, { ...(datasets.get(key) ?? {}), ...patch });
|
||||
}
|
||||
|
||||
for (const match of text.matchAll(/\.insertRow\(\s*['"]([^'"]+)['"]/g)) {
|
||||
const name = match[1];
|
||||
const prev = datasets.get(name) ?? {};
|
||||
datasets.set(name, { ...prev, insert: true });
|
||||
remember(match[1], { insert: true });
|
||||
}
|
||||
for (const match of text.matchAll(/\.listRows\(\s*['"]([^'"]+)['"]/g)) {
|
||||
const name = match[1];
|
||||
const prev = datasets.get(name) ?? {};
|
||||
datasets.set(name, { ...prev, read: true });
|
||||
remember(match[1], { read: true });
|
||||
}
|
||||
for (const match of text.matchAll(/\.insertRow\(\s*([A-Za-z_$][\w$]*)/g)) {
|
||||
remember(constants.get(match[1]) ?? match[1], { insert: true });
|
||||
}
|
||||
for (const match of text.matchAll(/\.listRows\(\s*([A-Za-z_$][\w$]*)/g)) {
|
||||
remember(constants.get(match[1]) ?? match[1], { read: true });
|
||||
}
|
||||
|
||||
return datasets;
|
||||
|
||||
Reference in New Issue
Block a user