summaryrefslogtreecommitdiffstats
path: root/routers/home.go
Commit message (Collapse)AuthorAgeFilesLines
* Refactor routers directory (#15800)Lunny Xiao2021-06-091-413/+0
| | | | | | | | | | | * refactor routers directory * move func used for web and api to common * make corsHandler a function to prohibit side efects * rm unused func Co-authored-by: 6543 <6543@obermui.de>
* [refactor] replace int with httpStatusCodes (#15282)65432021-04-051-6/+7
| | | | | | | | | | | * replace "200" (int) with "http.StatusOK" (const) * ctx.Error & ctx.HTML * ctx.JSON Part1 * ctx.JSON Part2 * ctx.JSON Part3
* Add ui.explore settings to control view of explore pages (2) (#14094)zeripath2021-03-111-0/+7
| | | | | | | | | | | | | | | | | | | | | | | This is an alternative PR to #13687. Add `[ui.explore]` settings to allow restricting the explore pages to logged in users only and to disable the users explore page. The two proposed settings are: - `REQUIRE_SIGNIN_VIEW`: Only allows access to the explore pages if the user is signed in. Also restricts - `/api/v1/user/search` - `/api/v1/users/{username}` - `/api/v1/users/{username}/repos` - but does not restrict `/api/v1/users/{username}/heatmap` - `DISABLE_USERS_PAGE`: Disables the /explore/users page Fix #2908 Close #13687 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
* Add SameSite setting for cookies (#14900)zeripath2021-03-071-1/+2
| | | | | | | | | Add SameSite setting for cookies and rationalise the cookie setting code. Switches SameSite to Lax by default. There is a possible future extension of differentiating which cookies could be set at Strict by default but that is for a future PR. Fix #5583 Signed-off-by: Andrew Thornton <art27@cantab.net>
* [Feature] add precise search type for Elastic Search (#12869)Jui-Nan Lin2021-01-271-2/+6
| | | | | | | | * feat: add type query parameters for specifying precise search * feat: add select dropdown in search box Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Simplify CheckUnitUser logic (#12854)赵智超2020-09-151-3/+1
| | | | | | | | if check one user's unit in different repos, it's not necessary to get user data every time. Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Show 2FA info on Admin Pannel: Users List (#12515)65432020-08-201-0/+1
|
* Ensure public repositories in private organizations are visible and fix ↵zeripath2020-05-181-1/+2
| | | | | | | | | | | | | | | | | admin organizations list (#11465) * Ensure that we can see public repositories in private organization Fix #10144 (Again) Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix Admin users and organizations page Signed-off-by: Andrew Thornton <art27@cantab.net> * Update models/repo_list.go Co-authored-by: Lauris BH <lauris@nix.lv>
* Add detected file language to code search (#10256)Lauris BH2020-02-201-4/+9
| | | | | | | Move langauge detection to separate module to be more reusable Add option to disable vendored file exclusion from file search Allways show all language stats for search
* API add/generalize pagination (#9452)SpaWn2KiLl2020-01-241-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * paginate results * fixed deadlock * prevented breaking change * updated swagger * go fmt * fixed find topic * go mod tidy * go mod vendor with go1.13.5 * fixed repo find topics * fixed unit test * added Limit method to Engine struct; use engine variable when provided; fixed gitignore * use ItemsPerPage for default pagesize; fix GetWatchers, getOrgUsersByOrgID and GetStargazers; fix GetAllCommits headers; reverted some changed behaviors * set Page value on Home route * improved memory allocations * fixed response headers * removed logfiles * fixed import order * import order * improved swagger * added function to get models.ListOptions from context * removed pagesize diff on unit test * fixed imports * removed unnecessary struct field * fixed go fmt * scoped PR * code improvements * code improvements * go mod tidy * fixed import order * fixed commit statuses session * fixed files headers * fixed headers; added pagination for notifications * go mod tidy * go fmt * removed Private from user search options; added setting.UI.IssuePagingNum as default valeu on repo's issues list * Apply suggestions from code review Co-Authored-By: 6543 <6543@obermui.de> Co-Authored-By: zeripath <art27@cantab.net> * fixed build error * CI.restart() * fixed merge conflicts resolve * fixed conflicts resolve * improved FindTrackedTimesOptions.ToOptions() method * added backwards compatibility on ListReleases request; fixed issue tracked time ToSession * fixed build error; fixed swagger template * fixed swagger template * fixed ListReleases backwards compatibility * added page to user search route Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
* Restricted users (#6274)Manush Dodunekov2020-01-131-17/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Restricted users (#4334): initial implementation * Add User.IsRestricted & UI to edit it * Pass user object instead of user id to places where IsRestricted flag matters * Restricted users: maintain access rows for all referenced repos (incl public) * Take logged in user & IsRestricted flag into account in org/repo listings, searches and accesses * Add basic repo access tests for restricted users Signed-off-by: Manush Dodunekov <manush@stendahls.se> * Mention restricted users in the faq Signed-off-by: Manush Dodunekov <manush@stendahls.se> * Revert unnecessary change `.isUserPartOfOrg` -> `.IsUserPartOfOrg` Signed-off-by: Manush Dodunekov <manush@stendahls.se> * Remove unnecessary `org.IsOrganization()` call Signed-off-by: Manush Dodunekov <manush@stendahls.se> * Revert to an `int64` keyed `accessMap` * Add type `userAccess` * Add convenience func updateUserAccess() * Turn accessMap into a `map[int64]userAccess` Signed-off-by: Manush Dodunekov <manush@stendahls.se> * or even better: `map[int64]*userAccess` * updateUserAccess(): use tighter syntax as suggested by lafriks * even tighter * Avoid extra loop * Don't disclose limited orgs to unauthenticated users * Don't assume block only applies to orgs * Use an array of `VisibleType` for filtering * fix yet another thinko * Ok - no need for u * Revert "Ok - no need for u" This reverts commit 5c3e886aabd5acd997a3b35687d322439732c200. Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* [API] add GET /orgs endpoint (#9560)65432020-01-121-4/+10
| | | | | | | | | | | | | | * introduce `GET /orgs` * add TEST * show also other VisibleType's * update description * refactor a lot * SearchUserOptions by default return only public
* [BugFix] Hide public repos owned by private orgs (#9609)65432020-01-051-0/+1
| | | | | * Restrict AllPublic to actually public repos. * Add new parameter to add in AllLimited Repos
* Use Req.URL.RequestURI() to cope with FCGI urls (#9473)zeripath2019-12-241-1/+1
| | | | | * Use Req.URL.RequestURI() to cope with FCGI urls * Add debug logging statement when forbidden in internal API.
* Refactor code indexer (#9313)Lunny Xiao2019-12-231-4/+4
| | | | | | | | | | | | | | | | | | | | * Refactor code indexer * fix test * fix test * refactor code indexer * fix import * improve code * fix typo * fix test and make code clean * fix lint
* Explore page: Add topic param to pagination (#9077) (#9078)David Svantesson2019-11-201-0/+2
|
* Use AppSubUrl for more redirections (#8647)zeripath2019-10-231-1/+1
| | | | Fix #8461 - fix misspelling of {{AppSubUrl}} and other misspelling in template Fixes /explore and organisation redirection
* Include description in repository search. (#7942)David Svantesson2019-08-251-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add description in repository search. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Refactor SearchRepositoryByName with a general function SearchRepository Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Allow to specify if description shall be included in API repo search. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add new app.ini setting for whether to search within repo description. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Search keyword in description (if setting enabled) on: - Explore page - Organization profile page - User profile page - Admin repo page Do not search keyword in description on: - Any non-keyword search (not relevant) - Incremental search (uses API) Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Put parameters related to keyword directly after it Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add test cases for including (and not including) repository description in search. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Rename test function from TestSearchRepositoryByName to TestSearchRepository. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Make setting SEARCH_REPO_DESCRIPTION default to true Signed-off-by: David Svantesson <davidsvantesson@gmail.com>
* Unifies pagination template usage (#6531) (#6533)Mario Lubenka2019-04-201-6/+13
|
* Clean up various use of escape/unescape functions for URL generation (#6334)mrsdizzie2019-03-181-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use PathUnescape instead of QueryUnescape when working with branch names Currently branch names with a '+' fail in certain situations because QueryUnescape replaces the + character with a blank space. Using PathUnescape should be better since it is defined as: // PathUnescape is identical to QueryUnescape except that it does not // unescape '+' to ' ' (space). Fixes #6333 * Change error to match new function name * Add new util function PathEscapeSegments This function simply runs PathEscape on each segment of a path without touching the forward slash itself. We want to use this instead of PathEscape/QueryEscape in most cases because a forward slash is a valid name for a branch etc... and we don't want that escaped in a URL. Putting this in new file url.go and also moving a couple similar functions into that file as well. * Use EscapePathSegments where appropriate Replace various uses of EscapePath/EscapeQuery with new EscapePathSegments. Also remove uncessary uses of various escape/unescape functions when the text had already been escaped or was not escaped. * Reformat comment to make drone build happy * Remove no longer used url library * Requested code changes
* fix display dashboard even if require to change password (#6214)Lunny Xiao2019-02-281-0/+6
| | | | | | * fix display dashboard even if require to change password * fix comments
* Fix prohibit login check on authorization (#6106)Lunny Xiao2019-02-191-0/+5
| | | | | | | | | | | | * fix bug prohibit login not applied on dashboard * fix tests * fix bug user status leak * fix typo * return after render
* Allow to set organization visibility (public, internal, private) (#1763)Rémy Boulanouar2019-02-181-0/+9
|
* feat(repo): support search repository by topic name (#4505)Bo-Yi Wu2018-09-131-0/+2
| | | | * feat(repo): support search repository by topic name
* fix not respecting landing page setting (#4209)David Schneiderbauer2018-06-151-0/+4
| | | | | | | | * fix not respecting landing page setting * fmt * add landing page test
* Added repository search ordered by stars or forks. Forks column in admin ↵Alexey Terentyev2018-05-241-8/+16
| | | | | | | | | | | | | repo list. (#3969) * Added repository search order by stars or forks. Added Forks column to admin repository list. Signed-off-by: Alexey Terentyev <axifnx@gmail.com> * Renamed search repo template Signed-off-by: Alexey Terentyev <axifnx@gmail.com>
* Global code search support (#3664)Lunny Xiao2018-03-161-0/+116
| | | | | | | | | | | | * add global code search on explore * fix bug when no anyone public repos * change the icon * fix typo and add UnitTypeCode check for login non-admin user * fix ui description when no match
* Handle refactor (#3339)Morgan Bazalgette2018-01-101-3/+3
| | | | | | * Replace all ctx.Handle with ctx.ServerError or ctx.NotFound * Change Handle(403) to NotFound, avoid using macaron's NotFound
* Add search mode option to /api/repo/search (#2756)Morlinest2017-10-271-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | * 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
* Hide unactive on explore users and some refactors (#2741)Lunny Xiao2017-10-241-49/+18
| | | | | | | | | | | | | | | | | | | | | | | | * hide unactive on explore users and some refactors * fix test for removed Organizations * fix test for removed Organizations * fix imports * fix logic bug * refactor the toConds * Rename TestOrganizations to TestSearchUsers and add tests for users * fix other tests * fix other tests * fix watchers tests * fix comments and remove unused code
* Move swagger-ui under /api/v1 (#2746)Antoine GIRARD2017-10-211-7/+0
| | | | | | | | | | | | * Move swagger interface under /api/v1 * Update swagger-ui * Add /api/swagger and prepare for multiple api version * Update test links * Fix footer link
* Fix repository search function (#2689)Morlinest2017-10-171-1/+0
| | | | | | | | | | | | | | | | * Fix and remove FIXME * Respect membership visibility * Fix/rewrite searchRepositoryByName function * Add unit tests * Add integration tests * Remove Searcher completely * Remove trailing space
* Remove redudant functions and code (#2652)Morlinest2017-10-101-34/+23
| | | * Remove redudant functions and code
* Change default sort order (#2647)Kazuki Sawada2017-10-051-3/+9
| | | | | | | | | | | | * sort repositories by `updated_unix` in Explore * Fix UI problem * Added missing sort order "newest" * Change default sort order * fmt
* Use custom type and constants to hold order by options (#2572)Morlinest2017-09-221-9/+9
|
* Fix missing collabrative repos (#2367)Lunny Xiao2017-08-241-11/+13
| | | | | | | | * fix missing collabrative repos * fix bug of collabrative * fix SQL quotes
* Generate swagger json (#1402)Antoine GIRARD2017-05-021-0/+7
| | | | | | | - 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
* Sort on repo size in admin panel (#1654)Jorrit Klein Bramel2017-05-021-0/+4
| | | | | | * fix #1653 sort on repo size * fix minor mistake in en-us locale
* fix: Admin can see all private repositories on Explore page. (#1026)Bo-Yi Wu2017-02-261-7/+6
| | | | | | * fix: Admin can see all private repositories on Explore page. * refactor: fix session
* refactor: small optimize for sql query (#940)Bo-Yi Wu2017-02-151-11/+3
| | | | | | * refactor: small optimize for sql query * fix: get owner name if Searcher is not nil or user star page.
* fix: trim the whitespaces for the search keyword (#893)Bo-Yi Wu2017-02-111-4/+4
|
* UI config to toggle whether user email shows up in Explore Users (#336)Thiago Avelino2017-01-011-0/+1
| | | | | | | | | | | | | | | | | | * UI config to toggle whether user email shows up in Explore Users * Recommendation made by @tboerger https://github.com/go-gitea/gitea/pull/336/commits/66a1c59fe730eff019ce100673c6800cce7d102d#r94122732 * fixed typo, rename ShowUserEmailInExplore to ShowUserEmail * Fixed typo merged conflict * Hide email in the user profile page if you are active ShowUserEmail ref https://github.com/go-gitea/gitea/pull/336#issuecomment-269843725 * Please replace MustBool() with MustBool(true)
* Added sorting to organizations, repos & users page (#222)Bwko2016-12-241-17/+58
|
* Resolved #296 (#324)Lunny Xiao2016-12-011-20/+34
| | | | | | * resolved #296 * Indentation fixed
* Golint fixed for modules/setting (#262)Lunny Xiao2016-11-271-1/+1
| | | | | | * golint fixed for modules/setting * typo fixed and renamed UNIXSOCKET to UnixSocket
* golint fixed for parts of routers root, dev, user and org dirs (#167)Lunny Xiao2016-11-181-9/+22
| | | | | | | | * golint fixed for parts of routers root, dev and org dirs * add user/auth.go golint fixed * rename unnecessary exported to unexported and user dir golint fixed
* Update import paths from github.com/go-gitea to code.gitea.io (#135)Sandro Santilli2016-11-101-5/+5
| | | | | | | - 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
* Ordering organizations and users by nameThibault Meyer2016-11-101-2/+2
|
* And othersSandro Santilli2016-11-071-2/+2
|
* Change import reference to match gitea instead of gogs (#37)Rémy Boulanouar2016-11-031-5/+5
|