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

Release PR #840

Merged
merged 11 commits into from
Oct 30, 2023
26 changes: 26 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { defineConfig } from 'cypress'

export default defineConfig({
projectId: 'uckcr1',
viewportWidth: 1200,
viewportHeight: 800,
defaultCommandTimeout: 40000,
pageLoadTimeout: 120000,
video: false,
retries: {
runMode: 1,
openMode: 0,
},
experimentalStudio: true,
chromeWebSecurity: false,
numTestsKeptInMemory: 2,
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
},
baseUrl: 'http://localhost:3000',
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
},
})
17 changes: 0 additions & 17 deletions cypress.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions cypress/support/index.ts → cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ Cypress.on('uncaught:exception', (err, runnable) => {
afterEach(function onAfterEach() {
if ((this.currentTest as Mocha.Test).state === 'failed') {
cy.setCookie('shouldSkip', 'true');
Cypress.Cookies.defaults({
preserve: 'shouldSkip'
});
//set cookie to skip tests for further specs
// this.skip()
// Cypress.runner.stop();
Expand Down
2 changes: 1 addition & 1 deletion lib/matter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ export function matterWrapper(document: string): MatterResult {
}
});
return { data, content };
}
}
54 changes: 51 additions & 3 deletions middleware.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,59 @@
import { NextRequest, NextResponse } from 'next/server';
import { config as libConfig } from 'lib/config';

export async function middleware(req: NextRequest) {
const { pathname, search } = req.nextUrl;
export const config = {
matcher: [
/*
* Match all request paths except for the ones starting with:
* - api (API routes)
* - _next/static (static files)
* - _next/image (image optimization files)
* - favicon.ico (favicon file)
*/
{
source: '/((?!api|_next/static|_next/image|favicon.ico).*)',
missing: [
{ type: 'header', key: 'next-router-prefetch' },
{ type: 'header', key: 'purpose', value: 'prefetch' }
]
}
]
};

export async function middleware(request: NextRequest) {
const { pathname, search } = request.nextUrl;

if (pathname === '/api-docs' && search.length > 0) {
return NextResponse.redirect('/api-docs');
}

return NextResponse.next();
const nonce = Buffer.from(crypto.randomUUID()).toString('base64');
const dev = libConfig.NODE_ENV === 'development';

const cspHeader = `
default-src 'self' https://*.makerdao.com;
script-src 'self' ${
dev ? ` 'unsafe-eval' 'unsafe-inline'` : ''
} cdn.vercel-insights.com 'nonce-${nonce}';
style-src 'self' 'unsafe-inline';
frame-src https://connect.trezor.io https://www.youtube-nocookie.com https://player.vimeo.com https://vercel.live https://verify.walletconnect.com;
font-src 'self' data:;
connect-src http://localhost:8545 http://127.0.0.1:8546 http://127.0.0.1:8545 http://localhost:3001 'self' https: wss:;
img-src 'self' https: data:;
`;

const requestHeaders = new Headers(request.headers);
requestHeaders.set('x-nonce', nonce);
requestHeaders.set(
'Content-Security-Policy',
// Replace newline characters and spaces
cspHeader.replace(/\s{2,}/g, ' ').trim()
);

return NextResponse.next({
headers: requestHeaders,
request: {
headers: requestHeaders
}
});
}
15 changes: 0 additions & 15 deletions modules/app/components/layout/Head.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ SPDX-License-Identifier: AGPL-3.0-or-later
*/

import Head from 'next/head';
import { config } from 'lib/config';

export function HeadComponent({
title,
Expand All @@ -23,7 +22,6 @@ export function HeadComponent({
const defaultDescription =
'The MakerDAO Governance Portal allows for anyone to view governance proposals, and also allows for MKR holders to vote.';
const defaultTitle = 'Governance Portal';
const dev = config.NODE_ENV === 'development';
const renderedTitle = `Maker Governance - ${title || defaultTitle}`;
const renderedDescription = description || defaultDescription;
return (
Expand All @@ -40,19 +38,6 @@ export function HeadComponent({
<meta name="twitter:description" content={renderedDescription} />
{image && <meta name="twitter:image" content={image} />}
<meta name="twitter:card" content="summary_large_image"></meta>

<meta
httpEquiv="Content-Security-Policy"
content={
"default-src 'self' https://*.makerdao.com;" +
'frame-src https://connect.trezor.io https://www.youtube-nocookie.com https://player.vimeo.com https://vercel.live https://verify.walletconnect.com;' +
"font-src 'self' data:;" +
"connect-src http://localhost:8545/ http://127.0.0.1:8546/ http://127.0.0.1:8545/ http://localhost:3001/ 'self' https: wss:;" +
"style-src 'self' 'unsafe-inline';" +
`script-src 'self' ${dev ? "'unsafe-eval'" : ''};` +
"img-src 'self' https: data:"
}
/>
</Head>
);
}
2 changes: 1 addition & 1 deletion modules/tags/constants/delegates-tags-definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@
"longname": "",
"description": "Delegate values focus on long-term goals and helps align MakerDAO actors."
}
]
]
8 changes: 4 additions & 4 deletions modules/tags/constants/poll-tags-definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"shortname": "High Impact",
"longname": "High Impact",
"recommend_ui": true,
"description": "Polls that GovAlpha has judged high-impact",
"description": "Polls that the Governance Facilitators have judged high-impact",
"related_link": "https://forum.makerdao.com/t/introducing-impact-estimations/14267",
"precedence": 1
},
Expand Down Expand Up @@ -90,7 +90,7 @@
"shortname": "Med Impact",
"longname": "Medium Impact",
"recommend_ui": true,
"description": "Polls that GovAlpha has judged medium-impact",
"description": "Polls that the Governance Facilitators have judged medium-impact",
"related_link": "https://forum.makerdao.com/t/introducing-impact-estimations/14267",
"precedence": 11
},
Expand Down Expand Up @@ -133,7 +133,7 @@
"shortname": "Low Impact",
"longname": "Low Impact",
"recommend_ui": true,
"description": "Polls that GovAlpha has judged low-impact",
"description": "Polls that the Governance Facilitators have judged low-impact",
"related_link": "https://forum.makerdao.com/t/introducing-impact-estimations/14267",
"precedence": 16
},
Expand Down Expand Up @@ -281,4 +281,4 @@
"description": "Polls that seek input on prioritization sentiment from MKR holders",
"precedence": 33
}
]
]
49 changes: 48 additions & 1 deletion modules/tags/constants/poll-tags-mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,5 +978,52 @@
"996": ["medium-impact", "misc-governance", "endgame"],
"997": ["high-impact", "misc-governance", "endgame"],
"998": ["medium-impact", "misc-governance", "endgame"],
"999": ["high-impact", "misc-governance", "endgame"]
"999": ["high-impact", "misc-governance", "endgame"],
"1000": ["high-impact", "ratification", "mips", "endgame"],
"1001": ["high-impact", "technical", "misc-funding"],
"1002": ["high-impact", "collateral-onboard", "spark"],
"1003": ["low-impact", "technical", "real-world-assets", "risk-parameter"],
"1004": ["medium-impact", "real-world-assets", "greenlight"],
"1005": ["high-impact", "budget", "endgame"],
"1006": ["high-impact", "real-world-assets", "collateral-onboard", "risk-parameter", "psm"],
"1007": ["high-impact", "risk-parameter"],
"1008": ["medium-impact", "risk-parameter", "d3m", "spark"],
"1009": ["high-impact", "technical", "spark"],
"1010": ["high-impact", "collateral-onboard", "risk-parameter", "spark"],
"1011": ["medium-impact", "risk-parameter", "d3m", "spark"],
"1012": ["medium-impact", "risk-parameter", "psm"],
"1013": ["high-impact", "ratification", "mips", "endgame"],
"1014": ["medium-impact", "ratification", "mips"],
"1015": ["medium-impact", "risk-parameter", "psm"],
"1016": ["high-impact", "surplus", "technical", "risk-parameter", "endgame"],
"1017": ["high-impact", "misc-governance"],
"1018": ["medium-impact", "real-world-assets", "risk-parameter"],
"1019": ["high-impact", "mips", "dsr", "endgame"],
"1020": ["medium-impact", "real-world-assets", "risk-parameter"],
"1021": ["high-impact", "risk-parameter", "d3m", "spark"],
"1022": ["medium-impact", "risk-parameter", "spark"],
"1023": ["medium-impact", "risk-parameter"],
"1024": ["medium-impact", "surplus", "endgame"],
"1025": ["high-impact", "mips", "dsr", "endgame"],
"1026": ["high-impact", "ratification", "mips", "endgame"],
"1027": ["high-impact", "ratification", "mips", "endgame"],
"1028": ["high-impact", "ratification", "mips", "endgame"],
"1029": ["high-impact", "misc-governance"],
"1030": ["medium-impact", "risk-parameter", "spark"],
"1031": ["medium-impact", "risk-parameter", "spark"],
"1032": ["medium-impact", "real-world-assets"],
"1033": ["medium-impact", "real-world-assets"],
"1038": ["high-impact", "risk-parameter", "d3m", "spark"],
"1039": ["medium-impact", "risk-parameter", "spark"],
"1040": ["medium-impact", "risk-parameter", "spark"],
"1041": ["high-impact", "real-world-assets"],
"1042": ["high-impact", "ratification", "mips", "endgame"],
"1043": ["high-impact", "ratification", "mips", "endgame"],
"1044": ["high-impact", "ratification", "mips", "endgame"],
"1045": ["high-impact", "spark"],
"1046": ["high-impact", "real-world-assets", "risk-parameter"],
"1047": ["high-impact", "risk-parameter"],
"1048": ["high-impact", "risk-parameter", "spark"],
"1049": ["high-impact", "collateral-onboard", "risk-parameter", "spark"],
"1050": ["high-impact", "collateral-onboard", "risk-parameter", "spark"]
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"lottie-web": "^5.7.1",
"mersenne-twister": "^1.1.0",
"mongodb": "^3.6.2",
"next": "^13.3.0",
"next": "^13.4.20",
"next-swagger-doc": "^0.1.10",
"nextjs-progressbar": "^0.0.13",
"react": "^18.2.0",
Expand All @@ -85,7 +85,7 @@
"react-qr-svg": "^2.2.2",
"react-sticky": "^6.0.3",
"react-toastify": "^8.1.1",
"recharts": "2.1.12",
"recharts": "2.9.0",
"rehype-sanitize": "^5.0.1",
"rehype-stringify": "^9.0.3",
"remark-gfm": "^3.0.1",
Expand Down Expand Up @@ -128,7 +128,7 @@
"@typescript-eslint/parser": "^5.58.0",
"babel-plugin-istanbul": "^6.1.1",
"bignumber.js": "^9.0.1",
"cypress": "9.6.0",
"cypress": "13.3.0",
"dotenv": "^8.2.0",
"eslint": "^8.38.0",
"eslint-config-next": "^13.3.0",
Expand Down
8 changes: 0 additions & 8 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,6 @@ const App = ({ Component, pageProps }: AppProps): React.ReactElement => {
<AccountProvider>
<BallotProvider>
<HeadComponent />
{/* {process.env.NODE_ENV === 'production' && (
<Script
data-goatcounter="https://dux-makerdao.goatcounter.com/count"
async
src="//gc.zgo.at/count.js"
strategy="afterInteractive"
/>
)} */}
<SWRConfig
value={{
// default to 60 second refresh intervals
Expand Down
Loading