Files
RecipesCam/tools/set-variant.mjs
admin 1b60ca2f22 Drop the in-app unlock key: only the PRO apk opens PRO
The set is two apks and the unlock key was a second, weaker lock on the
same door. A verifier that runs offline has to carry its secret inside
the lite apk, so anyone who unpacked it could mint a key. Nothing in the
lite build can flip the gate now.

- entitlement.ts keeps the gate (which look is PRO, what an export
  carries in lite) and exports IS_PRO straight from the build flag.
- SETTINGS loses the key field; the plan chip still says LITE / PRO
  ACTIVE and the helper text says what lite cannot export.
- The upsell alerts just name the build that has the feature.
- tools/keygen.mjs goes with the verifier it fed.
2026-09-14 20:09:12 +07:00

19 lines
967 B
JavaScript

// Point the JS bundle at one tier before a build.
// node tools/set-variant.mjs lite -> src/provariant.ts has IS_PRO_BUILD = false
// node tools/set-variant.mjs pro -> src/provariant.ts has IS_PRO_BUILD = true
// The gradle flavor (assembleLiteRelease / assembleProRelease) sets the package
// name and label; this file is what entitlement.ts reads. Run the matching pair,
// or you ship a Pro apk that thinks it is Lite. `npm run apk:lite|apk:pro` does both.
import { writeFileSync } from 'node:fs';
const tier = process.argv[2];
if (tier !== 'lite' && tier !== 'pro') {
throw new Error('usage: node tools/set-variant.mjs lite|pro');
}
writeFileSync(
new URL('../src/provariant.ts', import.meta.url),
`// Generated by tools/set-variant.mjs - do not edit by hand.\n// false = Lite apk (free, PRO looks are preview-only), true = Pro apk (sold as-is).\nexport const IS_PRO_BUILD = ${tier === 'pro'};\n`
);
console.log('src/provariant.ts ->', tier);