40 lines
2.1 KiB
PowerShell
40 lines
2.1 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
function Read-Utf8([string]$relativePath) {
|
|
Get-Content -Raw -Encoding UTF8 (Join-Path $root $relativePath)
|
|
}
|
|
function Assert-Contains([string]$text, [string]$token, [string]$message) {
|
|
if (-not $text.Contains($token)) { throw $message }
|
|
}
|
|
|
|
$f02 = Read-Utf8 'pages/family/f02-publish-feed.vue'
|
|
foreach ($token in @('form.feedType', 'mediaReceipts', 'mediaOssIds', 'form.sortOrder', 'pickAndUploadImage', 'class="required-mark"')) {
|
|
Assert-Contains $f02 $token "F02 is missing full feed field owner: $token"
|
|
}
|
|
|
|
$f06 = Read-Utf8 'pages/family/f06-article-editor.vue'
|
|
foreach ($token in @('form.articleSummary', 'coverOssId', 'form.authorName', 'form.sortOrder', 'pickAndUploadImage', 'coverOssId.value = receipt.ossId', 'class="required-mark"')) {
|
|
Assert-Contains $f06 $token "F06 is missing full article field owner: $token"
|
|
}
|
|
if ($f06 -match 'v-model="(?:form\.)?coverOssId"') { throw 'F06 must not expose a raw cover OSS ID input' }
|
|
|
|
$f07 = Read-Utf8 'pages/family/f07-album-list.vue'
|
|
foreach ($token in @('form.albumDesc', 'coverOssId', 'form.sortOrder', 'pickAndUploadImage', 'coverOssId.value = receipt.ossId', 'class="required-mark"')) {
|
|
Assert-Contains $f07 $token "F07 is missing full album field owner: $token"
|
|
}
|
|
if ($f07 -match 'v-model="(?:form\.)?coverOssId"') { throw 'F07 must not expose a raw cover OSS ID input' }
|
|
|
|
foreach ($page in @($f02, $f06, $f07)) {
|
|
if ($page -match 'v-model="form\.(status|categoryId)"') { throw 'Family create forms must not ask users to enter status or category codes' }
|
|
if ($page -match 'placeholder="[^"]*(分类 ID|状态码|例如:0)') { throw 'Family create forms must not expose raw code placeholders' }
|
|
}
|
|
|
|
$fullWidthOptionalLabel = [string]([char]0xff08) + [char]0x9009 + [char]0x586b + [char]0xff09
|
|
$asciiOptionalLabel = '(' + [char]0x9009 + [char]0x586b + ')'
|
|
foreach ($page in @($f02, $f06, $f07)) {
|
|
if ($page.Contains($fullWidthOptionalLabel) -or $page.Contains($asciiOptionalLabel)) { throw 'Family create forms must not label optional fields as optional' }
|
|
}
|
|
|
|
Write-Output 'FAMILY-CREATE-PAGES-CONTRACT PASS'
|