名称Branding变更
This commit is contained in:
1 parent
c74c1e3914
commit
8b5103d542
41 files changed
+282
-93
No files matched your search
@@ -10,6 +10,21 @@ import { dirname, resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const webRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
||||
const appsettingsPath = resolve(webRoot, '..', 'src', 'Jiaowu.Api', 'appsettings.json')
|
||||
const branding = JSON.parse(readFileSync(appsettingsPath, 'utf8')).Branding
|
||||
|
||||
if (!branding?.BrandName?.trim() || !branding?.ShortName?.trim()) {
|
||||
throw new Error('appsettings.json 中缺少 Branding:BrandName 或 Branding:ShortName。')
|
||||
}
|
||||
|
||||
function escapeXml(value) {
|
||||
return String(value)
|
||||
.replaceAll('&', '&')
|
||||
.replaceAll('<', '<')
|
||||
.replaceAll('>', '>')
|
||||
.replaceAll('"', '"')
|
||||
.replaceAll("'", ''')
|
||||
}
|
||||
|
||||
function updateFile(path, update) {
|
||||
if (!existsSync(path)) return false
|
||||
@@ -57,6 +72,11 @@ function configureAndroid() {
|
||||
return content.replace(/minSdkVersion\s*=\s*\d+/, 'minSdkVersion = 26')
|
||||
})
|
||||
|
||||
const stringsPath = resolve(androidRoot, 'app', 'src', 'main', 'res', 'values', 'strings.xml')
|
||||
updateFile(stringsPath, content => content
|
||||
.replaceAll('{{BRAND_NAME}}', escapeXml(branding.BrandName.trim()))
|
||||
.replaceAll('{{SHORT_NAME}}', escapeXml(branding.ShortName.trim())))
|
||||
|
||||
updateFile(manifestPath, content => {
|
||||
const declarations = [
|
||||
'<uses-permission android:name="android.permission.CAMERA" />',
|
||||
|
||||
Reference in new issue
Block a user