2
0

refactor(gallery): simplify imports and string formatting
Some checks failed
Build and Release / Unit Tests (push) Successful in 3m1s
Build and Release / Create Release (push) Successful in 0s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 4m59s
Build and Release / Lint (push) Successful in 5m6s
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Successful in 2m43s
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Successful in 9h5m0s
Build and Release / Build Binaries (amd64, darwin, macos) (push) Successful in 8m59s
Build and Release / Build Binaries (arm64, darwin, macos) (push) Has been cancelled
Build and Release / Build Binary (linux/arm64) (push) Has been cancelled

Replace fmt.Sprintf with string concatenation for simple commit messages and consolidate JSON imports to use shared module.

- Use string concatenation instead of fmt.Sprintf for commit messages
- Move json import to shared modules/json package
- Remove unused fmt and encoding/json imports
This commit is contained in:
2026-01-19 22:57:09 -05:00
parent 8494306486
commit 27fb680a15
4 changed files with 13 additions and 14 deletions

View File

@@ -1,8 +0,0 @@
{
"id": "note-1768875333549-sft9y7mew",
"title": "working",
"content": "> a few bugs we need to address. 1. when I save a License in the Org Settings - it is\nautomatically making a README in the .profile. It should not do that. 2. THe Repos link in the\nRepo Header (the tab) should link to the Org repositories NOT the Overview page. 3. THe Move File\nto vault - I see the following tags and not text repo.editor.commit_message, repo.file 4. When I\nclick Move to Vault - it takes me to the file viewer but it is not moved to the vault. 5. on the\nvault/secrets/new - remove the Back to List - we already have a cancel button. 6. THe New Secret\nbutton in the header of /vault should be right aligned. 7. No Secrets\nThis repository doesn't have any secrets stored yet. is still not centered\n\n \"repo.file\": \"File\",\n \"repo.file_size\": \"File size\",\n \"repo.file_raw\": \"Raw\",\n \"repo.editor.commit_message\": \"Commit message\",\n \"repo.settings.license_scan\": \"Scan\",\n \"repo.settings.license_detected\": \"License detected\",\n \"repo.settings.license_not_found\": \"No license file detected in repository.\",\n \"org.settings.license_saved\": \"License updated successfully.\",\n \"org.settings.license_cleared\": \"License has been cleared.\",\n \"org.settings.license_error\": \"Failed to update license.\",",
"createdAt": 1768875333547,
"updatedAt": 1768877911515,
"tags": []
}

View File

@@ -0,0 +1,8 @@
{
"id": "note-1768881142114-zwzrej9gc",
"title": "Release Notes for Gallery",
"content": " New Feature: Repository Home Page Tabs\n\n The repository home page now features a tabbed interface replacing the single README display. When content is available, users will see tabs for:\n\n - Readme - Displays the README file (default tab, existing behavior)\n - License - Displays the LICENSE file content\n - Gallery - Displays project screenshots from the .gallery folder\n\n Tabs only appear when the corresponding content exists in the repository.\n\n ---\n New Feature: Repository Gallery\n\n Developers can now showcase screenshots and images of their applications directly on the repository home page.\n\n Gallery Tab Features:\n - Responsive image grid layout\n - Lightbox viewer for full-size images with keyboard navigation (← →)\n - Custom captions for each image\n - Lazy loading for better performance\n\n Gallery Settings Page (Repository > Settings > Gallery):\n - Upload images (PNG, JPG, JPEG, GIF, WebP, SVG, BMP, ICO)\n - 5MB maximum file size per image\n - Add/edit captions for each image\n - Delete images with confirmation\n\n Storage:\n - Images are stored in the .gallery folder at the repository root\n - Captions are stored in .gallery/gallery.json\n - All changes are committed to the repository automatically\n\n ---\n Localization\n\n Full translations added for gallery-related strings in 20+ languages:\n - English, German, French, Spanish, Italian, Dutch, Polish\n - Portuguese (Brazil & Portugal)\n - Russian, Ukrainian, Turkish, Czech, Greek, Hungarian\n - Finnish, Swedish\n - Japanese, Korean, Chinese (Simplified & Traditional)",
"createdAt": 1768881142111,
"updatedAt": 1768881147863,
"tags": []
}

View File

@@ -5,8 +5,6 @@ package setting
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"path"
@@ -14,6 +12,7 @@ import (
"code.gitcaddy.com/server/v3/modules/git"
"code.gitcaddy.com/server/v3/modules/gitrepo"
"code.gitcaddy.com/server/v3/modules/json"
"code.gitcaddy.com/server/v3/modules/log"
"code.gitcaddy.com/server/v3/modules/templates"
"code.gitcaddy.com/server/v3/modules/typesniffer"
@@ -183,7 +182,7 @@ func GalleryUpload(ctx *context.Context) {
// Create/update file in repo
opts := &files_service.ChangeRepoFilesOptions{
Message: fmt.Sprintf("Add gallery image: %s", filename),
Message: "Add gallery image: " + filename,
OldBranch: repo.DefaultBranch,
NewBranch: repo.DefaultBranch,
Files: []*files_service.ChangeRepoFile{
@@ -273,7 +272,7 @@ func GalleryCaption(ctx *context.Context) {
}
opts := &files_service.ChangeRepoFilesOptions{
Message: fmt.Sprintf("Update gallery caption: %s", filename),
Message: "Update gallery caption: " + filename,
OldBranch: repo.DefaultBranch,
NewBranch: repo.DefaultBranch,
Files: []*files_service.ChangeRepoFile{
@@ -312,7 +311,7 @@ func GalleryDelete(ctx *context.Context) {
// Delete file from repo
opts := &files_service.ChangeRepoFilesOptions{
Message: fmt.Sprintf("Delete gallery image: %s", filename),
Message: "Delete gallery image: " + filename,
OldBranch: repo.DefaultBranch,
NewBranch: repo.DefaultBranch,
Files: []*files_service.ChangeRepoFile{

View File

@@ -4,7 +4,6 @@
package repo
import (
"encoding/json"
"errors"
"fmt"
"net/http"
@@ -22,6 +21,7 @@ import (
"code.gitcaddy.com/server/v3/modules/gitrepo"
"code.gitcaddy.com/server/v3/modules/htmlutil"
"code.gitcaddy.com/server/v3/modules/httplib"
"code.gitcaddy.com/server/v3/modules/json"
"code.gitcaddy.com/server/v3/modules/log"
"code.gitcaddy.com/server/v3/modules/plugins"
repo_module "code.gitcaddy.com/server/v3/modules/repository"