installed gitea so i dont need this anymore
This commit is contained in:
parent
3c883aa113
commit
d23d710e9c
3 changed files with 0 additions and 49 deletions
|
@ -41,12 +41,6 @@ exports.render = (where, name) => {
|
|||
return generate(path.join(where, index).slice(path.join(__dirname, "..", "overlay").length));
|
||||
}
|
||||
|
||||
if(names.includes(".git")) {
|
||||
git = true;
|
||||
if(!comments.has(where)) comments.set(name, fs.readFileSync(path.join(where, ".git/description"), "utf8"));
|
||||
names.splice(names.indexOf(".git"), 1);
|
||||
}
|
||||
|
||||
for(let file of names) {
|
||||
try {
|
||||
const stat = fs.statSync(path.join(where, file));
|
||||
|
|
|
@ -38,13 +38,5 @@ module.exports = (app, dir, log) => {
|
|||
app.get("/private/", authorize(process.env.SECURE_USER, process.env.SECURE_PASS));
|
||||
app.all("/upload", authorize(process.env.SECURE_USER, process.env.SECURE_PASS));
|
||||
app.all("/upload/", authorize(process.env.SECURE_USER, process.env.SECURE_PASS));
|
||||
app.get("/restrict/", authorize(process.env.RESTRICT_USER, process.env.RESTRICT_PASS));
|
||||
app.get("/restrict/*", authorize(process.env.RESTRICT_USER, process.env.RESTRICT_PASS));
|
||||
|
||||
app.get("*/info/refs", (req, res, next) => {
|
||||
if(req.query.service !== "git-receive-pack") return next();
|
||||
authorize(process.env.SECURE_USER, process.env.SECURE_PASS)(req, res, next);
|
||||
});
|
||||
app.all("*/git-receive-pack", authorize(process.env.SECURE_USER, process.env.SECURE_PASS));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { spawn } = require("child_process");
|
||||
const backend = require("git-http-backend");
|
||||
const gitdirs = new Map();
|
||||
|
||||
module.exports = (app, dir, log) => {
|
||||
function handle(repo, req, res) {
|
||||
const reqStream = req.headers["content-encoding"] === "gzip" ? req.pipe(zlib.createGunzip())
|
||||
: req.headers["content-encoding"] === "deflate" ? req.pipe(zlib.createDeflate())
|
||||
: req;
|
||||
|
||||
reqStream.pipe(backend(req.url, (err, service) => {
|
||||
if(err) return res.end(err + "\n");
|
||||
res.contentType(service.type);
|
||||
|
||||
const ps = spawn(service.cmd, service.args.concat(repo));
|
||||
ps.stdout.pipe(service.createStream()).pipe(ps.stdin);
|
||||
})).pipe(res);
|
||||
}
|
||||
|
||||
app.get("*/info/refs", (req, res, next) => {
|
||||
if(!["git-upload-pack", "git-receive-pack"].includes(req.query.service)) return next();
|
||||
handle(path.join(dir, "overlay", path.normalize(req.params[0])), req, res);
|
||||
});
|
||||
|
||||
app.post("*/git-upload-pack", (req, res, next) => {
|
||||
handle(path.join(dir, "overlay", path.normalize(req.params[0])), req, res);
|
||||
});
|
||||
|
||||
app.post("*/git-receive-pack", (req, res, next) => {
|
||||
handle(path.join(dir, "overlay", path.normalize(req.params[0])), req, res);
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in a new issue