Commit Graph

137 Commits (ba4e8f221bea0ab40a27da03c7fe3f0f78f6b790)

Author SHA1 Message Date
Lunny Xiao 477a80f658 upgrade go-sql-driver/mysql to fix invalid connection error ()
should fix 
Zsombor c2dcb35148 Fixing : ()
* Format boolean values to true/false even when it is returned as byte-slice,
* Fix the sequence generation, the proper sequence name is used (instead of 'table_id_seq'), and fix the next value be max+1 always
techknowlogick 5c44f751a3
Discord Oauth2 support ()
* add discord auth

* add vendor for discord

* fix syntax error

* make fmt

* update version of goth in use

* update markbates/goth
Zsombor 31aa00fa4b Update xorm to fix issue and ()
Lunny Xiao fe55ab2a68 fix forgot removed records when deleting user ()
* fix forgot removed records when deleting user

* fix migration

* fix rewritekey lock on sqlite

* remove unused codes
kolaente 6db7dbd333 Added test environment for mssql ()
* Added test environment for m$sql

* Added template for test environment for m$sql

* Fix password

* Fix password (again)

* Fix password (again again)

* Fix db

* Ci trigger (Looking at you drone....)

* Ci trigger (Looking at you drone....)

* Ci trigger (Looking at you drone....)

* Ci trigger (Looking at you drone....)

* Create master database for mssql integration tests

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Create database only if master do not exist

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Fix mssql integration tests by using custom database "gitea"

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Moved defer

* bump xorm

* updated xorm

* Fixed build
Lauris BH 08bf443016 Implement git refs API for listing references (branches, tags and other) ()
* Inital routes to git refs api

* Git refs API implementation

* Update swagger

* Fix copyright

* Make swagger happy add basic test

* Fix test

* Fix test again :)
Antoine GIRARD 4c1f1f9646 Remove x/net/context vendor by using std package ()
* Update dep github.com/markbates/goth

* Update dep github.com/blevesearch/bleve

* Update dep golang.org/x/oauth2

* Fix github.com/blevesearch/bleve to c74e08f039e56cef576e4336382b2a2d12d9e026

* Update dep golang.org/x/oauth2
Stanislav 078c404c3b Prometheus endpoint ()
* Add prometheus collector and route

* dep ensure -add github.com/prometheus/client_golang/prometheus

* dep ensure -update github.com/golang/protobuf

* add metrics to reserved usernames

* add comment head in metrics package

* fix style imports

* add metrics settings

* add bearer token check

* mapping metrics configs

* fix lint

* update config cheat sheet

* update conf sample, typo fix
Kim "BKC" Carlbäcker aeb5655c25 Update go-macaron/session to latest mast to fix RCE-bug ()
Mura Li 317ddb7283 Update vendor/github.com/mattn/go-sqlite3 ()
To fix build failure on Windows/386
Mura Li 2ce72d4e00 Update vendor/go-sqlite3 ()
Lauris BH ab5b245182 Disable debug routes unless PPROF is enabled in configuration ()
OvermindDL1 07af31d004 Fix to follow the OpenID Connect Audiences spec ()
Signed-off-by: Gabriel Robertson <overminddl1@gmail.com>
Lauris BH 0c59edaafa Update xorm to latest version and fix correct `user` table referencing in sql ()
Antoine GIRARD 74f9f98f78 Simply remove tidb and deps ()
techknowlogick 9d4c1ddfa1
Dep upgrade mysql lib ()
*  update gopkg file to add sql dep
Magnus Lindvall cdb9478774 LDAP Public SSH Keys synchronization ()
* Add LDAP Key Synchronization feature

Signed-off-by: Magnus Lindvall <magnus@dnmgns.com>

* Add migration: add login source id column for public_key table

* Only update keys if needed

* Add function to only list pubkey synchronized from ldap

* Only list pub ssh keys synchronized from ldap. Do not sort strings as ExistsInSlice does it.

* Only get keys belonging to current login source id

* Set default login source id to 0

* Some minor cleanup. Add integration tests (updete dep testify)
Aleksandr Bulyshchenko ee878e3951 Support secure cookie for csrf-token ()
* dep: Update github.com/go-macaron/csrf

Update github.com/go-macaron/csrf with dep to revision 503617c6b372
to fix issue of csrf-token security.

This update includes following commits:
- Add support for the Cookie HttpOnly flag
- Support secure mode for csrf cookie

Signed-off-by: Aleksandr Bulyshchenko <A.Bulyshchenko@globallogic.com>

* routers: set csrf-token security depending on COOKIE_SECURE

Signed-off-by: Aleksandr Bulyshchenko <A.Bulyshchenko@globallogic.com>
Antoine GIRARD 3f3383dc0a Migrate to dep ()
* Update makefile to use dep

* Migrate to dep

* Fix some deps

* Try to find a better version for golang.org/x/net

* Try to find a better version for golang.org/x/oauth2
Antoine GIRARD 8dca5ad526 Fetch missing file in github.com/davecgh/go-spew/spew ()
Jonas Franz 951309f76a Add support for FIDO U2F ()
* Add support for U2F

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Add vendor library
Add missing translations

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Minor improvements

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Add U2F support for Firefox, Chrome (Android) by introducing a custom JS library
Add U2F error handling

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Add U2F login page to OAuth

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Move U2F user settings to a separate file

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Add unit tests for u2f model
Renamed u2f table name

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Fix problems caused by refactoring

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Add U2F documentation

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Remove not needed console.log-s

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Add default values to app.ini.sample
Add FIDO U2F to comparison

Signed-off-by: Jonas Franz <info@jonasfranz.software>
Antoine GIRARD 917b9641ec Update to last common bleve ()
Lauris BH e74055878f Update xormstore dependency to fix OAuth2 support for MySQL ()
Lauris BH ff64f188fd Switch back to upstream goth repository and update govendor to latest goth version ()
Lauris BH 5a62eb30df
Store OAuth2 session data in database ()
* Store OAuth2 session data in database

* Rename table to `oauth2_session` and do not skip xormstorage initialization error
PJ Eby fc36567ee1 Update blackfriday dependency per ()
Signed-off-by: PJ Eby <pje@telecommunity.com>
Lauris BH ad33730dca
Update markbates/goth libary to fix OAuth2 support ()
Lauris BH 7b297808ce
Update markbates/goth library ()
Signed-off-by: Lauris Bukšis-Haberkorns <lauris@nix.lv>
Ethan Koenig a89592d4ab Reduce repo indexer disk usage ()
Lunny Xiao 97fe773491 fix MSSQL bug on org ()
Antoine GIRARD d2736e268b Remove unused vendor github.com/stretchr/testify/require ()
Ethan Koenig 58a7de2aea Update code.gitea.io/git ()
Ethan Koenig b7ebaf6d20 Various wiki bug fixes ()
* Update macaron

* Various wiki bug fixes
Lunny Xiao 10b54df2b2 Add dingtalk webhook ()
* add dingtalk webhook type

* add vendor

* some fixes

* fix name check

* fix name check & improvment
Lauris BH a6f337046f Update go-ini dependency and remove semicolon hack in translations ()
Ethan Koenig 5866eb2321 Code/repo search ()
Indexed search of repository contents (for default branch only)
Jonas Bröms e86a0bf3fe Add support for extra sendmail arguments ()
* Add support for extra sendmail arguments

* Sendmail args to exec.command should be a list

* Add go-shellquote package

* Use go-shellquote lib for parsing Sendmail args

* Only parse if sendmail is configured
Antoine GIRARD 2112eb8741 Update vendor github.com/lib/pq ()
Lunny Xiao a8717e5e3a Use AfterLoad instead of AfterSet on Structs ()
* use AfterLoad instead of AfterSet on Structs

* fix the comments on AfterLoad

* fix the comments on action AfterLoad
Lunny Xiao 0d80af649a Add init support of orgmode document type on file view and readme ()
* add init support of orgmode document type on file view and readme

* fix imports

* fix imports and readmeExist

* fix imports order

* fix format

* remove unnecessary convert
Ethan Koenig b0f7457d9e Improve issue search ()
* Improve issue indexer

* Fix new issue sqlite bug

* Different test indexer paths for each db

* Add integration indexer paths to make clean
Lunny Xiao 0f9e20b3d7 fix updated update on public key ()
* fix updated update on public key

* update vendor.json

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* fix root path

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Lunny Xiao 005900baea Use created & updated instead BeforeInsert & BeforeUpdate ()
* use created & updated instead BeforeInsert & BeforeUpdate

* fix vendor checksum

* only show generated SQL when development mode

* remove extra update column updated_unix

* remove trace config
Lunny Xiao 2c6a0fdca8 update latest xorm version to vendor ()
Andrey Nering 2ef33b5338 vendor: update sqlite to fix "database is locked" errors ()
closes 

upstream commit: acfa601240
Antoine GIRARD 274149dd14 Switch to keybase go-crypto (for some elliptic curve key) + test ()
* Switch to keybase go-crypto (for some elliptic curve key) + test

* Use assert.NoError 

and add a little more context to failing test description

* Use assert.(No)Error everywhere 🌈

and assert.Error in place of .Nil/.NotNil
Ethan Koenig cf02cd7ba0 Fix and test for delete user ()
* Fix and test for delete user

* Run updates in batches

* Unit test
Lauris BH 79494047b0 Show commit status icon in commits table ()
* Show commit status icon in commits table

* Add comments

* Fix icons

* Few more places where commit table is displayed

* Change integration test to use goquery for parsing html

* Add integration tests for commit table and status icons

* Fix status to return lates status correctly on all databases

* Rewrote lates commit status selects
Lauris BH 3792867955 Update xorm to latest version ()
* Update xorm to latest version

* Update xorm/builder
Willem van Dreumel 950f2e2074 Additional OAuth2 providers ()
* add google+

* sort signin oauth2 providers based on the name so order is always the same

* update auth tip for google+

* add gitlab provider

* add bitbucket provider (and some go fmt)

* add twitter provider

* add facebook provider

* add dropbox provider

* add openid connect provider incl. new format of tips section in "Add New Source"

* lower the amount of disk storage for each session to prevent issues while building cross platform (and disk overflow)

* imports according to goimport and code style

* make it possible to set custom urls to gitlab and github provider (only these could have a different host)

* split up oauth2 into multiple files

* small typo in comment

* fix indention

* fix indentation

* fix new line before external import

* fix layout of signin part

* update "broken" dependency
Lunny Xiao e3c2963222 remove unused vendor packages ()
Antoine GIRARD eb1075dd4c Check if missing/modified/unused deps in vendor and fix errors ()
* Check if missing deps in vendor

This will catch import from other repos. (maybe by auto-import)

* Remove github.com/smartystreets unused deps

* Remove github.com/boltdb/bolt unused dep

* Fetch github.com/go-xorm/core + sync gopkg.in/ldap.v2/ldap.go

* Auto-install govendor + reinstall github.com/boltdb/bolt needed by vendor/github.com/blevesearch/bleve/index/store/boltdb

* Update go-xorm/xorm to a5cb21 in vendor.json

* Use a custom repo for implementing change to bolt dep.

* Switching bolt to github.com/go-gitea/bolt

* Switching bolt to github.com/go-gitea/bolt (fork version)

* change the drone sign
Lunny Xiao 5acfc7c4bc fix migrate failed and org dashboard failed on MSSQL database ()
Damien Gaignon a78a0266c4 Correct broken unaligned load/store in armv5 ()
Update vendor github.com/boltdb/bolt to take care of the issue .
Sandro Santilli 71d16f69ff Login via OpenID-2.0 ()
Lunny Xiao fa41ddd3eb fix build failed on aarch64 ()
Lunny Xiao 6bdfadf4a9 fix broken caused by boltdb in mips/mipsle ()
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)
Lunny Xiao c5f8b96dda update xorm for fixing bug on processor BeforeSet and AfterSet when Find a map ()
Lunny Xiao 46320f9630 refactor notificationsForUser since xorm In support slice of customerize type ()
Lunny Xiao 284c0160c3 update xorm vendor and also fix ()
Ethan Koenig d2329e1c26 Use assert in legacy unit tests ()
Thomas Boerger ea8c8cdaf3 Fix master builds on mips* again ()
* Use local folder for xgo

* Always do crosscompile and testing to fail early

* Added mips* values for boltdb

In order to get master building again I have applied these 2 additional
files to boltdb. This should get dropped when
https://github.com/boltdb/bolt/issues/656 gets solved.
Andrey Nering e7c3be5f2f Merge pull request from andreynering/fix-windows-ssh
Fix SSH server on Windows when running as service
Bo-Yi Wu 691fbdf1d3 fix: delete attachment after remove comment.
Bwko 8555e888d8 Add ETag header to avatars ()
Ethan Koenig 833f8b94c2 Search bar for issues/pulls ()
Andrey Nering 2009f4cbda Remove original minwinsvc from vendor
Lunny Xiao 907b6f943c update xorm for bugs fix ()
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
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
Ethan Koenig de8b73dd92 Unit tests for token and update models
Lunny Xiao 527c2dd665 Support http service graceful restart ()
* support http service graceful restart

* fix dependencies
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
btrepp 25b5ffb6af Enables mssql support ()
* Enables mssql support

Port of dlobs work in gogs.
Enables options in index.js
Enables MSSQL as a database option in go.
Sets ID to 0 on initial migration. Required for
MSSQL insert statements.

Signed-off-by: Beau Trepp <beautrepp@gmail.com>

* Vendors in denisenkom/go-mssqldb

Includes golang.org/x/crypto/md4
as this is required by go-msssqldb

Signed-off-by: Beau Trepp <beautrepp@gmail.com>
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 a8c6698de8 Fix error 500 on organization dashboard page ()
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 a5d0b4de5b
Vendor github.com/stretchr/testify for the assert package
Sandro Santilli 0b62aeb495 More MixedCase consts
Sandro Santilli 80eea77953 Use MixedCase constant names
See https://github.com/golang/go/wiki/CodeReviewComments#mixed-caps
Thomas Boerger e378648c79
Added updated go-sdk
Thomas Boerger 6f3097f9e6
Dropped github.com/gogits/go-gogs-client vendored dep
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)
Thomas Boerger 1ebb35b988
Added all required dependencies