🚀 github contribution service cors
This commit is contained in:
@@ -5,19 +5,27 @@ container.style.fontFamily = "helvetica";
|
|||||||
document.body.appendChild(container);
|
document.body.appendChild(container);
|
||||||
|
|
||||||
for (const demo of require("./demo.json").filter(
|
for (const demo of require("./demo.json").filter(
|
||||||
(x: any) => !["index", "interactive"].includes(x)
|
(x: any) => !["index"].includes(x)
|
||||||
)) {
|
)) {
|
||||||
const title = document.createElement("h1");
|
const title = document.createElement("h1");
|
||||||
title.innerText = demo;
|
title.innerText = demo;
|
||||||
|
|
||||||
container.appendChild(title);
|
container.appendChild(title);
|
||||||
|
|
||||||
for (const g of Object.keys(grid)) {
|
if (["interactive"].includes(demo)) {
|
||||||
const a = document.createElement("a");
|
const a = document.createElement("a");
|
||||||
a.style.display = "block";
|
a.style.display = "block";
|
||||||
a.innerText = `${demo} - ${g}`;
|
a.innerText = demo;
|
||||||
a.href = `./${demo}.html?grid=${g}`;
|
a.href = `./${demo}.html`;
|
||||||
|
|
||||||
container.appendChild(a);
|
container.appendChild(a);
|
||||||
}
|
} else
|
||||||
|
for (const g of Object.keys(grid)) {
|
||||||
|
const a = document.createElement("a");
|
||||||
|
a.style.display = "block";
|
||||||
|
a.innerText = `${demo} - ${g}`;
|
||||||
|
a.href = `./${demo}.html?grid=${g}`;
|
||||||
|
|
||||||
|
container.appendChild(a);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
public
|
|
||||||
@@ -5,6 +5,8 @@ export default async (req: NowRequest, res: NowResponse) => {
|
|||||||
const { userName } = req.query;
|
const { userName } = req.query;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
res.setHeader("Access-Control-Allow-Origin", "https://platane.github.io");
|
||||||
|
res.statusCode = 200;
|
||||||
res.json(await getGithubUserContribution(userName as string));
|
res.json(await getGithubUserContribution(userName as string));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|||||||
@@ -3,10 +3,6 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@snk/github-user-contribution": "1.0.0",
|
"@snk/github-user-contribution": "1.0.0",
|
||||||
"@snk/demo": "1.0.0",
|
|
||||||
"@vercel/node": "1.8.4"
|
"@vercel/node": "1.8.4"
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"vercel-build": "( cd ../demo && yarn build ) && mv ../demo/dist public"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user