Compare commits
19 Commits
rc/05.03.01
..
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| c7193abc0c | |||
| e6a4dfccf0 | |||
| a5c805b0f6 | |||
| 46ce0a7e32 | |||
| c236c4e018 | |||
| b79b48b760 | |||
| 22a529dfd8 | |||
| 09dc64eef0 | |||
| d541a07263 | |||
| 2eee4bbf1c | |||
| 2dea95a431 | |||
| f69212859a | |||
| 3828411311 | |||
| 447a45ec15 | |||
| f19fd9683f | |||
| 039ab896cc | |||
| 65660863d6 | |||
| 198ae92579 | |||
| bc4eae2e0f |
@@ -9,6 +9,7 @@ import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
repo_model "git.mokoconsulting.tech/MokoConsulting/MokoGitea/models/repo"
|
||||
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/log"
|
||||
@@ -17,9 +18,8 @@ import (
|
||||
)
|
||||
|
||||
// GenerateReleaseChecksums computes SHA256 checksums for all attachments
|
||||
// on a release and adds a checksums.sha256 manifest file as an attachment.
|
||||
// on a release and creates a [filename].sha256 file for each one.
|
||||
func GenerateReleaseChecksums(ctx context.Context, rel *repo_model.Release) error {
|
||||
// Load attachments into rel.Attachments
|
||||
if err := repo_model.GetReleaseAttachments(ctx, rel); err != nil {
|
||||
return fmt.Errorf("GetReleaseAttachments: %w", err)
|
||||
}
|
||||
@@ -28,20 +28,19 @@ func GenerateReleaseChecksums(ctx context.Context, rel *repo_model.Release) erro
|
||||
return nil
|
||||
}
|
||||
|
||||
// Remove existing checksums file if present
|
||||
// Remove existing .sha256 files
|
||||
for _, a := range rel.Attachments {
|
||||
if a.Name == "checksums.sha256" {
|
||||
if strings.HasSuffix(a.Name, ".sha256") {
|
||||
if err := repo_model.DeleteAttachment(ctx, a, true); err != nil {
|
||||
log.Warn("Failed to delete old checksums.sha256: %v", err)
|
||||
log.Warn("Failed to delete old %s: %v", a.Name, err)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Compute SHA256 for each attachment
|
||||
var manifest bytes.Buffer
|
||||
// Compute SHA256 for each non-checksum attachment and create individual .sha256 files
|
||||
created := 0
|
||||
for _, a := range rel.Attachments {
|
||||
if a.Name == "checksums.sha256" {
|
||||
if strings.HasSuffix(a.Name, ".sha256") {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -59,24 +58,24 @@ func GenerateReleaseChecksums(ctx context.Context, rel *repo_model.Release) erro
|
||||
}
|
||||
fr.Close()
|
||||
|
||||
fmt.Fprintf(&manifest, "%x %s\n", h.Sum(nil), a.Name)
|
||||
checksumContent := fmt.Sprintf("%x %s\n", h.Sum(nil), a.Name)
|
||||
checksumReader := bytes.NewBufferString(checksumContent)
|
||||
|
||||
checksumAttach := &repo_model.Attachment{
|
||||
RepoID: rel.RepoID,
|
||||
ReleaseID: rel.ID,
|
||||
Name: a.Name + ".sha256",
|
||||
}
|
||||
|
||||
if _, err := attachment_service.NewAttachment(ctx, checksumAttach, checksumReader, int64(len(checksumContent))); err != nil {
|
||||
log.Warn("Failed to create %s: %v", checksumAttach.Name, err)
|
||||
continue
|
||||
}
|
||||
created++
|
||||
}
|
||||
|
||||
if manifest.Len() == 0 {
|
||||
return nil
|
||||
if created > 0 {
|
||||
log.Info("Generated %d .sha256 checksum files for release %s (repo %d)", created, rel.TagName, rel.RepoID)
|
||||
}
|
||||
|
||||
// Create the checksums.sha256 attachment
|
||||
checksumAttach := &repo_model.Attachment{
|
||||
RepoID: rel.RepoID,
|
||||
ReleaseID: rel.ID,
|
||||
Name: "checksums.sha256",
|
||||
}
|
||||
|
||||
if _, err := attachment_service.NewAttachment(ctx, checksumAttach, &manifest, int64(manifest.Len())); err != nil {
|
||||
return fmt.Errorf("create checksums.sha256 attachment: %w", err)
|
||||
}
|
||||
|
||||
log.Info("Generated checksums.sha256 for release %s (repo %d)", rel.TagName, rel.RepoID)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<div class="flex-container-nav">
|
||||
<div class="ui fluid vertical menu">
|
||||
<div class="ui fluid vertical menu" style="text-align: left !important;">
|
||||
<div class="header item">{{ctx.Locale.Tr "admin.settings"}}</div>
|
||||
|
||||
<details class="item toggleable-item" {{if or .PageIsAdminDashboard .PageIsAdminSelfCheck}}open{{end}}>
|
||||
<summary>{{svg "octicon-tools" 16}} {{ctx.Locale.Tr "admin.maintenance"}}</summary>
|
||||
<div class="menu">
|
||||
<a class="{{if .PageIsAdminDashboard}}active {{end}}item" href="{{AppSubUrl}}/-/admin">
|
||||
{{svg "octicon-dashboard" 16}} {{ctx.Locale.Tr "admin.dashboard"}}
|
||||
{{svg "octicon-meter" 16}} {{ctx.Locale.Tr "admin.dashboard"}}
|
||||
</a>
|
||||
<a class="{{if .PageIsAdminSelfCheck}}active {{end}}item" href="{{AppSubUrl}}/-/admin/self_check">
|
||||
{{svg "octicon-check-circle" 16}} {{ctx.Locale.Tr "admin.self_check"}}
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
</div>
|
||||
<a href="{{AssetUrlPrefix}}/licenses.txt">{{ctx.Locale.Tr "licenses"}}</a>
|
||||
{{if .EnableSwagger}}<a href="{{AppSubUrl}}/api/swagger">API</a>{{end}}
|
||||
<a href="{{HelpURL}}" target="_blank">{{ctx.Locale.Tr "help"}}</a>
|
||||
{{template "custom/extra_links_footer" .}}
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -35,9 +35,7 @@
|
||||
|
||||
{{template "custom/extra_links" .}}
|
||||
|
||||
{{if not .IsSigned}}
|
||||
<a class="item" target="_blank" href="{{HelpURL}}">{{ctx.Locale.Tr "help"}}</a>
|
||||
{{end}}
|
||||
<a class="item" target="_blank" href="{{HelpURL}}">{{ctx.Locale.Tr "help"}}</a>
|
||||
</div>
|
||||
|
||||
<!-- the full dropdown menus -->
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<div class="ui container fluid">
|
||||
<div class="tw-text-center tw-mb-4">
|
||||
<img src="{{AssetUrlPrefix}}/img/login-logo.png" style="max-width: 220px; max-height: 80px; object-fit: contain;" onerror="this.style.display='none'">
|
||||
</div>
|
||||
{{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn)}}
|
||||
{{template "base/alert" .}}
|
||||
{{end}}
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
width: 240px;
|
||||
}
|
||||
|
||||
.flex-container-nav .ui.menu .item {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* wide sidebar on the right, used in frontpage */
|
||||
.flex-container-sidebar {
|
||||
width: 35%;
|
||||
|
||||
@@ -9,8 +9,8 @@ details.toggleable-item .menu {
|
||||
|
||||
details.toggleable-item summary {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 0.5em;
|
||||
padding: 0.92857143em 1.14285714em;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ details.toggleable-item summary::-webkit-details-marker /* Safari */ {
|
||||
}
|
||||
|
||||
details.toggleable-item summary::after {
|
||||
margin-left: auto;
|
||||
transition: transform 0.25s ease;
|
||||
content: "";
|
||||
width: 14px;
|
||||
@@ -35,3 +36,8 @@ details.toggleable-item summary::after {
|
||||
details.toggleable-item[open] summary::after {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.flex-container-nav .ui.menu .item {
|
||||
text-align: left !important;
|
||||
justify-content: flex-start !important;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user