dowload package
This commit is contained in:
@@ -1067,7 +1067,13 @@ function getLocalPackageFilePath(filePath) {
|
||||
|
||||
function getDownloadFileName(packageVersion, localPath) {
|
||||
const storedName = path.basename(localPath || '');
|
||||
if (storedName) return storedName.replace(/"/g, '');
|
||||
if (storedName) {
|
||||
const uploadedName = storedName
|
||||
.replace(/"/g, '')
|
||||
.replace(/^\d+-[a-f0-9]{8}-/, '');
|
||||
|
||||
if (uploadedName) return uploadedName;
|
||||
}
|
||||
|
||||
const packageCode = String(packageVersion.packageCode || 'package').replace(/[^a-zA-Z0-9._+-]/g, '-');
|
||||
const version = String(packageVersion.version || 'latest').replace(/[^a-zA-Z0-9._:+~=-]/g, '-');
|
||||
|
||||
@@ -346,6 +346,7 @@ function mapPackageRow(row) {
|
||||
code: row.PackageCode,
|
||||
name: row.PackageName,
|
||||
type: row.PackageType,
|
||||
latestVersionId: row.LatestVersionId ? String(row.LatestVersionId) : '',
|
||||
latestVersion: row.LatestVersion || '',
|
||||
latestReleaseDate: formatDate(row.LatestReleaseDate),
|
||||
status: normalizePackageStatus(row.IsActive),
|
||||
|
||||
@@ -71,6 +71,11 @@
|
||||
<td><span class="badge <%= helpers.statusClass(version.status) %>"><%= version.status %></span></td>
|
||||
<td class="action-col">
|
||||
<div class="action-group">
|
||||
<% if (packageItem.type === 'deb' && version.filePath) { %>
|
||||
<a class="icon-button subtle" href="/api/package-versions/<%= version.id %>/download" title="Download package" aria-label="Download package version <%= version.version %>">
|
||||
<span class="material-symbols-outlined">download</span>
|
||||
</a>
|
||||
<% } %>
|
||||
<form method="post" action="/package-versions/<%= version.id %>/latest">
|
||||
<input type="hidden" name="returnTo" value="<%= currentPath %>">
|
||||
<button class="icon-button subtle" type="submit" title="Đặt latest" aria-label="Đặt latest <%= version.version %>" <%= version.status === 'Latest' ? 'disabled' : '' %>>
|
||||
|
||||
@@ -77,6 +77,11 @@
|
||||
<a class="icon-button subtle" href="/packages/<%= item.id %>" title="Xem chi tiết" aria-label="Xem chi tiết <%= item.name %>">
|
||||
<span class="material-symbols-outlined">visibility</span>
|
||||
</a>
|
||||
<% if (item.type === 'deb' && item.latestVersionId && item.artifact) { %>
|
||||
<a class="icon-button subtle" href="/api/package-versions/<%= item.latestVersionId %>/download" title="Download latest package" aria-label="Download latest package <%= item.name %>">
|
||||
<span class="material-symbols-outlined">download</span>
|
||||
</a>
|
||||
<% } %>
|
||||
<button class="icon-button subtle" type="button" title="Update version" data-modal-open="updatePackageModal" data-package-update="<%= item.id %>">
|
||||
<span class="material-symbols-outlined">upgrade</span>
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user