Skip to content

Conversation

@pieer
Copy link
Collaborator

@pieer pieer commented Oct 7, 2025

First version of the custom version of gitea to implement Forkana needs

Add custom homepage + search page + graph view + table view

To build from source, the following programs must be present on the system:

go 1.25 or higher, see here
node 22 or higher with npm, see here
make, see here

Use pnpm to install all the dependencies

Add this file into you folder gitea/custom/conf/app.ini

WORK_PATH = /Users/{YOUR PATH}/Sites/forkana

[server]
PROTOCOL = http
DOMAIN = localhost
HTTP_PORT = 3000
ROOT_URL = http://localhost:3000/
RUN_MODE = dev
; LANDING_PAGE = explore

[database]
DB_TYPE = sqlite3
PATH = data/gitea.db

[security]
INSTALL_LOCK = true
SECRET_KEY = changeme
INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE3NTY3NDU2NjZ9.luRdwGyyCdO0dyjghYinzVgC7Uu8JXTlst2HkrjE80k

[oauth2]
JWT_SECRET = 9l225INhfQSZkuiCA1bu3rDvR3TDf6DckPy0m3qAGmE

[ui]
DEFAULT_THEME = gitea-light
EXPLORE_PAGING_DEFAULT_SORT = alphabetically

To build the project:
TAGS="bindata sqlite sqlite_unlock_notify" make build

To run the project:
TAGS="sqlite sqlite_unlock_notify" make watch

lynxplay and others added 30 commits September 17, 2025 12:26
Commit 6a97ab0 reworked team permission
application. The introduced logic overrode the unitModes for *every*
team a user is in, max(...) the current value and the team value
together.

The logic completely fails in case the team does not have a unit for the
specific unit type defined, in which case the logic inserted the
minimumVisibility, overriding any previous aggregation of access modes
for the unit.

This is resolved by simply always merging the unit access mode of the
team as it will simply default to None in case the team does not have a
permission defined for the unit, which will be swallowed by the max(..)
call in favour of the previous aggregated permission.
- Remove `minimatch`, was inadvertently re-introduced in
go-gitea#35482
- Remove `postcss-nesting`, originally introduced in
go-gitea#29746 to support some fork, but
I'm now of the opinion we should not ship dependencies that we don't use
ourselves.
- Remove `eslint-plugin-no-jquery`, plugin is currently disabled because
of compat issues with eslint 9
(wikimedia/eslint-plugin-no-jquery#311)
Initial implementation of linked proposal.

* Closes go-gitea#29942
* Fix go-gitea#34003
* Fix go-gitea#30443

---------

Co-authored-by: silverwind <[email protected]>
Co-authored-by: wxiaoguang <[email protected]>
…epository (go-gitea#35511)

Extracted from go-gitea#35077
`UpdateRef` and `RemoveRef` will call git commands even for gogit
version.
…ea#34316)

This pull request updates the handling of issue label events in
workflows to distinguish between label additions and deletions,
introduces corresponding test cases, and extends the `IssuePayload`
structure to support this functionality.

### Enhancements to issue label event handling:
* Updated `matchIssuesEvent` in `modules/actions/workflows.go` to
differentiate between "labeled" and "unlabeled" events based on whether
labels were added or removed.
* Added a new field, `RemovedLabels`, to the `IssuePayload` struct in
`modules/structs/hook.go` to track labels that were removed during an
issue event.

### Testing improvements:
* Added `TestMatchIssuesEvent` in `modules/actions/workflows_test.go` to
cover scenarios such as label addition, label deletion, and label
clearing, ensuring the correct event type is triggered.

---------

Co-authored-by: Lunny Xiao <[email protected]>
pieer and others added 26 commits October 27, 2025 16:05
…bbleNode

Replace inefficient SVG text rendering with HTML elements using foreignObject:
- Replaced SVG <text> elements with HTML div/span elements
- All text and button now rendered in 'html-label-wrapper' div
- Text and button maintain constant size during zoom (inverse scaling preserved)
- HTML elements visibility adapts based on available bubble space
- Same recomputeFit logic determines what to show based on screen radius
- View button converted from SVG rect/text to native HTML button
- Improved performance and text rendering quality
- Better browser text rendering and antialiasing
- More maintainable and accessible button implementation

Benefits:
- Better text rendering quality across browsers
- Improved performance (HTML vs SVG text)
- Native button behavior and accessibility
- Consistent sizing independent of zoom level
- Dynamic content visibility based on available space
- Reduced button size with specific padding (0.5rem L/R, 0.38rem T/B)
- Changed font-size from 20px to 14px
- Positioned button 1.5rem (24px) below copy instead of at bubble edge
- Removed fixed width/height in favor of auto-sizing with padding
- Changed display to inline-flex for proper auto-width
- Reduced border-radius to 0.375rem for subtler appearance
- Button and copy remain centered in bubble
The issue was that explicit pixel dimensions on html-label-wrapper
prevented proper flexbox centering. By using height: 100% and width: 100%,
the wrapper now fills the foreignObject naturally, allowing the flexbox
justify-content and align-items to properly center the content vertically
and horizontally.

This works because:
- foreignObject is properly sized in world coordinates (r*2)
- scale(1/k) transform maintains screen pixel consistency
- 100% sizing makes wrapper fill the available space
- Flexbox can now properly center content within that space
With the new percentage-based sizing and flexbox centering approach,
the vertical shift adjustment (shiftPx) is no longer needed. The
flexbox justify-content: center handles all vertical centering
automatically.
Changes:
- Date now formatted as yyyy-mm-dd instead of raw ISO format
- When enough space is available, show count and label on same line
  (e.g., "123 Contributors") with larger 1.375rem (22px) font
- Falls back to stacked layout when space is limited
- Added FONT_SIZE_COMBINED constant for the combined layout
- Added showCombined flag to track which layout to use
- Updated recomputeFit logic to calculate space for combined layout
- Combined layout prioritized over stacked for better readability
- Add accessibility improvements to FishboneGraph and BubbleNode components
- Replace magic numbers with documented constants
- Add loading, error, and empty states to graph
- Improve keyboard navigation and screen reader support
- Update colors and visual styling
- Enhance UX across multiple components
- Various bug fixes and improvements

Squashed 23 commits for cleaner history after rebasing onto forkana/dev
Replace custom RepoAssignmentByName middleware with Gitea's standard RepoAssignment middleware.

* Change route to /explore/articles/history/{username}/{reponame}
* Fixes security issue with ambiguous repository lookup

Fixes okTurtles/issues/8
* Resolves inconsistent URL generation where backend Link() function used repository names while frontend templates expected subject names, causing broken links on subject-based routes.
* Modifies Repository.Link() to use GetSubject() instead of Name
* Enhances RepoAssignment middleware for dual URL support
* Updates custom templates to use .GetSubject consistently
* This ensures routes like /article/{owner}/{subject} receive correct subject names in URLs, preventing 404 errors while maintaining backward compatibility with existing repository name URLs.
* Efficiently loads all subjects in a single database query
* Only loads subjects that haven't been loaded yet
* Uses a map for O(1) lookup when assigning subjects to repositories

Fixes okTurtles/issues/47
* Refactor the GetSubject() method to automatically load the subject relation when needed, eliminating silent failures when SubjectRelation is not pre-loaded.
* Fix template rendering errors after GetSubject() refactoring: templates were calling .GetSubject without the required context.Context parameter.

Fixes okTurtles/issues/18
* Replace loop-based INSERT pattern with a single bulk INSERT...SELECT statement to eliminate N+1 query overhead.
* Added comprehensive test suite

Fixes okTurtles/issues/29
* Create new error type ErrRepoWithSubjectNotExist to distinguish between subject lookup failures and repository-by-subject lookup failures.

Fixes okTurtles/issues/22
* Replace inefficient O(n*m) for loop with O(n) regex-based replacement for collapsing consecutive hyphens.
* The new implementation uses a pre-compiled regex pattern (-{2,}) stored in globalVars, matching the existing pattern for other regex operations in the file. This reduces time complexity from O(n*m) to O(n) where n is string length and m is the number of consecutive hyphens.

Fixes okTurtles/issues/19
* Replaces string-matching error detection with robust database-specific error code checking
* Creates IsErrDuplicateKey() utility function that uses database driver error types instead of parsing error messages
* Splits SQLite error handling into separate files with build tags to prevent build failures when SQLite support is not enabled

Fixes okTurtles/issues/20
* The subject table migration was incorrectly using `UNIQUE INDEX` instead of a proper `UNIQUE` constraint on the `name` column. This has been corrected to use the standard XORM `UNIQUE` tag, which generates the appropriate database constraint.

Fixes okTurtles/issues/30
* Refactor searchRepositoryByCondition to reuse the same database session for both count and main queries, instead of creating a new session via db.GetEngine(ctx) for the count.
* The count query is now performed before adding JOINs to the session, since JOINs are only needed for ordering by subject fields, not for counting repositories.

Fixes okTurtles/issues/27
* Applied input validation to SearchRepositoryCondition to prevent denial-of-service attacks through malicious search queries. The existing validation constants (maxSearchKeywordLength=500, maxSearchKeywords=10, maxIndividualKeywordLength=100) were only being enforced in buildRelevanceScoreSQL but not in the main search query construction.

Fixes okTurtles/issues/25
Replace blur event with input event for auto-generation reset to provide
more responsive user experience. The repository name now automatically
regenerates from the subject immediately when the user clears the input
field, instead of requiring them to click outside the field.

- Consolidate auto-generation logic into the input event handler
- Remove blur event listener (no longer needed)
- Use !!inputRepoName.value.trim() to track user edits more accurately

Fixes #26
Improve frontend performance by adding throttling (debouncing) and caching
to all search components to reduce unnecessary API calls.

Changes:
- Add 300ms throttle to prevent excessive API calls during rapid typing
- Enable caching to store and reuse results for identical queries
- Apply improvements to repository, user, and team search components

Performance benefits:
- Reduces server load by minimizing redundant API requests
- Improves user experience with faster perceived response times
- Maintains data freshness while optimizing network usage

Fixes #17
Remove duplicate autofocus attribute to comply with HTML specifications.
Only the repo_name field (first input) now has autofocus, ensuring
consistent behavior across all browsers.

Changes:
- Add autofocus to repo_name input field
- Remove autofocus from subject input field

According to HTML spec, only one element in a document should have the
autofocus attribute. Having multiple autofocus attributes leads to
undefined behavior and inconsistent user experience.

Fixes #24
* Improves performance (3N to ~4 queries) by batch loading all owners, licenses and subjects

Fixes okTurtles/issues/15
* models/activities/action.go - Update to use the repository's built-in URL generation methods instead of manually constructing URLs
* modules/httplib/url.go - Handle /article/ prefix in URL parsing
* models/repo/repo.go - Use subject names in metas
* modules/markup/html_commit.go - Add /article/ prefix to commit URLs
* modules/markup/html_issue.go - Add /article/ prefix to issue URLs
* routers/common/qos.go - Set CurrentURL in service unavailable page
* models/renderhelper/main_test.go - Import repo models
* services/markup/main_test.go - Import repo models
* all test files - Update expected URL paths
* modules/markup - Update commitPath, cross-reference, baseURL construction, pull request and issue references
* modules/markup/markdown - Update commit URL expectation
* modules/repository - Update all commit URL expectations
* modules/templates - Update issue reference URLs
* routers/api/v1/misc - Update context paths and split wiki test cases
@socket-security
Copy link

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​toast-ui/​editor@​3.2.210010010080100

View full report

@pedrogaudencio pedrogaudencio self-assigned this Nov 4, 2025
Copy link
Member

@taoeffect taoeffect left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved! Congrats @pieer and @pedrogaudencio!! 🥳🎉🎉

Great job!

@taoeffect taoeffect merged commit 1be1e8c into okTurtles:master Nov 4, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants