Skip to content

Commit f69081c

Browse files
committed
Implements PWA features and adds FFmpeg to the Docker image.
1 parent 75479a0 commit f69081c

File tree

4 files changed

+75
-1
lines changed

4 files changed

+75
-1
lines changed

Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
# Use an official Python runtime as a parent image
2-
FROM python:3.11-slim-buster
2+
FROM python:3.11-slim-bookworm
33

44
# Set the working directory in the container
55
WORKDIR /app
66

7+
# Install FFmpeg (required for audio processing)
8+
RUN apt-get update && apt-get install -y --no-install-recommends \
9+
ffmpeg \
10+
&& rm -rf /var/lib/apt/lists/*
11+
712
# Copy the requirements file into the container at /app
813
COPY requirements.txt .
914

static/manifest.webmanifest

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "Podcast Generator",
3+
"short_name": "PodcastGen",
4+
"description": "Generate podcasts from text scripts using AI.",
5+
"start_url": "/",
6+
"display": "standalone",
7+
"background_color": "#121212",
8+
"theme_color": "#1e1e1e",
9+
"icons": [
10+
{
11+
"src": "/assets/podcast.png",
12+
"sizes": "192x192",
13+
"type": "image/png"
14+
},
15+
{
16+
"src": "/assets/podcast.png",
17+
"sizes": "512x512",
18+
"type": "image/png"
19+
}
20+
]
21+
}

static/sw.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
const CACHE_NAME = 'podcast-generator-cache-v1';
2+
const urlsToCache = [
3+
'/',
4+
'/assets/podcast.png',
5+
'/static/manifest.webmanifest'
6+
];
7+
8+
// Install the service worker and cache the app shell
9+
self.addEventListener('install', event => {
10+
event.waitUntil(
11+
caches.open(CACHE_NAME)
12+
.then(cache => {
13+
console.log('Opened cache');
14+
return cache.addAll(urlsToCache);
15+
})
16+
);
17+
});
18+
19+
// Serve cached content when offline
20+
self.addEventListener('fetch', event => {
21+
// We only want to cache GET requests.
22+
if (event.request.method !== 'GET') {
23+
return;
24+
}
25+
26+
event.respondWith(
27+
caches.match(event.request)
28+
.then(response => {
29+
// Cache hit - return response
30+
return response || fetch(event.request);
31+
})
32+
);
33+
});

templates/index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>Podcast Generator</title>
77
<link rel="icon" href="/assets/podcast.png" type="image/png">
8+
<link rel="manifest" href="/static/manifest.webmanifest">
9+
<meta name="theme-color" content="#1e1e1e">
10+
<!-- iOS support -->
11+
<link rel="apple-touch-icon" href="/assets/podcast.png">
812
<style>
913
:root {
1014
--bg-color: #f4f4f9;
@@ -682,6 +686,17 @@ <h3>Asset Credits</h3>
682686
generateDemoConfirmBtn.textContent = 'Generate';
683687
}
684688
}
689+
690+
// --- PWA Service Worker Registration ---
691+
if ('serviceWorker' in navigator) {
692+
window.addEventListener('load', () => {
693+
navigator.serviceWorker.register('/static/sw.js').then(registration => {
694+
console.log('ServiceWorker registration successful with scope: ', registration.scope);
695+
}, err => {
696+
console.log('ServiceWorker registration failed: ', err);
697+
});
698+
});
699+
}
685700
});
686701
</script>
687702
</body>

0 commit comments

Comments
 (0)