get matching repos
commit
d169a6c2b4
@ -0,0 +1,25 @@
|
||||
const express = require('express');
|
||||
const rest = require('superagent');
|
||||
|
||||
const giteaHost = 'git.adb.sh';
|
||||
|
||||
const app = express();
|
||||
app.get('/', function (req, res) {
|
||||
res.send('Hello World');
|
||||
});
|
||||
|
||||
app.listen(3000);
|
||||
|
||||
let updateRepos = setInterval(()=>{
|
||||
rest.get('https://git.adb.sh/api/v1/repos/search?q=git.adb.sh').then(res=>{
|
||||
console.log(res.text);
|
||||
let content = JSON.parse(res.text);
|
||||
content.data.forEach(repo=>{
|
||||
if (!repo.name.match(/^(.*).git.adb.sh/)) return; //matches domain?
|
||||
let namePattern = new RegExp(`^(.*.)|()${repo.owner.username}.${giteaHost}`);
|
||||
if (!repo.name.match(namePattern)) return; //matches owner?
|
||||
console.log(`found => ${repo.owner.username}.${giteaHost}`)
|
||||
|
||||
});
|
||||
}).catch(console.error);
|
||||
},1000);
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "gitea-repo-host",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"express": "^4.17.1",
|
||||
"superagent": "^6.1.0"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue