Compare commits

..

4 Commits

8 changed files with 36 additions and 47 deletions
+25 -24
View File
@@ -9,7 +9,6 @@ import (
"crypto/sha256"
"fmt"
"io"
"strings"
repo_model "git.mokoconsulting.tech/MokoConsulting/MokoGitea/models/repo"
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/log"
@@ -18,8 +17,9 @@ import (
)
// GenerateReleaseChecksums computes SHA256 checksums for all attachments
// on a release and creates a [filename].sha256 file for each one.
// on a release and adds a checksums.sha256 manifest file as an attachment.
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,19 +28,20 @@ func GenerateReleaseChecksums(ctx context.Context, rel *repo_model.Release) erro
return nil
}
// Remove existing .sha256 files
// Remove existing checksums file if present
for _, a := range rel.Attachments {
if strings.HasSuffix(a.Name, ".sha256") {
if a.Name == "checksums.sha256" {
if err := repo_model.DeleteAttachment(ctx, a, true); err != nil {
log.Warn("Failed to delete old %s: %v", a.Name, err)
log.Warn("Failed to delete old checksums.sha256: %v", err)
}
break
}
}
// Compute SHA256 for each non-checksum attachment and create individual .sha256 files
created := 0
// Compute SHA256 for each attachment
var manifest bytes.Buffer
for _, a := range rel.Attachments {
if strings.HasSuffix(a.Name, ".sha256") {
if a.Name == "checksums.sha256" {
continue
}
@@ -58,24 +59,24 @@ func GenerateReleaseChecksums(ctx context.Context, rel *repo_model.Release) erro
}
fr.Close()
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++
fmt.Fprintf(&manifest, "%x %s\n", h.Sum(nil), a.Name)
}
if created > 0 {
log.Info("Generated %d .sha256 checksum files for release %s (repo %d)", created, rel.TagName, rel.RepoID)
if manifest.Len() == 0 {
return nil
}
// 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
}
+2 -2
View File
@@ -1,12 +1,12 @@
<div class="flex-container-nav">
<div class="ui fluid vertical menu" style="text-align: left !important;">
<div class="ui fluid vertical menu">
<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-meter" 16}} {{ctx.Locale.Tr "admin.dashboard"}}
{{svg "octicon-dashboard" 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"}}
-1
View File
@@ -36,7 +36,6 @@
</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>
+3 -1
View File
@@ -35,7 +35,9 @@
{{template "custom/extra_links" .}}
<a class="item" target="_blank" href="{{HelpURL}}">{{ctx.Locale.Tr "help"}}</a>
{{if not .IsSigned}}
<a class="item" target="_blank" href="{{HelpURL}}">{{ctx.Locale.Tr "help"}}</a>
{{end}}
</div>
<!-- the full dropdown menus -->
-3
View File
@@ -1,7 +1,4 @@
<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}}
+5 -5
View File
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
SPDX-License-Identifier: GPL-3.0-or-later
VERSION: 05.14.00
VERSION: 05.05.00
-->
<updates>
@@ -87,13 +87,13 @@
<element>mokogitea</element>
<type>application</type>
<client>site</client>
<version>05.14.00</version>
<creationDate>2026-05-31</creationDate>
<version>05.05.00</version>
<creationDate>2026-05-30</creationDate>
<infourl title='MokoGitea'>https://git.mokoconsulting.tech/MokoConsulting/MokoGitea/releases/tag/stable</infourl>
<downloads>
<downloadurl type='full' format='zip'>https://git.mokoconsulting.tech/MokoConsulting/MokoGitea/releases/download/stable/mokogitea-05.14.00.zip</downloadurl>
<downloadurl type='full' format='zip'>https://git.mokoconsulting.tech/MokoConsulting/MokoGitea/releases/download/stable/mokogitea-05.05.00.zip</downloadurl>
</downloads>
<sha256>bec4bf5a1a841f8e72d9826451004db5d8afc70144231dfedc7fb01a6695955c</sha256>
<sha256>4fee9eb03e4b819a63bce2ceb54fdce0d3eb8bf5b31460fcc42e5ecd75cc856e</sha256>
<tags><tag>stable</tag></tags>
<changelogurl>https://git.mokoconsulting.tech/MokoConsulting/MokoGitea/raw/branch/main/CHANGELOG.md</changelogurl>
<maintainer>Moko Consulting</maintainer>
-4
View File
@@ -11,10 +11,6 @@
width: 240px;
}
.flex-container-nav .ui.menu .item {
text-align: left;
}
/* wide sidebar on the right, used in frontpage */
.flex-container-sidebar {
width: 35%;
+1 -7
View File
@@ -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,7 +20,6 @@ details.toggleable-item summary::-webkit-details-marker /* Safari */ {
}
details.toggleable-item summary::after {
margin-left: auto;
transition: transform 0.25s ease;
content: "";
width: 14px;
@@ -36,8 +35,3 @@ 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;
}