Skip to content

Commit

Permalink
Merge pull request #26 from balancer/feat/safeAppManifest
Browse files Browse the repository at this point in the history
feat: adapt manifest to work with Safe App
  • Loading branch information
MattPereira authored Jan 7, 2025
2 parents 4869f52 + 44857f2 commit d78b2bf
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
30 changes: 30 additions & 0 deletions packages/nextjs/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,36 @@ const nextConfig = {
config.externals.push("pino-pretty", "lokijs", "encoding");
return config;
},
// Safe App setup
headers: manifestHeaders,
};

module.exports = nextConfig;

/**
* Add specific CORS headers to the manifest.json file
* This is required to allow the Safe Browser to fetch the manifest file
* More info: https://help.safe.global/en/articles/40859-add-a-custom-safe-app
*/
async function manifestHeaders() {
const corsHeaders = [
{
key: "Access-Control-Allow-Origin",
value: "*",
},
{
key: "Access-Control-Allow-Methods",
value: "GET",
},
{
key: "Access-Control-Allow-Headers",
value: "X-Requested-With, content-type, Authorization",
},
];
return [
{
source: "/manifest.json",
headers: corsHeaders,
},
];
}
16 changes: 13 additions & 3 deletions packages/nextjs/public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"name": "Scaffold-ETH 2 DApp",
"description": "A DApp built with Scaffold-ETH",
"iconPath": "logo.svg"
"short_name": "Balancer pool creator",
"name": "Balancer pool creator",
"description": "Create and initialize a variety of liquidity pool types with Balancer protocol",
"icons": [
{
"src": "/logo.svg",
"sizes": "any",
"type": "image/svg+xml"
}
],
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

0 comments on commit d78b2bf

Please sign in to comment.