release: harden Android network security

This commit is contained in:
key
2026-07-29 01:13:18 +08:00
parent 9ea5d79a62
commit ba68fc8326
16 changed files with 198 additions and 29 deletions
@@ -0,0 +1,24 @@
import { cpSync, existsSync, mkdirSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
const projectRoot = resolve(import.meta.dirname, '..');
const mappings = [
[
resolve(projectRoot, 'AndroidManifest.xml'),
resolve(projectRoot, 'dist/build/app/AndroidManifest.xml')
],
[
resolve(projectRoot, 'nativeResources/android/res/xml/network_security_config.xml'),
resolve(projectRoot, 'dist/build/app/nativeResources/android/res/xml/network_security_config.xml')
]
];
for (const [source, destination] of mappings) {
if (!existsSync(source)) {
throw new Error(`Missing required native App resource: ${source}`);
}
mkdirSync(dirname(destination), { recursive: true });
cpSync(source, destination);
}
console.log('Android native manifest and network security resources synchronized.');