You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

426 lines
12 KiB

Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
8 years ago
10 years ago
Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
8 years ago
Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. // Copyright 2017 The Gitea Authors. All rights reserved.
  2. // Copyright 2014 The Gogs Authors. All rights reserved.
  3. // Use of this source code is governed by a MIT-style
  4. // license that can be found in the LICENSE file.
  5. package repo
  6. import (
  7. "bytes"
  8. "encoding/base64"
  9. "fmt"
  10. gotemplate "html/template"
  11. "io/ioutil"
  12. "path"
  13. "strconv"
  14. "strings"
  15. "code.gitea.io/git"
  16. "code.gitea.io/gitea/models"
  17. "code.gitea.io/gitea/modules/base"
  18. "code.gitea.io/gitea/modules/context"
  19. "code.gitea.io/gitea/modules/highlight"
  20. "code.gitea.io/gitea/modules/lfs"
  21. "code.gitea.io/gitea/modules/log"
  22. "code.gitea.io/gitea/modules/markup"
  23. "code.gitea.io/gitea/modules/setting"
  24. "code.gitea.io/gitea/modules/templates"
  25. "github.com/Unknwon/paginater"
  26. )
  27. const (
  28. tplRepoBARE base.TplName = "repo/bare"
  29. tplRepoHome base.TplName = "repo/home"
  30. tplWatchers base.TplName = "repo/watchers"
  31. tplForks base.TplName = "repo/forks"
  32. )
  33. func renderDirectory(ctx *context.Context, treeLink string) {
  34. tree, err := ctx.Repo.Commit.SubTree(ctx.Repo.TreePath)
  35. if err != nil {
  36. ctx.NotFoundOrServerError("Repo.Commit.SubTree", git.IsErrNotExist, err)
  37. return
  38. }
  39. entries, err := tree.ListEntries()
  40. if err != nil {
  41. ctx.ServerError("ListEntries", err)
  42. return
  43. }
  44. entries.CustomSort(base.NaturalSortLess)
  45. ctx.Data["Files"], err = entries.GetCommitsInfo(ctx.Repo.Commit, ctx.Repo.TreePath)
  46. if err != nil {
  47. ctx.ServerError("GetCommitsInfo", err)
  48. return
  49. }
  50. var readmeFile *git.Blob
  51. for _, entry := range entries {
  52. if entry.IsDir() {
  53. continue
  54. }
  55. if !markup.IsReadmeFile(entry.Name()) {
  56. continue
  57. }
  58. readmeFile = entry.Blob()
  59. if markup.Type(entry.Name()) != "" {
  60. break
  61. }
  62. }
  63. if readmeFile != nil {
  64. ctx.Data["RawFileLink"] = ""
  65. ctx.Data["ReadmeInList"] = true
  66. ctx.Data["ReadmeExist"] = true
  67. dataRc, err := readmeFile.DataAsync()
  68. if err != nil {
  69. ctx.ServerError("Data", err)
  70. return
  71. }
  72. defer dataRc.Close()
  73. buf := make([]byte, 1024)
  74. n, _ := dataRc.Read(buf)
  75. buf = buf[:n]
  76. isTextFile := base.IsTextFile(buf)
  77. ctx.Data["FileIsText"] = isTextFile
  78. ctx.Data["FileName"] = readmeFile.Name()
  79. // FIXME: what happens when README file is an image?
  80. if isTextFile {
  81. if readmeFile.Size() >= setting.UI.MaxDisplayFileSize {
  82. // Pretend that this is a normal text file to display 'This file is too large to be shown'
  83. ctx.Data["IsFileTooLarge"] = true
  84. ctx.Data["IsTextFile"] = true
  85. ctx.Data["FileSize"] = readmeFile.Size()
  86. } else {
  87. d, _ := ioutil.ReadAll(dataRc)
  88. buf = append(buf, d...)
  89. if markup.Type(readmeFile.Name()) != "" {
  90. ctx.Data["IsMarkup"] = true
  91. ctx.Data["FileContent"] = string(markup.Render(readmeFile.Name(), buf, treeLink, ctx.Repo.Repository.ComposeMetas()))
  92. } else {
  93. ctx.Data["IsRenderedHTML"] = true
  94. ctx.Data["FileContent"] = strings.Replace(
  95. gotemplate.HTMLEscapeString(string(buf)), "\n", `<br>`, -1,
  96. )
  97. }
  98. }
  99. }
  100. }
  101. // Show latest commit info of repository in table header,
  102. // or of directory if not in root directory.
  103. latestCommit := ctx.Repo.Commit
  104. if len(ctx.Repo.TreePath) > 0 {
  105. latestCommit, err = ctx.Repo.Commit.GetCommitByPath(ctx.Repo.TreePath)
  106. if err != nil {
  107. ctx.ServerError("GetCommitByPath", err)
  108. return
  109. }
  110. }
  111. ctx.Data["LatestCommit"] = latestCommit
  112. ctx.Data["LatestCommitVerification"] = models.ParseCommitWithSignature(latestCommit)
  113. ctx.Data["LatestCommitUser"] = models.ValidateCommitWithEmail(latestCommit)
  114. statuses, err := models.GetLatestCommitStatus(ctx.Repo.Repository, ctx.Repo.Commit.ID.String(), 0)
  115. if err != nil {
  116. log.Error(3, "GetLatestCommitStatus: %v", err)
  117. }
  118. ctx.Data["LatestCommitStatus"] = models.CalcCommitStatus(statuses)
  119. // Check permission to add or upload new file.
  120. if ctx.Repo.IsWriter() && ctx.Repo.IsViewBranch {
  121. ctx.Data["CanAddFile"] = true
  122. ctx.Data["CanUploadFile"] = setting.Repository.Upload.Enabled
  123. }
  124. }
  125. func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink string) {
  126. ctx.Data["IsViewFile"] = true
  127. blob := entry.Blob()
  128. dataRc, err := blob.DataAsync()
  129. if err != nil {
  130. ctx.ServerError("DataAsync", err)
  131. return
  132. }
  133. defer dataRc.Close()
  134. ctx.Data["FileSize"] = blob.Size()
  135. ctx.Data["FileName"] = blob.Name()
  136. ctx.Data["HighlightClass"] = highlight.FileNameToHighlightClass(blob.Name())
  137. ctx.Data["RawFileLink"] = rawLink + "/" + ctx.Repo.TreePath
  138. buf := make([]byte, 1024)
  139. n, _ := dataRc.Read(buf)
  140. buf = buf[:n]
  141. isTextFile := base.IsTextFile(buf)
  142. ctx.Data["IsTextFile"] = isTextFile
  143. //Check for LFS meta file
  144. if isTextFile && setting.LFS.StartServer {
  145. headString := string(buf)
  146. if strings.HasPrefix(headString, models.LFSMetaFileIdentifier) {
  147. splitLines := strings.Split(headString, "\n")
  148. if len(splitLines) >= 3 {
  149. oid := strings.TrimPrefix(splitLines[1], models.LFSMetaFileOidPrefix)
  150. size, err := strconv.ParseInt(strings.TrimPrefix(splitLines[2], "size "), 10, 64)
  151. if len(oid) == 64 && err == nil {
  152. contentStore := &lfs.ContentStore{BasePath: setting.LFS.ContentPath}
  153. meta := &models.LFSMetaObject{Oid: oid}
  154. if contentStore.Exists(meta) {
  155. ctx.Data["IsTextFile"] = false
  156. isTextFile = false
  157. ctx.Data["IsLFSFile"] = true
  158. ctx.Data["FileSize"] = size
  159. filenameBase64 := base64.RawURLEncoding.EncodeToString([]byte(blob.Name()))
  160. ctx.Data["RawFileLink"] = fmt.Sprintf("%s%s.git/info/lfs/objects/%s/%s", setting.AppURL, ctx.Repo.Repository.FullName(), oid, filenameBase64)
  161. }
  162. }
  163. }
  164. }
  165. }
  166. // Assume file is not editable first.
  167. if !isTextFile {
  168. ctx.Data["EditFileTooltip"] = ctx.Tr("repo.editor.cannot_edit_non_text_files")
  169. }
  170. switch {
  171. case isTextFile:
  172. if blob.Size() >= setting.UI.MaxDisplayFileSize {
  173. ctx.Data["IsFileTooLarge"] = true
  174. break
  175. }
  176. d, _ := ioutil.ReadAll(dataRc)
  177. buf = append(buf, d...)
  178. readmeExist := markup.IsReadmeFile(blob.Name())
  179. ctx.Data["ReadmeExist"] = readmeExist
  180. if markup.Type(blob.Name()) != "" {
  181. ctx.Data["IsMarkup"] = true
  182. ctx.Data["FileContent"] = string(markup.Render(blob.Name(), buf, path.Dir(treeLink), ctx.Repo.Repository.ComposeMetas()))
  183. } else if readmeExist {
  184. ctx.Data["IsRenderedHTML"] = true
  185. ctx.Data["FileContent"] = strings.Replace(
  186. gotemplate.HTMLEscapeString(string(buf)), "\n", `<br>`, -1,
  187. )
  188. } else {
  189. // Building code view blocks with line number on server side.
  190. var fileContent string
  191. if content, err := templates.ToUTF8WithErr(buf); err != nil {
  192. if err != nil {
  193. log.Error(4, "ToUTF8WithErr: %v", err)
  194. }
  195. fileContent = string(buf)
  196. } else {
  197. fileContent = content
  198. }
  199. var output bytes.Buffer
  200. lines := strings.Split(fileContent, "\n")
  201. //Remove blank line at the end of file
  202. if len(lines) > 0 && lines[len(lines)-1] == "" {
  203. lines = lines[:len(lines)-1]
  204. }
  205. for index, line := range lines {
  206. line = gotemplate.HTMLEscapeString(line)
  207. if index != len(lines)-1 {
  208. line += "\n"
  209. }
  210. output.WriteString(fmt.Sprintf(`<li class="L%d" rel="L%d">%s</li>`, index+1, index+1, line))
  211. }
  212. ctx.Data["FileContent"] = gotemplate.HTML(output.String())
  213. output.Reset()
  214. for i := 0; i < len(lines); i++ {
  215. output.WriteString(fmt.Sprintf(`<span id="L%d">%d</span>`, i+1, i+1))
  216. }
  217. ctx.Data["LineNums"] = gotemplate.HTML(output.String())
  218. }
  219. if ctx.Repo.CanEnableEditor() {
  220. ctx.Data["CanEditFile"] = true
  221. ctx.Data["EditFileTooltip"] = ctx.Tr("repo.editor.edit_this_file")
  222. } else if !ctx.Repo.IsViewBranch {
  223. ctx.Data["EditFileTooltip"] = ctx.Tr("repo.editor.must_be_on_a_branch")
  224. } else if !ctx.Repo.IsWriter() {
  225. ctx.Data["EditFileTooltip"] = ctx.Tr("repo.editor.fork_before_edit")
  226. }
  227. case base.IsPDFFile(buf):
  228. ctx.Data["IsPDFFile"] = true
  229. case base.IsVideoFile(buf):
  230. ctx.Data["IsVideoFile"] = true
  231. case base.IsImageFile(buf):
  232. ctx.Data["IsImageFile"] = true
  233. }
  234. if ctx.Repo.CanEnableEditor() {
  235. ctx.Data["CanDeleteFile"] = true
  236. ctx.Data["DeleteFileTooltip"] = ctx.Tr("repo.editor.delete_this_file")
  237. } else if !ctx.Repo.IsViewBranch {
  238. ctx.Data["DeleteFileTooltip"] = ctx.Tr("repo.editor.must_be_on_a_branch")
  239. } else if !ctx.Repo.IsWriter() {
  240. ctx.Data["DeleteFileTooltip"] = ctx.Tr("repo.editor.must_have_write_access")
  241. }
  242. }
  243. // Home render repository home page
  244. func Home(ctx *context.Context) {
  245. if len(ctx.Repo.Repository.Units) > 0 {
  246. var firstUnit *models.Unit
  247. for _, repoUnit := range ctx.Repo.Repository.Units {
  248. if repoUnit.Type == models.UnitTypeCode {
  249. renderCode(ctx)
  250. return
  251. }
  252. unit, ok := models.Units[repoUnit.Type]
  253. if ok && (firstUnit == nil || !firstUnit.IsLessThan(unit)) {
  254. firstUnit = &unit
  255. }
  256. }
  257. if firstUnit != nil {
  258. ctx.Redirect(fmt.Sprintf("%s/%s%s", setting.AppSubURL, ctx.Repo.Repository.FullName(), firstUnit.URI))
  259. return
  260. }
  261. }
  262. ctx.NotFound("Home", fmt.Errorf(ctx.Tr("units.error.no_unit_allowed_repo")))
  263. }
  264. func renderCode(ctx *context.Context) {
  265. ctx.Data["PageIsViewCode"] = true
  266. if ctx.Repo.Repository.IsBare {
  267. ctx.HTML(200, tplRepoBARE)
  268. return
  269. }
  270. title := ctx.Repo.Repository.Owner.Name + "/" + ctx.Repo.Repository.Name
  271. if len(ctx.Repo.Repository.Description) > 0 {
  272. title += ": " + ctx.Repo.Repository.Description
  273. }
  274. ctx.Data["Title"] = title
  275. ctx.Data["RequireHighlightJS"] = true
  276. branchLink := ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchNameSubURL()
  277. treeLink := branchLink
  278. rawLink := ctx.Repo.RepoLink + "/raw/" + ctx.Repo.BranchNameSubURL()
  279. if len(ctx.Repo.TreePath) > 0 {
  280. treeLink += "/" + ctx.Repo.TreePath
  281. }
  282. // Get Topics of this repo
  283. topics, err := models.FindTopics(&models.FindTopicOptions{
  284. RepoID: ctx.Repo.Repository.ID,
  285. })
  286. if err != nil {
  287. ctx.ServerError("models.FindTopics", err)
  288. return
  289. }
  290. ctx.Data["Topics"] = topics
  291. // Get current entry user currently looking at.
  292. entry, err := ctx.Repo.Commit.GetTreeEntryByPath(ctx.Repo.TreePath)
  293. if err != nil {
  294. ctx.NotFoundOrServerError("Repo.Commit.GetTreeEntryByPath", git.IsErrNotExist, err)
  295. return
  296. }
  297. if entry.IsDir() {
  298. renderDirectory(ctx, treeLink)
  299. } else {
  300. renderFile(ctx, entry, treeLink, rawLink)
  301. }
  302. if ctx.Written() {
  303. return
  304. }
  305. var treeNames []string
  306. paths := make([]string, 0, 5)
  307. if len(ctx.Repo.TreePath) > 0 {
  308. treeNames = strings.Split(ctx.Repo.TreePath, "/")
  309. for i := range treeNames {
  310. paths = append(paths, strings.Join(treeNames[:i+1], "/"))
  311. }
  312. ctx.Data["HasParentPath"] = true
  313. if len(paths)-2 >= 0 {
  314. ctx.Data["ParentPath"] = "/" + paths[len(paths)-2]
  315. }
  316. }
  317. ctx.Data["Paths"] = paths
  318. ctx.Data["TreeLink"] = treeLink
  319. ctx.Data["TreeNames"] = treeNames
  320. ctx.Data["BranchLink"] = branchLink
  321. ctx.HTML(200, tplRepoHome)
  322. }
  323. // RenderUserCards render a page show users according the input templaet
  324. func RenderUserCards(ctx *context.Context, total int, getter func(page int) ([]*models.User, error), tpl base.TplName) {
  325. page := ctx.QueryInt("page")
  326. if page <= 0 {
  327. page = 1
  328. }
  329. pager := paginater.New(total, models.ItemsPerPage, page, 5)
  330. ctx.Data["Page"] = pager
  331. items, err := getter(pager.Current())
  332. if err != nil {
  333. ctx.ServerError("getter", err)
  334. return
  335. }
  336. ctx.Data["Cards"] = items
  337. ctx.HTML(200, tpl)
  338. }
  339. // Watchers render repository's watch users
  340. func Watchers(ctx *context.Context) {
  341. ctx.Data["Title"] = ctx.Tr("repo.watchers")
  342. ctx.Data["CardsTitle"] = ctx.Tr("repo.watchers")
  343. ctx.Data["PageIsWatchers"] = true
  344. RenderUserCards(ctx, ctx.Repo.Repository.NumWatches, ctx.Repo.Repository.GetWatchers, tplWatchers)
  345. }
  346. // Stars render repository's starred users
  347. func Stars(ctx *context.Context) {
  348. ctx.Data["Title"] = ctx.Tr("repo.stargazers")
  349. ctx.Data["CardsTitle"] = ctx.Tr("repo.stargazers")
  350. ctx.Data["PageIsStargazers"] = true
  351. RenderUserCards(ctx, ctx.Repo.Repository.NumStars, ctx.Repo.Repository.GetStargazers, tplWatchers)
  352. }
  353. // Forks render repository's forked users
  354. func Forks(ctx *context.Context) {
  355. ctx.Data["Title"] = ctx.Tr("repos.forks")
  356. forks, err := ctx.Repo.Repository.GetForks()
  357. if err != nil {
  358. ctx.ServerError("GetForks", err)
  359. return
  360. }
  361. for _, fork := range forks {
  362. if err = fork.GetOwner(); err != nil {
  363. ctx.ServerError("GetOwner", err)
  364. return
  365. }
  366. }
  367. ctx.Data["Forks"] = forks
  368. ctx.HTML(200, tplForks)
  369. }