feat: update Angular cache with latest TypeScript definitions

This commit is contained in:
2025-09-22 22:17:38 -04:00
parent d78afda4cd
commit d372b7d509
27 changed files with 512 additions and 646 deletions
+34 -15
View File
@@ -1,5 +1,5 @@
/**
* Minimal Twitch provider handler
* Twitch provider using Helix API
*/
const handler = {
id: 'tw',
@@ -12,17 +12,36 @@ const handler = {
async search(q, opts) {
const { limit = 10 } = opts;
try {
// Use Twitch Kraken API (older but public)
// First, get OAuth token
const authResponse = await fetch('https://id.twitch.tv/oauth2/token', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({
client_id: process.env.TWITCH_CLIENT_ID,
client_secret: process.env.TWITCH_CLIENT_SECRET,
grant_type: 'client_credentials'
})
});
if (!authResponse.ok) {
throw new Error(`Twitch auth error: ${authResponse.status}`);
}
const { access_token } = await authResponse.json();
// Then search streams
const response = await fetch(
`https://api.twitch.tv/kraken/search/streams?` +
`https://api.twitch.tv/helix/search/channels?` +
new URLSearchParams({
query: q,
limit: Math.min(limit, 25).toString()
first: Math.min(limit, 100).toString()
}),
{
headers: {
'Accept': 'application/vnd.twitchtv.v5+json',
'Client-ID': process.env.TWITCH_CLIENT_ID || ''
'Client-ID': process.env.TWITCH_CLIENT_ID,
'Authorization': `Bearer ${access_token}`
}
}
);
@@ -33,19 +52,19 @@ const handler = {
const data = await response.json();
return (data.streams || []).map(item => ({
title: item.channel.status || item.channel.display_name,
id: item.channel.name, // Channel name as ID
url: `https://www.twitch.tv/${item.channel.name}`,
thumbnail: item.preview?.medium || item.channel.logo,
uploaderName: item.channel.display_name,
return data.data?.map(item => ({
title: item.title || item.display_name,
id: item.id,
url: `https://www.twitch.tv/${item.broadcaster_login}`,
thumbnail: item.thumbnail_url?.replace('{width}x{height}', '440x248'),
uploaderName: item.display_name,
type: 'stream',
isLive: true
}));
isLive: item.is_live || item.started_at
})) || [];
} catch (error) {
console.error('Twitch search error:', error);
return [];
}
}
};
export default handler;
export default handler;