
* Split "my library" into "video space (channels, videos...)" and "my library (playlists, history...)" * Split "admin" into "overview (users, videos...)", "moderation (abuses, blocks, registrations...)" and "settings (configuration, runners...)" * Reorganize the header and the left menu: account settings/notifications are now in the header * Add instance information context in the left menu * Merge dedicated videos pages for "recently added", "trending", "local videos" into a "browse videos" page that includes quick filters * Clean up entire CSS * Clean CSS variables so it's easier to theme PeerTube (some new variables fallback to old variables to limit currnet themes breakages) * Replace the current light theme into a new one (beige) * Add a dark (brown) theme (included in PeerTube core) * Fix accessibility issues with old light theme colors (white on orange button for example) * Redesign the left menu, the horizontal menu, form controls and buttons, "Discover videos" page and common video filters panel * Replace/remove/add some global icon
20 lines
851 B
TypeScript
20 lines
851 B
TypeScript
import { DEFAULT_THEME_NAME, DEFAULT_USER_THEME_NAME } from '../../initializers/constants.js'
|
|
import { PluginManager } from './plugin-manager.js'
|
|
import { CONFIG } from '../../initializers/config.js'
|
|
import { ServerConfigManager } from '../server-config-manager.js'
|
|
|
|
export function getThemeOrDefault (name: string, defaultTheme: string) {
|
|
if (isThemeRegistered(name)) return name
|
|
|
|
// Fallback to admin default theme
|
|
if (name !== CONFIG.THEME.DEFAULT) return getThemeOrDefault(CONFIG.THEME.DEFAULT, DEFAULT_THEME_NAME)
|
|
|
|
return defaultTheme
|
|
}
|
|
|
|
export function isThemeRegistered (name: string) {
|
|
if (name === DEFAULT_THEME_NAME || name === DEFAULT_USER_THEME_NAME) return true
|
|
|
|
return PluginManager.Instance.getRegisteredThemes().some(r => r.name === name) ||
|
|
ServerConfigManager.Instance.getBuiltInThemes().some(r => r.name === name)
|
|
}
|