Commit Graph

824 Commits (a902af75f480a5629f0747cd65531107e4897e4e)

Author SHA1 Message Date
Lanre Adelowo 8d2c24f7f9 Allow for user specific themes ()
* add migration and basic UI for changing a user's theme

* update user themem

* use right text on button

* load theme based on users' selection

* load theme based on users' selection in pwa too

* update sample config

* delete older theme loading

* implement AfterLoad to set users' theme properly

* set up default theme when creating a user. This uses the installation wide theme

* use flash messages for error

* set default theme when creating a user from the cli

* fix @lunny review
Lanre Adelowo a82ba73346 Make sure argsSet verifies string isn't empty too ()
Lunny Xiao 7fd34c0517
fix lfs version check warning log when using ssh protocol ()
Greg Karékinian ebef3eff23 Remove a double slash in the HTTPS redirection when Let's Encrypt is enabled ()
Before:

$ curl 0.0.0.0:3001
<a href="https://gitea.example.com:3000//">Found</a>.

After:

$ curl 0.0.0.0:3001
<a href="https://gitea.example.com:3000/">Found</a>.

Fixes 
Lunny Xiao af6bce3ad5 fix detect force push failure on deletion of protected branches ()
Lunny Xiao ba75319157 fix clone wiki failed via ssh ()
Greg Karékinian 15d6cf179d Fix the Let's Encrypt handler by listening on a valid address ()
* Fix the Let's Encrypt handler by listening on a valid address

Also handle errors in the HTTP server go routine, return a fatal error
when something goes wrong.

Thanks to @gbl08ma for finding the actual bug

Here is an example of the error handling:

    2018/12/11 14:23:07 [....io/gitea/cmd/web.go:87 func1()] [E] Failed to
    start the Let's Encrypt handler on port 30: listen tcp 0.0.0.0:30: bind:
    permission denied

Closes 

* Fix a typo
Lunny Xiao eabbddcd98
Restrict permission check on repositories and fix some problems ()
* fix units permission problems

* fix some bugs and merge LoadUnits to repoAssignment

* refactor permission struct and add some copyright heads

* remove unused codes

* fix routes units check

* improve permission check

* add unit tests for permission

* fix typo

* fix tests

* fix some routes

* fix api permission check

* improve permission check

* fix some permission check

* fix tests

* fix tests

* improve some permission check

* fix some permission check

* refactor AccessLevel

* fix bug

* fix tests

* fix tests

* fix tests

* fix AccessLevel

* rename CanAccess

* fix tests

* fix comment

* fix bug

* add missing unit for test repos

* fix bug

* rename some functions

* fix routes check
Lanre Adelowo ce9a5173fe fix password variable shadowing ()
Lanre Adelowo fd37fb01fd Don't force a password change for the admin user when creating an account via cli ()
* don't force a password change for the admin user

* don't totally dicard -must-change-password flag if creating the first (admin) user via the cli. Use flag if present but make sure to default to not forcing a password update
zeripath 7d9a191a3c Create AuthorizedKeysCommand ()
Robert Ștefan 7edb930240 Add command for migrating database ()
Lanre Adelowo e5daa2698f Generate random password ()
* add random-password flag

* run make fmt

* add length cli flag rather than use a default value
Lunny Xiao 0ba57949e4 remove unused db init on commands serv, update, hooks ()
Antoine GIRARD 617a2433a3 Make gitea serv use api/internal ()
* Start to move to internal/private

* Add GetPublicKeyByID

* Add HasDeployKey

* Add private.UpdateDeployKeyUpdated

* Add private.GetUserByKeyID

* Add private.AccessLevel

* Add private.CheckUnitUser

* Fix mistakes I made

* Some cleaning + moving code to separate files

* Fix error handling

* Remove useless error handling for setup

* lint: fix comment on exported func

* fix copyright header

* Fix order of args
Lunny Xiao a2ee2a3c67 fix showing pull request link when delete a branch ()
Lanre Adelowo c2748ea7fe Add must-change-password flag to cli for creating a user ()
* add support for an admin to force a user to change his/her password from thee cli

* use BoolFlag instead

* default to true

* simplify by removing unnneccessary if/else
Julien Tant dea3d849e1 Give user a link to create PR after push ()
* Give user a link to create PR after push

* Forks now create PR in the base repository + make sure PR creation is allowed

* fix code style
Bo-Yi Wu 1e34413238 refactor: err != nil check, just return error instead ()
techknowlogick e91a2cf2ea
Add/remove/list oauth providers via cli ()
Fluf b82c14b3d2 add letsencrypt to Gitea ()
Jerry Jacobs b1bc08e268 cmd/serve: pprof cpu and memory profile dumps to disk ()
Fluf f54626df0b Add config path as an optional flag when changing pass via CLI ()
Inon S 15f6ec9632 LFS: make HTTP auth period configurable ()
* LFS: make HTTP auth period configurable

* Formatting: Removed semicolon

Due to automated fmt-check failure (drone.gitea.io)

* applying code reviews

* Applied code review comment: Change HTTPAuthExpiry to time.Duration

* Updated config cheat sheet
techknowlogick 8176345c0e Add cli commands to regen hooks & keys ()
* Add cli commands to regen hooks & keys

* make fmt

* Allow passing path to config as an option

* add docs
Lauris BH b66d6b3449
Do not allow inactive users to access repositories using private keys ()
Codruț Constantin Gușoi 96c268c0fc Implements generator cli for secrets ()
Signed-off-by: Codruț Constantin Gușoi <codrut.gusoi@gmail.com>
Antoine GIRARD 9e842c8a72 Fix SSH auth lfs locks ()
* Fix SSH auth LFS locks

* Activate SSH/lock test

* Remove debug

* Follow @lunny recommendation for AfterLoad method
Morgan Bazalgette 2b52f77e1b General refactor of the cmd package ()
* General refactor of the cmd package

* Address breakage in runCreateUser

* Place "common" functions into cmd.go
Kim "BKC" Carlbäcker e5b8b4b5ec Cleanup models.User.HashPassword ()
Morgan Bazalgette 674cfb7cac Change EncodePasswd to HashPassword ()
* Change EncodePasswd to HashPassword

* Create test+benchmark for HashPassword
Sandro Santilli 8cd987af0c Add repo-sync-releases admin command ()
* Add repo-sync-releases admin command

Will help recovering corrupted database, see 

* Load repos in chunks of 10, exit with error if unable to get a list, scan private repos, fix typo

* Fix debug output about num releases

* Introduce RepositoryListDefaultPageSize constant, set to 64

Use it from the new admin command

* Use RepositoryListDefaultPageSize in more places

* Document RepositoryListDefaultPageSize
Mike Fellows fabf3f2fc2 Add an option to allow redirect of http port 80 to https. ()
* Add an option to allow redirect of http port 80 to https.

This is an "opt in" option (default is to not redirect).  It will only redirect
if protocol is https and the new REDIRECT_PORT_80 option is set to true.

The Port to redirect in previous commit was hardcoded to 80, now it can be
specified in the app.ini, defaulting to 80.  The boolean option to turn
redirection on has been changed to REDIRECT_OTHER_PORT to be logically
consistent with the new port option.

Signed-off-by: Mike Fellows <mike.fellows@shaw.ca>
Lunny Xiao f94c1b3943
Improvements for supporting UI Location ()
* improvements for supporting UI Location

* improved the comment
Lunny Xiao 00bfa1d055
fix run web with -p push failed ()
Lunny Xiao 35cc5b0402
Remove GetRepositoryByRef and add GetRepositoryByOwnerAndName ()
* remove GetRepositoryByRef and add GetRepositoryByOwnerAndName

* fix tests

* fix tests bug

* some improvements
Lunny Xiao 62d0a4d882 Add external markup render support ()
* add external markup render support

* bug fixed

* refacotr codes and fix wrong error log

* fix comments and add check to prevent leaks

* add check for config file and improve the example

* check file close error

* use ioutil.TempFile instead uuid

* correct Render -> Parser

* improve warning when incorrect markup setting

* fix typos
Guillaume Dube 8798cf4e3b Set session and indexers' data files rel to AppDataPath ()
* Set session and indexers' data files rel to AppDataPath

The setting AppDataPath is now relative to the working directory.
The session svc's PROVIDER_CONFIG now defaults to AppDataPath/data/sessions.
The issue indexer's IssuePath now defaults to AppDataPath/indexers/issues.bleves.

* fix bug
Lunny Xiao 9ddbbd9d5a improve force push detect when push ()
Lunny Xiao 1739e84ac0 improve protected branch to add whitelist support ()
* 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
Lunny Xiao f960e19c59 Only update needed columns when update user ()
* only update needed columns when update user

* fix missing update_unix column
Jonas Östanbäck b1b8c5e9f4 Set TMPDIR enviroment variable for dump command ()
Bo-Yi Wu 703d18e50d feat: add check misspelling ()
Lunny Xiao 6362462da8
fix admin lost permission caused by
Lunny Xiao fd6034aaf2 Add units to team ()
* add units to team

* fix lint

* finish team setting backend

* finished permission controll on routes

* fix import blank line

* add unit check on ssh/http pull and push and fix test failed

* fix fixtures data

* remove unused code
Lunny Xiao 930d1759ae Remove env user salt since no need to use ()
* remove env user salt since no need to use

* remove unused variable from update.go
Lunny Xiao 1773e88643 Drop db operations from hook commands ()
* move all database operations from hook command to web command and instead of internal routes

* bug fixed

* adjust the import path sequences

* remove unused return value on hookSetup
Ethan Koenig c58708d3ee Integration test framework ()
* Integration test framework

* udpate drone sign

* Formatting fixes and move router.go to routers/

* update sign for drone
Lunny Xiao 42072783c9 support health check via / and fix ()
Bo-Yi Wu fa2a513c62 feat: add download count field and unit testing for attachment. ()
* feat: add download count field and unit testing.

* fix: unit testing

* refactor: improve testing.

* fix: update comment

* add default value.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Lunny Xiao 2eeae84cbd Add internal routes for ssh hook comands ()
* add internal routes for ssh hook comands

* fix lint

* add comment on why package named private not internal but the route name is internal

* add comment above package private why package named private not internal but the route name is internal

* remove exp time on internal access

* move routes from /internal to /api/internal

* add comment and defer on UpdatePublicKeyUpdated
Lauris BH f42ec6120e Better URL validation ()
* Add correct git branch name validation

* Change git refname validation error constant name

* Implement URL validation based on GoLang url.Parse method

* Backward compatibility with older Go compiler

* Add git reference name validation unit tests

* Remove unused variable in unit test

* Implement URL validation based on GoLang url.Parse method

* Backward compatibility with older Go compiler

* Add url validation unit tests
Bo-Yi Wu 22295944df refactor: show command help message. ()
Lunny Xiao 5c0bee9b20 refactor update ssh key use time ()
Andrey Nering b674460748 Add watch button on issue
Sandro Santilli 129b0d6a4b Allow ENABLE_OPENID_SIGNUP to depend on DISABLE_REGISTRATION ()
* Allow ENABLE_OPENID_SIGNUP to depend on DISABLE_REGISTRATION

Omit the configuration variable (the default) to be dependent.
Fixes 

* Move OpenID settings under Service object

* Show OpenID SignUp and SignIn status in admin panel / configuration
Pavel Korovin ae9b02b079 Fix FCGI (over TCP) support ()
Fabian Zaremba 9224405155 LFS: Fix SSH authentication for trailing arguments ()
Fixes 
Fabian Zaremba 5586445207 LFS: Return 404 for unimplemented endpoints ()
Without this patch a 401 is returned for unspecified endpoints, making
the LFS client ask for HTTP credentials. This behaviour was introduced
with the new locking API:

https://github.com/git-lfs/git-lfs/blob/master/docs/api/locking.md
Sandro Santilli 9182a35f18 Show user OpenID URIs in their profile ()
Sandro Santilli e1586898b2 Add change-password admin command ()
* Add change-password admin command
Bo-Yi Wu 1c3bd436cc feat: Only use issue and wiki on repo. ()
Sandro Santilli 71d16f69ff Login via OpenID-2.0 ()
Lunny Xiao ebbcf6fe12 Allow push to init a wiki repo ()
* allow push to init a wiki repo

* compact error check
Ethan Koenig 09fe4a2ae9 Batch updates for issues ()
Ethan Koenig ec0ae5d50c Refactor and fix incorrect comment ()
Sandro Santilli 7d8f9d1c46 Rename /forget_password url to /forgot_password
Also renames `forgot_password` translation key to
`forgot_password_title` and `forget_password` to
`forgot_password`

Includes entry in CHANGELOG about the breaking change
(and some markdown fixes in there)
Lunny Xiao 341b3a0349 bug fix for dump when data directoryis not exist ()
Lunny Xiao cfdc62e7fa Comment force push detect to fix bug ()
* umcomment force push detect to fix bug 

* fix 

* handle global config set and fix 
Lunny Xiao 9084bdd863 fix push ()
Lunny Xiao 50918084bb remove unused struct ()
Lunny Xiao 35548a9d4e remove unused fixme on dump command ()
Lunny Xiao cd1821a7e2 Move push update to post-receive and protected branch check to pre-receive ()
* move all push update to git hook post-receive and protected branch check to git hook pre-receive

* add SSH_ORIGINAL_COMMAND check back

* remove all unused codes

* fix the import
Lunny Xiao 0e6b9ea786 Take back control of hooks ()
* git: delegate all server-side Git hooks ()

* create hooks directories

* take control hooks back

* fix lint

* bug fixed and minor changes

* fix imports style

* fix migration scripts
Willem van Dreumel 01d957677f Oauth2 consumer ()
* initial stuff for oauth2 login, fails on:
* login button on the signIn page to start the OAuth2 flow and a callback for each provider
Only GitHub is implemented for now
* show login button only when the OAuth2 consumer is configured (and activated)
* create macaron group for oauth2 urls
* prevent net/http in modules (other then oauth2)
* use a new data sessions oauth2 folder for storing the oauth2 session data
* add missing 2FA when this is enabled on the user
* add password option for OAuth2 user , for use with git over http and login to the GUI
* add tip for registering a GitHub OAuth application
* at startup of Gitea register all configured providers and also on adding/deleting of new providers
* custom handling of errors in oauth2 request init + show better tip
* add ExternalLoginUser model and migration script to add it to database
* link a external account to an existing account (still need to handle wrong login and signup) and remove if user is removed
* remove the linked external account from the user his settings
* if user is unknown we allow him to register a new account or link it to some existing account
* sign up with button on signin page (als change OAuth2Provider structure so we can store basic stuff about providers)

* from gorilla/sessions docs:
"Important Note: If you aren't using gorilla/mux, you need to wrap your handlers with context.ClearHandler as or else you will leak memory!"
(we're using gorilla/sessions for storing oauth2 sessions)

* use updated goth lib that now supports getting the OAuth2 user if the AccessToken is still valid instead of re-authenticating (prevent flooding the OAuth2 provider)
Denis Denisov fd941db246 Protected branches system ()
* Protected branches system

* Moved default branch to branches section (`:org/:reponame/settings/branches`).
* Initial support Protected Branch.
  - Admin does not restrict
  - Owner not to limit
  - To write permission restrictions

* reformat tmpl

* finished the UI and add/delete protected branch response

* remove unused comment

* indent all the template files and remove ru translations since we use crowdin

* fix the push bug
Christoph König ffde33bdfa Fix typo ()
Lunny Xiao 04fdeb9d8d Make Xorm log configurable ()
* make xorm log configable

* bug fixed for other sub commands except web

* rebase and fix xorm log

* bug fix for TrimSpace
Lunny Xiao be55460b63 catch error on call setup on serv command ()
Bo-Yi Wu d67b278a0d feat: Able to disable non-admin to create new organization ()
Andrew Boyarshin dc8248f8a4 Markdown rendering overhaul ()
* Markdown rendering overhaul

Cleaned up and squashed commits into single one.

Signed-off-by: Andrew Boyarshin <boyarshinand@gmail.com>

* Fix markdown API, add markdown module and API tests, improve code coverage

Signed-off-by: Andrew Boyarshin <boyarshinand@gmail.com>
Sandro Santilli 9b4f6c1c32 Handle SetModel error, fixes one errcheck report ()
Lunny Xiao c5887b0f28 fix watchers templates breaks ()
Matthias Loibl 17c5e12e6e Add ENABLE_PPROF to app.ini and start pprof if true on localhost:6060 ()
* Add ENABLE_PPROF to app.ini and start pprof if true on localhost:6060

* Add comment for golint to blank pprof import
surefire c73b7a65f5 Fix remove unix socket listenAddr ()
Because the absence of the listenAddr is what is expected.
The error will only be then when we can't remove.
Lunny Xiao 8a421b1fd7 Add units concept for modulable functions of a repository ()
* Add units concept for modulable functions of a repository

* remove unused comment codes & fix lints and tests

* remove unused comment codes

* use struct config instead of map

* fix lint

* rm wrong files

* fix tests
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.
Thomas Boerger 78535fb08e Allow custom public files ()
* Allow custom public files

* Gofmt code, lots of places not related to this pr
Bwko 8555e888d8 Add ETag header to avatars ()
Lunny Xiao a8048c19f3 Update xorm and fix dump command ()
* update xorm and fix dump

* catch database init error

* still use dumpTables

* fix dump bool type

* update vendor.json
Andrew 6dd096b7f0 Two factor authentication support ()
* Initial commit for 2FA support

Signed-off-by: Andrew <write@imaginarycode.com>

* Add vendored files

* Add missing depends

* A few clean ups

* Added improvements, proper encryption

* Better encryption key

* Simplify "key" generation

* Make 2FA enrollment page more robust

* Fix typo

* Rename twofa/2FA to TwoFactor

* UNIQUE INDEX -> UNIQUE
Philip Couling 64375d875b Attach to release ()
* Moved attachaments POST url from /issues/attachments to /attachments

* Implemented attachment upload on release page

* Implemented downloading attachments on the release page

* Added zip and gzip files to default allowed attachments

* Implemented uploading attachments on edit release

* Renamed UploadIssueAttachment to UploadAttachment
Bwko 4a1f36c3cc Don't create a default pid file ()
Manuel Kuhlmann e698654902 Add data directory excluding sessions to dump ()
Andrey Nering 769e0a3ea6 Notifications: mark as read/unread and pin ()
* Use relative URLs

* Notifications - Mark as read/unread

* Feature of pinning a notification

* On view issue, do not mark as read a pinned notification
Bo-Yi Wu 9f575986d8 feat: support pid file.
Andrey Nering 79d527195d Merge pull request from andreynering/notifications-step-2
Notifications - Step 2
Lunny Xiao 980dd0bf51 Update xorm and dependencies vendor for feature to dump to other database ()
* update xorm and dependencies vendor for feature to dump to other database

* fix golint
Lunny Xiao bf85c82087
fix windows build broken by
Lunny Xiao 527c2dd665 Support http service graceful restart ()
* support http service graceful restart

* fix dependencies
Andrey Nering 6069abe5fd Notifications - Step 2
Andrey Nering b992858883 Tab on user profile to show starred repos ()
* Tab on user profile to show starred repos

* Make golint happy and use transactions on StarRepo function

* x -> sess

* Use sess.Close() instead of sess.Rollback()

* Add copyright

* Fix lint
Kjell Kvinge 22e1bd31c6 commithgraph / timeline ()
* Add model and tests for graph

* Add route and router for graph

* Add assets for graph

* Add template for graph
Fabian Zaremba 2e7ccecfe6 Git LFS support v2 ()
* 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
Lunny Xiao 4b7594d9fa Provide button to delete merged pull request ()
* provide button to delete merged pull request

* golint fix
Thomas Boerger b33078fa33 Bindata is optional and over-writable on restart ()
* 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
Lunny Xiao 47a7529d96 update code.gitea.io/git ()
Joubert RedRat ce21ed6c34 Remove remaining Gogs reference on locales and cmd ()
Bwko 026ad4aee7 Fixes panic when there's no user initialized ()
Thomas Boerger 83ed234472 Integrate templates into bindata optionally ()
Integrated optional bindata for the templates
Antonio Facciolo 947d2ee21b Fixes
Export Pusher name as GITEA_PUSHER_NAME env variable
Export also GITEA_UUID, but keep the uuid env variable for backward compatibility

export pusher name ENV variable 

change env variable prefix to GITEA_

Signed-off-by: Antonio Facciolo <afdev82@gmail.com>

Export also GITEA_UUID 

Keep uuid env variable for backward compatibility
Bwko 4ff0db0246 Catch os... errors
Thomas Boerger 2932042a6d Get rid of bin folder within makefile, enabled TiDB ()
* Get rid of the bin folder within the build process

Signed-off-by: Thomas Boerger <thomas@webhippie.de>

* Dropped latest make task, it is unused

Signed-off-by: Thomas Boerger <thomas@webhippie.de>

* Added tidb tag to drone config

Signed-off-by: Thomas Boerger <thomas@webhippie.de>

* Dropped the cert build tag

Signed-off-by: Thomas Boerger <thomas@webhippie.de>

* Dropped useless minwinsvc build tag

Signed-off-by: Thomas Boerger <thomas@webhippie.de>

* Dropped the useless build tags from drone config

Signed-off-by: Thomas Boerger <thomas@webhippie.de>
Thomas Boerger b6a95a8cb3 Integrate public as bindata optionally ()
* Dropped unused codekit config

* Integrated dynamic and static bindata for public

* Ignore public bindata

* Add a general generate make task

* Integrated flexible public assets into web command

* Updated vendoring, added all missiong govendor deps

* Made the linter happy with the bindata and dynamic code

* Moved public bindata definition to modules directory

* Ignoring the new bindata path now

* Updated to the new public modules import path

* Updated public bindata command and drop the new prefix
Lunny Xiao ec87a75c00 golint fixed for modules/auth
Andrey Nering c664ffd1db Merge pull request from andreynering/gitea/http-headers-download
Fix HTTP headers for issue attachment download
Lunny Xiao 94da472717 Golint fixed for modules/setting ()
* golint fixed for modules/setting

* typo fixed and renamed UNIXSOCKET to UnixSocket
Andrey Nering 638dd24cec Fix HTTP headers for issue attachment download
- Download filename was wrong for files other than images. Example: It was `download` instead of `file.pdf`
- PDF was downloading instead of showing on browser
Bo-Yi Wu 5054020c1f fix gofmt error.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Andrey Nering 739f07c98e Remember diff view style ()
Sandro Santilli 4247304f5a Update import paths from github.com/go-gitea to code.gitea.io ()
- 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
Matthias Loibl 90fb64b217 Improve formatting of admin command
Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>
Matthias Loibl 5cd093aa46 Use cli Flags directly and not some helper funcs
Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>
Sandro Santilli aadd7dcdc3 And others
Sandro Santilli f388661bda ACCESS_MODE_* -> AccessMode*
Thomas Boerger 3e13e16b3f
Dropped client from version check
Sandro Santilli 6e4252dad4 Replace gogits/git-module dependency with go-gitea/git ()
* Replace gogits/git-module dependency with go-gitea/git

Fixes 

* Remove git alias for git module import (not needed)
Sandro Santilli f36544f98d Merge branch 'master' into feature/goimports
Andrey Nering bd898a10f8 Refactor editorconfig middleware
Matthias Loibl 953c099428 Add missing version & gogs package
Matthias Loibl 1f44b01e2a Fix imports found by goimports.
Thomas Boerger 3dd14ee522
Fixed "net.UnixAddr composite literal uses unkeyed fields"
Thomas Boerger 5b5af7daee
Made linter happy in cmd folder
Lunny Xiao 1adde07a3f Merge branch 'master' into fix/3743-route-regexp-branchname
Rémy Boulanouar 2d68bd1ef9 Change import reference to match gitea instead of gogs ()
Thibault Meyer 8ea63f8c50
Restore whitespace
Thibault Meyer a79eb48de3
Fix SHA regexp and commit comparisons
Unknwon 491407ddf8
fix 404 for release draft edition
Closes 
Daniel Oaks b3d9ca4ccd Add the ability to explore organizations ()
* Add ability to explore organizations

* Use right icon for org explore links
Unknwon c2afdf2192 Minor code fix [CI SKIP]
Unknwon 16eb2eb6a3 Fix import path
Unknwon e6ec1ca1f8 disable issue cannot edit label and milestonefor pull requests
Unknwon 643142acab Web editor: support upload files
Kim "BKC" Carlbäcker 4f40019130 codegangsta/cli => urfave/cli ()
Unknwon 2a13f682e0 Bump git-module required version
Thibault Meyer 92fb30c526 Load a set of predefined labels ()
* Can use a predefined set of labels

* Change UI

* Fix HTML file indentation

* Avoid reading file from other directory (security issue)

* Apply a better fix

* Remove not used variable

* Merge upstream/develop

* Do modifications

* Raname

* remove binding + rename variable
Unknwon 579e5e4fee Web editor: disallow edit mirror repository
Unknwon 0114fdcba4 Web editor: improve delete file process
Unknwon c30b856d14 use user’s info for committer and author
Unknwon 0b273ac4d5 code cleanup
Thibault Meyer 2c5411b00c Fix : Dumps are created world readable ()
* Set dump file permission to 0600

* Typo
Unknwon a00c932bbc General code quality improvement
Unknwon 6f9a95f830 add HTMLURL to webhook type
- Fill Milestone and Assignee field when available in webhook payload
Unknwon 4042d1f0c3 models/issue: improve quality and performance of NewIssue function
Unknwon 4a46613916 markdown: fix treating pure number as SHA1
- Detect non-exist commit and return 404 not 500
Unknwon 4a19fd6441 Web editor: temporarily disable upload and quick fix for edit and new
Try to merge into develop branch ASAP, then continue minor fixes afterwards.
Unknwon 54e0ada9d5 Web editor: improve delete file
Unknwon 15845cb287 Code clean up for new config options
Richard Mahn d0a0239bac 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
Unknwon dccb0c15b9 Replace convert.To with APIFormat calls
Unknwon 3f7f4852ef fully support of webhooks for pull request
Unknwon 0f33b04c87 Add subcommand to create new user in CLI
Andrey Nering fa12c282f6 Add Content-Disposition header for downloads ()
Thibault Meyer 7eafe3213f Fix : commit tag shortener ()
* Fix : commit tag shortener

* Check short commit

* remove debug

* Edit unit tests

* Show 10-char short SHA
Unknwon a47aef5460 code cleanup
Odin Ugedal 1dd003bd4c Add initial support for unix sockets ()
Thibault Meyer 53c573ed02 Fix : Cannot edit release with tag name contains slash ()
Unknwon 7e9b42c87d code clean up
Unknwon 5077408d78 code cleanup and minor issue fix
Unknwon 042d350762 Fix only user has repo write access can comment
Thibault Meyer 6a81632e36 Fix typo CacheInternal -> CacheInterval ()
Unknwon c5d4a9e046 Add commit timestamp to webhook
Unknwon 15b0cbe318 update git-module require version
Unknwon bbe866122d fix regression of MustEnableIssues check
Unknwon b73318bc62 Fix 404 when comment on pulls and not using interal issue tracker
Sandro Santilli 90dd0657b5 Add support for federated avatars ()
* Add support for federated avatars

Fixes 

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 

* 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
Unknwon ab9c5fb5e7 allow render raw content
Use URL query parameter render=1 to render content in raw mode.
Unknwon 2f105f3979 completely disable builtin issue tracker when enable external tracker
Unknwon e7fd65f0cf better code structure and batch minor improvements
Unknwon 899e799459 support delete issue comment
Unknwon 1f2e173a74 Refactor User.Id to User.ID
Unknwon ae88d76032 Bump version
Unknwon e3d3d424b2 Minor fix for go vet
Unknwon f1b8d52eb3 fix no mail notification when issue is closed/reopened
Unknwon a752f09055 validate username attribute fetched from LDAP
Unknwon de10387f41 bump git-module requirement
Unknwon 1faaaeb3d9 Update glide.lock
Unknwon 7938506e07 update git-module require version
Unknwon 73b4acbb63 Update glide.yaml
Unknwon a4eaddff81 Update dep version
Alex Myasoedov 84d9aff8a2 gogs dump tempdir flag ()
Unknwon 7826eae452 fix DEPRECATED Action signature erorr
Unknwon 60ae8ac3d2 Add route for
Unknwon 9bd9ad4205 add CRUD issue APIs
- Fix go-gogs-client#10
- Related to 
Unknwon dd6faf7f9b Convert all API handers to use *context.APIContext
Unknwon b4f47a7623 attempt to fix invalid csrf token
Unknwon d733efc1cc Alpha support for custom templates
No guarantee for compatibility with future changes
Unknwon f76d821bda fix
Unknwon 2bf8494332 finish user and repository search
Both are possible on explore and admin panel
Unknwon 514382e2eb Rename module: middleware -> context
Unknwon 58f0c68151 Some minor changes
Unknwon 12b5a76b0d Minor fix for
Tamás Molnár 9c91e27933 Added: Ability to delete org avatar.
Unknwon a5b0400be7 finish new access rights for collaborators
Unknwon 045f14fbd0 finsih UI work for access mode of collaborators
Collaborators have write access as default, and can be changed via repository
collaboration settings page to change between read, write and admin.
Unknwon a2f13eae55 some avatar setting changes
- Allow to delete current avatar
Unknwon 2d2d85bba4 support pull requests in same repository
Unknwon 9df6ce48c5 Minor fixes for
Josh Frye 2f228ddf31 Update delete wiki page route
Josh Frye 1ca171dbe9 Add ability to delete single wiki pages.
Unknwon 9e89584cb4 Allow setting git operations timeouts
- Migrate:  
- Clone: 
- Mirror, Pull
Unknwon 8055a0bdac Post work for
Improve test cases, config settings, also show SSH config settings on admin config panel.
Unknwon baaf6046a1 Minor fix for
Josh Frye c27038e392 Test mailer button. Addresses
Unknwon 72ce06eab8 fix missing slash for go-get meta
Unknwon 912f7b51e9 add actions for close and reopen issues
Unknwon c9516c4c60 Fix wrong place to check disable SSH
Unknwon ac78bae7b5 Replace uuid module with original package
Unknwon 7140dbac95 Fix
Unknwon 2408df3f35 Merge pull request from Download-Fritz/MirrorForks
 Allow to fork and disallow to create PRs for mirrors.
Download-Fritz a1b28fc33c Rename MustEnablePulls() to MustAllowPulls() and simplify the contained check to AllowsPulls().
Unknwon 338af89d56 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.
Unknwon ccc94dd11c fix panic on pushing repositor
Unknwon 9cf4fe043b Add env var check for update
Unknwon 58e004f7da Remove cache avatar support and add its tests
Unknwon 9adfe453d5 delete repo local copy when transfer
Remote repository path is renamed but does not delete
outdated local copy which still has old repository path
as remote.
Josh Frye 8662990746 Add default branch to repo payload
Josh Frye 47adc0e8f7 Bump git-module. Fixes
Unknwon 739d5aa1d3 Merge pull request from fnkr/hide-other-teams-repos-from-org-page
Hide other teams & repos from organization page
Florian Kaiser 71bb7f6053 Escape unescaped periods in route regular expression
Florian Kaiser e35791b2b2 Only show teams the user has access to
Unknwon ee814bf8d6 minor fix for sr on dashboard
Unknwon db719abff2 stop compile bindata for TRANSLATORS
- update required version of git-module for 
Unknwon e0f0f72a36 disallow access of some pages for empty repo
Unknwon cc22c8a1ae update dep lib version requirement
Unknwon a62290de52 improve HTTP auth error message
Unknwon 85af36332b fix utf-8 recognized as windows-1252
Unknwon a49af93faf APIs: Users Followers
- User profile un/follow
- List user's followers/following
Unknwon f00fef0cd0 show commits count in PR tabs
Unknwon 9cd16c5b12 add organization APIs
Unknwon 8ecbf0f16d fix
Unknwon 19423957b1 rename import path
Unknwon 3362b3a44f fix possible disclosure
Unknwon 50264200f0 fix huge diff hangs
Unknwon 7509fa2c33 improve get commits performance
Unknwon 79dcd7ee6e able to identify git version on Windows
Unknwon 59c965a5ec admin able to edit organization max repo creation
Unknwon 477b4d3b50 fix form submit error
Unknwon 2a0bb1fa90 Limit repo creation
Unknwon 9a2e43bff2 move out git module and send push hook
Adam Strzelecki e4a092fb5a Make serv/update use LOCAL_ROOT_URL instead public
The reasoning for that is in the previous commit.
Unknwon 4e0c697aaf force new INI version
Unknwon ca8ce793d1 Ability to delete repo from admin panel
Unknwon 404867f206 fix and fix
Unknwon f3eaa4c592 Set default language for i18n
Unknwon f41360d864 advanced select ops for system notices
Unknwon e538ff2770 fix and fix
Unknwon 56dd430a10 refactor API routes and some work for
Unknwon 5742f9fe69 fix
Unknwon cc8f5add6e fix
Unknwon ec2423ad7c more UI minor fixes
Adam Strzelecki 2580e7b57e UI: Always show menu on repo pages
Merges repo/sidebar.tmpl with repo/header.tmpl and makes every repo page use
middleware.RepoRef() necessary to display information on this menu.
Unknwon 0be8b1b1a1 Ability to batch delete system notices
Unknwon dcb391d341 Merge branch 'feature/wiki' into develop
Unknwon 830d000667 finish wiki
Unknwon 5a14c3cf98 Merge pull request from kakwa/develop
various fixes in gogs dump command
Unknwon 9950f5a5bd add line break after SSH error message
kakwa 1d7a1b6034 add name of the dump file in last log message
kakwa a59b1fcc21 Fix dump of log and custom directory in dump cmd
Now, the dump cmd uses setting.CustomPath and setting.LogRootPath
instead of setting.WorkDir which was kind of broken if the gogs
binary was in a different directory than gogs data.
Additionally, the backup of setting.CustomPath directory is only done
if it exists.
kakwa c5a9be9115 Using a tmp dir to generate db and repo dumps
Using a tmp dir makes gogs dump more robust to concurrent runs.

It also permits an easier cleaning of the tmp files (gogs-db.sql and
gog-repo.zip) by just removing the tmp dir.

As a side effect, it partially fix bugs on workdir.
Previously, 'gogs dump' created the archives in the current directory,
and tried to include these archives from the directory where the
gogs binary lies.
ex: if gogs binary is in /usr/bin/gogs, and gogs dump is run from /tmp/,
/tmp/gog-repo.zip is created, but gogs dump tried to include
/usr/bin/gogs-repo.zip.
kakwa f86afb04a2 Adding more error handling in dump cmd
The dump cmd did not check the return value of the z.AddFile or
z.AddDir when building the final archive.
It caused the dump command to succeed even if an error occurred.
The resulted dump archive could be corrupted/empty.
(errors could be various: removal by a concurrent process, disk full,
bugs in the dump cmd itself)
Unknwon e42fcb033d wiki: finish edit
Unknwon 392f3ee210 wiki: finish new
Unknwon c50a3503e6 introduce git-shell
Unknwon 2b10fdc4dc Wiki: UI for page new
Unknwon 3ca544912f Drop /org/ URL path prefix in organization home page
Unknwon 21ad4bf0fe print error log to client side when dev mode
Unknwon 0128036514 some fixes for builtin SSH server on Windows
Unknwon 52c8f69163 fix
Unknwon 987dcc5372 fix
Unknwon f455125d4d fix
Unknwon 29ed7872f8 repo sidebar active class
Unknwon 5dc3dd1704 fix
Unknwon 134d8e7681 work on
Unknwon e030109b5a fix api broken
Unknwon 7c80eba77f minor UI fix and fix ssh race
Unknwon 1d57f0d64f Show custom avatars in commits
Unknwon 2db785b3ed convert missing name
Unknwon 647688bd06 convert name to lower when handle SSH
Unknwon 18c841050b fix 1540 and experimental SSH server support
Unknwon b55499d039 go vet and fix
Unknwon 676d774d88 fix
Unknwon f255b1e86d fatal when no needed update task
Unknwon a374751eb8 add Makefile
Unknwon b9f5def5dc fix insecure tls when trigger task
Unknwon 0fbb8c8826 New push to head repo of head branch: regenerate patch and retest apply
Unknwon b5fdf0947b reduce code
Unknwon 35a65736fa add get repo API
Unknwon 932dbccb67 fix import path, fix
Unknwon aff49b1c9e unified API error response