Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[app] Fix manifest 401 loading #1146

Merged
merged 2 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/toolpad-app/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const BASIC_AUTH_WHITELIST = [

// Static content is public
new URLPattern({ pathname: '/_next/static/*' }),
new URLPattern({ pathname: '/static/*' }),

// Apps must be able to be public
// These urls will handle their own basic auth when the corresponding Toolpad app is not public
Expand Down
6 changes: 2 additions & 4 deletions packages/toolpad-app/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ export default class MyDocument extends Document<ToolpadDocumentProps> {
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
/>
<link rel="manifest" href="/site.webmanifest" />
<link rel="manifest" href="/static/manifest.json" />
<script
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
__html: `
// Add the data-toolpad-canvas attribute to the canvas iframe element
if (window.frameElement?.dataset.toolpadCanvas){
if (window.frameElement?.dataset.toolpadCanvas){
var script = document.createElement('script');
script.type = 'module';
script.src = '/reactDevtools/bootstrap.js';
Expand All @@ -84,7 +84,6 @@ export default class MyDocument extends Document<ToolpadDocumentProps> {
`,
}}
/>

<script
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
Expand All @@ -93,7 +92,6 @@ export default class MyDocument extends Document<ToolpadDocumentProps> {
)}] = ${serializeJavascript(this.props.config, { ignoreFunction: true })}`,
}}
/>

{/* Global site tag (gtag.js) - Google Analytics */}
<Script
async
Expand Down
1 change: 0 additions & 1 deletion packages/toolpad-app/public/site.webmanifest

This file was deleted.

11 changes: 11 additions & 0 deletions packages/toolpad-app/public/static/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"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"
}