summaryrefslogtreecommitdiffstats
path: root/modules/base/tool.go
Commit message (Collapse)AuthorAgeFilesLines
* Convert files to utf-8 for indexing (#7814)guillep2k2019-08-151-49/+0
| | | | | | | | | | | | | | * Convert files to utf-8 for indexing * Move utf8 functions to modules/base * Bump repoIndexerLatestVersion to 3 * Add tests for base/encoding.go * Changes to pass gosimple * Move UTF8 funcs into new modules/charset package
* Add golangci (#6418)kolaente2019-06-121-19/+9
|
* refactor: append, build variable and type switch (#4940)Bo-Yi Wu2019-05-281-16/+16
| | | | | | * refactor: append, build variable and type switch * fix: remove redundant space.
* Hash App token (#6724)techknowlogick2019-05-041-0/+8
|
* UI: Detect and restore encoding and BOM in content (#6727)zeripath2019-04-261-0/+12
| | | | | | | | | | | | | | | | | | | | | | * detect and remove a decoded BOM Signed-off-by: Andrew Thornton <art27@cantab.net> * Restore the previous encoding and BOM * On error keep as UTF-8 Signed-off-by: Andrew Thornton <art27@cantab.net> * create remove BOM function * Deal with LFSed content * Update modules/repofiles/update.go * Fix final LFS bug * Keep LFS sections referring to opts.Content
* Fixes 4762 - Content API for Creating, Updating, Deleting Files (#6314)Richard Mahn2019-04-171-0/+25
|
* Better logging (#6038) (#6095)zeripath2019-04-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Panic don't fatal on create new logger Fixes #5854 Signed-off-by: Andrew Thornton <art27@cantab.net> * partial broken * Update the logging infrastrcture Signed-off-by: Andrew Thornton <art27@cantab.net> * Reset the skip levels for Fatal and Error Signed-off-by: Andrew Thornton <art27@cantab.net> * broken ncsa * More log.Error fixes Signed-off-by: Andrew Thornton <art27@cantab.net> * Remove nal * set log-levels to lowercase * Make console_test test all levels * switch to lowercased levels * OK now working * Fix vetting issues * Fix lint * Fix tests * change default logging to match current gitea * Improve log testing Signed-off-by: Andrew Thornton <art27@cantab.net> * reset error skip levels to 0 * Update documentation and access logger configuration * Redirect the router log back to gitea if redirect macaron log but also allow setting the log level - i.e. TRACE * Fix broken level caching * Refactor the router log * Add Router logger * Add colorizing options * Adjust router colors * Only create logger if they will be used * update app.ini.sample * rename Attribute ColorAttribute * Change from white to green for function * Set fatal/error levels * Restore initial trace logger * Fix Trace arguments in modules/auth/auth.go * Properly handle XORMLogger * Improve admin/config page * fix fmt * Add auto-compression of old logs * Update error log levels * Remove the unnecessary skip argument from Error, Fatal and Critical * Add stacktrace support * Fix tests * Remove x/sync from vendors? * Add stderr option to console logger * Use filepath.ToSlash to protect against Windows in tests * Remove prefixed underscores from names in colors.go * Remove not implemented database logger This was removed from Gogs on 4 Mar 2016 but left in the configuration since then. * Ensure that log paths are relative to ROOT_PATH * use path.Join * rename jsonConfig to logConfig * Rename "config" to "jsonConfig" to make it clearer * Requested changes * Requested changes: XormLogger * Try to color the windows terminal If successful default to colorizing the console logs * fixup * Colorize initially too * update vendor * Colorize logs on default and remove if this is not a colorizing logger * Fix documentation * fix test * Use go-isatty to detect if on windows we are on msys or cygwin * Fix spelling mistake * Add missing vendors * More changes * Rationalise the ANSI writer protection * Adjust colors on advice from @0x5c * Make Flags a comma separated list * Move to use the windows constant for ENABLE_VIRTUAL_TERMINAL_PROCESSING * Ensure matching is done on the non-colored message - to simpify EXPRESSION
* move code.gitea.io/git to code.gitea.io/gitea/modules/git (#6364)Lunny Xiao2019-03-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * move code.gitea.io/git to code.gitea.io/gitea/modules/git * fix imports * fix fmt * fix misspell * remove wrong tests data * fix unit tests * fix tests * fix tests * fix tests * fix tests * fix tests * enable Debug to trace the failure tests * fix tests * fix tests * fix tests * fix tests * fix tests * comment commit count tests since git clone depth is 50 * fix tests * update from code.gitea.io/git * revert change to makefile
* Serve audio files using HTML5 audio tag (#5221)Jonas Bröms2018-10-301-0/+5
| | | | | | * Serve audio files using HTML5 audio tag * Correct copy paste error
* Use type switch (#5122)Oleg Kovalov2018-10-191-16/+16
|
* Detect charset and convert non UTF-8 files for display (#4950)Lauris BH2018-09-291-1/+16
| | | | | | | | | | | | | | * Detect charset and convert non UTF-8 files for display * Refactor and move function to correct module * Revert unrelated changes * More unrelated changes * Duplicate content for small text to have better encoding detection * Check if original content is valid before duplicating it
* Symlink icons (#1416) (#3826)Tris Forster2018-05-011-0/+23
| | | | | | | | | | | | * Updated vendor code for code.gitea.io/git * Display symlinks correctly for files and directories * Added symlink tests * Applied silverwinds stylesheet patch Signed-off-by: Tris Forster <tris.git@shoddynet.org>
* Implements generator cli for secrets (#3531)Codruț Constantin Gușoi2018-02-181-29/+0
| | | Signed-off-by: Codruț Constantin Gușoi <codrut.gusoi@gmail.com>
* Refactor struct's time to remove unnecessary memory usage (#3142)Lunny Xiao2017-12-111-3/+19
| | | | | | | | | | | | | | * refactor struct's time to remove unnecessary memory usage * use AsTimePtr simple code * fix tests * fix time compare * fix template on gpg * use AddDuration instead of Add
* Fix avatar URLs (#3069)Ethan Koenig2017-12-031-10/+47
| | | | | | * Fix avatar URLs * import order
* Use identicon image for default gravatar. (#2767)harry2017-10-231-1/+1
| | | | | | * Use identicon image for default gravatar. * Fixed tests.
* improve protected branch to add whitelist support (#2451)Lunny Xiao2017-09-141-0/+10
| | | | | | | | | | | | | | | | | | | | * improve protected branch to add whitelist support * fix lint * fix style check * fix tests * fix description on UI and import * fix test * bug fixed * fix tests and languages * move isSliceInt64Eq to util pkg; improve function names & typo
* lintEthan Koenig2017-06-291-0/+1
|
* Use default avatar on errorEthan Koenig2017-06-291-1/+6
|
* Don't ignore gravatar errorEthan Koenig2017-06-291-2/+4
|
* Make time diff translatable (#2057)Lauris BH2017-06-281-63/+30
|
* xxx_active_code_live setting in printed in hours and minutes instead … (#1814)Jonas Östanbäck2017-05-291-0/+7
| | | | | | * xxx_active_code_live setting in printed in hours and minutes instead of just hours * Update app.ini description of xxx_code_lives settings
* fix some typos (#1082)Lunny Xiao2017-02-281-3/+3
|
* Cleanup log messagingGabriel Jackson2017-02-021-1/+1
| | | | | | | | | This change corrects a few logging issues: * Standardized formatting errors with '%v'. * Standardized failure warning word usage. * Corrected an instance of using the standard log library when the gitea log library should be used instead.
* Git LFS support v2 (#122)Fabian Zaremba2016-12-261-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Bug fixes and tests for modules/base (#442)Ethan Koenig2016-12-221-14/+31
| | | Also address other TODOs
* Fix random string generator (#384)Denis Denisov2016-12-201-9/+23
| | | | | | | | | | | * Remove unused custom-alphabet feature of random string generator Fix random string generator Random string generator should return error if it fails to read random data via crypto/rand * Fixes variable (un)initialization mixed assign Update test GetRandomString
* serve video files using the HTML5 video tag (#418)Nico Mandery2016-12-201-0/+5
| | | | | | * serve video files using the HTML5 video tag * lint fix: add comment to IsVideoFile
* Don't use custom PBKDF2 function (#382)Lunny Xiao2016-12-151-41/+0
|
* Golint fixed for modules/setting (#262)Lunny Xiao2016-11-271-1/+1
| | | | | | * golint fixed for modules/setting * typo fixed and renamed UNIXSOCKET to UnixSocket
* golint fixed for modules/baseLunny Xiao2016-11-241-7/+14
|
* Normalize files with gofmtThibault Meyer2016-11-111-2/+2
|
* Update import paths from github.com/go-gitea to code.gitea.io (#135)Sandro Santilli2016-11-101-2/+2
| | | | | | | - Update import paths from github.com/go-gitea to code.gitea.io - Fix import path for travis See https://docs.travis-ci.com/user/languages/go#Go-Import-Path
* Make long godoc comment 2 linesMatthias Loibl2016-11-071-1/+2
|
* Add tests for StringsToInt64s() & Int64sToStrings()Matthias Loibl2016-11-071-1/+2
|
* Use TruncateString(sha1,10) in ShortSha and deprecate it.Matthias Loibl2016-11-071-4/+2
|
* Add tests for EllipsisString() and fix bug if param length < 3Matthias Loibl2016-11-071-1/+4
|
* Test AvatarLink and refactor with tests passingMatthias Loibl2016-11-071-12/+9
|
* Start to add tests for modules/base/toolMatthias Loibl2016-11-071-7/+2
|
* Change import reference to match gitea instead of gogs (#37)Rémy Boulanouar2016-11-031-2/+2
|
* #3559 fix template errorUnknwon2016-08-311-0/+4
|
* router/repo: code refactoringUnknwon2016-08-301-18/+6
|
* Fix #3321: commit tag shortener (#3418)Thibault Meyer2016-08-111-1/+1
| | | | | | | | | | | | * Fix #3321: commit tag shortener * Check short commit * remove debug * Edit unit tests * Show 10-char short SHA
* #3320 code cleanupUnknwon2016-08-071-14/+11
|
* Add support for federated avatars (#3320)Sandro Santilli2016-08-071-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Use a gopher as default avatar (rather than the gravatar logo) (#3208)Sandro Santilli2016-06-271-1/+1
| | | | | | | | | | | | Also changes the avatar from a jpeg to a png, to allow for transparent background. The indexed png is also smaller in size. Note that at the moment the default avatar is only used when the user requested a custom avatar and the custom avatar file is not found (should never happen). In the future the default avatar could be used as a default return when by-mail avatar lookups fail too (both gravatar and libravatar support passing a default)
* PDF-Previews in file-lists now working (#3000)Kim Carlbäcker2016-04-261-0/+8
|
* Fix ref comment from commit create empty feedUnknwon2016-03-111-0/+1
|
* #1157 some avatar setting changesUnknwon2016-03-051-0/+9
| | | | - Allow to delete current avatar
* Make markdown as an independent moduleUnknwon2016-02-201-16/+24
|