mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-06 06:49:10 +00:00
fix(client): fix PWA manifest so "Install as App" works properly (#2192)
This commit is contained in:
@@ -7,13 +7,15 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
||||||
<meta name="theme-color" content="#101010" />
|
<meta name="theme-color" content="#101010" />
|
||||||
<meta name="ontime" content="ontime - time keeping for live events" />
|
<meta name="ontime" content="ontime - time keeping for live events" />
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
|
<meta name="mobile-web-app-capable" content="yes" />
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||||
|
<meta name="apple-mobile-web-app-title" content="Ontime" />
|
||||||
<link rel="apple-touch-icon" href="ontime-logo.png" />
|
<link rel="apple-touch-icon" href="ontime-logo.png" />
|
||||||
<link rel="icon" type="image/png" href="ontime-logo.png" />
|
<link rel="icon" type="image/png" href="ontime-logo.png" />
|
||||||
<link rel="manifest" href="site.webmanifest" />
|
|
||||||
<link rel="manifest" href="manifest.json" />
|
<link rel="manifest" href="manifest.json" />
|
||||||
<meta name="robots" content="noindex" />
|
<meta name="robots" content="noindex" />
|
||||||
<title>ontime</title>
|
<title>Ontime</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
|
|||||||
@@ -1,19 +1,21 @@
|
|||||||
{
|
{
|
||||||
"name": "ontime",
|
"name": "Ontime",
|
||||||
"short_name": "ontime",
|
"short_name": "Ontime",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "favicon.ico",
|
"src": "ontime-logo-192.png",
|
||||||
"type": "image/x-icon"
|
"sizes": "192x192",
|
||||||
|
"type": "image/png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "ontime-logo.png",
|
"src": "ontime-logo-512.png",
|
||||||
|
"sizes": "512x512",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"scope": "./",
|
"scope": "./",
|
||||||
"start_url": "./",
|
"start_url": "./",
|
||||||
"display": "",
|
"display": "standalone",
|
||||||
"theme_color": "#121212",
|
"theme_color": "#101010",
|
||||||
"background_color": "#101010"
|
"background_color": "#101010"
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 84 KiB |
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "",
|
|
||||||
"short_name": "",
|
|
||||||
"icons": [{ "src": "ontime-logo.png", "sizes": "295x295", "type": "image/png" }],
|
|
||||||
"theme_color": "#121212",
|
|
||||||
"background_color": "#101010",
|
|
||||||
"display": "standalone"
|
|
||||||
}
|
|
||||||
@@ -6,6 +6,6 @@ import { useEffect } from 'react';
|
|||||||
*/
|
*/
|
||||||
export function useWindowTitle(title: string) {
|
export function useWindowTitle(title: string) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.title = `ontime - ${title}`;
|
document.title = `Ontime - ${title}`;
|
||||||
}, []);
|
}, []);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export default function ShutdownPanel() {
|
|||||||
{!isOntimeCloud && (
|
{!isOntimeCloud && (
|
||||||
<Panel.Section>
|
<Panel.Section>
|
||||||
<Button variant='destructive' onClick={handler.open} disabled={!canShutdown}>
|
<Button variant='destructive' onClick={handler.open} disabled={!canShutdown}>
|
||||||
Shutdown ontime
|
Shutdown Ontime
|
||||||
</Button>
|
</Button>
|
||||||
{!canShutdown && <Panel.Description>Only available from the machine running Ontime.</Panel.Description>}
|
{!canShutdown && <Panel.Description>Only available from the machine running Ontime.</Panel.Description>}
|
||||||
</Panel.Section>
|
</Panel.Section>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
http-equiv="Content-Security-Policy"
|
http-equiv="Content-Security-Policy"
|
||||||
content="default-src 'self'; style-src 'unsafe-inline'; script-src 'self'"
|
content="default-src 'self'; style-src 'unsafe-inline'; script-src 'self'"
|
||||||
/>
|
/>
|
||||||
<title>ontime</title>
|
<title>Ontime</title>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<img src="../assets/logo.png" />
|
<img src="../assets/logo.png" />
|
||||||
<h1>ontime · event timers</h1>
|
<h1>Ontime · event timers</h1>
|
||||||
<div class="lds-ellipsis">
|
<div class="lds-ellipsis">
|
||||||
<div></div>
|
<div></div>
|
||||||
<div></div>
|
<div></div>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
body {
|
body {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: #121212;
|
background: #101010;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|||||||
@@ -29,15 +29,19 @@ function makeHeadersWithFailingAuthorization(cookie?: string) {
|
|||||||
|
|
||||||
describe('isPublicAssetRequest()', () => {
|
describe('isPublicAssetRequest()', () => {
|
||||||
it('allows root public assets without a prefix', () => {
|
it('allows root public assets without a prefix', () => {
|
||||||
expect(isPublicAssetRequest('/site.webmanifest', '')).toBe(true);
|
|
||||||
expect(isPublicAssetRequest('/manifest.json', '')).toBe(true);
|
expect(isPublicAssetRequest('/manifest.json', '')).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows prefixed public assets in cloud deployments', () => {
|
it('allows prefixed public assets in cloud deployments', () => {
|
||||||
expect(isPublicAssetRequest('/stage-hash/site.webmanifest', '/stage-hash')).toBe(true);
|
expect(isPublicAssetRequest('/stage-hash/manifest.json', '/stage-hash')).toBe(true);
|
||||||
expect(isPublicAssetRequest('/stage-hash/ontime-logo.png?cache=1', '/stage-hash')).toBe(true);
|
expect(isPublicAssetRequest('/stage-hash/ontime-logo.png?cache=1', '/stage-hash')).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('allows the PWA install icons', () => {
|
||||||
|
expect(isPublicAssetRequest('/ontime-logo-192.png', '')).toBe(true);
|
||||||
|
expect(isPublicAssetRequest('/ontime-logo-512.png', '')).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
it('keeps non-public paths protected', () => {
|
it('keeps non-public paths protected', () => {
|
||||||
expect(isPublicAssetRequest('/stage-hash/data', '/stage-hash')).toBe(false);
|
expect(isPublicAssetRequest('/stage-hash/data', '/stage-hash')).toBe(false);
|
||||||
expect(isPublicAssetRequest('/backstage', '')).toBe(false);
|
expect(isPublicAssetRequest('/backstage', '')).toBe(false);
|
||||||
|
|||||||
@@ -17,8 +17,9 @@ const publicAssets = new Set([
|
|||||||
'/favicon.ico',
|
'/favicon.ico',
|
||||||
'/manifest.json',
|
'/manifest.json',
|
||||||
'/ontime-logo.png',
|
'/ontime-logo.png',
|
||||||
|
'/ontime-logo-192.png',
|
||||||
|
'/ontime-logo-512.png',
|
||||||
'/robots.txt',
|
'/robots.txt',
|
||||||
'/site.webmanifest',
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export function isPublicAssetRequest(originalUrl: string, prefix: string): boolean {
|
export function isPublicAssetRequest(originalUrl: string, prefix: string): boolean {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ test.describe('pages routes are available', () => {
|
|||||||
test('editor', async ({ page }) => {
|
test('editor', async ({ page }) => {
|
||||||
await page.goto('/editor');
|
await page.goto('/editor');
|
||||||
|
|
||||||
await expect(page).toHaveTitle(/ontime/);
|
await expect(page).toHaveTitle(/ontime/i);
|
||||||
await expect(page.getByTestId('editor-container')).toBeVisible();
|
await expect(page.getByTestId('editor-container')).toBeVisible();
|
||||||
await expect(page.getByTestId('panel-rundown')).toBeVisible();
|
await expect(page.getByTestId('panel-rundown')).toBeVisible();
|
||||||
await expect(page.getByTestId('panel-timer-control')).toBeVisible();
|
await expect(page.getByTestId('panel-timer-control')).toBeVisible();
|
||||||
@@ -16,38 +16,38 @@ test.describe('pages routes are available', () => {
|
|||||||
test('cuesheet', async ({ page }) => {
|
test('cuesheet', async ({ page }) => {
|
||||||
await page.goto('/cuesheet');
|
await page.goto('/cuesheet');
|
||||||
|
|
||||||
await expect(page).toHaveTitle(/ontime/);
|
await expect(page).toHaveTitle(/ontime/i);
|
||||||
await expect(page.getByTestId('cuesheet')).toBeVisible();
|
await expect(page.getByTestId('cuesheet')).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('operator', async ({ page }) => {
|
test('operator', async ({ page }) => {
|
||||||
await page.goto('/op');
|
await page.goto('/op');
|
||||||
|
|
||||||
await expect(page).toHaveTitle(/ontime/);
|
await expect(page).toHaveTitle(/ontime/i);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('timer', async ({ page }) => {
|
test('timer', async ({ page }) => {
|
||||||
await page.goto('/timer');
|
await page.goto('/timer');
|
||||||
|
|
||||||
await expect(page).toHaveTitle(/ontime/);
|
await expect(page).toHaveTitle(/ontime/i);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('backstage', async ({ page }) => {
|
test('backstage', async ({ page }) => {
|
||||||
await page.goto('/backstage');
|
await page.goto('/backstage');
|
||||||
|
|
||||||
await expect(page).toHaveTitle(/ontime/);
|
await expect(page).toHaveTitle(/ontime/i);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('studio', async ({ page }) => {
|
test('studio', async ({ page }) => {
|
||||||
await page.goto('/studio');
|
await page.goto('/studio');
|
||||||
|
|
||||||
await expect(page).toHaveTitle(/ontime/);
|
await expect(page).toHaveTitle(/ontime/i);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('countdown', async ({ page }) => {
|
test('countdown', async ({ page }) => {
|
||||||
await page.goto('/countdown?sub=32d31');
|
await page.goto('/countdown?sub=32d31');
|
||||||
|
|
||||||
await expect(page).toHaveTitle(/ontime/);
|
await expect(page).toHaveTitle(/ontime/i);
|
||||||
|
|
||||||
await expect(page.getByText('Albania')).toBeVisible();
|
await expect(page.getByText('Albania')).toBeVisible();
|
||||||
await expect(page.getByText('Latvia')).toBeHidden();
|
await expect(page.getByText('Latvia')).toBeHidden();
|
||||||
|
|||||||
@@ -92,12 +92,12 @@ test.describe('test view navigation feature', () => {
|
|||||||
test('not-found', async ({ page }) => {
|
test('not-found', async ({ page }) => {
|
||||||
await page.goto('/not-found');
|
await page.goto('/not-found');
|
||||||
|
|
||||||
await expect(page).toHaveTitle(/ontime/);
|
await expect(page).toHaveTitle(/ontime/i);
|
||||||
await expect(page.getByRole('heading', { name: 'Not found' })).toBeVisible();
|
await expect(page.getByRole('heading', { name: 'Not found' })).toBeVisible();
|
||||||
|
|
||||||
await page.goto('/preset/not-found');
|
await page.goto('/preset/not-found');
|
||||||
|
|
||||||
await expect(page).toHaveTitle(/ontime/);
|
await expect(page).toHaveTitle(/ontime/i);
|
||||||
await expect(page.getByRole('heading', { name: 'Not found' })).toBeVisible();
|
await expect(page.getByRole('heading', { name: 'Not found' })).toBeVisible();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user