Skip to content

Commit 77539c3

Browse files
authored
Merge pull request #371 from DialmasterOrg/feature/222-apprise-notifications
Integrates Apprise for notifications
2 parents bc51dc1 + aca08f4 commit 77539c3

28 files changed

+3438
-1119
lines changed

Dockerfile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,21 @@ COPY server/ ./server/
1717
COPY client/build/ ./client/build/
1818
COPY migrations/ ./migrations/
1919

20+
# ---- Apprise ----
21+
FROM python:3.11-slim AS apprise
22+
RUN pip install --no-cache-dir --target=/opt/apprise apprise
23+
2024
# ---- Release ----
2125
FROM node:20-slim AS release
2226
WORKDIR /app
2327

2428
# Install runtime dependencies
25-
RUN apt-get update && apt-get install -y \
29+
RUN apt-get update && apt-get install -y --no-install-recommends \
2630
ffmpeg \
2731
curl \
2832
unzip \
29-
python3-minimal \
33+
python3 \
34+
ca-certificates \
3035
&& rm -rf /var/lib/apt/lists/*
3136

3237
# Download the latest yt-dlp release directly from GitHub
@@ -37,6 +42,14 @@ RUN curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o
3742
ENV DENO_INSTALL="/usr/local"
3843
RUN curl -fsSL https://deno.land/install.sh | sh
3944

45+
# Copy Apprise from builder stage
46+
COPY --from=apprise /opt/apprise /opt/apprise
47+
ENV PYTHONPATH="/opt/apprise"
48+
49+
# Create apprise wrapper (the pip-installed script has wrong shebang for this image)
50+
RUN printf '#!/bin/sh\nexec python3 -c "from apprise.cli import main; main()" "$@"\n' > /usr/local/bin/apprise && \
51+
chmod +x /usr/local/bin/apprise
52+
4053
# Copy production node_modules
4154
COPY --from=dependencies /app/node_modules ./node_modules
4255

client/src/components/Configuration/hooks/__tests__/useConfigSave.test.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,10 @@ describe('useConfigSave', () => {
611611
const notificationsConfig: ConfigState = {
612612
...mockConfig,
613613
notificationsEnabled: true,
614-
notificationService: 'discord',
615-
discordWebhookUrl: 'https://discord.com/api/webhooks/123',
614+
appriseUrls: [
615+
{ url: 'discord://webhook_id/token', name: 'Discord', richFormatting: true },
616+
{ url: 'tgram://bot/chat', name: 'Telegram', richFormatting: true }
617+
],
616618
};
617619

618620
const { result } = renderHook(() =>
@@ -630,8 +632,10 @@ describe('useConfigSave', () => {
630632

631633
const callBody = JSON.parse(mockFetch.mock.calls[0][1]?.body as string);
632634
expect(callBody.notificationsEnabled).toBe(true);
633-
expect(callBody.notificationService).toBe('discord');
634-
expect(callBody.discordWebhookUrl).toBe('https://discord.com/api/webhooks/123');
635+
expect(callBody.appriseUrls).toEqual([
636+
{ url: 'discord://webhook_id/token', name: 'Discord', richFormatting: true },
637+
{ url: 'tgram://bot/chat', name: 'Telegram', richFormatting: true }
638+
]);
635639
});
636640

637641
test('saves configuration with subtitles enabled', async () => {
@@ -806,7 +810,7 @@ describe('useConfigSave', () => {
806810
const emptyConfig: ConfigState = {
807811
...mockConfig,
808812
plexApiKey: '',
809-
discordWebhookUrl: '',
813+
appriseUrls: [],
810814
autoRemovalFreeSpaceThreshold: '',
811815
autoRemovalVideoAgeThreshold: '',
812816
};
@@ -826,7 +830,7 @@ describe('useConfigSave', () => {
826830

827831
const callBody = JSON.parse(mockFetch.mock.calls[0][1]?.body as string);
828832
expect(callBody.plexApiKey).toBe('');
829-
expect(callBody.discordWebhookUrl).toBe('');
833+
expect(callBody.appriseUrls).toEqual([]);
830834
expect(callBody.autoRemovalFreeSpaceThreshold).toBe('');
831835
expect(callBody.autoRemovalVideoAgeThreshold).toBe('');
832836
});

0 commit comments

Comments
 (0)