From 5bbbbad5f192afba603892d6b46aa53be4e71b18 Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 20 Apr 2021 10:36:55 +0200 Subject: Moved most of the page to js, added settings & removed a bunch of hardcoded stuff --- api/git.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'api/git.js') diff --git a/api/git.js b/api/git.js index 59f7371..72ca5a1 100644 --- a/api/git.js +++ b/api/git.js @@ -30,9 +30,9 @@ function execGit(path, action , format, args = "") }); } -async function getLog(path) +async function getLog(base_dir, path) { - let log = await execGit(path, "log", log_format); + let log = await execGit(`${base_dir}/${path}`, "log", log_format); if(!log["error"]) { log["data"] = log["data"].split('\n'); @@ -118,5 +118,22 @@ function getBasicRepoInfo(base_dir, repo_dirs) }); } +function getRepos(base_dir) +{ + return new Promise((resolve) => + { + fs.readdir(base_dir, async (err, content) => + { + if(err) { + resolve({ "error": err }); + return; + } + resolve({ "data": content }); + }); + }); +} + module.exports.getLog = getLog; -module.exports.getBasicRepoInfo = getBasicRepoInfo; \ No newline at end of file +module.exports.getBasicRepoInfo = getBasicRepoInfo; +module.exports.getRepos = getRepos; +module.exports.getRepoFile = getRepoFile; \ No newline at end of file -- cgit v1.2.3-18-g5258