summaryrefslogtreecommitdiffstats
path: root/modules/public
Commit message (Collapse)AuthorAgeFilesLines
* refactor: move from io/ioutil to io and os package (#17109)Eng Zer Jun2021-09-221-2/+1
| | | | | | | | | The io/ioutil package has been deprecated as of Go 1.16, see https://golang.org/doc/go1.16#ioutil. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add bundle download for repository (#14538)John Olheiser2021-08-243-5/+8
| | | | | | | | | | | | | | | | | * Add bundle download Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix fmt Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix build tags Signed-off-by: jolheiser <john.olheiser@gmail.com> * Download specific commit Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Improve assets handler middleware (#15961)Lunny Xiao2021-05-303-124/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use route to serve assets but not middleware * Fix build error with bindata tag * convert path to absolute * fix build * reduce function stack * Add tests for assets * Remove test for assets because they are not generated * Use a http function to serve assets * Still use middleware to serve assets then less middleware stack for assets * Move serveContent to original position * remove unnecessary blank line change * Fix bug for /assets* requests * clean code Co-authored-by: zeripath <art27@cantab.net>
* add `/assets` as root dir of public files (#15219)a10121127962021-04-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | * add `/assets` as root dir of public files Signed-off-by: a1012112796 <1012112796@qq.com> * move serviceworker.js * make fmt * fix some link * fix test * Apply suggestions from code review Co-authored-by: silverwind <me@silverwind.io> * Apply suggestions from code review Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
* Add ETag header (#15370)KN4CK3R2021-04-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * Add ETag header. * Comply with RFC 7232. * Moved logic into httpcache.go * Changed name. * Lint * Implemented If-None-Match list. * Fixed missing header on * * Removed weak etag support. * Removed * support. * Added unit test. * Lint Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* add 'fonts' into 'KnownPublicEntries' (#15188)a10121127962021-03-301-0/+1
| | | | | | | fix #15184 Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Update docs and comments to remove macaron (#14491)Lunny Xiao2021-01-293-4/+4
|
* When visit /favicon.ico but the static file is not exist return 404 but not ↵Lunny Xiao2021-01-011-0/+1
| | | | | continue to handle the route (#14211) Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Improve vfsgen to not unzip bindata files but send to browser directly (#7109)Lunny Xiao2020-12-244-2/+102
| | | | | | | | | | | | | | | * Don't unzip files from bindata but send to browser directly * remove dependent for httpgzip * Add tests for parseAcceptEncoding * Update docs for ENABLE_GZIP * Fix bug * Fix bug Co-authored-by: zeripath <art27@cantab.net>
* HTTP cache rework and enable caching for storage assets (#13569)silverwind2020-11-171-23/+5
| | | | | | | | | | This enabled HTTP time-based cache for storage assets, primarily avatars. I have not observed If-Modified-Since from browsers during tests but I guess it's good to support regardless. It introduces a new generic httpcache module that can handle both time-based and etag-based caching. Additionally, manifest.json and robots.txt are now also cachable.
* Introduce go chi web framework as frontend of macaron, so that we can move ↵Lunny Xiao2020-11-133-43/+42
| | | | | | | | | routes from macaron to chi step by step (#7420) * When route cannot be found on chi, go to macaron * Stick chi version to 1.5.0 * Follow router log setting
* fix go1.15 lint error in modules/public/public.go (#12707)65432020-09-041-1/+1
| | | Co-authored-by: Lauris BH <lauris@nix.lv>
* go1.15 (#12475)techknowlogick2020-08-131-1/+2
| | | | | | | | | | | | | * go1.15 * update makefile xgo version * fix vet issue * update docs to version of go in use * add TODO for asyncpreemptoff Co-authored-by: Lauris BH <lauris@nix.lv>
* Move fomantic and jQuery to main webpack bundle (#11997)silverwind2020-06-271-1/+0
| | | | | | | | | | | | | | This saves around 3 MB binary size by not including useless fomantic files in the build. Also, this allows us to move jQuery into the main bundle as well which eliminates a few HTTP requests. Also included are webpack config changes: - split less and css loaders to speed up compliation - enable css sourcemaps - switch css minfier plugin to cssnano-webpack-plugin which works better for sourcemaps than the previous plugin Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add serviceworker.js to KnownPublicEntries (#11992)silverwind2020-06-201-3/+4
| | | | | | | Fixes a wrong 302 redirect to the login page, see https://github.com/go-gitea/gitea/issues/11989. Also made it so the reserved username list is extended with those known entries so we avoid code duplication. Should be backported to 1.12.
* Send 404 immediately for known public requests (#11117)silverwind2020-04-181-0/+22
| | | | | | | Instead of further handling requests to public which causes issues like #11088, immediately terminate requests to directories js, css, fomantic if no file is found which is checked against a hardcoded list. Maybe there is a way to retrieve the top-level entries below public in a dynamic fashion. I also added fomantic to the reserved usernames and sorted the list. Fixes: #11088
* Rename scripts to build and add revive command as a new build tool command ↵Lunny Xiao2020-04-031-1/+1
| | | | | (#10942) Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Implement "embedded" command to extract static resources (#9982)guillep2k2020-02-021-0/+33
| | | | | | | | | | | | | | | | | | | | | | | * draft * Implement extract command * Fix nits and force args on extract * Add !bindata stub, support Windows, fmt * fix vendored flag * Remove leading slash for matching * Add docs * Fix typos * Add embedded view command Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Generate Bindata iff TAGS="bindata" and not up-to-date (#10004)zeripath2020-01-273-25/+9
| | | | | | | | | | | | | | | | | | | | | | * Only generate bindata if necessary * Only generate bindata if they are not up-to-date * generate a hash of the fileinfo and use that to keep up-to-date * Newer test is redundant * handle missing bindata and clean * Only update hash after successful write * switch to sha1 hash * Apply suggestions from code review Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Use gitea forked macaron (#7933)Tamal Saha2019-08-233-3/+4
| | | Signed-off-by: Tamal Saha <tamal@appscode.com>
* remove unnecessary fmt on generate bindata (#7706)Lunny Xiao2019-08-011-1/+0
|
* Use vfsgen instead of go-bindata (#7080)Lunny Xiao2019-06-033-11/+25
| | | | | | | | | | * use vfsgen instead of go-bindata * fix templates * fix fmt * vendor vsfgen
* When redirecting clean the path to avoid redirecting to //www.othersite.com ↵zeripath2019-01-091-1/+1
| | | | | | | (#5669) Fix #5627 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Enable caching on assets and avatars (#3376)Morgan Bazalgette2018-02-043-25/+143
| | | | | | | | | | | | | | * Enable caching on assets and avatars Fixes #3323 * Only set avatar in user BeforeUpdate when there is no avatar set * add error checking after stat * gofmt * Change cache time for avatars to an hour
* Allow custom public files (#782)Thomas Boerger2017-01-281-0/+17
| | | | | | * Allow custom public files * Gofmt code, lots of places not related to this pr
* Integrate templates into bindata optionally (#314)Thomas Boerger2016-12-062-1/+3
| | | Integrated optional bindata for the templates
* Integrate public as bindata optionally (#293)Thomas Boerger2016-11-303-0/+64
* 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