Skip to content

Commit

Permalink
Merge pull request #1046 from maxmind/kevin/ip-address-date
Browse files Browse the repository at this point in the history
Add lastUpdated value to maxmind server ip address list
  • Loading branch information
kevcenteno authored Oct 12, 2023
2 parents 8c62240 + 8074278 commit 7810489
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ module.exports = {
'as-needed',
],
quotes: [
'warn',
'error',
'single',
],
'react-hooks/exhaustive-deps': 'warn',
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@
"develop": "gatsby clean && GATSBY_URL=http://localhost:8000 gatsby develop",
"fix": "run-p fix:*",
"fix:content": "prettier --write '**/*.mdx' --embedded-language-formatting off",
"fix:json": "npm run lint:json --fix",
"fix:scripts": "npm run lint:scripts --fix",
"fix:styles": "npm run lint:styles --fix",
"fix:json": "npm run lint:json -- --fix",
"fix:scripts": "npm run lint:scripts -- --fix",
"fix:styles": "npm run lint:styles -- --fix",
"lint": "run-p lint:*",
"lint:configs": "eslint .*rc.js --no-ignore",
"lint:content": "prettier --check '**/*.mdx' --embedded-language-formatting off",
Expand Down
23 changes: 16 additions & 7 deletions src/components/IpAddresses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,24 @@ import * as React from 'react';

import MaxMindIpAddresses from '../../static/maxmind-server-ip-addresses.json';
import Example from './Example';
import { p as P } from './Mdx';

const lastUpdated = new Date(MaxMindIpAddresses.lastUpdated).toUTCString();

const IpAddresses: React.FC = () => (
<Example
language="bash"
>
{MaxMindIpAddresses.IPv4.join('\n')}
{'\n'}
{MaxMindIpAddresses.IPv6.join('\n')}
</Example>
<>
<Example
language="bash"
>
{MaxMindIpAddresses.IPv4.join('\n')}
{'\n'}
{MaxMindIpAddresses.IPv6.join('\n')}
</Example>
<P>
Last updated:
{lastUpdated}
</P>
</>
);

export default IpAddresses;
7 changes: 2 additions & 5 deletions src/gatsby/gatsby-config/feeds/createServerIpAddressesFeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ export default (): any => ({
nodes {
IPv4
IPv6
lastUpdated
}
}
file {
modifiedTime
}
site {
siteMetadata {
siteUrl
Expand All @@ -23,10 +21,9 @@ export default (): any => ({
serialize: (args: any) => {
const { query } = args;
const { allJson } = query;
const { modifiedTime } = query.file;
const { siteUrl } = query.site.siteMetadata;

const date = new Date(modifiedTime);
const date = new Date(allJson.nodes[0].lastUpdated);

return [
{
Expand Down
3 changes: 2 additions & 1 deletion static/maxmind-server-ip-addresses.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"2606:4700::6810:252f",
"2606:4700:7::a29f:8616",
"2606:4700:7::a29f:8716"
]
],
"lastUpdated": "2021-06-30T22:15:51.000-04:00"
}
2 changes: 1 addition & 1 deletion test/matchers/toHaveNoBrokenLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const toHaveNoBrokenLinks = (brokenLinks: any[]): any => {
Page: ${brokenLink.base.original} ${BR}
Broken Link Url: ${brokenLink.url.original} ${BR}
Broken Link Text: ${brokenLink.html.text} ${BR}
Broken Link Selector: ${brokenLink.html.selector} ${BR}`
Broken Link Selector: ${brokenLink.html.selector} ${BR}`;

return list;
});
Expand Down

0 comments on commit 7810489

Please sign in to comment.