Replace __DITTO_CONFIG__ global with import.meta.env.DITTO_CONFIG and remove ThemeSchemaCompat
Move build-time ditto.json injection from a Vite define global to import.meta.env.DITTO_CONFIG (a JSON string parsed and validated at runtime via DittoConfigSchema). Remove the global type declaration from vite-env.d.ts. Drop ThemeSchemaCompat and its legacy "black"/"pink" migration code from AppProvider and NostrSync — invalid theme values now simply fail Zod validation. Fix a latent bug where a partial feedSettings from ditto.json would replace the full hardcoded defaults; defaultConfig now deep-merges feedSettings.
This commit is contained in:
+1
-1
@@ -136,7 +136,7 @@ export default defineConfig(() => {
|
||||
...(publicDir ? [mergePublicDir(publicDir)] : []),
|
||||
],
|
||||
define: {
|
||||
__DITTO_CONFIG__: JSON.stringify(dittoConfig ?? null),
|
||||
'import.meta.env.DITTO_CONFIG': JSON.stringify(JSON.stringify(dittoConfig ?? null)),
|
||||
'import.meta.env.VERSION': JSON.stringify(pkg.version),
|
||||
'import.meta.env.BUILD_DATE': JSON.stringify(new Date().toISOString()),
|
||||
'import.meta.env.COMMIT_SHA': JSON.stringify(getCommitSha()),
|
||||
|
||||
Reference in New Issue
Block a user