feat: add Ombi requests tab and webhook panel integration
- Add Ombi requests tab UI with movie/TV request display - Add showAll parameter support for Ombi requests (API and SSE) - Add Ombi webhook panel with enable/test functionality - Add Ombi webhook status endpoint with metrics - Add Ombi webhook test endpoint - Change GET /api/ombi/requests to use OmbiRetriever instead of cache - Add Ombi webhook state and API functions to frontend - Update SSE payload to include Ombi baseUrl and requests
This commit is contained in:
@@ -29,6 +29,7 @@ function readCacheSnapshot() {
|
||||
const radarrHistoryData = cache.get('poll:radarr-history') || { records: [] };
|
||||
const radarrTagsData = cache.get('poll:radarr-tags') || [];
|
||||
const qbittorrentTorrents = cache.get('poll:qbittorrent') || [];
|
||||
const ombiRequests = cache.get('poll:ombi-requests') || { movie: [], tv: [] };
|
||||
|
||||
return {
|
||||
sabnzbdQueue: { data: { queue: sabQueueData } },
|
||||
@@ -39,7 +40,8 @@ function readCacheSnapshot() {
|
||||
radarrHistory: { data: radarrHistoryData },
|
||||
radarrTags: { data: radarrTagsData },
|
||||
qbittorrentTorrents,
|
||||
sonarrTagsResults
|
||||
sonarrTagsResults,
|
||||
ombiRequests
|
||||
};
|
||||
}
|
||||
|
||||
@@ -489,7 +491,32 @@ router.get('/stream', requireAuth, async (req, res) => {
|
||||
name: c.name,
|
||||
type: c.getClientType()
|
||||
}));
|
||||
res.write(`data: ${JSON.stringify({ user: user.name, isAdmin, downloads: userDownloads, downloadClients })}\n\n`);
|
||||
|
||||
// Filter Ombi requests by user if not admin or if showAll is false
|
||||
const ombiRequests = snapshot.ombiRequests || { movie: [], tv: [] };
|
||||
let filteredOmbiMovieRequests = ombiRequests.movie || [];
|
||||
let filteredOmbiTvRequests = ombiRequests.tv || [];
|
||||
|
||||
const showAllOmbi = showAll; // Use the same showAll flag for Ombi
|
||||
|
||||
if (!showAllOmbi && username) {
|
||||
const usernameLower = username.toLowerCase();
|
||||
filteredOmbiMovieRequests = filteredOmbiMovieRequests.filter(req => {
|
||||
const requestedUser = req.requestedUser || req.userAlias || '';
|
||||
return requestedUser.toLowerCase() === usernameLower;
|
||||
});
|
||||
filteredOmbiTvRequests = filteredOmbiTvRequests.filter(req => {
|
||||
const requestedUser = req.requestedUser || req.userAlias || '';
|
||||
return requestedUser.toLowerCase() === usernameLower;
|
||||
});
|
||||
}
|
||||
|
||||
const ombiRequestsFiltered = {
|
||||
movie: filteredOmbiMovieRequests,
|
||||
tv: filteredOmbiTvRequests
|
||||
};
|
||||
|
||||
res.write(`data: ${JSON.stringify({ user: user.name, isAdmin, downloads: userDownloads, downloadClients, ombiRequests: ombiRequestsFiltered, ombiBaseUrl })}\n\n`);
|
||||
} catch (err) {
|
||||
console.error('[SSE] Error building payload:', sanitizeError(err));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user