summaryrefslogtreecommitdiffstats
path: root/modules/base
Commit message (Collapse)AuthorAgeFilesLines
* Update JS dependencies (#19281)silverwind2022-04-011-1/+1
| | | | | | - Upgrade all JS dependencies minus vue and vue-loader - Adapt to breaking change of octicons - Update eslint rules - Tested Swagger UI, sortablejs and prod build
* format with gofumpt (#18184)65432022-01-201-1/+1
| | | | | | | | | | | * gofumpt -w -l . * gofumpt -w -l -extra . * Add linter * manual fix * change make fmt
* Simplify parameter types (#18006)Gusted2021-12-201-1/+1
| | | Remove repeated type declarations in function definitions.
* Fixed assert statements. (#16089)KN4CK3R2021-06-071-4/+4
|
* Add Image Diff for SVG files (#14867)KN4CK3R2021-06-052-160/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Added type sniffer. * Switched content detection from base to typesniffer. * Added GuessContentType to Blob. * Moved image info logic to client. Added support for SVG images in diff. * Restore old blocked svg behaviour. * Added missing image formats. * Execute image diff only when container is visible. * add margin to spinner * improve BIN tag on image diffs * Default to render view. * Show image diff on incomplete diff. Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* fix truncate utf8 string (#15828)yan2021-05-132-4/+13
| | | | | * fix truncate utf8 string. * revoke truncated user info.
* Add some Unit-Tests (#14500)65432021-01-283-9/+96
| | | | | | | | | | | * fix url * modules/auth/pa: coverage: 40#.0% * modules/base coverage: 67.6% -> 89.9% * modules/cache coverage: 0% -> 12.0% * modules/convert coverage: 27.1% -> 29.7%
* Kd/fix allow svg doctype (#14344)Kyle D2021-01-152-2/+10
| | | | | | | | | * make svg regex case-insensitive & use strict word boundary * allow doctype svg * add doctype tests * allow <!DOCTYPE svg> and <svg/>
* Display SVG files as images instead of text (#14101)Jonathan Tran2021-01-122-5/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Change to display SVG files as images * Remove unsafe styles from SVG CSP * Add integration test to test SVG headers * Add config setting to disable SVG rendering * Add test for img tag when loading SVG image * Remove the Raw view button for svg files since we don't fully support this * Fix copyright year * Rename and move config setting * Add setting to cheat sheet in docs * Fix so that comment matches cheat sheet * Add allowing styles in CSP based on pull request feedback * Re-enable raw button since we show SVG styles now * Change so that SVG files are editable * Add UI to toggle between source and rendered image for SVGs * Change to show blame button for SVG images * Fix to update ctx data * Add test for DetectContentType when file is longer than sniffLen Co-authored-by: Jonathan Tran <jon@allspice.io> Co-authored-by: Kyle D <kdumontnu@gmail.com>
* migrate from com.* to alternatives (#14103)65432020-12-251-5/+4
| | | | | | | | | | | | | | | * remove github.com/unknwon/com from models * dont use "com.ToStr()" * replace "com.ToStr" with "fmt.Sprint" where its easy to do * more refactor * fix test * just "proxy" Copy func for now * as per @lunny
* Fix panic in BasicAuthDecode (#14046)silverwind2020-12-172-0/+12
| | | | | | | | | | * Fix panic in BasicAuthDecode If the string does not contain ":" that function would run into an `index out of range [1] with length 1` error. prevent that. * Update BasicAuthDecode() Co-authored-by: 6543 <6543@obermui.de>
* Direct avatar rendering (#13649)silverwind2020-12-032-130/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Direct avatar rendering This adds new template helpers for avatar rendering which output image elements with direct links to avatars which makes them cacheable by the browsers. This should be a major performance improvment for pages with many avatars. * fix avatars of other user's profile pages * fix top border on user avatar name * uncircle avatars * remove old incomplete avatar selector * use title attribute for name and add it back on blame * minor refactor * tweak comments * fix url path join and adjust test to new result * dedupe functions
* Use a simple format for the big number on ui (#12822)赵智超2020-09-162-0/+32
| | | | | | | | | | | | | | | * Use a simple format for the big number on ui Signed-off-by: a1012112796 <1012112796@qq.com> * make fmt * Apply review suggestion @silverwind * Change name 2 * make fmt Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Update Octicons to v10 (#12240)silverwind2020-07-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update Octicons to v10 Besides a few renames, these icons are no longer present in v10 that we've used, so had to change: file-symlink-directory -> file-submodule internal-repo -> repo repo-force-push -> repo-push repo-template-private -> repo-template Fixes: https://github.com/go-gitea/gitea/issues/11889 Ref: https://github.com/primer/octicons/releases/tag/v10.0.0 * add custom sliders svg for removed octicon-settings * apply suggestion * fix triangles and use play on admin dashboard * add custom mirror svg * add missing build files * unify custom svgs * move to octicon-repo-clone to gitea-mirror * use octicon-x on conflicts * tweak timeline icons * tweak comment buttons * update settings icon to octicons v1 * switch to octicon-mirror and octicon-tools * replace two wiki buttons with octicons * remove whitespace in svg sources * Fix filepath basename on Windows for SVG bindata (#12241) * move octicons to devDependencies * move back to dependencies * move svgo to devDependencies again Co-authored-by: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add gitea-vet (#10948)John Olheiser2020-04-051-0/+4
| | | | | | | | | | | | | | | | | * Add copyright Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add gitea-vet and fix non-compliance Signed-off-by: jolheiser <john.olheiser@gmail.com> * Combine tools.go into build.go and clean up Signed-off-by: jolheiser <john.olheiser@gmail.com> * Remove extra GO111MODULE=on Signed-off-by: jolheiser <john.olheiser@gmail.com>
* make avatar lookup occur at image request (#10540)zeripath2020-03-272-16/+26
| | | | | | | | | | | | | speed up page generation by making avatar lookup occur at the browser not at page generation * Protect against evil email address ".." * hash the complete email address Signed-off-by: Andrew Thornton <art27@cantab.net> Co-Authored-By: Lauris BH <lauris@nix.lv>
* Remove Unused Functions (#10516)65432020-03-021-14/+0
| | | | | | | | | | | | | | | | | | | | | | | | | * remove ReplaceLeft * remove GetRepositoryByOwnerAndName chainload to models.GetRepositoryByOwnerAndName * remove CheckUnitUser chainload to models.CheckUnitUser * remove MakeAssigneeList * remove DownloadDiff & DownloadPatch -> DownloadDiffOrPatch * remove GetRandomBytesAsBase64 * remove PushUpdateDeleteTags * remove GetUserByKeyID (you still can resolve user by "k, err := GetPublicKeyByID; userID := k.OwnerID") * remove BasicAuthEncode from struct package -> same function in modules/base/tools ! * remove UserID from api.utils * remove unused func from structs package
* Add Octicon SVG spritemap (#10107)John Olheiser2020-02-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add octicon SVG sprite Signed-off-by: jolheiser <john.olheiser@gmail.com> * Static prefix Signed-off-by: jolheiser <john.olheiser@gmail.com> * SVG for all repo icons Signed-off-by: jolheiser <john.olheiser@gmail.com> * make vendor Signed-off-by: jolheiser <john.olheiser@gmail.com> * Swap out octicons Signed-off-by: jolheiser <john.olheiser@gmail.com> * Move octicons to top of less imports Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix JS Signed-off-by: jolheiser <john.olheiser@gmail.com> * Definitely not a search/replace Signed-off-by: jolheiser <john.olheiser@gmail.com> * Missed regex Signed-off-by: jolheiser <john.olheiser@gmail.com> * Move to more generic calls and webpack Signed-off-by: jolheiser <john.olheiser@gmail.com> * make svg -> make webpack Signed-off-by: jolheiser <john.olheiser@gmail.com> * Remove svg-sprite Signed-off-by: jolheiser <john.olheiser@gmail.com> * Update tests Signed-off-by: jolheiser <john.olheiser@gmail.com> * Missed a test Signed-off-by: jolheiser <john.olheiser@gmail.com> * Remove svg from makefile Signed-off-by: jolheiser <john.olheiser@gmail.com> * Suggestions Signed-off-by: jolheiser <john.olheiser@gmail.com> * Attempt to fix test Signed-off-by: jolheiser <john.olheiser@gmail.com> * Update tests Signed-off-by: jolheiser <john.olheiser@gmail.com> * Revert timetracking test Signed-off-by: jolheiser <john.olheiser@gmail.com> * Swap .octicon for .svg in less Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add aria-hidden Signed-off-by: jolheiser <john.olheiser@gmail.com> * Replace mega-octicon Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix webpack globbing on Windows Signed-off-by: jolheiser <john.olheiser@gmail.com> * Revert Co-Authored-By: silverwind <me@silverwind.io> * Fix octions from upstream Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix Vue and missed JS function Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add JS helper and PWA Signed-off-by: jolheiser <john.olheiser@gmail.com> * Preload SVG Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: techknowlogick <matti@mdranta.net>
* Show download count info in release list (#10124)Lauris BH2020-02-032-40/+15
| | | | | | * Show download count info in release list * Use go-humanize
* Use gitea forked macaron (#7933)Tamal Saha2019-08-231-1/+1
| | | Signed-off-by: Tamal Saha <tamal@appscode.com>
* Display ui time with customize time location (#7792)Lunny Xiao2019-08-152-300/+0
| | | | | | | | | | | | | | | | | | * display ui time with customize time location * fix lint * rename UILocation to DefaultUILocation * move time related functions to modules/timeutil * fix tests * fix tests * fix build * fix swagger
* Convert files to utf-8 for indexing (#7814)guillep2k2019-08-152-85/+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
* API error cleanup (#7186)John Olheiser2019-06-121-3/+0
|
* Add golangci (#6418)kolaente2019-06-122-27/+16
|
* refactor: append, build variable and type switch (#4940)Bo-Yi Wu2019-05-282-24/+24
| | | | | | * refactor: append, build variable and type switch * fix: remove redundant space.
* Hash App token (#6724)techknowlogick2019-05-042-0/+15
|
* 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-192-24/+24
|
* 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-182-35/+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-032-14/+77
| | | | | | * Fix avatar URLs * import order
* Use identicon image for default gravatar. (#2767)harry2017-10-232-2/+2
| | | | | | * Use identicon image for default gravatar. * Fixed tests.
* Sort repository tree entries in natural way (#2506)Lauris BH2017-09-192-0/+113
| | | | | | | | | | | | * Sort repository tree entries in natural way * Fix sort for different length strings with first parts equal * Improve test case * Refactor return statements * Update gitea/git dependency
* 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-282-72/+37
|
* xxx_active_code_live setting in printed in hours and minutes instead … (#1814)Jonas Östanbäck2017-05-292-0/+21
| | | | | | * 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
|
* Remove test that touch networkAndrey Nering2017-02-251-14/+2
|
* 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
* Fix race condition in unit test (#456)Ethan Koenig2016-12-231-2/+7
|