chore: Update .gitignore and add get-latest-commit API endpoint
This commit is contained in:
parent
799ce9ae08
commit
a5e85b7645
18
.gitignore
vendored
18
.gitignore
vendored
@ -1,21 +1,7 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
||||
/.gradle
|
||||
/.idea
|
||||
/.vs
|
||||
/app/.cxx
|
||||
/app/build
|
||||
/app/debug
|
||||
/app/release
|
||||
/local.properties
|
||||
|
2
api/.gitignore
vendored
Normal file
2
api/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
package-lock.json
|
19
api/get-latest-commit/main.js
Normal file
19
api/get-latest-commit/main.js
Normal file
@ -0,0 +1,19 @@
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
module.exports = async (req, res) => {
|
||||
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;
|
||||
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.setHeader('Cache-Control', 'no-cache');
|
||||
res.status(200).json({ hash: latestCommitHash });
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to fetch latest commit hash' });
|
||||
}
|
||||
};
|
7
api/get-latest-commit/package.json
Normal file
7
api/get-latest-commit/package.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "get-latest-commit",
|
||||
"main": "main.js",
|
||||
"dependencies": {
|
||||
"node-fetch": "^3.3.2"
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user