mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-21 17:24:10 +00:00
Support setting cookie domain (#6288)
Signed-off-by: Tamal Saha <tamal@appscode.com>
This commit is contained in:
parent
d95237b561
commit
2102f9d92d
15 changed files with 58 additions and 46 deletions
15
vendor/github.com/go-macaron/i18n/.travis.yml
generated
vendored
15
vendor/github.com/go-macaron/i18n/.travis.yml
generated
vendored
|
@ -1,14 +1,11 @@
|
|||
sudo: false
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.3
|
||||
- 1.4
|
||||
- 1.5
|
||||
- tip
|
||||
- 1.6.x
|
||||
- 1.7.x
|
||||
- 1.8.x
|
||||
- 1.9.x
|
||||
- 1.10.x
|
||||
- 1.11.x
|
||||
|
||||
script: go test -v -cover -race
|
||||
|
||||
notifications:
|
||||
email:
|
||||
- u@gogs.io
|
||||
|
|
6
vendor/github.com/go-macaron/i18n/i18n.go
generated
vendored
6
vendor/github.com/go-macaron/i18n/i18n.go
generated
vendored
|
@ -26,7 +26,7 @@ import (
|
|||
"gopkg.in/macaron.v1"
|
||||
)
|
||||
|
||||
const _VERSION = "0.3.0"
|
||||
const _VERSION = "0.4.0"
|
||||
|
||||
func Version() string {
|
||||
return _VERSION
|
||||
|
@ -96,6 +96,8 @@ type Options struct {
|
|||
TmplName string
|
||||
// Configuration section name. Default is "i18n".
|
||||
Section string
|
||||
// Domain used for `lang` cookie. Default is ""
|
||||
CookieDomain string
|
||||
}
|
||||
|
||||
func prepareOptions(options []Options) Options {
|
||||
|
@ -193,7 +195,7 @@ func I18n(options ...Options) macaron.Handler {
|
|||
|
||||
// Save language information in cookies.
|
||||
if !hasCookie {
|
||||
ctx.SetCookie("lang", curLang.Lang, 1<<31-1, "/"+strings.TrimPrefix(opt.SubURL, "/"))
|
||||
ctx.SetCookie("lang", curLang.Lang, 1<<31-1, "/"+strings.TrimPrefix(opt.SubURL, "/"), opt.CookieDomain)
|
||||
}
|
||||
|
||||
restLangs := make([]LangType, 0, i18n.Count()-1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue