* Allow custom public files * Gofmt code, lots of places not related to this prtags/v1.1.0
if setting.Protocol == setting.FCGI { | if setting.Protocol == setting.FCGI { | ||||
m.SetURLPrefix(setting.AppSubURL) | m.SetURLPrefix(setting.AppSubURL) | ||||
} | } | ||||
m.Use(public.Custom( | |||||
&public.Options{ | |||||
SkipLogging: setting.DisableRouterLog, | |||||
}, | |||||
)) | |||||
m.Use(public.Static( | m.Use(public.Static( | ||||
&public.Options{ | &public.Options{ | ||||
Directory: path.Join(setting.StaticRootPath, "public"), | Directory: path.Join(setting.StaticRootPath, "public"), |
CreatedUnix int64 | CreatedUnix int64 | ||||
} | } | ||||
// BeforeInsert is invoked from XORM before inserting an object of this type. | // BeforeInsert is invoked from XORM before inserting an object of this type. | ||||
func (a *Attachment) BeforeInsert() { | func (a *Attachment) BeforeInsert() { | ||||
a.CreatedUnix = time.Now().Unix() | a.CreatedUnix = time.Now().Unix() |
"time" | "time" | ||||
"code.gitea.io/git" | "code.gitea.io/git" | ||||
"code.gitea.io/gitea/modules/base" | |||||
"code.gitea.io/gitea/modules/log" | "code.gitea.io/gitea/modules/log" | ||||
"code.gitea.io/gitea/modules/process" | "code.gitea.io/gitea/modules/process" | ||||
"code.gitea.io/gitea/modules/setting" | "code.gitea.io/gitea/modules/setting" | ||||
api "code.gitea.io/sdk/gitea" | api "code.gitea.io/sdk/gitea" | ||||
"github.com/Unknwon/com" | "github.com/Unknwon/com" | ||||
"github.com/go-xorm/xorm" | "github.com/go-xorm/xorm" | ||||
"code.gitea.io/gitea/modules/base" | |||||
) | ) | ||||
var pullRequestQueue = sync.NewUniqueQueue(setting.Repository.PullRequestQueueLength) | var pullRequestQueue = sync.NewUniqueQueue(setting.Repository.PullRequestQueueLength) |
package public | package public | ||||
import ( | |||||
"path" | |||||
"code.gitea.io/gitea/modules/setting" | |||||
"gopkg.in/macaron.v1" | |||||
) | |||||
//go:generate go-bindata -tags "bindata" -ignore "\\.go|\\.less" -pkg "public" -o "bindata.go" ../../public/... | //go:generate go-bindata -tags "bindata" -ignore "\\.go|\\.less" -pkg "public" -o "bindata.go" ../../public/... | ||||
//go:generate go fmt bindata.go | //go:generate go fmt bindata.go | ||||
//go:generate sed -i.bak s/..\/..\/public\/// bindata.go | //go:generate sed -i.bak s/..\/..\/public\/// bindata.go | ||||
Directory string | Directory string | ||||
SkipLogging bool | SkipLogging bool | ||||
} | } | ||||
// Custom implements the macaron static handler for serving custom assets. | |||||
func Custom(opts *Options) macaron.Handler { | |||||
return macaron.Static( | |||||
path.Join(setting.CustomPath, "public"), | |||||
macaron.StaticOptions{ | |||||
SkipLogging: opts.SkipLogging, | |||||
}, | |||||
) | |||||
} |
"code.gitea.io/gitea/models" | "code.gitea.io/gitea/models" | ||||
"code.gitea.io/gitea/modules/cron" | "code.gitea.io/gitea/modules/cron" | ||||
"code.gitea.io/gitea/modules/highlight" | "code.gitea.io/gitea/modules/highlight" | ||||
"code.gitea.io/gitea/modules/indexer" | |||||
"code.gitea.io/gitea/modules/log" | "code.gitea.io/gitea/modules/log" | ||||
"code.gitea.io/gitea/modules/mailer" | "code.gitea.io/gitea/modules/mailer" | ||||
"code.gitea.io/gitea/modules/markdown" | "code.gitea.io/gitea/modules/markdown" | ||||
"code.gitea.io/gitea/modules/setting" | "code.gitea.io/gitea/modules/setting" | ||||
"code.gitea.io/gitea/modules/ssh" | "code.gitea.io/gitea/modules/ssh" | ||||
macaron "gopkg.in/macaron.v1" | macaron "gopkg.in/macaron.v1" | ||||
"code.gitea.io/gitea/modules/indexer" | |||||
) | ) | ||||
func checkRunMode() { | func checkRunMode() { |
"uuid": attach.UUID, | "uuid": attach.UUID, | ||||
}) | }) | ||||
} | } | ||||
ctx.Data["Title"] = ctx.Tr("repo.release.new_release") | ctx.Data["Title"] = ctx.Tr("repo.release.new_release") | ||||
ctx.Data["PageIsReleaseList"] = true | ctx.Data["PageIsReleaseList"] = true | ||||
ctx.Data["tag_target"] = ctx.Repo.Repository.DefaultBranch | ctx.Data["tag_target"] = ctx.Repo.Repository.DefaultBranch | ||||
renderAttachmentSettings(ctx); | |||||
renderAttachmentSettings(ctx) | |||||
ctx.HTML(200, tplReleaseNew) | ctx.HTML(200, tplReleaseNew) | ||||
} | } | ||||
ctx.Data["Title"] = ctx.Tr("repo.release.edit_release") | ctx.Data["Title"] = ctx.Tr("repo.release.edit_release") | ||||
ctx.Data["PageIsReleaseList"] = true | ctx.Data["PageIsReleaseList"] = true | ||||
ctx.Data["PageIsEditRelease"] = true | ctx.Data["PageIsEditRelease"] = true | ||||
renderAttachmentSettings(ctx); | |||||
renderAttachmentSettings(ctx) | |||||
tagName := ctx.Params("*") | tagName := ctx.Params("*") | ||||
rel, err := models.GetRelease(ctx.Repo.Repository.ID, tagName) | rel, err := models.GetRelease(ctx.Repo.Repository.ID, tagName) |