mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-14 03:41:46 +00:00
feat(refactor): PluginDefinition::platform (#3665)
This commit is contained in:
@ -59,14 +59,7 @@ import ErrorHtmlAsset from '@assets/error.html?asset';
|
||||
|
||||
import { defaultAuthProxyConfig } from '@/plugins/auth-proxy-adapter/config';
|
||||
|
||||
import type { PluginConfig } from '@/types/plugins';
|
||||
|
||||
if (!is.macOS()) {
|
||||
delete (await allPlugins())['touchbar'];
|
||||
}
|
||||
if (!is.windows()) {
|
||||
delete (await allPlugins())['taskbar-mediacontrol'];
|
||||
}
|
||||
import { type PluginConfig } from '@/types/plugins';
|
||||
|
||||
// Catch errors and log them
|
||||
unhandled({
|
||||
|
||||
@ -14,11 +14,13 @@ import registerCallback, {
|
||||
} from '@/providers/song-info';
|
||||
import { mediaIcons } from '@/types/media-icons';
|
||||
import { t } from '@/i18n';
|
||||
import { Platform } from '@/types/plugins';
|
||||
|
||||
export default createPlugin({
|
||||
name: () => t('plugins.taskbar-mediacontrol.name'),
|
||||
description: () => t('plugins.taskbar-mediacontrol.description'),
|
||||
restartNeeded: true,
|
||||
platform: Platform.Windows,
|
||||
config: {
|
||||
enabled: false,
|
||||
},
|
||||
|
||||
@ -6,11 +6,13 @@ import registerCallback, { SongInfoEvent } from '@/providers/song-info';
|
||||
import { t } from '@/i18n';
|
||||
|
||||
import youtubeMusicIcon from '@assets/youtube-music.png?asset&asarUnpack';
|
||||
import { Platform } from '@/types/plugins';
|
||||
|
||||
export default createPlugin({
|
||||
name: () => t('plugins.touchbar.name'),
|
||||
description: () => t('plugins.touchbar.description'),
|
||||
restartNeeded: true,
|
||||
platform: Platform.macOS,
|
||||
config: {
|
||||
enabled: false,
|
||||
},
|
||||
|
||||
2
src/reset.d.ts
vendored
2
src/reset.d.ts
vendored
@ -19,6 +19,8 @@ declare global {
|
||||
'videodatachange': CustomEvent<VideoDataChanged>;
|
||||
}
|
||||
|
||||
declare var electronIs: typeof import('electron-is')
|
||||
|
||||
interface Window {
|
||||
trustedTypes?: typeof trustedTypes;
|
||||
ipcRenderer: typeof electronIpcRenderer;
|
||||
|
||||
@ -38,6 +38,13 @@ export type RendererPluginLifecycle<Config, Context, This> =
|
||||
| PluginLifecycleSimple<Context, This>
|
||||
| RendererPluginLifecycleExtra<Config, Context, This>;
|
||||
|
||||
export enum Platform {
|
||||
Windows = 1 << 0,
|
||||
macOS = 1 << 1,
|
||||
Linux = 1 << 2,
|
||||
Freebsd = 1 << 3
|
||||
}
|
||||
|
||||
export interface PluginDef<
|
||||
BackendProperties,
|
||||
PreloadProperties,
|
||||
@ -49,6 +56,7 @@ export interface PluginDef<
|
||||
description?: () => string;
|
||||
addedVersion?: string;
|
||||
config?: Config;
|
||||
platform?: Platform;
|
||||
|
||||
menu?: (
|
||||
ctx: MenuContext<Config>,
|
||||
|
||||
Reference in New Issue
Block a user