This commit is contained in:
juneix
2026-04-17 10:45:33 +08:00
parent c583a46641
commit fa50e1d23e
3 changed files with 36 additions and 12 deletions
Vendored
BIN
View File
Binary file not shown.
+18 -6
View File
@@ -348,7 +348,7 @@
<div class="flex items-center"> <div class="flex items-center">
<h3 class="text-white font-bold text-2xl tracking-tight">📱 EmbyX</h3> <h3 class="text-white font-bold text-2xl tracking-tight">📱 EmbyX</h3>
<span <span
class="ml-2 px-2 py-0.5 bg-primary/20 text-primary text-xs font-bold rounded-full border border-primary/30">v1.0</span> class="ml-2 px-2 py-0.5 bg-primary/20 text-primary text-xs font-bold rounded-full border border-primary/30">v1.1</span>
</div> </div>
<div> <div>
@@ -683,7 +683,7 @@
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'X-Emby-Authorization': `Emby Client="EmbyX", Device="Web", DeviceId="EmbyX-Device", Version="1.0"` 'X-Emby-Authorization': `Emby Client="EmbyX", Device="Web", DeviceId="EmbyX-Device", Version="1.1"`
}, },
body: JSON.stringify({ Username: user, Pw: pwd }) body: JSON.stringify({ Username: user, Pw: pwd })
}); });
@@ -792,7 +792,7 @@
const PAGE_SIZE = 99; const PAGE_SIZE = 99;
// const MAX_GRID_VIDEOS = 1000; // const MAX_GRID_VIDEOS = 1000;
let url = `${server}/emby/Users/${userId}/Items?api_key=${token}&Recursive=true&IncludeItemTypes=Video&Limit=${PAGE_SIZE}&StartIndex=${this.state.startIndex || 0}&Fields=Overview,Path,RunTimeTicks,MediaSources`; let url = `${server}/emby/Users/${userId}/Items?api_key=${token}&Recursive=true&IncludeItemTypes=Movie,Episode,Video&Limit=${PAGE_SIZE}&StartIndex=${this.state.startIndex || 0}&Fields=Overview,Path,RunTimeTicks,MediaSources`;
if (ids) { if (ids) {
url += `&Ids=${ids}`; url += `&Ids=${ids}`;
@@ -808,7 +808,11 @@
url += `&SortBy=DateCreated&SortOrder=Descending`; url += `&SortBy=DateCreated&SortOrder=Descending`;
} }
const res = await fetch(url); const res = await fetch(url, {
headers: {
'X-Emby-Authorization': `Emby Client="EmbyX", Device="Web", DeviceId="EmbyX-Device", Version="1.1"`
}
});
if (!res.ok) { if (!res.ok) {
throw new Error(`Server Error: ${res.status}`); throw new Error(`Server Error: ${res.status}`);
} }
@@ -1457,10 +1461,18 @@
try { try {
const userId = this.config.userId; const userId = this.config.userId;
const playlistsRes = await fetch(`${this.config.server}/emby/Users/${userId}/Items?Recursive=true&IncludeItemTypes=Playlist&api_key=${this.config.token}`); const playlistsRes = await fetch(`${this.config.server}/emby/Users/${userId}/Items?Recursive=true&IncludeItemTypes=Playlist&api_key=${this.config.token}`, {
headers: {
'X-Emby-Authorization': `Emby Client="EmbyX", Device="Web", DeviceId="EmbyX-Device", Version="1.1"`
}
});
const playlistsData = await playlistsRes.json(); const playlistsData = await playlistsRes.json();
const viewsRes = await fetch(`${this.config.server}/emby/Users/${userId}/Views?api_key=${this.config.token}`); const viewsRes = await fetch(`${this.config.server}/emby/Users/${userId}/Views?api_key=${this.config.token}`, {
headers: {
'X-Emby-Authorization': `Emby Client="EmbyX", Device="Web", DeviceId="EmbyX-Device", Version="1.1"`
}
});
const viewsDataRaw = viewsRes.ok ? await viewsRes.json() : { Items: [] }; const viewsDataRaw = viewsRes.ok ? await viewsRes.json() : { Items: [] };
localStorage.setItem('emby_views_cache', JSON.stringify({ playlists: playlistsData, views: viewsDataRaw })); localStorage.setItem('emby_views_cache', JSON.stringify({ playlists: playlistsData, views: viewsDataRaw }));
+18 -6
View File
@@ -366,7 +366,7 @@
<div class="flex items-center"> <div class="flex items-center">
<h3 class="text-white font-bold text-2xl tracking-tight">📱 EmbyX</h3> <h3 class="text-white font-bold text-2xl tracking-tight">📱 EmbyX</h3>
<span <span
class="ml-2 px-2 py-0.5 bg-primary/20 text-primary text-xs font-bold rounded-full border border-primary/30">v1.0</span> class="ml-2 px-2 py-0.5 bg-primary/20 text-primary text-xs font-bold rounded-full border border-primary/30">v1.1</span>
</div> </div>
<div> <div>
@@ -724,7 +724,7 @@
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'X-Emby-Authorization': `Emby Client="EmbyX", Device="Web", DeviceId="EmbyX-Device", Version="1.0"` 'X-Emby-Authorization': `Emby Client="EmbyX", Device="Web", DeviceId="EmbyX-Device", Version="1.1"`
}, },
body: JSON.stringify({ Username: user, Pw: pwd }) body: JSON.stringify({ Username: user, Pw: pwd })
}); });
@@ -842,7 +842,7 @@
const PAGE_SIZE = 99; // 可调整,建议保持 3 的倍数 const PAGE_SIZE = 99; // 可调整,建议保持 3 的倍数
// const MAX_GRID_VIDEOS = 1000; // 硬性上限,目前由 API TotalRecordCount 控制,留作后期限速使用 // const MAX_GRID_VIDEOS = 1000; // 硬性上限,目前由 API TotalRecordCount 控制,留作后期限速使用
let url = `${server}/emby/Users/${userId}/Items?api_key=${token}&Recursive=true&IncludeItemTypes=Video&Limit=${PAGE_SIZE}&StartIndex=${this.state.startIndex || 0}&Fields=Overview,Path,RunTimeTicks,MediaSources`; let url = `${server}/emby/Users/${userId}/Items?api_key=${token}&Recursive=true&IncludeItemTypes=Movie,Episode,Video&Limit=${PAGE_SIZE}&StartIndex=${this.state.startIndex || 0}&Fields=Overview,Path,RunTimeTicks,MediaSources`;
if (ids) { if (ids) {
url += `&Ids=${ids}`; url += `&Ids=${ids}`;
@@ -861,7 +861,11 @@
url += `&SortBy=DateCreated&SortOrder=Descending`; url += `&SortBy=DateCreated&SortOrder=Descending`;
} }
const res = await fetch(url); const res = await fetch(url, {
headers: {
'X-Emby-Authorization': `Emby Client="EmbyX", Device="Web", DeviceId="EmbyX-Device", Version="1.1"`
}
});
if (!res.ok) { if (!res.ok) {
throw new Error(`服务器错误: ${res.status}`); throw new Error(`服务器错误: ${res.status}`);
} }
@@ -1577,10 +1581,18 @@
try { try {
const userId = this.config.userId; const userId = this.config.userId;
const playlistsRes = await fetch(`${this.config.server}/emby/Users/${userId}/Items?Recursive=true&IncludeItemTypes=Playlist&api_key=${this.config.token}`); const playlistsRes = await fetch(`${this.config.server}/emby/Users/${userId}/Items?Recursive=true&IncludeItemTypes=Playlist&api_key=${this.config.token}`, {
headers: {
'X-Emby-Authorization': `Emby Client="EmbyX", Device="Web", DeviceId="EmbyX-Device", Version="1.1"`
}
});
const playlistsData = await playlistsRes.json(); const playlistsData = await playlistsRes.json();
const viewsRes = await fetch(`${this.config.server}/emby/Users/${userId}/Views?api_key=${this.config.token}`); const viewsRes = await fetch(`${this.config.server}/emby/Users/${userId}/Views?api_key=${this.config.token}`, {
headers: {
'X-Emby-Authorization': `Emby Client="EmbyX", Device="Web", DeviceId="EmbyX-Device", Version="1.1"`
}
});
const viewsDataRaw = viewsRes.ok ? await viewsRes.json() : { Items: [] }; const viewsDataRaw = viewsRes.ok ? await viewsRes.json() : { Items: [] };
// 缓存完整的视图和列表数据供网格模式提取名称 // 缓存完整的视图和列表数据供网格模式提取名称