PluginProbe
Extendify / 3.2.1
Extendify v3.2.1
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / AutoLaunch / fetchers / get-design.js

get-design.js in Extendify 3.2.1, at src/AutoLaunch/fetchers/get-design.js

21 lines 693 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { failWithFallback } from '@auto-launch/functions/helpers';
2 import { z } from 'zod';
3
4 /**
5 * An unknown variable must not sink a design authored against a newer build.
6 * A number is a CSS value too, so `0.88` is not dropped.
7 */
8 export const designShape = z.object({
9 vars: z.record(z.string(), z.union([z.string(), z.number()])).optional(),
10 shader: z.string().optional(),
11 logo: z.string().optional(),
12 templates: z.record(z.string(), z.string()).optional(),
13 });
14
15 export const handleDesign = async () =>
16 failWithFallback(
17 async () => designShape.parse(window.extLaunchData?.customDesign ?? {}),
18 {},
19 { error: { message: 'Design config unreadable', name: 'DesignError' } },
20 );
21