| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- $ErrorActionPreference = 'Stop'
- $root = Split-Path -Parent $PSScriptRoot
- function Desense-Text([string]$c) {
- $n = $c
- $n = $n -replace 'Msq2025uqisad', 'TARGET_PARSE_MASTER_KEY'
- $n = $n -replace 'msq!post666', 'TARGET_DB_PASSWORD'
- $n = $n -replace 'https://server-msq\.fmode\.cn', 'https://TARGET_HOST'
- $n = $n -replace 'server-msq\.fmode\.cn', 'TARGET_HOST'
- $n = $n -replace "appId: 'msq-voc'", "appId: 'TARGET_PARSE_APP_ID'"
- $n = $n -replace 'appId msq-voc', 'appId TARGET_PARSE_APP_ID'
- $n = $n -replace "'msq-voc'", "'TARGET_PARSE_APP_ID'"
- $n = $n -replace '"msq-voc"', '"TARGET_PARSE_APP_ID"'
- $n = $n -replace 'BasicAuth [A-Za-z0-9+/=]+', 'BasicAuth TARGET_SORFTIME_TOKEN'
- $n = $n -replace 'Bearer [rt][A-Za-z0-9+/=]+', 'Bearer TARGET_TOKEN'
- return $n
- }
- function Desense-File([string]$path) {
- if (-not (Test-Path -LiteralPath $path)) {
- Write-Output "MISS $path"
- return
- }
- $c = Get-Content -Raw -LiteralPath $path
- $n = Desense-Text $c
- if ($n -ne $c) {
- Set-Content -LiteralPath $path -Value $n -NoNewline
- Write-Output ("UPDATED " + $path.Substring($root.Length + 1))
- }
- }
- $files = @(
- 'backend\modules\fmode-amazon-sp-api\src\parse-init.ts',
- 'backend\modules\fmode-eccang-api\src\parse-init.ts',
- 'backend\modules\fmode-sorftime-api\src\parse-init.ts',
- 'backend\modules\fmode-amazon-sp-api\src\dev-server.ts',
- 'backend\cloud\main.js',
- 'frontend\README.md',
- 'frontend\scripts\hongben\config.ts',
- 'frontend\scripts\hongben\README.md',
- 'frontend\scripts\backfill-amazon-product-fields.js',
- 'frontend\scripts\backfill-productdetail-owner-fields.js',
- 'frontend\scripts\cleanup-empty-user-emails.js',
- 'frontend\scripts\created-data.js',
- 'frontend\scripts\import-excel-categories.js',
- 'frontend\scripts\ingest-amazon-listings-for-shop.js',
- 'frontend\scripts\mark-admin-user.js',
- 'frontend\scripts\refresh-own-product-reviews.js',
- 'frontend\scripts\smoke-amazon-shop.js',
- 'frontend\scripts\test-single-api.js',
- 'frontend\scripts\test-sorftime-api.js',
- 'frontend\scripts\update-shop-spapi-credentials.js',
- 'frontend\scripts\audit-amazon-product.js',
- 'frontend\scripts\voc-create-schema.js',
- 'frontend\scripts\check-cert.js'
- )
- foreach ($rel in $files) {
- Desense-File (Join-Path $root $rel)
- }
- $dirs = @(
- (Join-Path $root 'backend\docs'),
- (Join-Path $root 'backend\modules'),
- (Join-Path $root 'frontend\docs'),
- (Join-Path $root 'frontend\scripts')
- )
- foreach ($dir in $dirs) {
- if (-not (Test-Path $dir)) { continue }
- Get-ChildItem -Path $dir -Recurse -File -Include *.md,*.ts,*.js,*.json -ErrorAction SilentlyContinue | ForEach-Object {
- Desense-File $_.FullName
- }
- }
- Write-Output 'DESENSE_DONE'
|