Initial commit
BIN
public/assets/appIcon.png
Normal file
|
After Width: | Height: | Size: 682 KiB |
BIN
public/assets/favicon_io.zip
Normal file
BIN
public/assets/favicon_io/android-chrome-192x192.png
Normal file
|
After Width: | Height: | Size: 55 KiB |
BIN
public/assets/favicon_io/android-chrome-512x512.png
Normal file
|
After Width: | Height: | Size: 290 KiB |
BIN
public/assets/favicon_io/app-icon.png
Normal file
|
After Width: | Height: | Size: 290 KiB |
BIN
public/assets/favicon_io/apple-touch-icon.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
public/assets/favicon_io/favicon-16x16.png
Normal file
|
After Width: | Height: | Size: 859 B |
BIN
public/assets/favicon_io/favicon-32x32.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
public/assets/favicon_io/icon.ico
Normal file
|
After Width: | Height: | Size: 15 KiB |
1
public/assets/favicon_io/site.webmanifest
Normal file
@@ -0,0 +1 @@
|
||||
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
||||
1
public/assets/javascript.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="32" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path fill="#F7DF1E" d="M0 0h256v256H0V0Z"></path><path d="m67.312 213.932l19.59-11.856c3.78 6.701 7.218 12.371 15.465 12.371c7.905 0 12.89-3.092 12.89-15.12v-81.798h24.057v82.138c0 24.917-14.606 36.259-35.916 36.259c-19.245 0-30.416-9.967-36.087-21.996m85.07-2.576l19.588-11.341c5.157 8.421 11.859 14.607 23.715 14.607c9.969 0 16.325-4.984 16.325-11.858c0-8.248-6.53-11.17-17.528-15.98l-6.013-2.58c-17.357-7.387-28.87-16.667-28.87-36.257c0-18.044 13.747-31.792 35.228-31.792c15.294 0 26.292 5.328 34.196 19.247l-18.732 12.03c-4.125-7.389-8.591-10.31-15.465-10.31c-7.046 0-11.514 4.468-11.514 10.31c0 7.217 4.468 10.14 14.778 14.608l6.014 2.577c20.45 8.765 31.963 17.7 31.963 37.804c0 21.654-17.012 33.51-39.867 33.51c-22.339 0-36.774-10.654-43.819-24.574"></path></svg>
|
||||
|
After Width: | Height: | Size: 995 B |
BIN
public/assets/radioplayer-logo-192.png
Normal file
|
After Width: | Height: | Size: 66 KiB |
BIN
public/assets/radioplayer-logo-512.png
Normal file
|
After Width: | Height: | Size: 412 KiB |
BIN
public/assets/radioplayer-logo.png
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
4
public/assets/tauri.svg
Normal file
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="206" height="231" viewBox="0 0 206 231">
|
||||
<!-- Wrapper SVG that embeds the PNG app icon so existing references to tauri.svg render the PNG -->
|
||||
<image href="appIcon.png" width="206" height="231" preserveAspectRatio="xMidYMid slice" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 289 B |
42
public/manifest.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"id": "radioplayer",
|
||||
"name": "RadioPlayer",
|
||||
"short_name": "Radio",
|
||||
"description": "RadioPlayer - stream and cast your favorite radio stations.",
|
||||
"start_url": "./",
|
||||
"scope": ".",
|
||||
"display": "standalone",
|
||||
"display_override": ["window-controls-overlay", "standalone", "minimal-ui", "browser"],
|
||||
"orientation": "portrait-primary",
|
||||
"background_color": "#111318",
|
||||
"theme_color": "#111318",
|
||||
"categories": ["music", "entertainment"],
|
||||
"icons": [
|
||||
{
|
||||
"src": "assets/radioplayer-logo-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "any maskable"
|
||||
},
|
||||
{
|
||||
"src": "assets/radioplayer-logo-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "any maskable"
|
||||
}
|
||||
],
|
||||
"shortcuts": [
|
||||
{
|
||||
"name": "Open RadioPlayer",
|
||||
"short_name": "Open",
|
||||
"description": "Launch RadioPlayer",
|
||||
"url": "./",
|
||||
"icons": [
|
||||
{
|
||||
"src": "assets/radioplayer-logo-192.png",
|
||||
"sizes": "192x192"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
1420
public/stations.json
Normal file
105
public/sw.js
Normal file
@@ -0,0 +1,105 @@
|
||||
// NOTE: This service worker is for the web/PWA build.
|
||||
// For development we aggressively unregister SWs in `src/player.js`.
|
||||
//
|
||||
// Bump this value whenever caching logic changes to guarantee clients don't
|
||||
// keep an old UI after updates.
|
||||
const CACHE_NAME = 'radioplayer-pwa-v4';
|
||||
|
||||
const CORE_ASSETS = [
|
||||
'./',
|
||||
'index.html',
|
||||
'stations.json',
|
||||
'manifest.json',
|
||||
'assets/radioplayer-logo-192.png',
|
||||
'assets/radioplayer-logo-512.png',
|
||||
];
|
||||
|
||||
const CORE_PATHS = new Set(CORE_ASSETS.map((p) => new URL(p, self.registration.scope).pathname));
|
||||
|
||||
self.addEventListener('install', (event) => {
|
||||
// Activate updated SW as soon as it's installed.
|
||||
self.skipWaiting();
|
||||
event.waitUntil(
|
||||
caches.open(CACHE_NAME).then(async (cache) => {
|
||||
const reqs = CORE_ASSETS.map((p) => new Request(p, { cache: 'reload' }));
|
||||
await cache.addAll(reqs);
|
||||
|
||||
// Vite fingerprints JS/CSS assets in production. Parse the built HTML so
|
||||
// the installed PWA can launch offline after its first install.
|
||||
try {
|
||||
const indexResp = await fetch(new Request('./', { cache: 'reload' }));
|
||||
const indexText = await indexResp.clone().text();
|
||||
await cache.put('./', indexResp);
|
||||
|
||||
const assetUrls = [...indexText.matchAll(/(?:src|href)="([^"]+)"/g)]
|
||||
.map((match) => match[1])
|
||||
.filter((assetPath) => assetPath.startsWith('./assets/') || assetPath.startsWith('assets/'))
|
||||
.map((assetPath) => new URL(assetPath, self.registration.scope).href);
|
||||
|
||||
await Promise.all(assetUrls.map((assetUrl) => {
|
||||
return cache.add(new Request(assetUrl, { cache: 'reload' })).catch(() => {});
|
||||
}));
|
||||
} catch (e) {
|
||||
// If HTML parsing fails, runtime caching below still catches assets.
|
||||
}
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener('activate', (event) => {
|
||||
event.waitUntil(
|
||||
Promise.all([
|
||||
self.clients.claim(),
|
||||
caches.keys().then((keys) => Promise.all(
|
||||
keys.map((k) => { if (k !== CACHE_NAME) return caches.delete(k); return null; })
|
||||
)),
|
||||
])
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', (event) => {
|
||||
// Only handle GET requests
|
||||
if (event.request.method !== 'GET') return;
|
||||
|
||||
const url = new URL(event.request.url);
|
||||
|
||||
// Don't cache cross-origin requests (station logos, APIs, etc.).
|
||||
if (url.origin !== self.location.origin) {
|
||||
return;
|
||||
}
|
||||
|
||||
const isCore = CORE_PATHS.has(url.pathname);
|
||||
const isHtmlNavigation = event.request.mode === 'navigate' || (event.request.headers.get('accept') || '').includes('text/html');
|
||||
|
||||
// Network-first for navigations and core assets to prevent "old UI" issues.
|
||||
if (isHtmlNavigation || isCore) {
|
||||
event.respondWith(
|
||||
fetch(event.request)
|
||||
.then((networkResp) => {
|
||||
const respClone = networkResp.clone();
|
||||
caches.open(CACHE_NAME).then((cache) => cache.put(event.request, respClone)).catch(() => {});
|
||||
return networkResp;
|
||||
})
|
||||
.catch(() => caches.match(event.request).then((cached) => cached || caches.match('./') || caches.match('index.html')))
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
event.respondWith(
|
||||
caches.match(event.request).then((cached) => {
|
||||
if (cached) return cached;
|
||||
return fetch(event.request).then((networkResp) => {
|
||||
// Optionally cache new resources (best-effort)
|
||||
try {
|
||||
const respClone = networkResp.clone();
|
||||
caches.open(CACHE_NAME).then((cache) => cache.put(event.request, respClone)).catch(()=>{});
|
||||
} catch (e) {}
|
||||
return networkResp;
|
||||
}).catch(() => {
|
||||
// If offline and HTML navigation, return cached index.html
|
||||
if (event.request.mode === 'navigate') return caches.match('./') || caches.match('index.html');
|
||||
return new Response('', { status: 503, statusText: 'Service Unavailable' });
|
||||
});
|
||||
})
|
||||
);
|
||||
});
|
||||