Skip to content

Commit 3576a98

Browse files
authored
fix: upgrade the vercel to the latest (#22)
* fix: upgrade the vercel to the latest * feat: add app * chore: fix lint * chore: fix lint * chore: remove unused package * chore: remove unused package
1 parent 031b418 commit 3576a98

File tree

20 files changed

+6502
-174
lines changed

20 files changed

+6502
-174
lines changed

.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

.gitignore

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,42 @@ node_modules/*
44
api/asset.ts
55
api/data.ts
66
api/winner.ts
7-
*.log
7+
*.log
8+
*.DS_Store
9+
10+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
11+
12+
# dependencies
13+
/node_modules
14+
/.pnp
15+
.pnp.js
16+
.yarn/install-state.gz
17+
18+
# testing
19+
/coverage
20+
21+
# next.js
22+
/.next/
23+
/out/
24+
25+
# production
26+
/build
27+
28+
# misc
29+
.DS_Store
30+
*.pem
31+
32+
# debug
33+
npm-debug.log*
34+
yarn-debug.log*
35+
yarn-error.log*
36+
37+
# local env files
38+
.env*.local
39+
40+
# vercel
41+
.vercel
42+
43+
# typescript
44+
*.tsbuildinfo
45+
next-env.d.ts

api/medium/[user]/[index].ts

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @ts-ignore
12
export default ({ title, description, date, url, thumbnail }) => `
23
<svg fill="none" width="800" height="120" xmlns="http://www.w3.org/2000/svg">
34
<foreignObject width="100%" height="100%">

app/favicon.ico

25.3 KB
Binary file not shown.

app/globals.css

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
:root {
2+
--max-width: 1100px;
3+
--border-radius: 12px;
4+
--font-mono: ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono",
5+
"Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Source Code Pro",
6+
"Fira Mono", "Droid Sans Mono", "Courier New", monospace;
7+
8+
--foreground-rgb: 0, 0, 0;
9+
--background-start-rgb: 214, 219, 220;
10+
--background-end-rgb: 255, 255, 255;
11+
12+
--primary-glow: conic-gradient(
13+
from 180deg at 50% 50%,
14+
#16abff33 0deg,
15+
#0885ff33 55deg,
16+
#54d6ff33 120deg,
17+
#0071ff33 160deg,
18+
transparent 360deg
19+
);
20+
--secondary-glow: radial-gradient(
21+
rgba(255, 255, 255, 1),
22+
rgba(255, 255, 255, 0)
23+
);
24+
25+
--tile-start-rgb: 239, 245, 249;
26+
--tile-end-rgb: 228, 232, 233;
27+
--tile-border: conic-gradient(
28+
#00000080,
29+
#00000040,
30+
#00000030,
31+
#00000020,
32+
#00000010,
33+
#00000010,
34+
#00000080
35+
);
36+
37+
--callout-rgb: 238, 240, 241;
38+
--callout-border-rgb: 172, 175, 176;
39+
--card-rgb: 180, 185, 188;
40+
--card-border-rgb: 131, 134, 135;
41+
}
42+
43+
@media (prefers-color-scheme: dark) {
44+
:root {
45+
--foreground-rgb: 255, 255, 255;
46+
--background-start-rgb: 0, 0, 0;
47+
--background-end-rgb: 0, 0, 0;
48+
49+
--primary-glow: radial-gradient(rgba(1, 65, 255, 0.4), rgba(1, 65, 255, 0));
50+
--secondary-glow: linear-gradient(
51+
to bottom right,
52+
rgba(1, 65, 255, 0),
53+
rgba(1, 65, 255, 0),
54+
rgba(1, 65, 255, 0.3)
55+
);
56+
57+
--tile-start-rgb: 2, 13, 46;
58+
--tile-end-rgb: 2, 5, 19;
59+
--tile-border: conic-gradient(
60+
#ffffff80,
61+
#ffffff40,
62+
#ffffff30,
63+
#ffffff20,
64+
#ffffff10,
65+
#ffffff10,
66+
#ffffff80
67+
);
68+
69+
--callout-rgb: 20, 20, 20;
70+
--callout-border-rgb: 108, 108, 108;
71+
--card-rgb: 100, 100, 100;
72+
--card-border-rgb: 200, 200, 200;
73+
}
74+
}
75+
76+
* {
77+
box-sizing: border-box;
78+
padding: 0;
79+
margin: 0;
80+
}
81+
82+
html,
83+
body {
84+
max-width: 100vw;
85+
overflow-x: hidden;
86+
}
87+
88+
body {
89+
color: rgb(var(--foreground-rgb));
90+
background: linear-gradient(
91+
to bottom,
92+
transparent,
93+
rgb(var(--background-end-rgb))
94+
)
95+
rgb(var(--background-start-rgb));
96+
}
97+
98+
a {
99+
color: inherit;
100+
text-decoration: none;
101+
}
102+
103+
@media (prefers-color-scheme: dark) {
104+
html {
105+
color-scheme: dark;
106+
}
107+
}

app/layout.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import type { Metadata } from "next";
2+
import { Inter } from "next/font/google";
3+
import "./globals.css";
4+
5+
const inter = Inter({ subsets: ["latin"] });
6+
7+
export const metadata: Metadata = {
8+
title: "github-readme-medium-recent-article",
9+
description:
10+
"Add Your Recently Published Medium Articles to Your GitHub Readme",
11+
};
12+
13+
export default function RootLayout({
14+
children,
15+
}: Readonly<{
16+
children: React.ReactNode;
17+
}>) {
18+
return (
19+
<html lang="en">
20+
<body className={inter.className}>{children}</body>
21+
</html>
22+
);
23+
}

app/medium/[user]/[index]/route.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { getArticle } from '../../../util/medium';
2+
import medium from '../../../assets/medium';
3+
4+
export async function GET(req: Request) {
5+
const reqURL = new URL(req.url);
6+
const headers = req.headers;
7+
var pathName = reqURL.pathname.split('/');
8+
const idx = pathName.pop(); // Get the last segment of the path
9+
const username = pathName.pop(); // Get the username
10+
11+
// @ts-ignore
12+
const { title, thumbnail, url, date, description } = await getArticle(idx, username);
13+
14+
const svgContent = medium({
15+
title,
16+
thumbnail,
17+
url,
18+
date,
19+
description,
20+
});
21+
22+
return new Response(svgContent, {
23+
headers: {
24+
'Cache-Control': 's-maxage=3600, stale-while-revalidate',
25+
'Content-Type': 'image/svg+xml',
26+
},
27+
});
28+
}

0 commit comments

Comments
 (0)