aboutsummaryrefslogtreecommitdiff
path: root/api/git.js
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-04-20 10:36:55 +0200
committerHampusM <hampus@hampusmat.com>2021-04-20 10:36:55 +0200
commit5bbbbad5f192afba603892d6b46aa53be4e71b18 (patch)
tree50b15dad6c3cdb66291bd2846ded505bd75cd359 /api/git.js
parent15992970bc9d3eec402f6d85e40236e3095f0fc0 (diff)
Moved most of the page to js, added settings & removed a bunch of hardcoded stuff
Diffstat (limited to 'api/git.js')
-rw-r--r--api/git.js23
1 files changed, 20 insertions, 3 deletions
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