mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-06-03 06:08:03 +02:00
improve download button
This commit is contained in:
+13
-3
@@ -78,8 +78,8 @@ input,
|
|||||||
button {
|
button {
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
*:hover,
|
input:hover,
|
||||||
*:active {
|
input:active {
|
||||||
box-shadow: none !important;
|
box-shadow: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,7 +326,7 @@ a:hover {
|
|||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
.paths {
|
.status-bar {
|
||||||
background-color: var(--main-bg-color);
|
background-color: var(--main-bg-color);
|
||||||
padding: 8px 6px;
|
padding: 8px 6px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@@ -334,6 +334,15 @@ a:hover {
|
|||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.paths {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
background-color: initial;
|
||||||
|
border: none;
|
||||||
|
border-radius: 0;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
.paths a {
|
.paths a {
|
||||||
color: var(--color);
|
color: var(--color);
|
||||||
}
|
}
|
||||||
@@ -507,3 +516,4 @@ loc .lang {
|
|||||||
rgb(23 26 49) 100%
|
rgb(23 26 49) 100%
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,24 +4,29 @@
|
|||||||
<tree class="files" file="files"></tree>
|
<tree class="files" file="files"></tree>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md h-100 overflow-auto p-0 d-flex flex-column">
|
<div class="col-md h-100 overflow-auto p-0 d-flex flex-column">
|
||||||
<nav aria-label="repository menu">
|
<div class="d-flex align-content-between status-bar shadow">
|
||||||
<ol class="breadcrumb shadow paths">
|
<ol class="flex-grow-1 breadcrumb paths">
|
||||||
<li class="breadcrumb-item" ng-repeat="p in paths" ng-bind="p">
|
<li class="breadcrumb-item" ng-repeat="p in paths" ng-bind="p">
|
||||||
Loading...
|
Loading...
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
<div class="">
|
||||||
<a ng-href="{{url}}" target="__self" class="btn btn-primary"
|
<a
|
||||||
>Download file</a
|
ng-if="options.download"
|
||||||
>
|
ng-href="{{url}}"
|
||||||
|
target="__self"
|
||||||
<a
|
class="btn btn-outline-primary btn-sm"
|
||||||
ng-href="/api/repo/{{repoId}}/zip"
|
>Download file</a
|
||||||
target="__self"
|
>
|
||||||
class="btn btn-primary"
|
<a
|
||||||
>Download Repository</a
|
ng-if="options.download"
|
||||||
>
|
ng-href="/api/repo/{{repoId}}/zip"
|
||||||
</nav>
|
target="__self"
|
||||||
|
class="btn btn-outline-primary btn-sm"
|
||||||
|
>Download Repository</a
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="align-items-stretch h-100 w-100 overflow-auto">
|
<div class="align-items-stretch h-100 w-100 overflow-auto">
|
||||||
<ng-include src="'./partials/pageView.htm'"></ng-include>
|
<ng-include src="'./partials/pageView.htm'"></ng-include>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -50,12 +50,26 @@ router.get(
|
|||||||
router.get(
|
router.get(
|
||||||
"/:repoId/options",
|
"/:repoId/options",
|
||||||
async (req: express.Request, res: express.Response) => {
|
async (req: express.Request, res: express.Response) => {
|
||||||
const repo = await getRepo(req, res);
|
|
||||||
if (!repo) return;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const repo = await getRepo(req, res, { nocheck: true });
|
||||||
|
|
||||||
|
let redirectURL = null;
|
||||||
|
if (
|
||||||
|
repo.status == "expired" &&
|
||||||
|
repo.options.expirationMode == "redirect" &&
|
||||||
|
repo.source.url
|
||||||
|
) {
|
||||||
|
redirectURL = repo.source.url;
|
||||||
|
} else {
|
||||||
|
repo.check();
|
||||||
|
}
|
||||||
|
|
||||||
await repo.updateIfNeeded();
|
await repo.updateIfNeeded();
|
||||||
res.json(repo.options);
|
|
||||||
|
res.json({
|
||||||
|
url: redirectURL,
|
||||||
|
download: !!config.ENABLE_DOWNLOAD,
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
handleError(error, res);
|
handleError(error, res);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user