Commit Graph

33 Commits (jc/exp/srcgraph-external-service)

Author SHA1 Message Date
unknwon 08a53e5eca
pkg/context/notice: use path.Join to concatenate path 2019-07-28 16:08:00 -07:00
unknwon d775fe7936
pkg/context: change banner file path (#5750) 2019-07-28 14:59:51 -07:00
Achilleas Koutsou dc13eb6df0 pkg/context: Render live notice banner from file (#5750)
* pkg/context: Render live notice banner from file

- Contexter checks if there is a file called 'notice' under the
GOGS_CUSTOM directory and loads it.
- The first line is treated as a header/title and everything else as the
message body.
- Message body is rendered as HTML (tags allowed).
- File size is limited to 1024 bytes.
- File mime type must be text.
- Notice is rendered in head.tmpl for all pages.

* pkg/context: Rename maxlen to maxSize

Rename maxlen to maxSize for the maximum size (in bytes) of the notice
file to render.
Define the variable when needed to avoid instantiating it when the file
doesn't exist.

Co-Authored-By: ᴊ. ᴄʜᴇɴ <u@gogs.io>

* pkg/context: Package name after license header

Co-Authored-By: ᴊ. ᴄʜᴇɴ <u@gogs.io>

* pkg/context: Don't print 'Found notice file'

Becomes too verbose as it prints on every page load when the file
exists.

* pkg/context: Match project conventions

Import order and grouping

Variable names:
    fileloc -> fpath
    fp -> f
    finfo -> fi

* pkg/context: Remove empty line

Co-Authored-By: ᴊ. ᴄʜᴇɴ <u@gogs.io>

* pkg/context: Render notice as markdown

Server notice file should be named 'notice.md'.  The contents of the
file are treated as markdown and rendered as a warning message at the
top of every page.

* Update notice.go


Co-authored-by: ᴊ. ᴄʜᴇɴ <u@gogs.io>
2019-07-27 23:47:35 -07:00
Unknwon f91cb9321e
api: add GetReferenceSHA (#5546) 2018-12-16 19:47:32 -05:00
Unknwon ee82d35ed8
api: add GetSingleCommit (#5546) 2018-12-15 00:24:41 -05:00
Unknwon f545faa06d
templates: make state changing routes to POST method (#5541)
- pkg/context: add ParamsUser to unify the injection process
2018-12-06 22:58:02 -05:00
Unknwon 6690023555
pkg/context: use host address and apply insecure flag for go-get=1 when needed (#5305) 2018-12-03 13:36:11 -05:00
Unknwon a7e8187a0d
pkg/context: expose port in import path for 'go-get=1' (#5305) 2018-12-03 13:24:31 -05:00
Unknwon e1b3a25008
api/repo: support edit repository issue tracker (gogs/go-gogs-client#94) 2018-12-02 12:55:05 -05:00
Unknwon 69c1cd3f38
routes/api: change status handle to new style
Also fixed one bug that did not catch team not found error.
2018-12-01 21:41:30 -05:00
Unknwon 3db9b06a6e
api: fix critical CSRF vulnerabilities on API routes (#5355)
By explicitly requires token authentication.
2018-11-28 21:05:58 -05:00
Unknwon a221b2807f
routes/repo/issue: fix redirect with unexpected escape (#5443) 2018-09-30 13:55:40 -04:00
Unknwon 0d66b1cc1c
pkg/context: apply EscapePound at context level
Always escape template variable {{.Link}} variable and  redirect calls.

Relates to #5442
2018-09-28 23:56:45 -04:00
Unknwon 520530dfcf
metrics: add initial Prometheus support (#4141) 2018-09-14 22:29:43 -04:00
Unknwon ac73d43444
repo_editor: able to trigger Git hooks (#4338) 2018-08-17 23:15:20 +08:00
oOOps f9bc980b0b api: correct pagination in repository search api (#5293) 2018-06-13 21:55:09 +08:00
Unknwon dfd494c113
repo: minor improve for PR #5219 and support UTF-8 byte count 2018-06-11 21:06:24 +08:00
Unknwon aff4208244
*: rename "gogits" to "gogs" 2018-05-27 08:53:48 +08:00
Drahoslav Bednář 7faa2356d8 pkg/context: add doctype to go-get=1 response (#4938) 2018-03-06 16:43:48 -05:00
Unknwon 86931f546f
repo: fix go-get meta tags (#4832)
The first part in go-import should be the root import path. It
included subpath when 'go get' with a subpath and was not correct.
2017-11-16 18:43:03 -05:00
Unknwon 36d6450977
repo/pull: detect case when no merge base found (#4434) 2017-06-05 00:10:53 -04:00
Unknwon 2478b87432
Refactoring: rename ctx -> c 2017-06-03 07:26:09 -04:00
Unknwon e33c714073
repo: always response go-get meta when requested (#1878) 2017-06-03 06:54:06 -04:00
Unknwon 239dd978ff
repo: support go get subpkg (#1878) 2017-06-03 06:50:09 -04:00
Unknwon 91cd350b63
repo/editor: fix wrong context for subdirectory (#4368) 2017-04-07 21:44:55 -04:00
Unknwon fda4b1106e
user/setting: simplify code 2017-04-07 00:49:30 -04:00
Unknwon ac43eab51f
Refactoring: rename Signed -> Logged 2017-04-06 23:48:49 -04:00
Unknwon 90b9f7e08c
pkg/setting: rename {AppUrl, AppSubUrl} -> {AppURL, AppSubURL} 2017-04-06 17:27:57 -04:00
Unknwon 2c404daca6
pkg/context: rename {CsrfToken, CsrfTokenHtml} -> {CSRFToken, CSRFTokenHTML} 2017-04-06 17:20:38 -04:00
Unknwon a617d52374
2fa: initial support (#945) 2017-04-06 00:14:30 -04:00
Unknwon edaf14f2b6
Refactoring: remove tool.TplName 2017-04-05 09:17:21 -04:00
Unknwon 6fbb984ebf
Refactoring: rename pkg/base -> pkg/tool 2017-04-05 09:05:40 -04:00
Unknwon d05395fe90
Refactoring: rename modules -> pkg
Reasons to change:

1. Shorter than 'modules'
2. More generally used by other Go projects
3. Corresponds to the naming of '$GOPATH/pkg' directory
2017-04-04 19:29:59 -04:00