Commit Graph

370 Commits

Author SHA1 Message Date
Lauris BH 81702e6ec9 Detect charset and convert non UTF-8 files for display (#4950)
* 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
2018-09-29 16:33:54 +08:00
Tris Forster 85d14cc229 Symlink icons (#1416) (#3826)
* 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>
2018-05-01 10:04:36 +03:00
Codruț Constantin Gușoi 96c268c0fc Implements generator cli for secrets (#3531)
Signed-off-by: Codruț Constantin Gușoi <codrut.gusoi@gmail.com>
2018-02-18 20:14:37 +02:00
Lunny Xiao f2e20c81b6 Refactor struct's time to remove unnecessary memory usage (#3142)
* 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
2017-12-11 06:37:04 +02:00
Ethan Koenig ab62da283a Fix avatar URLs (#3069)
* Fix avatar URLs

* import order
2017-12-03 19:55:13 +08:00
harry 81d1e54a49 Use identicon image for default gravatar. (#2767)
* Use identicon image for default gravatar.

* Fixed tests.
2017-10-23 03:50:07 -05:00
Lauris BH 23645fe05f Sort repository tree entries in natural way (#2506)
* 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
2017-09-19 11:37:03 +03:00
Lunny Xiao 1739e84ac0 improve protected branch to add whitelist support (#2451)
* 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
2017-09-14 16:16:22 +08:00
Ethan Koenig 2b410e44b2 lint 2017-06-29 12:11:34 -04:00
Ethan Koenig 05e3726415 Use default avatar on error 2017-06-29 12:10:33 -04:00
Ethan Koenig 23f0728879 Don't ignore gravatar error 2017-06-29 10:37:55 -04:00
Lauris BH 32fc44aa83 Make time diff translatable (#2057) 2017-06-28 13:43:28 +08:00
Jonas Östanbäck b93568cce4 xxx_active_code_live setting in printed in hours and minutes instead … (#1814)
* xxx_active_code_live setting in printed in hours and minutes instead of just hours

* Update app.ini description of xxx_code_lives settings
2017-05-29 02:35:47 -05:00
Lunny Xiao c2eef171ff fix some typos (#1082) 2017-02-28 12:56:15 +08:00
Andrey Nering f552b0a207 Remove test that touch network 2017-02-25 10:32:15 -03:00
Gabriel Jackson bf6f61cc69 Cleanup log messaging
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.
2017-02-02 15:24:18 +01:00
Fabian Zaremba 2e7ccecfe6 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
2016-12-26 09:16:37 +08:00
Ethan Koenig ec1fe1183d Fix race condition in unit test (#456) 2016-12-23 14:31:22 +08:00
Thomas Boerger b33078fa33 Bindata is optional and over-writable on restart (#354)
* Moved conf assets into options folder

* Dropped old bindata

* Started to integrate options bindata and accessors

* Do not enforce a builtin app.ini

* Replaced bindata calls with options

* Dropped bindata task from makefile, it's the generate task now

* Always embedd app.ini to provide sane config defaults

* Use sane defaults for the configuration

* Defined default value for SSH_KEYGEN_PATH

* Dropped "NEVER EVER MODIFY THIS FILE" header from app.ini

* Fixed new paths in latest test additions

* Drop bindata with make clean task

* Set more proper default values
2016-12-22 19:12:23 +01:00
Ethan Koenig 4c89a9c33c Bug fixes and tests for modules/base (#442)
Also address other TODOs
2016-12-22 16:58:04 +08:00
Denis Denisov 380e32e129 Fix random string generator (#384)
* 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
2016-12-20 13:32:02 +01:00
Nico Mandery 6ade13e86e serve video files using the HTML5 video tag (#418)
* serve video files using the HTML5 video tag

* lint fix: add comment to IsVideoFile
2016-12-20 16:09:11 +08:00
Lunny Xiao d771e978a1 Don't use custom PBKDF2 function (#382) 2016-12-15 09:24:27 +08:00
Lunny Xiao 94da472717 Golint fixed for modules/setting (#262)
* golint fixed for modules/setting

* typo fixed and renamed UNIXSOCKET to UnixSocket
2016-11-27 18:14:25 +08:00
Lunny Xiao fb3bb69ec6 golint fixed for modules/base 2016-11-24 15:17:44 +08:00
Thibault Meyer ddee4c8b58
Normalize files with gofmt 2016-11-11 13:11:45 +01:00
Sandro Santilli 4247304f5a Update import paths from github.com/go-gitea to code.gitea.io (#135)
- 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
2016-11-10 17:24:48 +01:00
Matthias Loibl e74868a850
Add test for IsTextFile() 2016-11-07 23:31:40 +01:00
Matthias Loibl 95d4cd9292
Make long godoc comment 2 lines 2016-11-07 23:31:40 +01:00
Matthias Loibl 2bb188ae79
Add test for IsLetter() 2016-11-07 23:31:40 +01:00
Matthias Loibl 4235fff9ee
Add test for Int64sToMap() 2016-11-07 23:31:40 +01:00
Matthias Loibl d417aedcfa
Add tests for StringsToInt64s() & Int64sToStrings() 2016-11-07 23:31:40 +01:00
Matthias Loibl b00d82d679
Add tests for TruncateString() 2016-11-07 23:31:40 +01:00
Matthias Loibl 86c32f2706
Use TruncateString(sha1,10) in ShortSha and deprecate it. 2016-11-07 23:31:39 +01:00
Matthias Loibl 030ba2894f
Add tests for EllipsisString() and fix bug if param length < 3 2016-11-07 23:31:39 +01:00
Matthias Loibl f81711f40d
Test AvatarLink and refactor with tests passing 2016-11-07 23:31:39 +01:00
Matthias Loibl 70fb1cf9d1
Use testify/assert for all tests in tool_test.go 2016-11-07 23:29:42 +01:00
Matthias Loibl d874a9bf6b
Add unit test for base.FileSize() 2016-11-07 23:29:42 +01:00
Matthias Loibl 11c9160cd3
Start to add tests for modules/base/tool 2016-11-07 23:29:41 +01:00
Thomas Boerger 77f9c7e571
Fixed links to sdk docs 2016-11-07 16:10:32 +01:00
Thomas Boerger 6bf9910975
Set correct doc url for go-sdk 2016-11-07 14:49:25 +01:00
Rémy Boulanouar 2d68bd1ef9 Change import reference to match gitea instead of gogs (#37) 2016-11-03 10:29:56 -02:00
Unknwon dadd35b636 #3559 fix template error 2016-08-31 13:59:23 -07:00
Unknwon 780cc2d110 router/repo: code refactoring 2016-08-30 02:08:38 -07:00
Thibault Meyer 7eafe3213f Fix #3321: commit tag shortener (#3418)
* Fix #3321: commit tag shortener

* Check short commit

* remove debug

* Edit unit tests

* Show 10-char short SHA
2016-08-11 15:34:00 -07:00
Unknwon 99385db0c4 #3320 code cleanup 2016-08-07 11:01:47 -07:00
Sandro Santilli 90dd0657b5 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
2016-08-07 10:27:38 -07:00
Sandro Santilli 8a248696e9 Use a gopher as default avatar (rather than the gravatar logo) (#3208)
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)
2016-06-27 18:12:30 +08:00
Kim Carlbäcker 3df8eb60e3 PDF-Previews in file-lists now working (#3000) 2016-04-26 21:48:44 -04:00
Unknwon 5267dce210 Fix ref comment from commit create empty feed 2016-03-11 05:11:58 -05:00
Unknwon a2f13eae55 #1157 some avatar setting changes
- Allow to delete current avatar
2016-03-05 00:51:51 -05:00
Unknwon d5a3021a7d Make markdown as an independent module 2016-02-20 17:10:05 -05:00
Unknwon 341da3cea7 Fix inappropriate markdown post process end tag check
When <code> is nested inside <pre>, the next end tag token would not able to be the same
as outer-most start tag. So we only check outer-most start and end tag token to be the same.
2016-02-19 17:39:50 -05:00
Unknwon 338af89d56 #2650 fix possbility that use email as pusher user name
Remove the possibility of using email as user name when user actually push
through combination of email and password with HTTP.

Also refactor update action function to replcae tons of arguments with
single PushUpdateOptions struct.
And define the user who pushes code as pusher, therefore variable names shouldn't
be confusing any more.
2016-02-17 22:47:06 -05:00
Unknwon 58e004f7da Remove cache avatar support and add its tests 2016-02-14 23:14:55 -05:00
Unknwon 4e96a4a62b Merge pull request #2406 from bkcsoft/feature/markdown-custom-url-scheme
Feature/markdown custom url scheme
2016-02-05 13:11:45 -05:00
Unknwon 8e40f86d2c #2556 handle space in image URL 2016-02-04 22:51:40 -05:00
Unknwon 4848620594 #2229 adjust URL verbose depth for reverse proxy sub-path 2016-01-31 15:38:20 -05:00
Kim "BKC" Carlbäcker 1ab8a60d73 Not working, but slightly better... 2016-01-27 21:48:57 +01:00
Kim "BKC" Carlbäcker 3a9fd81f59 Custom URL-Schemas for Markdown 2016-01-27 02:02:03 +01:00
Kim "BKC" Carlbäcker a1a4f1103c Made Sanitizer-setup cleaner 2016-01-14 03:00:05 +01:00
Kim "BKC" Carlbäcker 8e09e03127 Checklist-rendering implemented 2016-01-13 13:25:52 +01:00
Unknwon f43cc90841 #2287 Truncate repository name if too long 2016-01-11 20:41:43 +08:00
Unknwon cc8c67ff29 fix markdown autolink error 2016-01-09 10:59:04 +08:00
Unknwon 4993ab1a76 #2185 fall back to use custom chardet lib 2015-12-31 22:13:47 -05:00
Unknwon 44637f03cc #2282 fast detection of utf-8 2015-12-27 17:02:36 -05:00
Unknwon 93f03707a7 #2283 set text/plain for non-binary files in raw mode 2015-12-25 05:45:07 -05:00
Unknwon 85af36332b #2282 fix utf-8 recognized as windows-1252 2015-12-25 05:25:47 -05:00
Unknwon 95f9c85bcc #2185 use Go sub-repo to detect encoding 2015-12-13 19:56:33 -05:00
Unknwon 7e88420bc6 #2161 fix wrong regexp 2015-12-12 16:13:18 -05:00
Unknwon 5911fc3512 #2161 No issue linking in commits when issue number in brackets 2015-12-12 16:01:54 -05:00
Unknwon e538ff2770 fix #1829 and fix #890 2015-12-04 21:30:33 -05:00
Unknwon ba92f4687e minor fix markdown post process 2015-11-24 19:29:35 -05:00
Unknwon 968edb3e44 more link fix 2015-11-24 19:28:24 -05:00
Unknwon 7f9598141b fix #2020 2015-11-24 18:49:34 -05:00
Unknwon f12832c61e fix possible panic 2015-11-21 21:06:11 -05:00
Unknwon 126228d146 HTML render fix 2015-11-20 05:37:51 -05:00
Unknwon 9b6c835715 fix #1873 2015-11-20 01:52:11 -05:00
Unknwon 1a901433e2 minor fix for #1949 2015-11-15 17:37:26 -05:00
Howl ca5678da32 Safely detect urlPrefix in the format /:owner/:repo 2015-11-15 22:22:25 +01:00
Howl 85c58eba90 Fix bad issue links in non-readme markdown files 2015-11-15 12:04:43 +01:00
Unknwon 1d57f0d64f Show custom avatars in commits 2015-11-13 17:10:25 -05:00
Unknwon 3b62a0fe0e fix #1572 fix file histrory paging issue 2015-11-10 16:46:17 -05:00
Unknwon 18c841050b fix 1540 and experimental SSH server support 2015-11-08 16:59:56 -05:00
Unknwon 54ca0b2f09 #1433 images with links in Markdown
- #1904 minor fix on image link
2015-11-06 11:10:27 -05:00
Unknwon 0af035c37e #1078 not show bin when rename a file 2015-11-03 09:52:17 -05:00
Unknwon 022820103d #1657 allow forcing all private repos 2015-10-25 04:26:26 -04:00
Unknwon aff49b1c9e unified API error response 2015-10-08 20:36:07 -04:00
Sergio Benitez 7acbcf9ddd Commit messages now rendered with line breaks and prefix spacing. 2015-09-18 19:02:23 -07:00
Unknwon 2729eb998c #1646 and other minor fixes 2015-09-16 15:34:46 -04:00
Unknwon c8d92fad30 #1595 pushing new branch will rereference issues in previous branch 2015-09-10 07:53:40 -04:00
Hongcai Deng e4d4662074 add regexp to restrict `<code class=""></code>` 2015-09-10 09:06:09 +08:00
Hongcai Deng 357c002c03 add allow attribute `class` to `<code>` 2015-09-09 17:31:14 +08:00
Unknwon 645d4d0c5b #1594 Collaborative Repositories missing suburl on Dashboard 2015-09-07 05:57:19 -04:00
Unknwon 85f34ba538 new user profile settings UI
Signed-off-by: Unknwon <u@gogs.io>
2015-09-06 16:31:22 -04:00
Unknwon 8af094967f #1377 add rename repo action 2015-09-01 09:29:52 -04:00
Unknwon 90a6553c37 #1009 Config option for preserving hard line breaks 2015-09-01 08:32:02 -04:00
Unknwon 55ddf225bb webhook APIs 2015-08-29 11:49:59 +08:00
Unknwon a7686e8749 #1203 bundle jquery with gogs 2015-08-28 14:24:05 +08:00
Unknwon a329bbc215 new org dashboard issues 2015-08-25 23:22:05 +08:00