-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev' into refactor/trilemma-chak…
…ra-updates
- Loading branch information
1 parent
83cc467
commit 6cfa88e
Showing
261 changed files
with
8,197 additions
and
4,571 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "ethereum-org-website", | ||
"version": "7.22.3", | ||
"version": "7.23.0", | ||
"description": "Website of ethereum.org", | ||
"main": "index.js", | ||
"repository": "[email protected]:ethereum/ethereum-org-website.git", | ||
|
@@ -58,7 +58,6 @@ | |
"is-relative-url": "^3.0.0", | ||
"lodash": "^4.17.21", | ||
"luxon": "^1.28.1", | ||
"netlify-lambda": "^2.0.3", | ||
"polished": "^4.1.4", | ||
"prism-react-renderer": "^1.1.1", | ||
"prismjs": "^1.27.0", | ||
|
@@ -83,6 +82,7 @@ | |
"@chakra-ui/cli": "^2.4.1", | ||
"@chakra-ui/storybook-addon": "^5.0.1", | ||
"@netlify/functions": "^1.2.0", | ||
"@netlify/plugin-gatsby": "^3.7.2", | ||
"@storybook/addon-a11y": "^7.0.23", | ||
"@storybook/addon-actions": "^7.0.23", | ||
"@storybook/addon-essentials": "^7.0.23", | ||
|
@@ -121,7 +121,6 @@ | |
"scripts": { | ||
"postinstall": "yarn theme", | ||
"build": "gatsby build", | ||
"build:lambda": "cross-env NODE_OPTIONS=--openssl-legacy-provider netlify-lambda build src/lambda --config=./webpack.lambda.js", | ||
"build:10gb": "cross-env NODE_OPTIONS=--max-old-space-size=10240 gatsby build", | ||
"clean": "gatsby clean", | ||
"crowdin-clean": "rm -rf .crowdin && mkdir .crowdin", | ||
|
@@ -134,7 +133,6 @@ | |
"optimize-images": "ts-node -O '{ \"module\": \"commonjs\" }' src/scripts/optimizeImages.ts", | ||
"crowdin-contributors": "ts-node -O '{ \"module\": \"commonjs\" }' src/scripts/crowdin/getCrowdinContributors.ts", | ||
"start": "gatsby develop", | ||
"start:lambda": "netlify-lambda serve src/lambda", | ||
"start:static": "gatsby build && gatsby serve", | ||
"serve": "gatsby serve", | ||
"type-check": "tsc --noEmit", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,54 @@ | ||
import axios from "axios" | ||
import type { GatsbyFunctionRequest, GatsbyFunctionResponse } from "gatsby" | ||
import { lambda } from "../lambda/calendarEvents" | ||
|
||
async function handler( | ||
__req: GatsbyFunctionRequest, | ||
res: GatsbyFunctionResponse | ||
): Promise<void> { | ||
// passing env vars as arguments due to a bug on GC functions where env vars | ||
// can not be accessed by imported functions | ||
const { statusCode, body } = await lambda( | ||
process.env.GOOGLE_API_KEY!, | ||
process.env.GOOGLE_CALENDAR_ID! | ||
) | ||
res.status(statusCode).send(body) | ||
const apiKey = process.env.GOOGLE_API_KEY | ||
const calendarId = process.env.GOOGLE_CALENDAR_ID | ||
|
||
try { | ||
const futureEventsReq = await axios.get( | ||
`https://content.googleapis.com/calendar/v3/calendars/${calendarId}/events`, | ||
{ | ||
params: { | ||
key: apiKey, | ||
timeMin: new Date().toISOString(), | ||
maxResults: 3, | ||
singleEvents: true, | ||
orderBy: "startTime", | ||
}, | ||
} | ||
) | ||
|
||
const pastEventsReq = await axios.get( | ||
`https://content.googleapis.com/calendar/v3/calendars/${calendarId}/events`, | ||
{ | ||
params: { | ||
key: apiKey, | ||
timeMax: new Date().toISOString(), | ||
maxResults: 4, | ||
singleEvents: true, | ||
orderBy: "startTime", | ||
}, | ||
} | ||
) | ||
|
||
const response = { | ||
pastEvents: pastEventsReq.data.items, | ||
futureEvents: futureEventsReq.data.items, | ||
} | ||
|
||
res.status(200).send(JSON.stringify(response)) | ||
} catch (error) { | ||
console.error(error) | ||
res.status(500).send( | ||
JSON.stringify({ | ||
msg: "Something went wrong with requesting the calendar events data.", | ||
}) | ||
) | ||
} | ||
} | ||
|
||
export default handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,37 @@ | ||
import axios from "axios" | ||
import takeRightWhile from "lodash/takeRightWhile" | ||
import type { GatsbyFunctionRequest, GatsbyFunctionResponse } from "gatsby" | ||
|
||
import { lambda } from "../lambda/defipulse" | ||
|
||
async function handler( | ||
__req: GatsbyFunctionRequest, | ||
res: GatsbyFunctionResponse | ||
): Promise<void> { | ||
// passing env vars as arguments due to a bug on GC functions where env vars | ||
// can not be accessed by imported functions | ||
const { statusCode, body } = await lambda() | ||
res.status(statusCode).send(body) | ||
try { | ||
const response = await axios.get(`https://api.llama.fi/charts/Ethereum`) | ||
if (response.status < 200 || response.status >= 300) { | ||
return res | ||
.status(response.status) | ||
.send(JSON.stringify(response.statusText)) | ||
} | ||
|
||
const { data } = response | ||
|
||
// get only the last 90 days | ||
const daysToFetch = 90 | ||
const now = new Date() | ||
const startDate = new Date(now.setDate(now.getDate() - daysToFetch)) | ||
const startTimestamp = Math.round(startDate.getTime() / 1000) | ||
|
||
const trimmedData = takeRightWhile( | ||
data, | ||
({ date }) => Number(date) > startTimestamp | ||
) | ||
|
||
res.status(200).send(JSON.stringify(trimmedData)) | ||
} catch (error) { | ||
console.error(error) | ||
res.status(500).send(JSON.stringify({ msg: (error as Error)?.message })) | ||
} | ||
} | ||
|
||
export default handler |
Oops, something went wrong.