Skip to content

Commit

Permalink
v1.3.0
Browse files Browse the repository at this point in the history
更换组件库为 MantineUI
重构了设置页面
增加了切换全屏功能
优化了专辑图的加载流程
优化了样式表重载流程
一堆布局细节修正
  • Loading branch information
Steve-xmh committed Jan 5, 2023
1 parent bf9ef89 commit dae0b46
Show file tree
Hide file tree
Showing 17 changed files with 736 additions and 424 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author_links": ["https://github.com/Steve-xmh", "https://github.com/Steve-xmh/applemusic-like-lyrics"],
"description": "一个基于 BetterNCM 的类 Apple Music 歌词显示插件",
"preview": "preview.svg",
"version": "1.2.0",
"version": "1.3.0",
"type": "extension",
"requirements": [],
"incompatible": [],
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"@emotion/styled": "^11.10.5",
"@mantine/core": "^5.10.0",
"@mantine/hooks": "^5.10.0",
"@mui/material": "^5.11.2",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.9",
"esbuild": "^0.16.1",
Expand Down
17 changes: 16 additions & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ export enum PlayState {
Pausing = 2,
}

export const NCM_IMAGE_CDNS = [
"https://p3.music.126.net/",
"https://p4.music.126.net/",
];
let selectIndex = 0;
export function getNCMImageUrl(id: number | string) {
selectIndex++;
selectIndex %= NCM_IMAGE_CDNS.length;
return `${NCM_IMAGE_CDNS[selectIndex]}${channel.encryptId(
id.toString(),
)}/${id}.jpg`;
}

export interface EAPIRequestConfig {
/**
* 返回响应的数据类型,绝大部分情况下都是 `json`
Expand Down Expand Up @@ -52,6 +65,8 @@ export function eapiRequest(url: string, config: EAPIRequestConfig) {
if (DEBUG) {
// rome-ignore lint/suspicious/noExplicitAny: <explanation>
(window as any).eapiRequest = eapiRequest;
// rome-ignore lint/suspicious/noExplicitAny: <explanation>
(window as any).getNCMImageUrl = getNCMImageUrl;
}

export function tryFindEapiRequestFuncName(
Expand Down Expand Up @@ -252,7 +267,7 @@ export function useConfig(
React.useEffect(() => {
const onConfigUpdate = () => {
const newValue = plugin.getConfig(key, defaultValue) || defaultValue;
if (value !== newValue) setValue(newValue);
setValue(newValue);
};
GLOBAL_EVENTS.addEventListener(eventKey, onConfigUpdate);
return () => {
Expand Down
Loading

0 comments on commit dae0b46

Please sign in to comment.