This commit is contained in:
Omar Najjar 2025-03-15 22:35:29 +11:00
parent 5a16edc1a2
commit 2e5c99636a
3 changed files with 129 additions and 1 deletions

View file

@ -10,7 +10,6 @@
<meta itemprop="name" content="RADICAL - The Underground Parliament">
<meta property="og:site_name" content="RADICAL">
<meta name="application-name" content="RADICAL">
<meta name="apple-mobile-web-app-title" content="RADICAL">
<meta name="twitter:domain" content="RADICAL">
<!-- Description -->
@ -69,6 +68,21 @@
<link rel="apple-touch-icon" sizes="32x32"
href="https://radical.omar-c29.workers.dev/memes/favicon.jpg">
<!-- APPLE TOUCH ICONS -->
<link rel="apple-touch-icon" href="https://radical.omar-c29.workers.dev/memes/favicon.jpg">
<link rel="apple-touch-icon" sizes="152x152" href="https://radical.omar-c29.workers.dev/memes/favicon.jpg">
<link rel="apple-touch-icon" sizes="180x180" href="https://radical.omar-c29.workers.dev/memes/favicon.jpg">
<link rel="apple-touch-icon" sizes="167x167" href="https://radical.omar-c29.workers.dev/memes/favicon.jpg">
<!-- SPLASH SCREEN IMAGES -->
<!-- iPhone X (1125px x 2436px) -->
<link rel="apple-touch-startup-image" media="(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3)" href="https://radical.omar-c29.workers.dev/memes/splash-1125x2436.png">
<!-- iPhone 8, 7, 6s, 6 (750px x 1334px) -->
<link rel="apple-touch-startup-image" media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2)" href="https://radical.omar-c29.workers.dev/memes/splash-750x1334.png">
<!-- iPhone 8 Plus, 7 Plus, 6s Plus, 6 Plus (1242px x 2208px) -->
<link rel="apple-touch-startup-image" media="(device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3)" href="https://radical.omar-c29.workers.dev/memes/splash-1242x2208.png">
<!-- Author -->
<meta name="og:email" content="contact@theradicalparty.com">
<meta name="twitter:creator" content="@RadicalAustralia">
@ -89,6 +103,20 @@
rel="stylesheet">
<link rel="manifest"
href="https://theradicalparty.com/manifest.webmanifest">
<!-- For iOS -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="RADICAL">
<!-- For Android -->
<meta name="mobile-web-app-capable" content="yes">
<meta name="theme-color" content="#ff0099">
<meta name="application-name" content="RADICAL">
<!-- For Windows -->
<meta name="msapplication-TileColor" content="#ff0099">
<meta name="msapplication-navbutton-color" content="#ff0099">
</head>
<!-- Crawling -->

28
manifest.webmanifest Normal file
View file

@ -0,0 +1,28 @@
{
"name": "RADICAL - The Underground Parliament",
"short_name": "RADICAL",
"description": "Australia's direct democracy movement. Share policy ideas, vote on proposals, take back control.",
"start_url": "/?source=pwa",
"display": "standalone",
"background_color": "#000000",
"theme_color": "#ff0099",
"orientation": "portrait-primary",
"icons": [
{
"src": "https://radical.omar-c29.workers.dev/memes/favicon.jpg",
"sizes": "192x192",
"type": "image/jpeg"
},
{
"src": "https://radical.omar-c29.workers.dev/memes/favicon.jpg",
"sizes": "512x512",
"type": "image/jpeg"
},
{
"src": "https://radical.omar-c29.workers.dev/memes/favicon.jpg",
"sizes": "512x512",
"type": "image/jpeg",
"purpose": "maskable"
}
]
}

72
service-worker.js Normal file
View file

@ -0,0 +1,72 @@
// Service Worker for RADICAL PWA
const CACHE_NAME = 'radical-cache-v1';
const urlsToCache = [
'/',
'/styles.css',
'https://radical.omar-c29.workers.dev/memes/favicon.jpg',
'https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300;400;500;600;700&display=swap'
];
// Install event - cache essential resources
self.addEventListener('install', event => {
event.waitUntil(
caches.open(CACHE_NAME)
.then(cache => {
console.log('Cache opened');
return cache.addAll(urlsToCache);
})
);
});
// Fetch event - serve from cache when possible
self.addEventListener('fetch', event => {
event.respondWith(
caches.match(event.request)
.then(response => {
// Return cached response if found
if (response) {
return response;
}
// Clone the request - request can only be used once
const fetchRequest = event.request.clone();
return fetch(fetchRequest).then(response => {
// Check if valid response
if (!response || response.status !== 200 || response.type !== 'basic') {
return response;
}
// Clone the response - response can only be used once
const responseToCache = response.clone();
caches.open(CACHE_NAME).then(cache => {
// Don't cache API responses
if (!event.request.url.includes('/api/')) {
cache.put(event.request, responseToCache);
}
});
return response;
});
})
);
});
// Activate event - clean up old caches
self.addEventListener('activate', event => {
const cacheWhitelist = [CACHE_NAME];
event.waitUntil(
caches.keys().then(cacheNames => {
return Promise.all(
cacheNames.map(cacheName => {
if (cacheWhitelist.indexOf(cacheName) === -1) {
return caches.delete(cacheName);
}
})
);
})
);
});