mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-11-26 23:30:22 +01:00
Better theme validation
This commit is contained in:
parent
dac962580b
commit
e25dea27e7
1 changed files with 3 additions and 2 deletions
|
@ -104,8 +104,9 @@ function genValue(c: tinycolor.Instance): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function validateTheme(theme: Record<string, any>): boolean {
|
export function validateTheme(theme: Record<string, any>): boolean {
|
||||||
if (theme.id == null) return false;
|
if (theme.id == null || typeof theme.id !== 'string') return false;
|
||||||
if (theme.name == null) return false;
|
if (theme.name == null || typeof theme.name !== 'string') return false;
|
||||||
if (theme.base == null || !['light', 'dark'].includes(theme.base)) return false;
|
if (theme.base == null || !['light', 'dark'].includes(theme.base)) return false;
|
||||||
|
if (theme.props == null || typeof theme.props !== 'object') return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue