168 Commits (bd66fa586a0da58c4cf2f5f8390aef4bac9d0527)

Author SHA1 Message Date
Lunny Xiao 08069dc465
Improve migrations to support migrating milestones/labels/issues/comments/pullrequests (#6290)
* add migrations

* fix package dependency

* fix lints

* implements migrations except pull requests

* add releases

* migrating releases

* fix bug

* fix lint

* fix migrate releases

* fix tests

* add rollback

* pull request migtations

* fix import

* fix go module vendor

* add tests for upload to gitea

* more migrate options

* fix swagger-check

* fix misspell

* add options on migration UI

* fix log error

* improve UI options on migrating

* add support for username password when migrating from github

* fix tests

* remove comments and fix migrate limitation

* improve error handles

* migrate API will also support migrate milestones/labels/issues/pulls/releases

* fix tests and remove unused codes

* add DownloaderFactory and docs about how to create a new Downloader

* fix misspell

* fix migration docs

* Add hints about migrate options on migration page

* fix tests
5 years ago
zeripath 704da08fdc
Better logging (#6038) (#6095)
* 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
5 years ago
John Olheiser cac9e6e760 Updates to API 404 responses (#6077) 5 years ago
Bogdan Petrea 583968f274 Return 409 when creating repo if it already exists. (#6330) 5 years ago
Lunny Xiao 7afe81f28e fix bug when migrate repository 500 when repo is existed (#6188)
* fix bug when migrate repository 500 when repo is existed

* use 409 but not 422 for error status code when not exist

* translation fix
5 years ago
John Olheiser df30010dbd Make repo creation for API similar to UI (#6142) 5 years ago
Rémy Boulanouar 64ce159a6e Allow to set organization visibility (public, internal, private) (#1763) 5 years ago
Lanre Adelowo 9441bfaccc admin should be able to delete repos even if he is not a member of the organization (#5443) 6 years ago
Lunny Xiao eabbddcd98
Restrict permission check on repositories and fix some problems (#5314)
* 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
6 years ago
zeripath 43f9233914 Fix Swagger JSON autogeneration issues. (#4845)
* Fix Swagger JSON.

Remove unnecessary schema references for the forbidden and empty responses

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Fix swagger API for CreateAccessToken

* Fix admin create org swagger

* Fix swagger for adminCreateRepo

* More swagger fixes

Set int64 format for those which are int64
Some more form fixes

* Fix swagger description of GET /repos/{owner}/{repo}/pulls
6 years ago
Bo-Yi Wu ea20adaa84
feat(repo): support search repository by topic name (#4505)
* feat(repo): support search repository by topic name
6 years ago
Allen Wild c40f5d2d4c api: repos/search: add parameters to control the sort order (#3964)
The backend SearchRepositoryByName function supports several sort order
options, hook these up to the /repos/search API.

New parameters for /repos/search:
    'sort':  alpha, created, updated, size, or id
    'order': asc or desc

'sort' defaults to alpha.
'order' defaults to ascending, and is ignored if 'sort' is not specified.
The overall default behavior is unchanged (alphabetically ascending).

This partially implements issue #3963

Signed-off-by: Allen Wild <allenwild93@gmail.com>
6 years ago
Lauris BH 69e2ab1611 Allow administrator to create repository for any organization (#4368) 6 years ago
Lauris BH 4a8ee0b5cc
Check that repositories can only be migrated to own user or organizations (#4366)
* Repositories can only migrated to own user or organizations

* Add check for organization that user does not belong to

* Allow admin to migrate repositories for other users
6 years ago
Antoine GIRARD 908e8942cc Fix swagger errors (#4220)
Fix all the resting errors to have a valid swagger file.

They are still some warnings but nothing blocking.

Doing so I found that some request still misses son parameters for some POST/PUT/PATCH request. This means the a client generated from the swagger file will not work completely. 

Fix #4088 by activating validation in drone
Should fix #4010.
6 years ago
Lunny Xiao bec69f702b
Add topic support (#3711)
* add topic models and unit tests

* fix comments

* fix comment

* add the UI to show or add topics for a repo

* show topics on repositories list

* fix test

* don't show manage topics link when no permission

* use green basic as topic label

* fix topic label color

* remove trace content

* remove debug function
6 years ago
Bo-Yi Wu 1c5cbc390b refactor: import order. (#3736) 6 years ago
Morgan Bazalgette 65861900cd Handle refactor (#3339)
* Replace all ctx.Handle with ctx.ServerError or ctx.NotFound

* Change Handle(403) to NotFound, avoid using macaron's NotFound
6 years ago
Ethan Koenig 515cdaa85d Fix ignored errors when checking if organization, team member (#3177) 7 years ago
Ethan Koenig 3c1b1ca78e Fix error message sanitiziation (#3082) 7 years ago
Ethan Koenig d22a8dc022 Page parameter for repo search API (#2915) 7 years ago
Ethan Koenig f26f4a7e01 Update swagger documentation (#2899)
* Update swagger documentation

Add docs for missing endpoints
Add documentation for request parameters
Make parameter naming consistent
Fix response documentation

* Restore delete comments
7 years ago
Morlinest ddb7f59ef4 Add search mode option to /api/repo/search (#2756)
* Add repo type option to /api/repo/search

* Add tests and fix result of collaborative filter in specific condition

* Fix/optimize search & tests

* Improve integration tests

* Fix lint errors

* Fix unit tests

* Change and improve internal implementation of repo search

* Use NonexistentID

* Make search api more general

* Change mirror and fork search behaviour

* Fix tests & typo in comment
7 years ago
Morlinest ccd3577970 Fix repository search function (#2689)
* Fix and remove FIXME

* Respect membership visibility

* Fix/rewrite searchRepositoryByName function

* Add unit tests

* Add integration tests

* Remove Searcher completely

* Remove trailing space
7 years ago
Ethan Koenig b689bb6180 Webhooks for repo creation/deletion (#1663)
* Webhooks for repo creation/deletion

* add createHookTask

* Add handles for GetSlackPayload and GetDiscordPayload
7 years ago
Bwko 1a5fe4326f Add collaborative repositories to the dashboard (#2205)
* Add collaborative repositories to the dashboard

Remove some unused code from the Dashboard func

* fix some bug and some refactor

* fix tests
7 years ago
Antoine GIRARD fd8e8a421a Improve swagger doc (#2274)
* Add swagger comment for adminCreateOrg

* Add swagger comment for admin route

* add hook swagger doc

* Add tags

* Add auth

* Fix name of responses

* Edit name method

* Update vendor

* make generate-swagger
7 years ago
Morlinest 951fb572a7 Fix and improve dashboard repo UI (#2285)
* Fix and improve dashboard repo UI

* Change order of scripts loading

* Remove "mirror" tab

* Remove single tab panel for "org user"

* Add localization strings

* Create vue component and change event for search

* Add "mirrors" filter
7 years ago
Ethan Koenig 49df677c47 Check for access in /repositories/:id (#2227)
* Check for access in /repositories/:id

* Integration test
7 years ago
Ethan Koenig 93a1de4842 Fix repo API bug (#2133)
Don't require token when not necessary
7 years ago
Antoine GIRARD 30787e48f2 Improve org error handling (#2117)
* Improve ErrOrgNotExist type
Return new error type
Use good error check
Use new method to check error
Update tests

* Fix unchanged method name report
7 years ago
Andrey Nering e67ece26f0 Merge pull request #1750 from andreynering/dashboard-search-org-repos
More fixes for dashboard search
7 years ago
Jonas Östanbäck 0161e46b5a Add swagger comment for MirrorSync (#1747)
* Add swagger comment for MirrorSync

* Generate swagger.v1.json
7 years ago
Andrey Nering 8906b2891b Fix test
There was a panic when there's no logged in user
7 years ago
Andrey Nering dc2b28ed76 Show repos acording to user/organization 7 years ago
Andrey Nering 8917f47347 Fix org repos not showing on dashboard search 7 years ago
Antoine GIRARD 3edb0c5894 Generate swagger json (#1402)
- Generate swagger.json into public/
- Add swagger-ui auto-installation
- Add footer link to local swagger-ui
- Add /swagger url for using app url.
- Fix Swagger-UI version via git tag
7 years ago
Lunny Xiao 0308d44a16 fix #1643 and improve integration test (#1645) 7 years ago
Jonas f995bcc87a Add repo mirror sync API endpoint (#1508)
* API: Add repo mirror sync

* Correct error message

* Change http status to 200
7 years ago
Ethan Koenig ec0ae5d50c Refactor and fix incorrect comment (#1247) 7 years ago
awwalker c0f99e8229 API: support /users/:username/repos
clean up

fix arguments

remove repeated token

give admins listing rights
7 years ago
Bo-Yi Wu 3576e1ee73 fix: trim the whitespaces for the search keyword (#893) 7 years ago
Ethan Koenig 2f13d31ff0 Fix bug in repos search (#884) 7 years ago
Bo-Yi Wu a90a215662 feat: Add search bar on user profile page. (#787) 7 years ago
Ethan Koenig 6f4ba6884c Repo permission bug fixes (#513) 8 years ago
Ethan Koenig 04b9a7e7a2 Bug fixes for repo permissions in API
Also move duplicated code into repo.APIFormat(..)
8 years ago
Kim "BKC" Carlbäcker e6cfccdd40 GitHub API Compliance (& linting) 8 years ago
Kim "BKC" Carlbäcker 71bb6df75a Add undocumented endpoint for /repositories/:id 8 years ago
Lunny Xiao ec87a75c00 golint fixed for modules/auth 8 years ago
Lunny Xiao 3917ed45de golint fixed for routers (#208) 8 years ago
Ethan Koenig 0834e492c0 API endpoints for stars 8 years ago
Sandro Santilli a1c5f02444 Fix import path of go-sdk (#141)
From code.gitea.io/go-sdk/gitea
  To code.gitea.io/sdk/gitea
8 years ago
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
8 years ago
Sandro Santilli f388661bda ACCESS_MODE_* -> AccessMode* 8 years ago
Thomas Boerger 4c6c16f358
Replaced go-gogs-client with go-sdk imports 8 years ago
Rémy Boulanouar 2d68bd1ef9 Change import reference to match gitea instead of gogs (#37) 8 years ago
Unknwon dccb0c15b9 Replace convert.To with APIFormat calls 8 years ago
Unknwon e74630ae3b #1384 add pagination for repositories 8 years ago
Unknwon 1f2e173a74 Refactor User.Id to User.ID 8 years ago
Unknwon 4b25bdfbc4 #3058 #3059 support correct page size and link header 8 years ago
Unknwon 9bd9ad4205 #1692 add CRUD issue APIs
- Fix go-gogs-client#10
- Related to #809
8 years ago
Unknwon dd6faf7f9b Convert all API handers to use *context.APIContext 8 years ago
Unknwon 2bf8494332 #13 finish user and repository search
Both are possible on explore and admin panel
8 years ago
Unknwon 514382e2eb Rename module: middleware -> context 8 years ago
Unknwon 1c9dd11ba7 #1692 API: admin create repo 9 years ago
Unknwon 9cd16c5b12 #1692 add organization APIs 9 years ago
Unknwon 120cd4e471 #1984 Better mirror repo management 9 years ago
Unknwon 56dd430a10 refactor API routes and some work for #976 9 years ago