mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-07 07:19:16 +00:00
fix(client): fix PWA manifest so "Install as App" works properly (#2192)
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #121212;
|
||||
background: #101010;
|
||||
color: #ffffff;
|
||||
font-family: sans-serif;
|
||||
overflow: hidden;
|
||||
|
||||
@@ -29,15 +29,19 @@ function makeHeadersWithFailingAuthorization(cookie?: string) {
|
||||
|
||||
describe('isPublicAssetRequest()', () => {
|
||||
it('allows root public assets without a prefix', () => {
|
||||
expect(isPublicAssetRequest('/site.webmanifest', '')).toBe(true);
|
||||
expect(isPublicAssetRequest('/manifest.json', '')).toBe(true);
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
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', () => {
|
||||
expect(isPublicAssetRequest('/stage-hash/data', '/stage-hash')).toBe(false);
|
||||
expect(isPublicAssetRequest('/backstage', '')).toBe(false);
|
||||
|
||||
@@ -17,8 +17,9 @@ const publicAssets = new Set([
|
||||
'/favicon.ico',
|
||||
'/manifest.json',
|
||||
'/ontime-logo.png',
|
||||
'/ontime-logo-192.png',
|
||||
'/ontime-logo-512.png',
|
||||
'/robots.txt',
|
||||
'/site.webmanifest',
|
||||
]);
|
||||
|
||||
export function isPublicAssetRequest(originalUrl: string, prefix: string): boolean {
|
||||
|
||||
Reference in New Issue
Block a user