mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-06-08 00:23:55 +02:00
feat(#171): supports display raw content
This commit is contained in:
@@ -20,6 +20,12 @@
|
|||||||
ng-href="{{url}}"
|
ng-href="{{url}}"
|
||||||
target="__self"
|
target="__self"
|
||||||
class="btn btn-outline-primary btn-sm"
|
class="btn btn-outline-primary btn-sm"
|
||||||
|
>View raw</a
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
ng-href="{{url}}?download=true"
|
||||||
|
target="__self"
|
||||||
|
class="btn btn-outline-primary btn-sm"
|
||||||
>Download file</a
|
>Download file</a
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
|
|||||||
+5
-3
@@ -31,9 +31,11 @@ router.get(
|
|||||||
object: f,
|
object: f,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
res.attachment(
|
if (req.query.download) {
|
||||||
anonymizedPath.substring(anonymizedPath.lastIndexOf("/") + 1)
|
res.attachment(
|
||||||
);
|
anonymizedPath.substring(anonymizedPath.lastIndexOf("/") + 1)
|
||||||
|
);
|
||||||
|
}
|
||||||
// cache the file for 5min
|
// cache the file for 5min
|
||||||
res.header("Cache-Control", "max-age=300");
|
res.header("Cache-Control", "max-age=300");
|
||||||
await Promise.all([repo.countView(), f.send(res)]);
|
await Promise.all([repo.countView(), f.send(res)]);
|
||||||
|
|||||||
+1
-1
@@ -126,7 +126,7 @@ export default async function start() {
|
|||||||
res.json({
|
res.json({
|
||||||
nbRepositories,
|
nbRepositories,
|
||||||
nbUsers: users.length,
|
nbUsers: users.length,
|
||||||
nbPageViews: nbPageViews[0].total,
|
nbPageViews: nbPageViews[0]?.total || 0,
|
||||||
nbPullRequests,
|
nbPullRequests,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user