You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

setting.go 51 kB

11 years ago
11 years ago
11 years ago
11 years ago
Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
9 years ago
11 years ago
11 years ago
11 years ago
11 years ago
Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
9 years ago
11 years ago
Feature: Timetracking (#2211) * Added comment's hashtag to url for mail notifications. * Added explanation to return statement + documentation. * Replacing in-line link generation with HTMLURL. (+gofmt) * Replaced action-based model with nil-based model. (+gofmt) * Replaced mailIssueActionToParticipants with mailIssueCommentToParticipants. * Updating comment for mailIssueCommentToParticipants * Added link to comment in "Dashboard" * Deleting feed entry if a comment is going to be deleted * Added migration * Added improved migration to add a CommentID column to action. * Added improved links to comments in feed entries. * Fixes #1956 by filtering for deleted comments that are referenced in actions. * Introducing "IsDeleted" column to action. * Adding design draft (not functional) * Adding database models for stopwatches and trackedtimes * See go-gitea/gitea#967 * Adding design draft (not functional) * Adding translations and improving design * Implementing stopwatch (for timetracking) * Make UI functional * Add hints in timeline for time tracking events * Implementing timetracking feature * Adding "Add time manual" option * Improved stopwatch * Created report of total spent time by user * Only showing total time spent if theire is something to show. * Adding license headers. * Improved error handling for "Add Time Manual" * Adding @sapks 's changes, refactoring * Adding API for feature tracking * Adding unit test * Adding DISABLE/ENABLE option to Repository settings page * Improving translations * Applying @sapk 's changes * Removing repo_unit and using IssuesSetting for disabling/enabling timetracker * Adding DEFAULT_ENABLE_TIMETRACKER to config, installation and admin menu * Improving documentation * Fixing vendor/ folder * Changing timtracking routes by adding subgroups /times and /times/stopwatch (Proposed by @lafriks ) * Restricting write access to timetracking based on the repo settings (Proposed by @lafriks ) * Fixed minor permissions bug. * Adding CanUseTimetracker and IsTimetrackerEnabled in ctx.Repo * Allow assignees and authors to track there time too. * Fixed some build-time-errors + logical errors. * Removing unused Get...ByID functions * Moving IsTimetrackerEnabled from context.Repository to models.Repository * Adding a seperate file for issue related repo functions * Adding license headers * Fixed GetUserByParams return 404 * Moving /users/:username/times to /repos/:username/:reponame/times/:username for security reasons * Adding /repos/:username/times to get all tracked times of the repo * Updating sdk-dependency * Updating swagger.v1.json * Adding warning if user has already a running stopwatch (auto-timetracker) * Replacing GetTrackedTimesBy... with GetTrackedTimes(options FindTrackedTimesOptions) * Changing code.gitea.io/sdk back to code.gitea.io/sdk * Correcting spelling mistake * Updating vendor.json * Changing GET stopwatch/toggle to POST stopwatch/toggle * Changing GET stopwatch/cancel to POST stopwatch/cancel * Added migration for stopwatches/timetracking * Fixed some access bugs for read-only users * Added default allow only contributors to track time value to config * Fixed migration by chaging x.Iterate to x.Find * Resorted imports * Moved Add Time Manually form to repo_form.go * Removed "Seconds" field from Add Time Manually * Resorted imports * Improved permission checking * Fixed some bugs * Added integration test * gofmt * Adding integration test by @lafriks * Added created_unix to comment fixtures * Using last event instead of a fixed event * Adding another integration test by @lafriks * Fixing bug Timetracker enabled causing error 500 at sidebar.tpl * Fixed a refactoring bug that resulted in hiding "HasUserStopwatch" warning. * Returning TrackedTime instead of AddTimeOption at AddTime. * Updating SDK from go-gitea/go-sdk#69 * Resetting Go-SDK back to default repository * Fixing test-vendor by changing ini back to original repository * Adding "tags" to swagger spec * govendor sync * Removed duplicate * Formatting templates * Adding IsTimetrackingEnabled checks to API * Improving translations / english texts * Improving documentation * Updating swagger spec * Fixing integration test caused be translation-changes * Removed encoding issues in local_en-US.ini. * "Added" copyright line * Moved unit.IssuesConfig().EnableTimetracker into a != nil check * Removed some other encoding issues in local_en-US.ini * Improved javascript by checking if data-context exists * Replaced manual comment creation with CreateComment * Removed unnecessary code * Improved error checking * Small cosmetic changes * Replaced int>string>duration parsing with int>duration parsing * Fixed encoding issues * Removed unused imports Signed-off-by: Jonas Franz <info@jonasfranz.software>
8 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
9 years ago
Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
9 years ago
11 years ago
11 years ago
10 years ago
11 years ago
Pull request review/approval and comment on code (#3748) * Initial ui components for pull request review * Add Review Add IssueComment types Signed-off-by: Jonas Franz <info@jonasfranz.software> (cherry picked from commit 2b4daab) Signed-off-by: Jonas Franz <info@jonasfranz.software> * Replace ReviewComment with Content Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add load functions Add ReviewID to findComments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add create review comment implementation Add migration for review Other small changes Signed-off-by: Jonas Franz <info@jonasfranz.software> * Simplified create and find functions for review Signed-off-by: Jonas Franz <info@jonasfranz.software> * Moved "Pending" to first position Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add GetCurrentReview to simplify fetching current review Signed-off-by: Jonas Franz <info@jonasfranz.software> * Preview for listing comments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Move new comment form to its own file Signed-off-by: Jonas Franz <info@jonasfranz.software> * Implement Review form Show Review comments on comment stream Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add support for single comments Showing buttons in context Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add pending tag to pending review comments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add unit tests for Review Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fetch all review ids at once Add unit tests Signed-off-by: Jonas Franz <info@jonasfranz.software> * gofmt Signed-off-by: Jonas Franz <info@jonasfranz.software> * Improved comment rendering in "Files" view by adding Comments to DiffLine Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add support for invalidating comments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Switched back to code.gitea.io/git Signed-off-by: Jonas Franz <info@jonasfranz.software> * Moved review migration from v64 to v65 Signed-off-by: Jonas Franz <info@jonasfranz.software> * Rebuild css Signed-off-by: Jonas Franz <info@jonasfranz.software> * gofmt Signed-off-by: Jonas Franz <info@jonasfranz.software> * Improve translations Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix unit tests by updating fixtures and updating outdated test Signed-off-by: Jonas Franz <info@jonasfranz.software> * Comments will be shown at the right place now Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add support for deleting CodeComments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix problems caused by files in subdirectories Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add support for showing code comments of reviews in conversation Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add support for "Show/Hide outdated" Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update code.gitea.io/git Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add support for new webhooks Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update comparison Signed-off-by: Jonas Franz <info@jonasfranz.software> * Resolve conflicts Signed-off-by: Jonas Franz <info@jonasfranz.software> * Minor UI improvements * update code.gitea.io/git * Fix ui bug reported by @lunny causing wrong position of add button Add functionality to "Cancel" button Add scale effects to add button Hide "Cancel" button for existing comments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Prepare solving conflicts Signed-off-by: Jonas Franz <info@jonasfranz.software> * Show add button only if no comments already exist for the line Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add missing vendor files Signed-off-by: Jonas Franz <info@jonasfranz.software> * Check if reviewer is nil Signed-off-by: Jonas Franz <info@jonasfranz.software> * Show forms only to users who are logged in Signed-off-by: Jonas Franz <info@jonasfranz.software> * Revert "Show forms only to users who are logged in" This reverts commit c083682 Signed-off-by: Jonas Franz <info@jonasfranz.software> * Save patch in comment Render patch for code comments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add link to comment in code Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add reply form to comment list Show forms only to signed in users Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add 'Reply' as translatable Add CODE_COMMENT_LINES setting Signed-off-by: Jonas Franz <info@jonasfranz.software> * gofmt Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix problems introduced by checking for singed in user Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add v70 Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update generated stylesheet Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix preview Beginn with new review comment patch system Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add new algo to generate diff for line range Remove old algo used for cutting big diffs (it was very buggy) * Add documentation and example for CutDiffAroundLine * Fix example of CutDiffAroundLine * Fix some comment UI rendering bugs * Add code comment edit mode * Send notifications / actions to users until review gets published Fix diff generation bug Fix wrong hashtag * Fix vet errors * Send notifications also for single comments * Fix some notification bugs, fix link * Fix: add comment icon is only shown on code lines * Add lint comment * Add unit tests for git diff * Add more error messages * Regenerated css Signed-off-by: Jonas Franz <info@jonasfranz.software> * fmt Signed-off-by: Jonas Franz <info@jonasfranz.software> * Regenerated CSS with latest less version Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix test by updating comment type to new ID Signed-off-by: Jonas Franz <info@jonasfranz.software> * Introducing CodeComments as type for map[string]map[int64][]*Comment Other minor code improvements Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix data-tab issues Signed-off-by: Jonas Franz <info@jonasfranz.software> * Remove unnecessary change Signed-off-by: Jonas Franz <info@jonasfranz.software> * refactored checkForInvalidation Signed-off-by: Jonas Franz <info@jonasfranz.software> * Append comments instead of setting Signed-off-by: Jonas Franz <info@jonasfranz.software> * Use HeadRepo instead of BaseRepo Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update migration Signed-off-by: Jonas Franz <info@jonasfranz.de> * Regenerated CSS Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add copyright Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update index.css Signed-off-by: Jonas Franz <info@jonasfranz.software>
7 years ago
Pull request review/approval and comment on code (#3748) * Initial ui components for pull request review * Add Review Add IssueComment types Signed-off-by: Jonas Franz <info@jonasfranz.software> (cherry picked from commit 2b4daab) Signed-off-by: Jonas Franz <info@jonasfranz.software> * Replace ReviewComment with Content Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add load functions Add ReviewID to findComments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add create review comment implementation Add migration for review Other small changes Signed-off-by: Jonas Franz <info@jonasfranz.software> * Simplified create and find functions for review Signed-off-by: Jonas Franz <info@jonasfranz.software> * Moved "Pending" to first position Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add GetCurrentReview to simplify fetching current review Signed-off-by: Jonas Franz <info@jonasfranz.software> * Preview for listing comments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Move new comment form to its own file Signed-off-by: Jonas Franz <info@jonasfranz.software> * Implement Review form Show Review comments on comment stream Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add support for single comments Showing buttons in context Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add pending tag to pending review comments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add unit tests for Review Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fetch all review ids at once Add unit tests Signed-off-by: Jonas Franz <info@jonasfranz.software> * gofmt Signed-off-by: Jonas Franz <info@jonasfranz.software> * Improved comment rendering in "Files" view by adding Comments to DiffLine Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add support for invalidating comments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Switched back to code.gitea.io/git Signed-off-by: Jonas Franz <info@jonasfranz.software> * Moved review migration from v64 to v65 Signed-off-by: Jonas Franz <info@jonasfranz.software> * Rebuild css Signed-off-by: Jonas Franz <info@jonasfranz.software> * gofmt Signed-off-by: Jonas Franz <info@jonasfranz.software> * Improve translations Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix unit tests by updating fixtures and updating outdated test Signed-off-by: Jonas Franz <info@jonasfranz.software> * Comments will be shown at the right place now Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add support for deleting CodeComments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix problems caused by files in subdirectories Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add support for showing code comments of reviews in conversation Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add support for "Show/Hide outdated" Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update code.gitea.io/git Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add support for new webhooks Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update comparison Signed-off-by: Jonas Franz <info@jonasfranz.software> * Resolve conflicts Signed-off-by: Jonas Franz <info@jonasfranz.software> * Minor UI improvements * update code.gitea.io/git * Fix ui bug reported by @lunny causing wrong position of add button Add functionality to "Cancel" button Add scale effects to add button Hide "Cancel" button for existing comments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Prepare solving conflicts Signed-off-by: Jonas Franz <info@jonasfranz.software> * Show add button only if no comments already exist for the line Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add missing vendor files Signed-off-by: Jonas Franz <info@jonasfranz.software> * Check if reviewer is nil Signed-off-by: Jonas Franz <info@jonasfranz.software> * Show forms only to users who are logged in Signed-off-by: Jonas Franz <info@jonasfranz.software> * Revert "Show forms only to users who are logged in" This reverts commit c083682 Signed-off-by: Jonas Franz <info@jonasfranz.software> * Save patch in comment Render patch for code comments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add link to comment in code Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add reply form to comment list Show forms only to signed in users Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add 'Reply' as translatable Add CODE_COMMENT_LINES setting Signed-off-by: Jonas Franz <info@jonasfranz.software> * gofmt Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix problems introduced by checking for singed in user Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add v70 Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update generated stylesheet Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix preview Beginn with new review comment patch system Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add new algo to generate diff for line range Remove old algo used for cutting big diffs (it was very buggy) * Add documentation and example for CutDiffAroundLine * Fix example of CutDiffAroundLine * Fix some comment UI rendering bugs * Add code comment edit mode * Send notifications / actions to users until review gets published Fix diff generation bug Fix wrong hashtag * Fix vet errors * Send notifications also for single comments * Fix some notification bugs, fix link * Fix: add comment icon is only shown on code lines * Add lint comment * Add unit tests for git diff * Add more error messages * Regenerated css Signed-off-by: Jonas Franz <info@jonasfranz.software> * fmt Signed-off-by: Jonas Franz <info@jonasfranz.software> * Regenerated CSS with latest less version Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix test by updating comment type to new ID Signed-off-by: Jonas Franz <info@jonasfranz.software> * Introducing CodeComments as type for map[string]map[int64][]*Comment Other minor code improvements Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix data-tab issues Signed-off-by: Jonas Franz <info@jonasfranz.software> * Remove unnecessary change Signed-off-by: Jonas Franz <info@jonasfranz.software> * refactored checkForInvalidation Signed-off-by: Jonas Franz <info@jonasfranz.software> * Append comments instead of setting Signed-off-by: Jonas Franz <info@jonasfranz.software> * Use HeadRepo instead of BaseRepo Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update migration Signed-off-by: Jonas Franz <info@jonasfranz.de> * Regenerated CSS Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add copyright Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update index.css Signed-off-by: Jonas Franz <info@jonasfranz.software>
7 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
10 years ago
11 years ago
10 years ago
11 years ago
11 years ago
11 years ago
10 years ago
11 years ago
11 years ago
10 years ago
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
9 years ago
Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
9 years ago
Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
9 years ago
Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
9 years ago
Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
9 years ago
Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
9 years ago
Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
9 years ago
Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
9 years ago
Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
9 years ago
Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
9 years ago
Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
9 years ago
Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
9 years ago
Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
9 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
9 years ago
11 years ago
11 years ago
Add support for federated avatars (#3320) * Add support for federated avatars Fixes #3105 Removes avatar fetching duplication code Adds an "Enable Federated Avatar" checkbox in user settings (defaults to unchecked) Moves avatar settings all in the same form, making local and remote avatars mutually exclusive Renames UploadAvatarForm to AvatarForm as it's not anymore only for uploading * Run gofmt on all modified files * Move Avatar form in its own page * Add go-libravatar dependency to vendor/ dir Hopefully helps with accepting the contribution. See also #3214 * Revert "Add go-libravatar dependency to vendor/ dir" This reverts commit a8cb93ae640bbb90f7d25012fc257bda9fae9b82. * Make federated avatar setting a global configuration Removes the per-user setting * Move avatar handling back to base tool, disable federated avatar in offline mode * Format, handle error * Properly set fallback host * Use unsupported github.com mirror for importing go-libravatar * Remove comment showing life exists outside of github.com ... pity, but contribution would not be accepted otherwise * Use Combo for Get and Post methods over /avatar * FEDERATED_AVATAR -> ENABLE_FEDERATED_AVATAR * Fix persistance of federated avatar lookup checkbox at install time * Federated Avatars -> Enable Federated Avatars * Use len(string) == 0 instead of string == "" * Move import line where it belong See https://github.com/Unknwon/go-code-convention/blob/master/en-US/import_packages.md Pity the import url is still the unofficial one, but oh well... * Save a line (and waste much more expensive time) * Remove redundant parens * Remove an empty line * Remove empty lines * Reorder lines to make diff smaller * Remove another newline Unknwon review got me start a fight against newlines * Move DISABLE_GRAVATAR and ENABLE_FEDERATED_AVATAR after OFFLINE_MODE On re-reading the diff I figured what Unknwon meant here: https://github.com/gogits/gogs/pull/3320/files#r73741106 * Remove newlines that weren't there before my intervention
9 years ago
Add support for federated avatars (#3320) * Add support for federated avatars Fixes #3105 Removes avatar fetching duplication code Adds an "Enable Federated Avatar" checkbox in user settings (defaults to unchecked) Moves avatar settings all in the same form, making local and remote avatars mutually exclusive Renames UploadAvatarForm to AvatarForm as it's not anymore only for uploading * Run gofmt on all modified files * Move Avatar form in its own page * Add go-libravatar dependency to vendor/ dir Hopefully helps with accepting the contribution. See also #3214 * Revert "Add go-libravatar dependency to vendor/ dir" This reverts commit a8cb93ae640bbb90f7d25012fc257bda9fae9b82. * Make federated avatar setting a global configuration Removes the per-user setting * Move avatar handling back to base tool, disable federated avatar in offline mode * Format, handle error * Properly set fallback host * Use unsupported github.com mirror for importing go-libravatar * Remove comment showing life exists outside of github.com ... pity, but contribution would not be accepted otherwise * Use Combo for Get and Post methods over /avatar * FEDERATED_AVATAR -> ENABLE_FEDERATED_AVATAR * Fix persistance of federated avatar lookup checkbox at install time * Federated Avatars -> Enable Federated Avatars * Use len(string) == 0 instead of string == "" * Move import line where it belong See https://github.com/Unknwon/go-code-convention/blob/master/en-US/import_packages.md Pity the import url is still the unofficial one, but oh well... * Save a line (and waste much more expensive time) * Remove redundant parens * Remove an empty line * Remove empty lines * Reorder lines to make diff smaller * Remove another newline Unknwon review got me start a fight against newlines * Move DISABLE_GRAVATAR and ENABLE_FEDERATED_AVATAR after OFFLINE_MODE On re-reading the diff I figured what Unknwon meant here: https://github.com/gogits/gogs/pull/3320/files#r73741106 * Remove newlines that weren't there before my intervention
9 years ago
Add support for federated avatars (#3320) * Add support for federated avatars Fixes #3105 Removes avatar fetching duplication code Adds an "Enable Federated Avatar" checkbox in user settings (defaults to unchecked) Moves avatar settings all in the same form, making local and remote avatars mutually exclusive Renames UploadAvatarForm to AvatarForm as it's not anymore only for uploading * Run gofmt on all modified files * Move Avatar form in its own page * Add go-libravatar dependency to vendor/ dir Hopefully helps with accepting the contribution. See also #3214 * Revert "Add go-libravatar dependency to vendor/ dir" This reverts commit a8cb93ae640bbb90f7d25012fc257bda9fae9b82. * Make federated avatar setting a global configuration Removes the per-user setting * Move avatar handling back to base tool, disable federated avatar in offline mode * Format, handle error * Properly set fallback host * Use unsupported github.com mirror for importing go-libravatar * Remove comment showing life exists outside of github.com ... pity, but contribution would not be accepted otherwise * Use Combo for Get and Post methods over /avatar * FEDERATED_AVATAR -> ENABLE_FEDERATED_AVATAR * Fix persistance of federated avatar lookup checkbox at install time * Federated Avatars -> Enable Federated Avatars * Use len(string) == 0 instead of string == "" * Move import line where it belong See https://github.com/Unknwon/go-code-convention/blob/master/en-US/import_packages.md Pity the import url is still the unofficial one, but oh well... * Save a line (and waste much more expensive time) * Remove redundant parens * Remove an empty line * Remove empty lines * Reorder lines to make diff smaller * Remove another newline Unknwon review got me start a fight against newlines * Move DISABLE_GRAVATAR and ENABLE_FEDERATED_AVATAR after OFFLINE_MODE On re-reading the diff I figured what Unknwon meant here: https://github.com/gogits/gogs/pull/3320/files#r73741106 * Remove newlines that weren't there before my intervention
9 years ago
Add support for federated avatars (#3320) * Add support for federated avatars Fixes #3105 Removes avatar fetching duplication code Adds an "Enable Federated Avatar" checkbox in user settings (defaults to unchecked) Moves avatar settings all in the same form, making local and remote avatars mutually exclusive Renames UploadAvatarForm to AvatarForm as it's not anymore only for uploading * Run gofmt on all modified files * Move Avatar form in its own page * Add go-libravatar dependency to vendor/ dir Hopefully helps with accepting the contribution. See also #3214 * Revert "Add go-libravatar dependency to vendor/ dir" This reverts commit a8cb93ae640bbb90f7d25012fc257bda9fae9b82. * Make federated avatar setting a global configuration Removes the per-user setting * Move avatar handling back to base tool, disable federated avatar in offline mode * Format, handle error * Properly set fallback host * Use unsupported github.com mirror for importing go-libravatar * Remove comment showing life exists outside of github.com ... pity, but contribution would not be accepted otherwise * Use Combo for Get and Post methods over /avatar * FEDERATED_AVATAR -> ENABLE_FEDERATED_AVATAR * Fix persistance of federated avatar lookup checkbox at install time * Federated Avatars -> Enable Federated Avatars * Use len(string) == 0 instead of string == "" * Move import line where it belong See https://github.com/Unknwon/go-code-convention/blob/master/en-US/import_packages.md Pity the import url is still the unofficial one, but oh well... * Save a line (and waste much more expensive time) * Remove redundant parens * Remove an empty line * Remove empty lines * Reorder lines to make diff smaller * Remove another newline Unknwon review got me start a fight against newlines * Move DISABLE_GRAVATAR and ENABLE_FEDERATED_AVATAR after OFFLINE_MODE On re-reading the diff I figured what Unknwon meant here: https://github.com/gogits/gogs/pull/3320/files#r73741106 * Remove newlines that weren't there before my intervention
9 years ago
11 years ago
11 years ago
11 years ago
11 years ago
Feature: Timetracking (#2211) * Added comment's hashtag to url for mail notifications. * Added explanation to return statement + documentation. * Replacing in-line link generation with HTMLURL. (+gofmt) * Replaced action-based model with nil-based model. (+gofmt) * Replaced mailIssueActionToParticipants with mailIssueCommentToParticipants. * Updating comment for mailIssueCommentToParticipants * Added link to comment in "Dashboard" * Deleting feed entry if a comment is going to be deleted * Added migration * Added improved migration to add a CommentID column to action. * Added improved links to comments in feed entries. * Fixes #1956 by filtering for deleted comments that are referenced in actions. * Introducing "IsDeleted" column to action. * Adding design draft (not functional) * Adding database models for stopwatches and trackedtimes * See go-gitea/gitea#967 * Adding design draft (not functional) * Adding translations and improving design * Implementing stopwatch (for timetracking) * Make UI functional * Add hints in timeline for time tracking events * Implementing timetracking feature * Adding "Add time manual" option * Improved stopwatch * Created report of total spent time by user * Only showing total time spent if theire is something to show. * Adding license headers. * Improved error handling for "Add Time Manual" * Adding @sapks 's changes, refactoring * Adding API for feature tracking * Adding unit test * Adding DISABLE/ENABLE option to Repository settings page * Improving translations * Applying @sapk 's changes * Removing repo_unit and using IssuesSetting for disabling/enabling timetracker * Adding DEFAULT_ENABLE_TIMETRACKER to config, installation and admin menu * Improving documentation * Fixing vendor/ folder * Changing timtracking routes by adding subgroups /times and /times/stopwatch (Proposed by @lafriks ) * Restricting write access to timetracking based on the repo settings (Proposed by @lafriks ) * Fixed minor permissions bug. * Adding CanUseTimetracker and IsTimetrackerEnabled in ctx.Repo * Allow assignees and authors to track there time too. * Fixed some build-time-errors + logical errors. * Removing unused Get...ByID functions * Moving IsTimetrackerEnabled from context.Repository to models.Repository * Adding a seperate file for issue related repo functions * Adding license headers * Fixed GetUserByParams return 404 * Moving /users/:username/times to /repos/:username/:reponame/times/:username for security reasons * Adding /repos/:username/times to get all tracked times of the repo * Updating sdk-dependency * Updating swagger.v1.json * Adding warning if user has already a running stopwatch (auto-timetracker) * Replacing GetTrackedTimesBy... with GetTrackedTimes(options FindTrackedTimesOptions) * Changing code.gitea.io/sdk back to code.gitea.io/sdk * Correcting spelling mistake * Updating vendor.json * Changing GET stopwatch/toggle to POST stopwatch/toggle * Changing GET stopwatch/cancel to POST stopwatch/cancel * Added migration for stopwatches/timetracking * Fixed some access bugs for read-only users * Added default allow only contributors to track time value to config * Fixed migration by chaging x.Iterate to x.Find * Resorted imports * Moved Add Time Manually form to repo_form.go * Removed "Seconds" field from Add Time Manually * Resorted imports * Improved permission checking * Fixed some bugs * Added integration test * gofmt * Adding integration test by @lafriks * Added created_unix to comment fixtures * Using last event instead of a fixed event * Adding another integration test by @lafriks * Fixing bug Timetracker enabled causing error 500 at sidebar.tpl * Fixed a refactoring bug that resulted in hiding "HasUserStopwatch" warning. * Returning TrackedTime instead of AddTimeOption at AddTime. * Updating SDK from go-gitea/go-sdk#69 * Resetting Go-SDK back to default repository * Fixing test-vendor by changing ini back to original repository * Adding "tags" to swagger spec * govendor sync * Removed duplicate * Formatting templates * Adding IsTimetrackingEnabled checks to API * Improving translations / english texts * Improving documentation * Updating swagger spec * Fixing integration test caused be translation-changes * Removed encoding issues in local_en-US.ini. * "Added" copyright line * Moved unit.IssuesConfig().EnableTimetracker into a != nil check * Removed some other encoding issues in local_en-US.ini * Improved javascript by checking if data-context exists * Replaced manual comment creation with CreateComment * Removed unnecessary code * Improved error checking * Small cosmetic changes * Replaced int>string>duration parsing with int>duration parsing * Fixed encoding issues * Removed unused imports Signed-off-by: Jonas Franz <info@jonasfranz.software>
8 years ago
Feature: Timetracking (#2211) * Added comment's hashtag to url for mail notifications. * Added explanation to return statement + documentation. * Replacing in-line link generation with HTMLURL. (+gofmt) * Replaced action-based model with nil-based model. (+gofmt) * Replaced mailIssueActionToParticipants with mailIssueCommentToParticipants. * Updating comment for mailIssueCommentToParticipants * Added link to comment in "Dashboard" * Deleting feed entry if a comment is going to be deleted * Added migration * Added improved migration to add a CommentID column to action. * Added improved links to comments in feed entries. * Fixes #1956 by filtering for deleted comments that are referenced in actions. * Introducing "IsDeleted" column to action. * Adding design draft (not functional) * Adding database models for stopwatches and trackedtimes * See go-gitea/gitea#967 * Adding design draft (not functional) * Adding translations and improving design * Implementing stopwatch (for timetracking) * Make UI functional * Add hints in timeline for time tracking events * Implementing timetracking feature * Adding "Add time manual" option * Improved stopwatch * Created report of total spent time by user * Only showing total time spent if theire is something to show. * Adding license headers. * Improved error handling for "Add Time Manual" * Adding @sapks 's changes, refactoring * Adding API for feature tracking * Adding unit test * Adding DISABLE/ENABLE option to Repository settings page * Improving translations * Applying @sapk 's changes * Removing repo_unit and using IssuesSetting for disabling/enabling timetracker * Adding DEFAULT_ENABLE_TIMETRACKER to config, installation and admin menu * Improving documentation * Fixing vendor/ folder * Changing timtracking routes by adding subgroups /times and /times/stopwatch (Proposed by @lafriks ) * Restricting write access to timetracking based on the repo settings (Proposed by @lafriks ) * Fixed minor permissions bug. * Adding CanUseTimetracker and IsTimetrackerEnabled in ctx.Repo * Allow assignees and authors to track there time too. * Fixed some build-time-errors + logical errors. * Removing unused Get...ByID functions * Moving IsTimetrackerEnabled from context.Repository to models.Repository * Adding a seperate file for issue related repo functions * Adding license headers * Fixed GetUserByParams return 404 * Moving /users/:username/times to /repos/:username/:reponame/times/:username for security reasons * Adding /repos/:username/times to get all tracked times of the repo * Updating sdk-dependency * Updating swagger.v1.json * Adding warning if user has already a running stopwatch (auto-timetracker) * Replacing GetTrackedTimesBy... with GetTrackedTimes(options FindTrackedTimesOptions) * Changing code.gitea.io/sdk back to code.gitea.io/sdk * Correcting spelling mistake * Updating vendor.json * Changing GET stopwatch/toggle to POST stopwatch/toggle * Changing GET stopwatch/cancel to POST stopwatch/cancel * Added migration for stopwatches/timetracking * Fixed some access bugs for read-only users * Added default allow only contributors to track time value to config * Fixed migration by chaging x.Iterate to x.Find * Resorted imports * Moved Add Time Manually form to repo_form.go * Removed "Seconds" field from Add Time Manually * Resorted imports * Improved permission checking * Fixed some bugs * Added integration test * gofmt * Adding integration test by @lafriks * Added created_unix to comment fixtures * Using last event instead of a fixed event * Adding another integration test by @lafriks * Fixing bug Timetracker enabled causing error 500 at sidebar.tpl * Fixed a refactoring bug that resulted in hiding "HasUserStopwatch" warning. * Returning TrackedTime instead of AddTimeOption at AddTime. * Updating SDK from go-gitea/go-sdk#69 * Resetting Go-SDK back to default repository * Fixing test-vendor by changing ini back to original repository * Adding "tags" to swagger spec * govendor sync * Removed duplicate * Formatting templates * Adding IsTimetrackingEnabled checks to API * Improving translations / english texts * Improving documentation * Updating swagger spec * Fixing integration test caused be translation-changes * Removed encoding issues in local_en-US.ini. * "Added" copyright line * Moved unit.IssuesConfig().EnableTimetracker into a != nil check * Removed some other encoding issues in local_en-US.ini * Improved javascript by checking if data-context exists * Replaced manual comment creation with CreateComment * Removed unnecessary code * Improved error checking * Small cosmetic changes * Replaced int>string>duration parsing with int>duration parsing * Fixed encoding issues * Removed unused imports Signed-off-by: Jonas Franz <info@jonasfranz.software>
8 years ago
Feature: Timetracking (#2211) * Added comment's hashtag to url for mail notifications. * Added explanation to return statement + documentation. * Replacing in-line link generation with HTMLURL. (+gofmt) * Replaced action-based model with nil-based model. (+gofmt) * Replaced mailIssueActionToParticipants with mailIssueCommentToParticipants. * Updating comment for mailIssueCommentToParticipants * Added link to comment in "Dashboard" * Deleting feed entry if a comment is going to be deleted * Added migration * Added improved migration to add a CommentID column to action. * Added improved links to comments in feed entries. * Fixes #1956 by filtering for deleted comments that are referenced in actions. * Introducing "IsDeleted" column to action. * Adding design draft (not functional) * Adding database models for stopwatches and trackedtimes * See go-gitea/gitea#967 * Adding design draft (not functional) * Adding translations and improving design * Implementing stopwatch (for timetracking) * Make UI functional * Add hints in timeline for time tracking events * Implementing timetracking feature * Adding "Add time manual" option * Improved stopwatch * Created report of total spent time by user * Only showing total time spent if theire is something to show. * Adding license headers. * Improved error handling for "Add Time Manual" * Adding @sapks 's changes, refactoring * Adding API for feature tracking * Adding unit test * Adding DISABLE/ENABLE option to Repository settings page * Improving translations * Applying @sapk 's changes * Removing repo_unit and using IssuesSetting for disabling/enabling timetracker * Adding DEFAULT_ENABLE_TIMETRACKER to config, installation and admin menu * Improving documentation * Fixing vendor/ folder * Changing timtracking routes by adding subgroups /times and /times/stopwatch (Proposed by @lafriks ) * Restricting write access to timetracking based on the repo settings (Proposed by @lafriks ) * Fixed minor permissions bug. * Adding CanUseTimetracker and IsTimetrackerEnabled in ctx.Repo * Allow assignees and authors to track there time too. * Fixed some build-time-errors + logical errors. * Removing unused Get...ByID functions * Moving IsTimetrackerEnabled from context.Repository to models.Repository * Adding a seperate file for issue related repo functions * Adding license headers * Fixed GetUserByParams return 404 * Moving /users/:username/times to /repos/:username/:reponame/times/:username for security reasons * Adding /repos/:username/times to get all tracked times of the repo * Updating sdk-dependency * Updating swagger.v1.json * Adding warning if user has already a running stopwatch (auto-timetracker) * Replacing GetTrackedTimesBy... with GetTrackedTimes(options FindTrackedTimesOptions) * Changing code.gitea.io/sdk back to code.gitea.io/sdk * Correcting spelling mistake * Updating vendor.json * Changing GET stopwatch/toggle to POST stopwatch/toggle * Changing GET stopwatch/cancel to POST stopwatch/cancel * Added migration for stopwatches/timetracking * Fixed some access bugs for read-only users * Added default allow only contributors to track time value to config * Fixed migration by chaging x.Iterate to x.Find * Resorted imports * Moved Add Time Manually form to repo_form.go * Removed "Seconds" field from Add Time Manually * Resorted imports * Improved permission checking * Fixed some bugs * Added integration test * gofmt * Adding integration test by @lafriks * Added created_unix to comment fixtures * Using last event instead of a fixed event * Adding another integration test by @lafriks * Fixing bug Timetracker enabled causing error 500 at sidebar.tpl * Fixed a refactoring bug that resulted in hiding "HasUserStopwatch" warning. * Returning TrackedTime instead of AddTimeOption at AddTime. * Updating SDK from go-gitea/go-sdk#69 * Resetting Go-SDK back to default repository * Fixing test-vendor by changing ini back to original repository * Adding "tags" to swagger spec * govendor sync * Removed duplicate * Formatting templates * Adding IsTimetrackingEnabled checks to API * Improving translations / english texts * Improving documentation * Updating swagger spec * Fixing integration test caused be translation-changes * Removed encoding issues in local_en-US.ini. * "Added" copyright line * Moved unit.IssuesConfig().EnableTimetracker into a != nil check * Removed some other encoding issues in local_en-US.ini * Improved javascript by checking if data-context exists * Replaced manual comment creation with CreateComment * Removed unnecessary code * Improved error checking * Small cosmetic changes * Replaced int>string>duration parsing with int>duration parsing * Fixed encoding issues * Removed unused imports Signed-off-by: Jonas Franz <info@jonasfranz.software>
8 years ago
Feature: Timetracking (#2211) * Added comment's hashtag to url for mail notifications. * Added explanation to return statement + documentation. * Replacing in-line link generation with HTMLURL. (+gofmt) * Replaced action-based model with nil-based model. (+gofmt) * Replaced mailIssueActionToParticipants with mailIssueCommentToParticipants. * Updating comment for mailIssueCommentToParticipants * Added link to comment in "Dashboard" * Deleting feed entry if a comment is going to be deleted * Added migration * Added improved migration to add a CommentID column to action. * Added improved links to comments in feed entries. * Fixes #1956 by filtering for deleted comments that are referenced in actions. * Introducing "IsDeleted" column to action. * Adding design draft (not functional) * Adding database models for stopwatches and trackedtimes * See go-gitea/gitea#967 * Adding design draft (not functional) * Adding translations and improving design * Implementing stopwatch (for timetracking) * Make UI functional * Add hints in timeline for time tracking events * Implementing timetracking feature * Adding "Add time manual" option * Improved stopwatch * Created report of total spent time by user * Only showing total time spent if theire is something to show. * Adding license headers. * Improved error handling for "Add Time Manual" * Adding @sapks 's changes, refactoring * Adding API for feature tracking * Adding unit test * Adding DISABLE/ENABLE option to Repository settings page * Improving translations * Applying @sapk 's changes * Removing repo_unit and using IssuesSetting for disabling/enabling timetracker * Adding DEFAULT_ENABLE_TIMETRACKER to config, installation and admin menu * Improving documentation * Fixing vendor/ folder * Changing timtracking routes by adding subgroups /times and /times/stopwatch (Proposed by @lafriks ) * Restricting write access to timetracking based on the repo settings (Proposed by @lafriks ) * Fixed minor permissions bug. * Adding CanUseTimetracker and IsTimetrackerEnabled in ctx.Repo * Allow assignees and authors to track there time too. * Fixed some build-time-errors + logical errors. * Removing unused Get...ByID functions * Moving IsTimetrackerEnabled from context.Repository to models.Repository * Adding a seperate file for issue related repo functions * Adding license headers * Fixed GetUserByParams return 404 * Moving /users/:username/times to /repos/:username/:reponame/times/:username for security reasons * Adding /repos/:username/times to get all tracked times of the repo * Updating sdk-dependency * Updating swagger.v1.json * Adding warning if user has already a running stopwatch (auto-timetracker) * Replacing GetTrackedTimesBy... with GetTrackedTimes(options FindTrackedTimesOptions) * Changing code.gitea.io/sdk back to code.gitea.io/sdk * Correcting spelling mistake * Updating vendor.json * Changing GET stopwatch/toggle to POST stopwatch/toggle * Changing GET stopwatch/cancel to POST stopwatch/cancel * Added migration for stopwatches/timetracking * Fixed some access bugs for read-only users * Added default allow only contributors to track time value to config * Fixed migration by chaging x.Iterate to x.Find * Resorted imports * Moved Add Time Manually form to repo_form.go * Removed "Seconds" field from Add Time Manually * Resorted imports * Improved permission checking * Fixed some bugs * Added integration test * gofmt * Adding integration test by @lafriks * Added created_unix to comment fixtures * Using last event instead of a fixed event * Adding another integration test by @lafriks * Fixing bug Timetracker enabled causing error 500 at sidebar.tpl * Fixed a refactoring bug that resulted in hiding "HasUserStopwatch" warning. * Returning TrackedTime instead of AddTimeOption at AddTime. * Updating SDK from go-gitea/go-sdk#69 * Resetting Go-SDK back to default repository * Fixing test-vendor by changing ini back to original repository * Adding "tags" to swagger spec * govendor sync * Removed duplicate * Formatting templates * Adding IsTimetrackingEnabled checks to API * Improving translations / english texts * Improving documentation * Updating swagger spec * Fixing integration test caused be translation-changes * Removed encoding issues in local_en-US.ini. * "Added" copyright line * Moved unit.IssuesConfig().EnableTimetracker into a != nil check * Removed some other encoding issues in local_en-US.ini * Improved javascript by checking if data-context exists * Replaced manual comment creation with CreateComment * Removed unnecessary code * Improved error checking * Small cosmetic changes * Replaced int>string>duration parsing with int>duration parsing * Fixed encoding issues * Removed unused imports Signed-off-by: Jonas Franz <info@jonasfranz.software>
8 years ago
Feature: Timetracking (#2211) * Added comment's hashtag to url for mail notifications. * Added explanation to return statement + documentation. * Replacing in-line link generation with HTMLURL. (+gofmt) * Replaced action-based model with nil-based model. (+gofmt) * Replaced mailIssueActionToParticipants with mailIssueCommentToParticipants. * Updating comment for mailIssueCommentToParticipants * Added link to comment in "Dashboard" * Deleting feed entry if a comment is going to be deleted * Added migration * Added improved migration to add a CommentID column to action. * Added improved links to comments in feed entries. * Fixes #1956 by filtering for deleted comments that are referenced in actions. * Introducing "IsDeleted" column to action. * Adding design draft (not functional) * Adding database models for stopwatches and trackedtimes * See go-gitea/gitea#967 * Adding design draft (not functional) * Adding translations and improving design * Implementing stopwatch (for timetracking) * Make UI functional * Add hints in timeline for time tracking events * Implementing timetracking feature * Adding "Add time manual" option * Improved stopwatch * Created report of total spent time by user * Only showing total time spent if theire is something to show. * Adding license headers. * Improved error handling for "Add Time Manual" * Adding @sapks 's changes, refactoring * Adding API for feature tracking * Adding unit test * Adding DISABLE/ENABLE option to Repository settings page * Improving translations * Applying @sapk 's changes * Removing repo_unit and using IssuesSetting for disabling/enabling timetracker * Adding DEFAULT_ENABLE_TIMETRACKER to config, installation and admin menu * Improving documentation * Fixing vendor/ folder * Changing timtracking routes by adding subgroups /times and /times/stopwatch (Proposed by @lafriks ) * Restricting write access to timetracking based on the repo settings (Proposed by @lafriks ) * Fixed minor permissions bug. * Adding CanUseTimetracker and IsTimetrackerEnabled in ctx.Repo * Allow assignees and authors to track there time too. * Fixed some build-time-errors + logical errors. * Removing unused Get...ByID functions * Moving IsTimetrackerEnabled from context.Repository to models.Repository * Adding a seperate file for issue related repo functions * Adding license headers * Fixed GetUserByParams return 404 * Moving /users/:username/times to /repos/:username/:reponame/times/:username for security reasons * Adding /repos/:username/times to get all tracked times of the repo * Updating sdk-dependency * Updating swagger.v1.json * Adding warning if user has already a running stopwatch (auto-timetracker) * Replacing GetTrackedTimesBy... with GetTrackedTimes(options FindTrackedTimesOptions) * Changing code.gitea.io/sdk back to code.gitea.io/sdk * Correcting spelling mistake * Updating vendor.json * Changing GET stopwatch/toggle to POST stopwatch/toggle * Changing GET stopwatch/cancel to POST stopwatch/cancel * Added migration for stopwatches/timetracking * Fixed some access bugs for read-only users * Added default allow only contributors to track time value to config * Fixed migration by chaging x.Iterate to x.Find * Resorted imports * Moved Add Time Manually form to repo_form.go * Removed "Seconds" field from Add Time Manually * Resorted imports * Improved permission checking * Fixed some bugs * Added integration test * gofmt * Adding integration test by @lafriks * Added created_unix to comment fixtures * Using last event instead of a fixed event * Adding another integration test by @lafriks * Fixing bug Timetracker enabled causing error 500 at sidebar.tpl * Fixed a refactoring bug that resulted in hiding "HasUserStopwatch" warning. * Returning TrackedTime instead of AddTimeOption at AddTime. * Updating SDK from go-gitea/go-sdk#69 * Resetting Go-SDK back to default repository * Fixing test-vendor by changing ini back to original repository * Adding "tags" to swagger spec * govendor sync * Removed duplicate * Formatting templates * Adding IsTimetrackingEnabled checks to API * Improving translations / english texts * Improving documentation * Updating swagger spec * Fixing integration test caused be translation-changes * Removed encoding issues in local_en-US.ini. * "Added" copyright line * Moved unit.IssuesConfig().EnableTimetracker into a != nil check * Removed some other encoding issues in local_en-US.ini * Improved javascript by checking if data-context exists * Replaced manual comment creation with CreateComment * Removed unnecessary code * Improved error checking * Small cosmetic changes * Replaced int>string>duration parsing with int>duration parsing * Fixed encoding issues * Removed unused imports Signed-off-by: Jonas Franz <info@jonasfranz.software>
8 years ago
11 years ago
11 years ago
Feature: Timetracking (#2211) * Added comment's hashtag to url for mail notifications. * Added explanation to return statement + documentation. * Replacing in-line link generation with HTMLURL. (+gofmt) * Replaced action-based model with nil-based model. (+gofmt) * Replaced mailIssueActionToParticipants with mailIssueCommentToParticipants. * Updating comment for mailIssueCommentToParticipants * Added link to comment in "Dashboard" * Deleting feed entry if a comment is going to be deleted * Added migration * Added improved migration to add a CommentID column to action. * Added improved links to comments in feed entries. * Fixes #1956 by filtering for deleted comments that are referenced in actions. * Introducing "IsDeleted" column to action. * Adding design draft (not functional) * Adding database models for stopwatches and trackedtimes * See go-gitea/gitea#967 * Adding design draft (not functional) * Adding translations and improving design * Implementing stopwatch (for timetracking) * Make UI functional * Add hints in timeline for time tracking events * Implementing timetracking feature * Adding "Add time manual" option * Improved stopwatch * Created report of total spent time by user * Only showing total time spent if theire is something to show. * Adding license headers. * Improved error handling for "Add Time Manual" * Adding @sapks 's changes, refactoring * Adding API for feature tracking * Adding unit test * Adding DISABLE/ENABLE option to Repository settings page * Improving translations * Applying @sapk 's changes * Removing repo_unit and using IssuesSetting for disabling/enabling timetracker * Adding DEFAULT_ENABLE_TIMETRACKER to config, installation and admin menu * Improving documentation * Fixing vendor/ folder * Changing timtracking routes by adding subgroups /times and /times/stopwatch (Proposed by @lafriks ) * Restricting write access to timetracking based on the repo settings (Proposed by @lafriks ) * Fixed minor permissions bug. * Adding CanUseTimetracker and IsTimetrackerEnabled in ctx.Repo * Allow assignees and authors to track there time too. * Fixed some build-time-errors + logical errors. * Removing unused Get...ByID functions * Moving IsTimetrackerEnabled from context.Repository to models.Repository * Adding a seperate file for issue related repo functions * Adding license headers * Fixed GetUserByParams return 404 * Moving /users/:username/times to /repos/:username/:reponame/times/:username for security reasons * Adding /repos/:username/times to get all tracked times of the repo * Updating sdk-dependency * Updating swagger.v1.json * Adding warning if user has already a running stopwatch (auto-timetracker) * Replacing GetTrackedTimesBy... with GetTrackedTimes(options FindTrackedTimesOptions) * Changing code.gitea.io/sdk back to code.gitea.io/sdk * Correcting spelling mistake * Updating vendor.json * Changing GET stopwatch/toggle to POST stopwatch/toggle * Changing GET stopwatch/cancel to POST stopwatch/cancel * Added migration for stopwatches/timetracking * Fixed some access bugs for read-only users * Added default allow only contributors to track time value to config * Fixed migration by chaging x.Iterate to x.Find * Resorted imports * Moved Add Time Manually form to repo_form.go * Removed "Seconds" field from Add Time Manually * Resorted imports * Improved permission checking * Fixed some bugs * Added integration test * gofmt * Adding integration test by @lafriks * Added created_unix to comment fixtures * Using last event instead of a fixed event * Adding another integration test by @lafriks * Fixing bug Timetracker enabled causing error 500 at sidebar.tpl * Fixed a refactoring bug that resulted in hiding "HasUserStopwatch" warning. * Returning TrackedTime instead of AddTimeOption at AddTime. * Updating SDK from go-gitea/go-sdk#69 * Resetting Go-SDK back to default repository * Fixing test-vendor by changing ini back to original repository * Adding "tags" to swagger spec * govendor sync * Removed duplicate * Formatting templates * Adding IsTimetrackingEnabled checks to API * Improving translations / english texts * Improving documentation * Updating swagger spec * Fixing integration test caused be translation-changes * Removed encoding issues in local_en-US.ini. * "Added" copyright line * Moved unit.IssuesConfig().EnableTimetracker into a != nil check * Removed some other encoding issues in local_en-US.ini * Improved javascript by checking if data-context exists * Replaced manual comment creation with CreateComment * Removed unnecessary code * Improved error checking * Small cosmetic changes * Replaced int>string>duration parsing with int>duration parsing * Fixed encoding issues * Removed unused imports Signed-off-by: Jonas Franz <info@jonasfranz.software>
8 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Copyright 2017 The Gitea Authors. All rights reserved.
  3. // Use of this source code is governed by a MIT-style
  4. // license that can be found in the LICENSE file.
  5. package setting
  6. import (
  7. "encoding/base64"
  8. "fmt"
  9. "net"
  10. "net/mail"
  11. "net/url"
  12. "os"
  13. "os/exec"
  14. "path"
  15. "path/filepath"
  16. "regexp"
  17. "runtime"
  18. "strconv"
  19. "strings"
  20. "time"
  21. "code.gitea.io/git"
  22. "code.gitea.io/gitea/modules/generate"
  23. "code.gitea.io/gitea/modules/log"
  24. _ "code.gitea.io/gitea/modules/minwinsvc" // import minwinsvc for windows services
  25. "code.gitea.io/gitea/modules/user"
  26. "github.com/Unknwon/com"
  27. _ "github.com/go-macaron/cache/memcache" // memcache plugin for cache
  28. _ "github.com/go-macaron/cache/redis"
  29. "github.com/go-macaron/session"
  30. _ "github.com/go-macaron/session/redis" // redis plugin for store session
  31. "github.com/go-xorm/core"
  32. "github.com/kballard/go-shellquote"
  33. "gopkg.in/ini.v1"
  34. "strk.kbt.io/projects/go/libravatar"
  35. )
  36. // Scheme describes protocol types
  37. type Scheme string
  38. // enumerates all the scheme types
  39. const (
  40. HTTP Scheme = "http"
  41. HTTPS Scheme = "https"
  42. FCGI Scheme = "fcgi"
  43. UnixSocket Scheme = "unix"
  44. )
  45. // LandingPage describes the default page
  46. type LandingPage string
  47. // enumerates all the landing page types
  48. const (
  49. LandingPageHome LandingPage = "/"
  50. LandingPageExplore LandingPage = "/explore"
  51. LandingPageOrganizations LandingPage = "/explore/organizations"
  52. )
  53. // MarkupParser defines the external parser configured in ini
  54. type MarkupParser struct {
  55. Enabled bool
  56. MarkupName string
  57. Command string
  58. FileExtensions []string
  59. IsInputFile bool
  60. }
  61. // enumerates all the policy repository creating
  62. const (
  63. RepoCreatingLastUserVisibility = "last"
  64. RepoCreatingPrivate = "private"
  65. RepoCreatingPublic = "public"
  66. )
  67. // enumerates all the types of captchas
  68. const (
  69. ImageCaptcha = "image"
  70. ReCaptcha = "recaptcha"
  71. )
  72. // settings
  73. var (
  74. // AppVer settings
  75. AppVer string
  76. AppBuiltWith string
  77. AppName string
  78. AppURL string
  79. AppSubURL string
  80. AppSubURLDepth int // Number of slashes
  81. AppPath string
  82. AppDataPath string
  83. AppWorkPath string
  84. // Server settings
  85. Protocol Scheme
  86. Domain string
  87. HTTPAddr string
  88. HTTPPort string
  89. LocalURL string
  90. RedirectOtherPort bool
  91. PortToRedirect string
  92. OfflineMode bool
  93. DisableRouterLog bool
  94. CertFile string
  95. KeyFile string
  96. StaticRootPath string
  97. EnableGzip bool
  98. LandingPageURL LandingPage
  99. UnixSocketPermission uint32
  100. EnablePprof bool
  101. PprofDataPath string
  102. EnableLetsEncrypt bool
  103. LetsEncryptTOS bool
  104. LetsEncryptDirectory string
  105. LetsEncryptEmail string
  106. SSH = struct {
  107. Disabled bool `ini:"DISABLE_SSH"`
  108. StartBuiltinServer bool `ini:"START_SSH_SERVER"`
  109. BuiltinServerUser string `ini:"BUILTIN_SSH_SERVER_USER"`
  110. Domain string `ini:"SSH_DOMAIN"`
  111. Port int `ini:"SSH_PORT"`
  112. ListenHost string `ini:"SSH_LISTEN_HOST"`
  113. ListenPort int `ini:"SSH_LISTEN_PORT"`
  114. RootPath string `ini:"SSH_ROOT_PATH"`
  115. ServerCiphers []string `ini:"SSH_SERVER_CIPHERS"`
  116. ServerKeyExchanges []string `ini:"SSH_SERVER_KEY_EXCHANGES"`
  117. ServerMACs []string `ini:"SSH_SERVER_MACS"`
  118. KeyTestPath string `ini:"SSH_KEY_TEST_PATH"`
  119. KeygenPath string `ini:"SSH_KEYGEN_PATH"`
  120. AuthorizedKeysBackup bool `ini:"SSH_AUTHORIZED_KEYS_BACKUP"`
  121. MinimumKeySizeCheck bool `ini:"-"`
  122. MinimumKeySizes map[string]int `ini:"-"`
  123. ExposeAnonymous bool `ini:"SSH_EXPOSE_ANONYMOUS"`
  124. }{
  125. Disabled: false,
  126. StartBuiltinServer: false,
  127. Domain: "",
  128. Port: 22,
  129. ServerCiphers: []string{"aes128-ctr", "aes192-ctr", "aes256-ctr", "aes128-gcm@openssh.com", "arcfour256", "arcfour128"},
  130. ServerKeyExchanges: []string{"diffie-hellman-group1-sha1", "diffie-hellman-group14-sha1", "ecdh-sha2-nistp256", "ecdh-sha2-nistp384", "ecdh-sha2-nistp521", "curve25519-sha256@libssh.org"},
  131. ServerMACs: []string{"hmac-sha2-256-etm@openssh.com", "hmac-sha2-256", "hmac-sha1", "hmac-sha1-96"},
  132. KeygenPath: "ssh-keygen",
  133. }
  134. LFS struct {
  135. StartServer bool `ini:"LFS_START_SERVER"`
  136. ContentPath string `ini:"LFS_CONTENT_PATH"`
  137. JWTSecretBase64 string `ini:"LFS_JWT_SECRET"`
  138. JWTSecretBytes []byte `ini:"-"`
  139. HTTPAuthExpiry time.Duration `ini:"LFS_HTTP_AUTH_EXPIRY"`
  140. }
  141. // Security settings
  142. InstallLock bool
  143. SecretKey string
  144. LogInRememberDays int
  145. CookieUserName string
  146. CookieRememberName string
  147. ReverseProxyAuthUser string
  148. MinPasswordLength int
  149. ImportLocalPaths bool
  150. DisableGitHooks bool
  151. // Database settings
  152. UseSQLite3 bool
  153. UseMySQL bool
  154. UseMSSQL bool
  155. UsePostgreSQL bool
  156. UseTiDB bool
  157. LogSQL bool
  158. // Indexer settings
  159. Indexer struct {
  160. IssuePath string
  161. RepoIndexerEnabled bool
  162. RepoPath string
  163. UpdateQueueLength int
  164. MaxIndexerFileSize int64
  165. }
  166. // Webhook settings
  167. Webhook = struct {
  168. QueueLength int
  169. DeliverTimeout int
  170. SkipTLSVerify bool
  171. Types []string
  172. PagingNum int
  173. }{
  174. QueueLength: 1000,
  175. DeliverTimeout: 5,
  176. SkipTLSVerify: false,
  177. PagingNum: 10,
  178. }
  179. // Repository settings
  180. Repository = struct {
  181. AnsiCharset string
  182. ForcePrivate bool
  183. DefaultPrivate string
  184. MaxCreationLimit int
  185. MirrorQueueLength int
  186. PullRequestQueueLength int
  187. PreferredLicenses []string
  188. DisableHTTPGit bool
  189. UseCompatSSHURI bool
  190. // Repository editor settings
  191. Editor struct {
  192. LineWrapExtensions []string
  193. PreviewableFileModes []string
  194. } `ini:"-"`
  195. // Repository upload settings
  196. Upload struct {
  197. Enabled bool
  198. TempPath string
  199. AllowedTypes []string `delim:"|"`
  200. FileMaxSize int64
  201. MaxFiles int
  202. } `ini:"-"`
  203. // Repository local settings
  204. Local struct {
  205. LocalCopyPath string
  206. LocalWikiPath string
  207. } `ini:"-"`
  208. // Pull request settings
  209. PullRequest struct {
  210. WorkInProgressPrefixes []string
  211. } `ini:"repository.pull-request"`
  212. }{
  213. AnsiCharset: "",
  214. ForcePrivate: false,
  215. DefaultPrivate: RepoCreatingLastUserVisibility,
  216. MaxCreationLimit: -1,
  217. MirrorQueueLength: 1000,
  218. PullRequestQueueLength: 1000,
  219. PreferredLicenses: []string{"Apache License 2.0,MIT License"},
  220. DisableHTTPGit: false,
  221. UseCompatSSHURI: false,
  222. // Repository editor settings
  223. Editor: struct {
  224. LineWrapExtensions []string
  225. PreviewableFileModes []string
  226. }{
  227. LineWrapExtensions: strings.Split(".txt,.md,.markdown,.mdown,.mkd,", ","),
  228. PreviewableFileModes: []string{"markdown"},
  229. },
  230. // Repository upload settings
  231. Upload: struct {
  232. Enabled bool
  233. TempPath string
  234. AllowedTypes []string `delim:"|"`
  235. FileMaxSize int64
  236. MaxFiles int
  237. }{
  238. Enabled: true,
  239. TempPath: "data/tmp/uploads",
  240. AllowedTypes: []string{},
  241. FileMaxSize: 3,
  242. MaxFiles: 5,
  243. },
  244. // Repository local settings
  245. Local: struct {
  246. LocalCopyPath string
  247. LocalWikiPath string
  248. }{
  249. LocalCopyPath: "tmp/local-repo",
  250. LocalWikiPath: "tmp/local-wiki",
  251. },
  252. // Pull request settings
  253. PullRequest: struct {
  254. WorkInProgressPrefixes []string
  255. }{
  256. WorkInProgressPrefixes: defaultPullRequestWorkInProgressPrefixes,
  257. },
  258. }
  259. RepoRootPath string
  260. ScriptType = "bash"
  261. // UI settings
  262. UI = struct {
  263. ExplorePagingNum int
  264. IssuePagingNum int
  265. RepoSearchPagingNum int
  266. FeedMaxCommitNum int
  267. GraphMaxCommitNum int
  268. CodeCommentLines int
  269. ReactionMaxUserNum int
  270. ThemeColorMetaTag string
  271. MaxDisplayFileSize int64
  272. ShowUserEmail bool
  273. DefaultTheme string
  274. HeatmapColorRange string
  275. Admin struct {
  276. UserPagingNum int
  277. RepoPagingNum int
  278. NoticePagingNum int
  279. OrgPagingNum int
  280. } `ini:"ui.admin"`
  281. User struct {
  282. RepoPagingNum int
  283. } `ini:"ui.user"`
  284. Meta struct {
  285. Author string
  286. Description string
  287. Keywords string
  288. } `ini:"ui.meta"`
  289. }{
  290. ExplorePagingNum: 20,
  291. IssuePagingNum: 10,
  292. RepoSearchPagingNum: 10,
  293. FeedMaxCommitNum: 5,
  294. GraphMaxCommitNum: 100,
  295. CodeCommentLines: 4,
  296. ReactionMaxUserNum: 10,
  297. ThemeColorMetaTag: `#6cc644`,
  298. MaxDisplayFileSize: 8388608,
  299. DefaultTheme: `gitea`,
  300. HeatmapColorRange: `['#f4f4f4', '#459928']`,
  301. Admin: struct {
  302. UserPagingNum int
  303. RepoPagingNum int
  304. NoticePagingNum int
  305. OrgPagingNum int
  306. }{
  307. UserPagingNum: 50,
  308. RepoPagingNum: 50,
  309. NoticePagingNum: 25,
  310. OrgPagingNum: 50,
  311. },
  312. User: struct {
  313. RepoPagingNum int
  314. }{
  315. RepoPagingNum: 15,
  316. },
  317. Meta: struct {
  318. Author string
  319. Description string
  320. Keywords string
  321. }{
  322. Author: "Gitea - Git with a cup of tea",
  323. Description: "Gitea (Git with a cup of tea) is a painless self-hosted Git service written in Go",
  324. Keywords: "go,git,self-hosted,gitea",
  325. },
  326. }
  327. // Markdown settings
  328. Markdown = struct {
  329. EnableHardLineBreak bool
  330. CustomURLSchemes []string `ini:"CUSTOM_URL_SCHEMES"`
  331. FileExtensions []string
  332. }{
  333. EnableHardLineBreak: false,
  334. FileExtensions: strings.Split(".md,.markdown,.mdown,.mkd", ","),
  335. }
  336. // Admin settings
  337. Admin struct {
  338. DisableRegularOrgCreation bool
  339. }
  340. // Picture settings
  341. AvatarUploadPath string
  342. AvatarMaxWidth int
  343. AvatarMaxHeight int
  344. GravatarSource string
  345. GravatarSourceURL *url.URL
  346. DisableGravatar bool
  347. EnableFederatedAvatar bool
  348. LibravatarService *libravatar.Libravatar
  349. // Log settings
  350. LogLevel string
  351. LogRootPath string
  352. LogModes []string
  353. LogConfigs []string
  354. // Attachment settings
  355. AttachmentPath string
  356. AttachmentAllowedTypes string
  357. AttachmentMaxSize int64
  358. AttachmentMaxFiles int
  359. AttachmentEnabled bool
  360. // Time settings
  361. TimeFormat string
  362. // Session settings
  363. SessionConfig session.Options
  364. CSRFCookieName = "_csrf"
  365. // Cron tasks
  366. Cron = struct {
  367. UpdateMirror struct {
  368. Enabled bool
  369. RunAtStart bool
  370. Schedule string
  371. } `ini:"cron.update_mirrors"`
  372. RepoHealthCheck struct {
  373. Enabled bool
  374. RunAtStart bool
  375. Schedule string
  376. Timeout time.Duration
  377. Args []string `delim:" "`
  378. } `ini:"cron.repo_health_check"`
  379. CheckRepoStats struct {
  380. Enabled bool
  381. RunAtStart bool
  382. Schedule string
  383. } `ini:"cron.check_repo_stats"`
  384. ArchiveCleanup struct {
  385. Enabled bool
  386. RunAtStart bool
  387. Schedule string
  388. OlderThan time.Duration
  389. } `ini:"cron.archive_cleanup"`
  390. SyncExternalUsers struct {
  391. Enabled bool
  392. RunAtStart bool
  393. Schedule string
  394. UpdateExisting bool
  395. } `ini:"cron.sync_external_users"`
  396. DeletedBranchesCleanup struct {
  397. Enabled bool
  398. RunAtStart bool
  399. Schedule string
  400. OlderThan time.Duration
  401. } `ini:"cron.deleted_branches_cleanup"`
  402. }{
  403. UpdateMirror: struct {
  404. Enabled bool
  405. RunAtStart bool
  406. Schedule string
  407. }{
  408. Enabled: true,
  409. RunAtStart: false,
  410. Schedule: "@every 10m",
  411. },
  412. RepoHealthCheck: struct {
  413. Enabled bool
  414. RunAtStart bool
  415. Schedule string
  416. Timeout time.Duration
  417. Args []string `delim:" "`
  418. }{
  419. Enabled: true,
  420. RunAtStart: false,
  421. Schedule: "@every 24h",
  422. Timeout: 60 * time.Second,
  423. Args: []string{},
  424. },
  425. CheckRepoStats: struct {
  426. Enabled bool
  427. RunAtStart bool
  428. Schedule string
  429. }{
  430. Enabled: true,
  431. RunAtStart: true,
  432. Schedule: "@every 24h",
  433. },
  434. ArchiveCleanup: struct {
  435. Enabled bool
  436. RunAtStart bool
  437. Schedule string
  438. OlderThan time.Duration
  439. }{
  440. Enabled: true,
  441. RunAtStart: true,
  442. Schedule: "@every 24h",
  443. OlderThan: 24 * time.Hour,
  444. },
  445. SyncExternalUsers: struct {
  446. Enabled bool
  447. RunAtStart bool
  448. Schedule string
  449. UpdateExisting bool
  450. }{
  451. Enabled: true,
  452. RunAtStart: false,
  453. Schedule: "@every 24h",
  454. UpdateExisting: true,
  455. },
  456. DeletedBranchesCleanup: struct {
  457. Enabled bool
  458. RunAtStart bool
  459. Schedule string
  460. OlderThan time.Duration
  461. }{
  462. Enabled: true,
  463. RunAtStart: true,
  464. Schedule: "@every 24h",
  465. OlderThan: 24 * time.Hour,
  466. },
  467. }
  468. // Git settings
  469. Git = struct {
  470. Version string `ini:"-"`
  471. DisableDiffHighlight bool
  472. MaxGitDiffLines int
  473. MaxGitDiffLineCharacters int
  474. MaxGitDiffFiles int
  475. GCArgs []string `delim:" "`
  476. Timeout struct {
  477. Migrate int
  478. Mirror int
  479. Clone int
  480. Pull int
  481. GC int `ini:"GC"`
  482. } `ini:"git.timeout"`
  483. }{
  484. DisableDiffHighlight: false,
  485. MaxGitDiffLines: 1000,
  486. MaxGitDiffLineCharacters: 5000,
  487. MaxGitDiffFiles: 100,
  488. GCArgs: []string{},
  489. Timeout: struct {
  490. Migrate int
  491. Mirror int
  492. Clone int
  493. Pull int
  494. GC int `ini:"GC"`
  495. }{
  496. Migrate: 600,
  497. Mirror: 300,
  498. Clone: 300,
  499. Pull: 300,
  500. GC: 60,
  501. },
  502. }
  503. // Mirror settings
  504. Mirror struct {
  505. DefaultInterval time.Duration
  506. MinInterval time.Duration
  507. }
  508. // API settings
  509. API = struct {
  510. EnableSwagger bool
  511. MaxResponseItems int
  512. }{
  513. EnableSwagger: true,
  514. MaxResponseItems: 50,
  515. }
  516. U2F = struct {
  517. AppID string
  518. TrustedFacets []string
  519. }{}
  520. // I18n settings
  521. Langs []string
  522. Names []string
  523. dateLangs map[string]string
  524. // Highlight settings are loaded in modules/template/highlight.go
  525. // Other settings
  526. ShowFooterBranding bool
  527. ShowFooterVersion bool
  528. ShowFooterTemplateLoadTime bool
  529. // Global setting objects
  530. Cfg *ini.File
  531. CustomPath string // Custom directory path
  532. CustomConf string
  533. CustomPID string
  534. ProdMode bool
  535. RunUser string
  536. IsWindows bool
  537. HasRobotsTxt bool
  538. InternalToken string // internal access token
  539. IterateBufferSize int
  540. ExternalMarkupParsers []MarkupParser
  541. // UILocation is the location on the UI, so that we can display the time on UI.
  542. // Currently only show the default time.Local, it could be added to app.ini after UI is ready
  543. UILocation = time.Local
  544. )
  545. // DateLang transforms standard language locale name to corresponding value in datetime plugin.
  546. func DateLang(lang string) string {
  547. name, ok := dateLangs[lang]
  548. if ok {
  549. return name
  550. }
  551. return "en"
  552. }
  553. func getAppPath() (string, error) {
  554. var appPath string
  555. var err error
  556. if IsWindows && filepath.IsAbs(os.Args[0]) {
  557. appPath = filepath.Clean(os.Args[0])
  558. } else {
  559. appPath, err = exec.LookPath(os.Args[0])
  560. }
  561. if err != nil {
  562. return "", err
  563. }
  564. appPath, err = filepath.Abs(appPath)
  565. if err != nil {
  566. return "", err
  567. }
  568. // Note: we don't use path.Dir here because it does not handle case
  569. // which path starts with two "/" in Windows: "//psf/Home/..."
  570. return strings.Replace(appPath, "\\", "/", -1), err
  571. }
  572. func getWorkPath(appPath string) string {
  573. workPath := ""
  574. giteaWorkPath := os.Getenv("GITEA_WORK_DIR")
  575. if len(giteaWorkPath) > 0 {
  576. workPath = giteaWorkPath
  577. } else {
  578. i := strings.LastIndex(appPath, "/")
  579. if i == -1 {
  580. workPath = appPath
  581. } else {
  582. workPath = appPath[:i]
  583. }
  584. }
  585. return strings.Replace(workPath, "\\", "/", -1)
  586. }
  587. func init() {
  588. IsWindows = runtime.GOOS == "windows"
  589. log.NewLogger(0, "console", `{"level": 0}`)
  590. var err error
  591. if AppPath, err = getAppPath(); err != nil {
  592. log.Fatal(4, "Failed to get app path: %v", err)
  593. }
  594. AppWorkPath = getWorkPath(AppPath)
  595. }
  596. func forcePathSeparator(path string) {
  597. if strings.Contains(path, "\\") {
  598. log.Fatal(4, "Do not use '\\' or '\\\\' in paths, instead, please use '/' in all places")
  599. }
  600. }
  601. // IsRunUserMatchCurrentUser returns false if configured run user does not match
  602. // actual user that runs the app. The first return value is the actual user name.
  603. // This check is ignored under Windows since SSH remote login is not the main
  604. // method to login on Windows.
  605. func IsRunUserMatchCurrentUser(runUser string) (string, bool) {
  606. if IsWindows {
  607. return "", true
  608. }
  609. currentUser := user.CurrentUsername()
  610. return currentUser, runUser == currentUser
  611. }
  612. func createPIDFile(pidPath string) {
  613. currentPid := os.Getpid()
  614. if err := os.MkdirAll(filepath.Dir(pidPath), os.ModePerm); err != nil {
  615. log.Fatal(4, "Failed to create PID folder: %v", err)
  616. }
  617. file, err := os.Create(pidPath)
  618. if err != nil {
  619. log.Fatal(4, "Failed to create PID file: %v", err)
  620. }
  621. defer file.Close()
  622. if _, err := file.WriteString(strconv.FormatInt(int64(currentPid), 10)); err != nil {
  623. log.Fatal(4, "Failed to write PID information: %v", err)
  624. }
  625. }
  626. // NewContext initializes configuration context.
  627. // NOTE: do not print any log except error.
  628. func NewContext() {
  629. Cfg = ini.Empty()
  630. CustomPath = os.Getenv("GITEA_CUSTOM")
  631. if len(CustomPath) == 0 {
  632. CustomPath = path.Join(AppWorkPath, "custom")
  633. } else if !filepath.IsAbs(CustomPath) {
  634. CustomPath = path.Join(AppWorkPath, CustomPath)
  635. }
  636. if len(CustomPID) > 0 {
  637. createPIDFile(CustomPID)
  638. }
  639. if len(CustomConf) == 0 {
  640. CustomConf = path.Join(CustomPath, "conf/app.ini")
  641. } else if !filepath.IsAbs(CustomConf) {
  642. CustomConf = path.Join(CustomPath, CustomConf)
  643. }
  644. if com.IsFile(CustomConf) {
  645. if err := Cfg.Append(CustomConf); err != nil {
  646. log.Fatal(4, "Failed to load custom conf '%s': %v", CustomConf, err)
  647. }
  648. } else {
  649. log.Warn("Custom config '%s' not found, ignore this if you're running first time", CustomConf)
  650. }
  651. Cfg.NameMapper = ini.AllCapsUnderscore
  652. homeDir, err := com.HomeDir()
  653. if err != nil {
  654. log.Fatal(4, "Failed to get home directory: %v", err)
  655. }
  656. homeDir = strings.Replace(homeDir, "\\", "/", -1)
  657. LogLevel = getLogLevel("log", "LEVEL", "Info")
  658. LogRootPath = Cfg.Section("log").Key("ROOT_PATH").MustString(path.Join(AppWorkPath, "log"))
  659. forcePathSeparator(LogRootPath)
  660. sec := Cfg.Section("server")
  661. AppName = Cfg.Section("").Key("APP_NAME").MustString("Gitea: Git with a cup of tea")
  662. Protocol = HTTP
  663. if sec.Key("PROTOCOL").String() == "https" {
  664. Protocol = HTTPS
  665. CertFile = sec.Key("CERT_FILE").String()
  666. KeyFile = sec.Key("KEY_FILE").String()
  667. } else if sec.Key("PROTOCOL").String() == "fcgi" {
  668. Protocol = FCGI
  669. } else if sec.Key("PROTOCOL").String() == "unix" {
  670. Protocol = UnixSocket
  671. UnixSocketPermissionRaw := sec.Key("UNIX_SOCKET_PERMISSION").MustString("666")
  672. UnixSocketPermissionParsed, err := strconv.ParseUint(UnixSocketPermissionRaw, 8, 32)
  673. if err != nil || UnixSocketPermissionParsed > 0777 {
  674. log.Fatal(4, "Failed to parse unixSocketPermission: %s", UnixSocketPermissionRaw)
  675. }
  676. UnixSocketPermission = uint32(UnixSocketPermissionParsed)
  677. }
  678. EnableLetsEncrypt = sec.Key("ENABLE_LETSENCRYPT").MustBool(false)
  679. LetsEncryptTOS = sec.Key("LETSENCRYPT_ACCEPTTOS").MustBool(false)
  680. if !LetsEncryptTOS && EnableLetsEncrypt {
  681. log.Warn("Failed to enable Let's Encrypt due to Let's Encrypt TOS not being accepted")
  682. EnableLetsEncrypt = false
  683. }
  684. LetsEncryptDirectory = sec.Key("LETSENCRYPT_DIRECTORY").MustString("https")
  685. LetsEncryptEmail = sec.Key("LETSENCRYPT_EMAIL").MustString("")
  686. Domain = sec.Key("DOMAIN").MustString("localhost")
  687. HTTPAddr = sec.Key("HTTP_ADDR").MustString("0.0.0.0")
  688. HTTPPort = sec.Key("HTTP_PORT").MustString("3000")
  689. defaultAppURL := string(Protocol) + "://" + Domain
  690. if (Protocol == HTTP && HTTPPort != "80") || (Protocol == HTTPS && HTTPPort != "443") {
  691. defaultAppURL += ":" + HTTPPort
  692. }
  693. AppURL = sec.Key("ROOT_URL").MustString(defaultAppURL)
  694. AppURL = strings.TrimRight(AppURL, "/") + "/"
  695. // Check if has app suburl.
  696. url, err := url.Parse(AppURL)
  697. if err != nil {
  698. log.Fatal(4, "Invalid ROOT_URL '%s': %s", AppURL, err)
  699. }
  700. // Suburl should start with '/' and end without '/', such as '/{subpath}'.
  701. // This value is empty if site does not have sub-url.
  702. AppSubURL = strings.TrimSuffix(url.Path, "/")
  703. AppSubURLDepth = strings.Count(AppSubURL, "/")
  704. // Check if Domain differs from AppURL domain than update it to AppURL's domain
  705. // TODO: Can be replaced with url.Hostname() when minimal GoLang version is 1.8
  706. urlHostname := strings.SplitN(url.Host, ":", 2)[0]
  707. if urlHostname != Domain && net.ParseIP(urlHostname) == nil {
  708. Domain = urlHostname
  709. }
  710. var defaultLocalURL string
  711. switch Protocol {
  712. case UnixSocket:
  713. defaultLocalURL = "http://unix/"
  714. case FCGI:
  715. defaultLocalURL = AppURL
  716. default:
  717. defaultLocalURL = string(Protocol) + "://"
  718. if HTTPAddr == "0.0.0.0" {
  719. defaultLocalURL += "localhost"
  720. } else {
  721. defaultLocalURL += HTTPAddr
  722. }
  723. defaultLocalURL += ":" + HTTPPort + "/"
  724. }
  725. LocalURL = sec.Key("LOCAL_ROOT_URL").MustString(defaultLocalURL)
  726. RedirectOtherPort = sec.Key("REDIRECT_OTHER_PORT").MustBool(false)
  727. PortToRedirect = sec.Key("PORT_TO_REDIRECT").MustString("80")
  728. OfflineMode = sec.Key("OFFLINE_MODE").MustBool()
  729. DisableRouterLog = sec.Key("DISABLE_ROUTER_LOG").MustBool()
  730. StaticRootPath = sec.Key("STATIC_ROOT_PATH").MustString(AppWorkPath)
  731. AppDataPath = sec.Key("APP_DATA_PATH").MustString(path.Join(AppWorkPath, "data"))
  732. EnableGzip = sec.Key("ENABLE_GZIP").MustBool()
  733. EnablePprof = sec.Key("ENABLE_PPROF").MustBool(false)
  734. PprofDataPath = sec.Key("PPROF_DATA_PATH").MustString(path.Join(AppWorkPath, "data/tmp/pprof"))
  735. if !filepath.IsAbs(PprofDataPath) {
  736. PprofDataPath = filepath.Join(AppWorkPath, PprofDataPath)
  737. }
  738. switch sec.Key("LANDING_PAGE").MustString("home") {
  739. case "explore":
  740. LandingPageURL = LandingPageExplore
  741. case "organizations":
  742. LandingPageURL = LandingPageOrganizations
  743. default:
  744. LandingPageURL = LandingPageHome
  745. }
  746. if len(SSH.Domain) == 0 {
  747. SSH.Domain = Domain
  748. }
  749. SSH.RootPath = path.Join(homeDir, ".ssh")
  750. serverCiphers := sec.Key("SSH_SERVER_CIPHERS").Strings(",")
  751. if len(serverCiphers) > 0 {
  752. SSH.ServerCiphers = serverCiphers
  753. }
  754. serverKeyExchanges := sec.Key("SSH_SERVER_KEY_EXCHANGES").Strings(",")
  755. if len(serverKeyExchanges) > 0 {
  756. SSH.ServerKeyExchanges = serverKeyExchanges
  757. }
  758. serverMACs := sec.Key("SSH_SERVER_MACS").Strings(",")
  759. if len(serverMACs) > 0 {
  760. SSH.ServerMACs = serverMACs
  761. }
  762. SSH.KeyTestPath = os.TempDir()
  763. if err = Cfg.Section("server").MapTo(&SSH); err != nil {
  764. log.Fatal(4, "Failed to map SSH settings: %v", err)
  765. }
  766. SSH.KeygenPath = sec.Key("SSH_KEYGEN_PATH").MustString("ssh-keygen")
  767. SSH.Port = sec.Key("SSH_PORT").MustInt(22)
  768. SSH.ListenPort = sec.Key("SSH_LISTEN_PORT").MustInt(SSH.Port)
  769. // When disable SSH, start builtin server value is ignored.
  770. if SSH.Disabled {
  771. SSH.StartBuiltinServer = false
  772. }
  773. if !SSH.Disabled && !SSH.StartBuiltinServer {
  774. if err := os.MkdirAll(SSH.RootPath, 0700); err != nil {
  775. log.Fatal(4, "Failed to create '%s': %v", SSH.RootPath, err)
  776. } else if err = os.MkdirAll(SSH.KeyTestPath, 0644); err != nil {
  777. log.Fatal(4, "Failed to create '%s': %v", SSH.KeyTestPath, err)
  778. }
  779. }
  780. SSH.MinimumKeySizeCheck = sec.Key("MINIMUM_KEY_SIZE_CHECK").MustBool()
  781. SSH.MinimumKeySizes = map[string]int{}
  782. minimumKeySizes := Cfg.Section("ssh.minimum_key_sizes").Keys()
  783. for _, key := range minimumKeySizes {
  784. if key.MustInt() != -1 {
  785. SSH.MinimumKeySizes[strings.ToLower(key.Name())] = key.MustInt()
  786. }
  787. }
  788. SSH.AuthorizedKeysBackup = sec.Key("SSH_AUTHORIZED_KEYS_BACKUP").MustBool(true)
  789. SSH.ExposeAnonymous = sec.Key("SSH_EXPOSE_ANONYMOUS").MustBool(false)
  790. sec = Cfg.Section("server")
  791. if err = sec.MapTo(&LFS); err != nil {
  792. log.Fatal(4, "Failed to map LFS settings: %v", err)
  793. }
  794. LFS.ContentPath = sec.Key("LFS_CONTENT_PATH").MustString(filepath.Join(AppDataPath, "lfs"))
  795. if !filepath.IsAbs(LFS.ContentPath) {
  796. LFS.ContentPath = filepath.Join(AppWorkPath, LFS.ContentPath)
  797. }
  798. LFS.HTTPAuthExpiry = sec.Key("LFS_HTTP_AUTH_EXPIRY").MustDuration(20 * time.Minute)
  799. if LFS.StartServer {
  800. if err := os.MkdirAll(LFS.ContentPath, 0700); err != nil {
  801. log.Fatal(4, "Failed to create '%s': %v", LFS.ContentPath, err)
  802. }
  803. LFS.JWTSecretBytes = make([]byte, 32)
  804. n, err := base64.RawURLEncoding.Decode(LFS.JWTSecretBytes, []byte(LFS.JWTSecretBase64))
  805. if err != nil || n != 32 {
  806. LFS.JWTSecretBase64, err = generate.NewLfsJwtSecret()
  807. if err != nil {
  808. log.Fatal(4, "Error generating JWT Secret for custom config: %v", err)
  809. return
  810. }
  811. // Save secret
  812. cfg := ini.Empty()
  813. if com.IsFile(CustomConf) {
  814. // Keeps custom settings if there is already something.
  815. if err := cfg.Append(CustomConf); err != nil {
  816. log.Error(4, "Failed to load custom conf '%s': %v", CustomConf, err)
  817. }
  818. }
  819. cfg.Section("server").Key("LFS_JWT_SECRET").SetValue(LFS.JWTSecretBase64)
  820. if err := os.MkdirAll(filepath.Dir(CustomConf), os.ModePerm); err != nil {
  821. log.Fatal(4, "Failed to create '%s': %v", CustomConf, err)
  822. }
  823. if err := cfg.SaveTo(CustomConf); err != nil {
  824. log.Fatal(4, "Error saving generated JWT Secret to custom config: %v", err)
  825. return
  826. }
  827. }
  828. //Disable LFS client hooks if installed for the current OS user
  829. //Needs at least git v2.1.2
  830. binVersion, err := git.BinVersion()
  831. if err != nil {
  832. log.Fatal(4, "Error retrieving git version: %v", err)
  833. }
  834. splitVersion := strings.SplitN(binVersion, ".", 4)
  835. majorVersion, err := strconv.ParseUint(splitVersion[0], 10, 64)
  836. if err != nil {
  837. log.Fatal(4, "Error parsing git major version: %v", err)
  838. }
  839. minorVersion, err := strconv.ParseUint(splitVersion[1], 10, 64)
  840. if err != nil {
  841. log.Fatal(4, "Error parsing git minor version: %v", err)
  842. }
  843. revisionVersion, err := strconv.ParseUint(splitVersion[2], 10, 64)
  844. if err != nil {
  845. log.Fatal(4, "Error parsing git revision version: %v", err)
  846. }
  847. if !((majorVersion > 2) || (majorVersion == 2 && minorVersion > 1) ||
  848. (majorVersion == 2 && minorVersion == 1 && revisionVersion >= 2)) {
  849. LFS.StartServer = false
  850. log.Error(4, "LFS server support needs at least Git v2.1.2")
  851. } else {
  852. git.GlobalCommandArgs = append(git.GlobalCommandArgs, "-c", "filter.lfs.required=",
  853. "-c", "filter.lfs.smudge=", "-c", "filter.lfs.clean=")
  854. }
  855. }
  856. sec = Cfg.Section("security")
  857. InstallLock = sec.Key("INSTALL_LOCK").MustBool(false)
  858. SecretKey = sec.Key("SECRET_KEY").MustString("!#@FDEWREWR&*(")
  859. LogInRememberDays = sec.Key("LOGIN_REMEMBER_DAYS").MustInt(7)
  860. CookieUserName = sec.Key("COOKIE_USERNAME").MustString("gitea_awesome")
  861. CookieRememberName = sec.Key("COOKIE_REMEMBER_NAME").MustString("gitea_incredible")
  862. ReverseProxyAuthUser = sec.Key("REVERSE_PROXY_AUTHENTICATION_USER").MustString("X-WEBAUTH-USER")
  863. MinPasswordLength = sec.Key("MIN_PASSWORD_LENGTH").MustInt(6)
  864. ImportLocalPaths = sec.Key("IMPORT_LOCAL_PATHS").MustBool(false)
  865. DisableGitHooks = sec.Key("DISABLE_GIT_HOOKS").MustBool(false)
  866. InternalToken = sec.Key("INTERNAL_TOKEN").String()
  867. if len(InternalToken) == 0 {
  868. InternalToken, err = generate.NewInternalToken()
  869. if err != nil {
  870. log.Fatal(4, "Error generate internal token: %v", err)
  871. }
  872. // Save secret
  873. cfgSave := ini.Empty()
  874. if com.IsFile(CustomConf) {
  875. // Keeps custom settings if there is already something.
  876. if err := cfgSave.Append(CustomConf); err != nil {
  877. log.Error(4, "Failed to load custom conf '%s': %v", CustomConf, err)
  878. }
  879. }
  880. cfgSave.Section("security").Key("INTERNAL_TOKEN").SetValue(InternalToken)
  881. if err := os.MkdirAll(filepath.Dir(CustomConf), os.ModePerm); err != nil {
  882. log.Fatal(4, "Failed to create '%s': %v", CustomConf, err)
  883. }
  884. if err := cfgSave.SaveTo(CustomConf); err != nil {
  885. log.Fatal(4, "Error saving generated JWT Secret to custom config: %v", err)
  886. }
  887. }
  888. IterateBufferSize = Cfg.Section("database").Key("ITERATE_BUFFER_SIZE").MustInt(50)
  889. LogSQL = Cfg.Section("database").Key("LOG_SQL").MustBool(true)
  890. sec = Cfg.Section("attachment")
  891. AttachmentPath = sec.Key("PATH").MustString(path.Join(AppDataPath, "attachments"))
  892. if !filepath.IsAbs(AttachmentPath) {
  893. AttachmentPath = path.Join(AppWorkPath, AttachmentPath)
  894. }
  895. AttachmentAllowedTypes = strings.Replace(sec.Key("ALLOWED_TYPES").MustString("image/jpeg,image/png,application/zip,application/gzip"), "|", ",", -1)
  896. AttachmentMaxSize = sec.Key("MAX_SIZE").MustInt64(4)
  897. AttachmentMaxFiles = sec.Key("MAX_FILES").MustInt(5)
  898. AttachmentEnabled = sec.Key("ENABLED").MustBool(true)
  899. TimeFormatKey := Cfg.Section("time").Key("FORMAT").MustString("RFC1123")
  900. TimeFormat = map[string]string{
  901. "ANSIC": time.ANSIC,
  902. "UnixDate": time.UnixDate,
  903. "RubyDate": time.RubyDate,
  904. "RFC822": time.RFC822,
  905. "RFC822Z": time.RFC822Z,
  906. "RFC850": time.RFC850,
  907. "RFC1123": time.RFC1123,
  908. "RFC1123Z": time.RFC1123Z,
  909. "RFC3339": time.RFC3339,
  910. "RFC3339Nano": time.RFC3339Nano,
  911. "Kitchen": time.Kitchen,
  912. "Stamp": time.Stamp,
  913. "StampMilli": time.StampMilli,
  914. "StampMicro": time.StampMicro,
  915. "StampNano": time.StampNano,
  916. }[TimeFormatKey]
  917. // When the TimeFormatKey does not exist in the previous map e.g.'2006-01-02 15:04:05'
  918. if len(TimeFormat) == 0 {
  919. TimeFormat = TimeFormatKey
  920. TestTimeFormat, _ := time.Parse(TimeFormat, TimeFormat)
  921. if TestTimeFormat.Format(time.RFC3339) != "2006-01-02T15:04:05Z" {
  922. log.Fatal(4, "Can't create time properly, please check your time format has 2006, 01, 02, 15, 04 and 05")
  923. }
  924. log.Trace("Custom TimeFormat: %s", TimeFormat)
  925. }
  926. RunUser = Cfg.Section("").Key("RUN_USER").MustString(user.CurrentUsername())
  927. // Does not check run user when the install lock is off.
  928. if InstallLock {
  929. currentUser, match := IsRunUserMatchCurrentUser(RunUser)
  930. if !match {
  931. log.Fatal(4, "Expect user '%s' but current user is: %s", RunUser, currentUser)
  932. }
  933. }
  934. SSH.BuiltinServerUser = Cfg.Section("server").Key("BUILTIN_SSH_SERVER_USER").MustString(RunUser)
  935. // Determine and create root git repository path.
  936. sec = Cfg.Section("repository")
  937. Repository.DisableHTTPGit = sec.Key("DISABLE_HTTP_GIT").MustBool()
  938. Repository.UseCompatSSHURI = sec.Key("USE_COMPAT_SSH_URI").MustBool()
  939. Repository.MaxCreationLimit = sec.Key("MAX_CREATION_LIMIT").MustInt(-1)
  940. RepoRootPath = sec.Key("ROOT").MustString(path.Join(homeDir, "gitea-repositories"))
  941. forcePathSeparator(RepoRootPath)
  942. if !filepath.IsAbs(RepoRootPath) {
  943. RepoRootPath = filepath.Join(AppWorkPath, RepoRootPath)
  944. } else {
  945. RepoRootPath = filepath.Clean(RepoRootPath)
  946. }
  947. ScriptType = sec.Key("SCRIPT_TYPE").MustString("bash")
  948. if err = Cfg.Section("repository").MapTo(&Repository); err != nil {
  949. log.Fatal(4, "Failed to map Repository settings: %v", err)
  950. } else if err = Cfg.Section("repository.editor").MapTo(&Repository.Editor); err != nil {
  951. log.Fatal(4, "Failed to map Repository.Editor settings: %v", err)
  952. } else if err = Cfg.Section("repository.upload").MapTo(&Repository.Upload); err != nil {
  953. log.Fatal(4, "Failed to map Repository.Upload settings: %v", err)
  954. } else if err = Cfg.Section("repository.local").MapTo(&Repository.Local); err != nil {
  955. log.Fatal(4, "Failed to map Repository.Local settings: %v", err)
  956. } else if err = Cfg.Section("repository.pull-request").MapTo(&Repository.PullRequest); err != nil {
  957. log.Fatal(4, "Failed to map Repository.PullRequest settings: %v", err)
  958. }
  959. if !filepath.IsAbs(Repository.Upload.TempPath) {
  960. Repository.Upload.TempPath = path.Join(AppWorkPath, Repository.Upload.TempPath)
  961. }
  962. sec = Cfg.Section("picture")
  963. AvatarUploadPath = sec.Key("AVATAR_UPLOAD_PATH").MustString(path.Join(AppDataPath, "avatars"))
  964. forcePathSeparator(AvatarUploadPath)
  965. if !filepath.IsAbs(AvatarUploadPath) {
  966. AvatarUploadPath = path.Join(AppWorkPath, AvatarUploadPath)
  967. }
  968. AvatarMaxWidth = sec.Key("AVATAR_MAX_WIDTH").MustInt(4096)
  969. AvatarMaxHeight = sec.Key("AVATAR_MAX_HEIGHT").MustInt(3072)
  970. switch source := sec.Key("GRAVATAR_SOURCE").MustString("gravatar"); source {
  971. case "duoshuo":
  972. GravatarSource = "http://gravatar.duoshuo.com/avatar/"
  973. case "gravatar":
  974. GravatarSource = "https://secure.gravatar.com/avatar/"
  975. case "libravatar":
  976. GravatarSource = "https://seccdn.libravatar.org/avatar/"
  977. default:
  978. GravatarSource = source
  979. }
  980. DisableGravatar = sec.Key("DISABLE_GRAVATAR").MustBool()
  981. EnableFederatedAvatar = sec.Key("ENABLE_FEDERATED_AVATAR").MustBool(!InstallLock)
  982. if OfflineMode {
  983. DisableGravatar = true
  984. EnableFederatedAvatar = false
  985. }
  986. if DisableGravatar {
  987. EnableFederatedAvatar = false
  988. }
  989. if EnableFederatedAvatar || !DisableGravatar {
  990. GravatarSourceURL, err = url.Parse(GravatarSource)
  991. if err != nil {
  992. log.Fatal(4, "Failed to parse Gravatar URL(%s): %v",
  993. GravatarSource, err)
  994. }
  995. }
  996. if EnableFederatedAvatar {
  997. LibravatarService = libravatar.New()
  998. if GravatarSourceURL.Scheme == "https" {
  999. LibravatarService.SetUseHTTPS(true)
  1000. LibravatarService.SetSecureFallbackHost(GravatarSourceURL.Host)
  1001. } else {
  1002. LibravatarService.SetUseHTTPS(false)
  1003. LibravatarService.SetFallbackHost(GravatarSourceURL.Host)
  1004. }
  1005. }
  1006. if err = Cfg.Section("ui").MapTo(&UI); err != nil {
  1007. log.Fatal(4, "Failed to map UI settings: %v", err)
  1008. } else if err = Cfg.Section("markdown").MapTo(&Markdown); err != nil {
  1009. log.Fatal(4, "Failed to map Markdown settings: %v", err)
  1010. } else if err = Cfg.Section("admin").MapTo(&Admin); err != nil {
  1011. log.Fatal(4, "Fail to map Admin settings: %v", err)
  1012. } else if err = Cfg.Section("cron").MapTo(&Cron); err != nil {
  1013. log.Fatal(4, "Failed to map Cron settings: %v", err)
  1014. } else if err = Cfg.Section("git").MapTo(&Git); err != nil {
  1015. log.Fatal(4, "Failed to map Git settings: %v", err)
  1016. } else if err = Cfg.Section("api").MapTo(&API); err != nil {
  1017. log.Fatal(4, "Failed to map API settings: %v", err)
  1018. }
  1019. sec = Cfg.Section("mirror")
  1020. Mirror.MinInterval = sec.Key("MIN_INTERVAL").MustDuration(10 * time.Minute)
  1021. Mirror.DefaultInterval = sec.Key("DEFAULT_INTERVAL").MustDuration(8 * time.Hour)
  1022. if Mirror.MinInterval.Minutes() < 1 {
  1023. log.Warn("Mirror.MinInterval is too low")
  1024. Mirror.MinInterval = 1 * time.Minute
  1025. }
  1026. if Mirror.DefaultInterval < Mirror.MinInterval {
  1027. log.Warn("Mirror.DefaultInterval is less than Mirror.MinInterval")
  1028. Mirror.DefaultInterval = time.Hour * 8
  1029. }
  1030. Langs = Cfg.Section("i18n").Key("LANGS").Strings(",")
  1031. if len(Langs) == 0 {
  1032. Langs = defaultLangs
  1033. }
  1034. Names = Cfg.Section("i18n").Key("NAMES").Strings(",")
  1035. if len(Names) == 0 {
  1036. Names = defaultLangNames
  1037. }
  1038. dateLangs = Cfg.Section("i18n.datelang").KeysHash()
  1039. ShowFooterBranding = Cfg.Section("other").Key("SHOW_FOOTER_BRANDING").MustBool(false)
  1040. ShowFooterVersion = Cfg.Section("other").Key("SHOW_FOOTER_VERSION").MustBool(true)
  1041. ShowFooterTemplateLoadTime = Cfg.Section("other").Key("SHOW_FOOTER_TEMPLATE_LOAD_TIME").MustBool(true)
  1042. UI.ShowUserEmail = Cfg.Section("ui").Key("SHOW_USER_EMAIL").MustBool(true)
  1043. HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt"))
  1044. extensionReg := regexp.MustCompile(`\.\w`)
  1045. for _, sec := range Cfg.Section("markup").ChildSections() {
  1046. name := strings.TrimPrefix(sec.Name(), "markup.")
  1047. if name == "" {
  1048. log.Warn("name is empty, markup " + sec.Name() + "ignored")
  1049. continue
  1050. }
  1051. extensions := sec.Key("FILE_EXTENSIONS").Strings(",")
  1052. var exts = make([]string, 0, len(extensions))
  1053. for _, extension := range extensions {
  1054. if !extensionReg.MatchString(extension) {
  1055. log.Warn(sec.Name() + " file extension " + extension + " is invalid. Extension ignored")
  1056. } else {
  1057. exts = append(exts, extension)
  1058. }
  1059. }
  1060. if len(exts) == 0 {
  1061. log.Warn(sec.Name() + " file extension is empty, markup " + name + " ignored")
  1062. continue
  1063. }
  1064. command := sec.Key("RENDER_COMMAND").MustString("")
  1065. if command == "" {
  1066. log.Warn(" RENDER_COMMAND is empty, markup " + name + " ignored")
  1067. continue
  1068. }
  1069. ExternalMarkupParsers = append(ExternalMarkupParsers, MarkupParser{
  1070. Enabled: sec.Key("ENABLED").MustBool(false),
  1071. MarkupName: name,
  1072. FileExtensions: exts,
  1073. Command: command,
  1074. IsInputFile: sec.Key("IS_INPUT_FILE").MustBool(false),
  1075. })
  1076. }
  1077. sec = Cfg.Section("U2F")
  1078. U2F.TrustedFacets, _ = shellquote.Split(sec.Key("TRUSTED_FACETS").MustString(strings.TrimRight(AppURL, "/")))
  1079. U2F.AppID = sec.Key("APP_ID").MustString(strings.TrimRight(AppURL, "/"))
  1080. }
  1081. // Service settings
  1082. var Service struct {
  1083. ActiveCodeLives int
  1084. ResetPwdCodeLives int
  1085. RegisterEmailConfirm bool
  1086. DisableRegistration bool
  1087. AllowOnlyExternalRegistration bool
  1088. ShowRegistrationButton bool
  1089. RequireSignInView bool
  1090. EnableNotifyMail bool
  1091. EnableReverseProxyAuth bool
  1092. EnableReverseProxyAutoRegister bool
  1093. EnableCaptcha bool
  1094. CaptchaType string
  1095. RecaptchaSecret string
  1096. RecaptchaSitekey string
  1097. DefaultKeepEmailPrivate bool
  1098. DefaultAllowCreateOrganization bool
  1099. EnableTimetracking bool
  1100. DefaultEnableTimetracking bool
  1101. DefaultEnableDependencies bool
  1102. DefaultAllowOnlyContributorsToTrackTime bool
  1103. NoReplyAddress string
  1104. EnableUserHeatmap bool
  1105. // OpenID settings
  1106. EnableOpenIDSignIn bool
  1107. EnableOpenIDSignUp bool
  1108. OpenIDWhitelist []*regexp.Regexp
  1109. OpenIDBlacklist []*regexp.Regexp
  1110. }
  1111. func newService() {
  1112. sec := Cfg.Section("service")
  1113. Service.ActiveCodeLives = sec.Key("ACTIVE_CODE_LIVE_MINUTES").MustInt(180)
  1114. Service.ResetPwdCodeLives = sec.Key("RESET_PASSWD_CODE_LIVE_MINUTES").MustInt(180)
  1115. Service.DisableRegistration = sec.Key("DISABLE_REGISTRATION").MustBool()
  1116. Service.AllowOnlyExternalRegistration = sec.Key("ALLOW_ONLY_EXTERNAL_REGISTRATION").MustBool()
  1117. Service.ShowRegistrationButton = sec.Key("SHOW_REGISTRATION_BUTTON").MustBool(!(Service.DisableRegistration || Service.AllowOnlyExternalRegistration))
  1118. Service.RequireSignInView = sec.Key("REQUIRE_SIGNIN_VIEW").MustBool()
  1119. Service.EnableReverseProxyAuth = sec.Key("ENABLE_REVERSE_PROXY_AUTHENTICATION").MustBool()
  1120. Service.EnableReverseProxyAutoRegister = sec.Key("ENABLE_REVERSE_PROXY_AUTO_REGISTRATION").MustBool()
  1121. Service.EnableCaptcha = sec.Key("ENABLE_CAPTCHA").MustBool(false)
  1122. Service.CaptchaType = sec.Key("CAPTCHA_TYPE").MustString(ImageCaptcha)
  1123. Service.RecaptchaSecret = sec.Key("RECAPTCHA_SECRET").MustString("")
  1124. Service.RecaptchaSitekey = sec.Key("RECAPTCHA_SITEKEY").MustString("")
  1125. Service.DefaultKeepEmailPrivate = sec.Key("DEFAULT_KEEP_EMAIL_PRIVATE").MustBool()
  1126. Service.DefaultAllowCreateOrganization = sec.Key("DEFAULT_ALLOW_CREATE_ORGANIZATION").MustBool(true)
  1127. Service.EnableTimetracking = sec.Key("ENABLE_TIMETRACKING").MustBool(true)
  1128. if Service.EnableTimetracking {
  1129. Service.DefaultEnableTimetracking = sec.Key("DEFAULT_ENABLE_TIMETRACKING").MustBool(true)
  1130. }
  1131. Service.DefaultEnableDependencies = sec.Key("DEFAULT_ENABLE_DEPENDENCIES").MustBool(true)
  1132. Service.DefaultAllowOnlyContributorsToTrackTime = sec.Key("DEFAULT_ALLOW_ONLY_CONTRIBUTORS_TO_TRACK_TIME").MustBool(true)
  1133. Service.NoReplyAddress = sec.Key("NO_REPLY_ADDRESS").MustString("noreply.example.org")
  1134. Service.EnableUserHeatmap = sec.Key("ENABLE_USER_HEATMAP").MustBool(true)
  1135. sec = Cfg.Section("openid")
  1136. Service.EnableOpenIDSignIn = sec.Key("ENABLE_OPENID_SIGNIN").MustBool(!InstallLock)
  1137. Service.EnableOpenIDSignUp = sec.Key("ENABLE_OPENID_SIGNUP").MustBool(!Service.DisableRegistration && Service.EnableOpenIDSignIn)
  1138. pats := sec.Key("WHITELISTED_URIS").Strings(" ")
  1139. if len(pats) != 0 {
  1140. Service.OpenIDWhitelist = make([]*regexp.Regexp, len(pats))
  1141. for i, p := range pats {
  1142. Service.OpenIDWhitelist[i] = regexp.MustCompilePOSIX(p)
  1143. }
  1144. }
  1145. pats = sec.Key("BLACKLISTED_URIS").Strings(" ")
  1146. if len(pats) != 0 {
  1147. Service.OpenIDBlacklist = make([]*regexp.Regexp, len(pats))
  1148. for i, p := range pats {
  1149. Service.OpenIDBlacklist[i] = regexp.MustCompilePOSIX(p)
  1150. }
  1151. }
  1152. }
  1153. var logLevels = map[string]string{
  1154. "Trace": "0",
  1155. "Debug": "1",
  1156. "Info": "2",
  1157. "Warn": "3",
  1158. "Error": "4",
  1159. "Critical": "5",
  1160. }
  1161. func getLogLevel(section string, key string, defaultValue string) string {
  1162. validLevels := []string{"Trace", "Debug", "Info", "Warn", "Error", "Critical"}
  1163. return Cfg.Section(section).Key(key).In(defaultValue, validLevels)
  1164. }
  1165. func newLogService() {
  1166. log.Info("Gitea v%s%s", AppVer, AppBuiltWith)
  1167. LogModes = strings.Split(Cfg.Section("log").Key("MODE").MustString("console"), ",")
  1168. LogConfigs = make([]string, len(LogModes))
  1169. useConsole := false
  1170. for i := 0; i < len(LogModes); i++ {
  1171. LogModes[i] = strings.TrimSpace(LogModes[i])
  1172. if LogModes[i] == "console" {
  1173. useConsole = true
  1174. }
  1175. }
  1176. if !useConsole {
  1177. log.DelLogger("console")
  1178. }
  1179. for i, mode := range LogModes {
  1180. sec, err := Cfg.GetSection("log." + mode)
  1181. if err != nil {
  1182. sec, _ = Cfg.NewSection("log." + mode)
  1183. }
  1184. // Log level.
  1185. levelName := getLogLevel("log."+mode, "LEVEL", LogLevel)
  1186. level, ok := logLevels[levelName]
  1187. if !ok {
  1188. log.Fatal(4, "Unknown log level: %s", levelName)
  1189. }
  1190. // Generate log configuration.
  1191. switch mode {
  1192. case "console":
  1193. LogConfigs[i] = fmt.Sprintf(`{"level":%s}`, level)
  1194. case "file":
  1195. logPath := sec.Key("FILE_NAME").MustString(path.Join(LogRootPath, "gitea.log"))
  1196. if err = os.MkdirAll(path.Dir(logPath), os.ModePerm); err != nil {
  1197. panic(err.Error())
  1198. }
  1199. LogConfigs[i] = fmt.Sprintf(
  1200. `{"level":%s,"filename":"%s","rotate":%v,"maxlines":%d,"maxsize":%d,"daily":%v,"maxdays":%d}`, level,
  1201. logPath,
  1202. sec.Key("LOG_ROTATE").MustBool(true),
  1203. sec.Key("MAX_LINES").MustInt(1000000),
  1204. 1<<uint(sec.Key("MAX_SIZE_SHIFT").MustInt(28)),
  1205. sec.Key("DAILY_ROTATE").MustBool(true),
  1206. sec.Key("MAX_DAYS").MustInt(7))
  1207. case "conn":
  1208. LogConfigs[i] = fmt.Sprintf(`{"level":%s,"reconnectOnMsg":%v,"reconnect":%v,"net":"%s","addr":"%s"}`, level,
  1209. sec.Key("RECONNECT_ON_MSG").MustBool(),
  1210. sec.Key("RECONNECT").MustBool(),
  1211. sec.Key("PROTOCOL").In("tcp", []string{"tcp", "unix", "udp"}),
  1212. sec.Key("ADDR").MustString(":7020"))
  1213. case "smtp":
  1214. LogConfigs[i] = fmt.Sprintf(`{"level":%s,"username":"%s","password":"%s","host":"%s","sendTos":["%s"],"subject":"%s"}`, level,
  1215. sec.Key("USER").MustString("example@example.com"),
  1216. sec.Key("PASSWD").MustString("******"),
  1217. sec.Key("HOST").MustString("127.0.0.1:25"),
  1218. strings.Replace(sec.Key("RECEIVERS").MustString("example@example.com"), ",", "\",\"", -1),
  1219. sec.Key("SUBJECT").MustString("Diagnostic message from serve"))
  1220. case "database":
  1221. LogConfigs[i] = fmt.Sprintf(`{"level":%s,"driver":"%s","conn":"%s"}`, level,
  1222. sec.Key("DRIVER").String(),
  1223. sec.Key("CONN").String())
  1224. }
  1225. log.NewLogger(Cfg.Section("log").Key("BUFFER_LEN").MustInt64(10000), mode, LogConfigs[i])
  1226. log.Info("Log Mode: %s(%s)", strings.Title(mode), levelName)
  1227. }
  1228. }
  1229. // NewXORMLogService initializes xorm logger service
  1230. func NewXORMLogService(disableConsole bool) {
  1231. logModes := strings.Split(Cfg.Section("log").Key("MODE").MustString("console"), ",")
  1232. var logConfigs string
  1233. for _, mode := range logModes {
  1234. mode = strings.TrimSpace(mode)
  1235. if disableConsole && mode == "console" {
  1236. continue
  1237. }
  1238. sec, err := Cfg.GetSection("log." + mode)
  1239. if err != nil {
  1240. sec, _ = Cfg.NewSection("log." + mode)
  1241. }
  1242. // Log level.
  1243. levelName := getLogLevel("log."+mode, "LEVEL", LogLevel)
  1244. level, ok := logLevels[levelName]
  1245. if !ok {
  1246. log.Fatal(4, "Unknown log level: %s", levelName)
  1247. }
  1248. // Generate log configuration.
  1249. switch mode {
  1250. case "console":
  1251. logConfigs = fmt.Sprintf(`{"level":%s}`, level)
  1252. case "file":
  1253. logPath := sec.Key("FILE_NAME").MustString(path.Join(LogRootPath, "xorm.log"))
  1254. if err = os.MkdirAll(path.Dir(logPath), os.ModePerm); err != nil {
  1255. panic(err.Error())
  1256. }
  1257. logPath = path.Join(filepath.Dir(logPath), "xorm.log")
  1258. logConfigs = fmt.Sprintf(
  1259. `{"level":%s,"filename":"%s","rotate":%v,"maxlines":%d,"maxsize":%d,"daily":%v,"maxdays":%d}`, level,
  1260. logPath,
  1261. sec.Key("LOG_ROTATE").MustBool(true),
  1262. sec.Key("MAX_LINES").MustInt(1000000),
  1263. 1<<uint(sec.Key("MAX_SIZE_SHIFT").MustInt(28)),
  1264. sec.Key("DAILY_ROTATE").MustBool(true),
  1265. sec.Key("MAX_DAYS").MustInt(7))
  1266. case "conn":
  1267. logConfigs = fmt.Sprintf(`{"level":%s,"reconnectOnMsg":%v,"reconnect":%v,"net":"%s","addr":"%s"}`, level,
  1268. sec.Key("RECONNECT_ON_MSG").MustBool(),
  1269. sec.Key("RECONNECT").MustBool(),
  1270. sec.Key("PROTOCOL").In("tcp", []string{"tcp", "unix", "udp"}),
  1271. sec.Key("ADDR").MustString(":7020"))
  1272. case "smtp":
  1273. logConfigs = fmt.Sprintf(`{"level":%s,"username":"%s","password":"%s","host":"%s","sendTos":"%s","subject":"%s"}`, level,
  1274. sec.Key("USER").MustString("example@example.com"),
  1275. sec.Key("PASSWD").MustString("******"),
  1276. sec.Key("HOST").MustString("127.0.0.1:25"),
  1277. sec.Key("RECEIVERS").MustString("[]"),
  1278. sec.Key("SUBJECT").MustString("Diagnostic message from serve"))
  1279. case "database":
  1280. logConfigs = fmt.Sprintf(`{"level":%s,"driver":"%s","conn":"%s"}`, level,
  1281. sec.Key("DRIVER").String(),
  1282. sec.Key("CONN").String())
  1283. }
  1284. log.NewXORMLogger(Cfg.Section("log").Key("BUFFER_LEN").MustInt64(10000), mode, logConfigs)
  1285. if !disableConsole {
  1286. log.Info("XORM Log Mode: %s(%s)", strings.Title(mode), levelName)
  1287. }
  1288. var lvl core.LogLevel
  1289. switch levelName {
  1290. case "Trace", "Debug":
  1291. lvl = core.LOG_DEBUG
  1292. case "Info":
  1293. lvl = core.LOG_INFO
  1294. case "Warn":
  1295. lvl = core.LOG_WARNING
  1296. case "Error", "Critical":
  1297. lvl = core.LOG_ERR
  1298. }
  1299. log.XORMLogger.SetLevel(lvl)
  1300. }
  1301. if len(logConfigs) == 0 {
  1302. log.DiscardXORMLogger()
  1303. }
  1304. }
  1305. // Cache represents cache settings
  1306. type Cache struct {
  1307. Adapter string
  1308. Interval int
  1309. Conn string
  1310. TTL time.Duration
  1311. }
  1312. var (
  1313. // CacheService the global cache
  1314. CacheService *Cache
  1315. )
  1316. func newCacheService() {
  1317. sec := Cfg.Section("cache")
  1318. CacheService = &Cache{
  1319. Adapter: sec.Key("ADAPTER").In("memory", []string{"memory", "redis", "memcache"}),
  1320. }
  1321. switch CacheService.Adapter {
  1322. case "memory":
  1323. CacheService.Interval = sec.Key("INTERVAL").MustInt(60)
  1324. case "redis", "memcache":
  1325. CacheService.Conn = strings.Trim(sec.Key("HOST").String(), "\" ")
  1326. default:
  1327. log.Fatal(4, "Unknown cache adapter: %s", CacheService.Adapter)
  1328. }
  1329. CacheService.TTL = sec.Key("ITEM_TTL").MustDuration(16 * time.Hour)
  1330. log.Info("Cache Service Enabled")
  1331. }
  1332. func newSessionService() {
  1333. SessionConfig.Provider = Cfg.Section("session").Key("PROVIDER").In("memory",
  1334. []string{"memory", "file", "redis", "mysql"})
  1335. SessionConfig.ProviderConfig = strings.Trim(Cfg.Section("session").Key("PROVIDER_CONFIG").MustString(path.Join(AppDataPath, "sessions")), "\" ")
  1336. if SessionConfig.Provider == "file" && !filepath.IsAbs(SessionConfig.ProviderConfig) {
  1337. SessionConfig.ProviderConfig = path.Join(AppWorkPath, SessionConfig.ProviderConfig)
  1338. }
  1339. SessionConfig.CookieName = Cfg.Section("session").Key("COOKIE_NAME").MustString("i_like_gitea")
  1340. SessionConfig.CookiePath = AppSubURL
  1341. SessionConfig.Secure = Cfg.Section("session").Key("COOKIE_SECURE").MustBool(false)
  1342. SessionConfig.Gclifetime = Cfg.Section("session").Key("GC_INTERVAL_TIME").MustInt64(86400)
  1343. SessionConfig.Maxlifetime = Cfg.Section("session").Key("SESSION_LIFE_TIME").MustInt64(86400)
  1344. log.Info("Session Service Enabled")
  1345. }
  1346. // Mailer represents mail service.
  1347. type Mailer struct {
  1348. // Mailer
  1349. QueueLength int
  1350. Name string
  1351. From string
  1352. FromName string
  1353. FromEmail string
  1354. SendAsPlainText bool
  1355. // SMTP sender
  1356. Host string
  1357. User, Passwd string
  1358. DisableHelo bool
  1359. HeloHostname string
  1360. SkipVerify bool
  1361. UseCertificate bool
  1362. CertFile, KeyFile string
  1363. // Sendmail sender
  1364. UseSendmail bool
  1365. SendmailPath string
  1366. SendmailArgs []string
  1367. }
  1368. var (
  1369. // MailService the global mailer
  1370. MailService *Mailer
  1371. )
  1372. func newMailService() {
  1373. sec := Cfg.Section("mailer")
  1374. // Check mailer setting.
  1375. if !sec.Key("ENABLED").MustBool() {
  1376. return
  1377. }
  1378. MailService = &Mailer{
  1379. QueueLength: sec.Key("SEND_BUFFER_LEN").MustInt(100),
  1380. Name: sec.Key("NAME").MustString(AppName),
  1381. SendAsPlainText: sec.Key("SEND_AS_PLAIN_TEXT").MustBool(false),
  1382. Host: sec.Key("HOST").String(),
  1383. User: sec.Key("USER").String(),
  1384. Passwd: sec.Key("PASSWD").String(),
  1385. DisableHelo: sec.Key("DISABLE_HELO").MustBool(),
  1386. HeloHostname: sec.Key("HELO_HOSTNAME").String(),
  1387. SkipVerify: sec.Key("SKIP_VERIFY").MustBool(),
  1388. UseCertificate: sec.Key("USE_CERTIFICATE").MustBool(),
  1389. CertFile: sec.Key("CERT_FILE").String(),
  1390. KeyFile: sec.Key("KEY_FILE").String(),
  1391. UseSendmail: sec.Key("USE_SENDMAIL").MustBool(),
  1392. SendmailPath: sec.Key("SENDMAIL_PATH").MustString("sendmail"),
  1393. }
  1394. MailService.From = sec.Key("FROM").MustString(MailService.User)
  1395. if sec.HasKey("ENABLE_HTML_ALTERNATIVE") {
  1396. log.Warn("ENABLE_HTML_ALTERNATIVE is deprecated, use SEND_AS_PLAIN_TEXT")
  1397. MailService.SendAsPlainText = !sec.Key("ENABLE_HTML_ALTERNATIVE").MustBool(false)
  1398. }
  1399. parsed, err := mail.ParseAddress(MailService.From)
  1400. if err != nil {
  1401. log.Fatal(4, "Invalid mailer.FROM (%s): %v", MailService.From, err)
  1402. }
  1403. MailService.FromName = parsed.Name
  1404. MailService.FromEmail = parsed.Address
  1405. if MailService.UseSendmail {
  1406. MailService.SendmailArgs, err = shellquote.Split(sec.Key("SENDMAIL_ARGS").String())
  1407. if err != nil {
  1408. log.Error(4, "Failed to parse Sendmail args: %v", CustomConf, err)
  1409. }
  1410. }
  1411. log.Info("Mail Service Enabled")
  1412. }
  1413. func newRegisterMailService() {
  1414. if !Cfg.Section("service").Key("REGISTER_EMAIL_CONFIRM").MustBool() {
  1415. return
  1416. } else if MailService == nil {
  1417. log.Warn("Register Mail Service: Mail Service is not enabled")
  1418. return
  1419. }
  1420. Service.RegisterEmailConfirm = true
  1421. log.Info("Register Mail Service Enabled")
  1422. }
  1423. func newNotifyMailService() {
  1424. if !Cfg.Section("service").Key("ENABLE_NOTIFY_MAIL").MustBool() {
  1425. return
  1426. } else if MailService == nil {
  1427. log.Warn("Notify Mail Service: Mail Service is not enabled")
  1428. return
  1429. }
  1430. Service.EnableNotifyMail = true
  1431. log.Info("Notify Mail Service Enabled")
  1432. }
  1433. func newWebhookService() {
  1434. sec := Cfg.Section("webhook")
  1435. Webhook.QueueLength = sec.Key("QUEUE_LENGTH").MustInt(1000)
  1436. Webhook.DeliverTimeout = sec.Key("DELIVER_TIMEOUT").MustInt(5)
  1437. Webhook.SkipTLSVerify = sec.Key("SKIP_TLS_VERIFY").MustBool()
  1438. Webhook.Types = []string{"gitea", "gogs", "slack", "discord", "dingtalk"}
  1439. Webhook.PagingNum = sec.Key("PAGING_NUM").MustInt(10)
  1440. }
  1441. // NewServices initializes the services
  1442. func NewServices() {
  1443. newService()
  1444. newLogService()
  1445. NewXORMLogService(false)
  1446. newCacheService()
  1447. newSessionService()
  1448. newMailService()
  1449. newRegisterMailService()
  1450. newNotifyMailService()
  1451. newWebhookService()
  1452. }