fix(android): share public legal URLs with cloud builds

This commit is contained in:
key
2026-07-29 10:07:22 +08:00
parent 7f3357c7a1
commit b9e0878926
8 changed files with 83 additions and 13 deletions
@@ -1,5 +1,6 @@
import { readFileSync, writeFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { loadEnv } from 'vite';
import { renderAndroidPrivacy } from './app-legal-config.mjs';
const projectRoot = resolve(import.meta.dirname, '..');
@@ -13,8 +14,13 @@ const argumentValue = (name) => {
return process.argv.find((argument) => argument.startsWith(prefix))?.slice(prefix.length);
};
const termsUrl = argumentValue('terms-url') || process.env.VITE_APP_TERMS_URL;
const privacyUrl = argumentValue('privacy-url') || process.env.VITE_APP_PRIVACY_URL;
const publicBuildEnv = loadEnv(process.env.NODE_ENV || 'production', projectRoot, 'VITE_');
const termsUrl = argumentValue('terms-url')
|| process.env.VITE_APP_TERMS_URL
|| publicBuildEnv.VITE_APP_TERMS_URL;
const privacyUrl = argumentValue('privacy-url')
|| process.env.VITE_APP_PRIVACY_URL
|| publicBuildEnv.VITE_APP_PRIVACY_URL;
try {
const rendered = renderAndroidPrivacy(