This commit is contained in:
parent
30d3d8c8af
commit
39c6e7419b
2
api/.gitignore
vendored
2
api/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
node_modules
|
||||
package-lock.json
|
@ -1,32 +0,0 @@
|
||||
// api/getLatestCommit.js
|
||||
|
||||
import fetch from 'node-fetch';
|
||||
|
||||
export default async (req, res) => {
|
||||
const label = 'Latest Commit';
|
||||
const username = 'NatsumeLS';
|
||||
const repo = 'Gakumas-Localify-EN';
|
||||
const apiUrl = `https://api.github.com/repos/${username}/${repo}/commits?per_page=1`;
|
||||
|
||||
try {
|
||||
const response = await fetch(apiUrl);
|
||||
const data = await response.json();
|
||||
const latestCommitHash = data[0].sha.substring(0, 7);
|
||||
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.setHeader('Cache-Control', 'no-cache');
|
||||
res.status(200).json({
|
||||
schemaVersion: 1,
|
||||
label: label,
|
||||
message: latestCommitHash,
|
||||
color: 'blue'
|
||||
});
|
||||
} catch (error) {
|
||||
res.status(500).json({
|
||||
schemaVersion: 1,
|
||||
label: label,
|
||||
message: 'Error',
|
||||
color: 'red'
|
||||
});
|
||||
}
|
||||
};
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"name": "api",
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"node-fetch": "^3.3.2"
|
||||
}
|
||||
}
|
BIN
docs/logo.png
BIN
docs/logo.png
Binary file not shown.
Before Width: | Height: | Size: 168 KiB |
BIN
docs/preview.png
BIN
docs/preview.png
Binary file not shown.
Before Width: | Height: | Size: 1.5 MiB |
Loading…
x
Reference in New Issue
Block a user