my-gitea-templates/templates/base/ head.tmpl
195 lines
7.9 KiB

  1. <!DOCTYPE html>
  2. <html lang="{{.Language}}">
  3. <head data-suburl="{{AppSubUrl}}">
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <meta http-equiv="x-ua-compatible" content="ie=edge">
  7. <title>{{if .Repository.Name}}{{.Repository.Name}}{{else}}{{if .Title}}{{.Title}} — {{end}}{{AppName}}{{end}}</title>
  8. {{if UseServiceWorker}}
  9. <script>
  10. if ('serviceWorker' in navigator) {
  11. navigator.serviceWorker.register('{{AppSubUrl}}/serviceworker.js').then(function(registration) {
  12. // Registration was successful
  13. console.info('ServiceWorker registration successful with scope: ', registration.scope);
  14. }, function(err) {
  15. // registration failed :(
  16. console.info('ServiceWorker registration failed: ', err);
  17. });
  18. }
  19. </script>
  20. {{else}}
  21. <script>
  22. if ('serviceWorker' in navigator) {
  23. navigator.serviceWorker.getRegistrations().then(function(registrations) {
  24. registrations.forEach(function(registration) {
  25. registration.unregister();
  26. console.info('ServiceWorker unregistered');
  27. });
  28. });
  29. }
  30. </script>
  31. {{end}}
  32. <meta name="theme-color" content="{{ThemeColorMetaTag}}">
  33. <meta name="author" content="{{if .Repository}}{{.Owner.Name}}{{else}}{{end}}" />
  34. <meta name="description" content="{{if .Repository}}{{.Repository.Name}}{{if .Repository.Description}} - {{.Repository.Description}}{{end}}{{else}}{{end}}" />
  35. <meta name="referrer" content="no-referrer" />
  36. <meta name="_csrf" content="{{.CsrfToken}}" />
  37. {{if .IsSigned}}
  38. <meta name="_uid" content="{{.SignedUser.ID}}" />
  39. {{end}}
  40. {{if .ContextUser}}
  41. <meta name="_context_uid" content="{{.ContextUser.ID}}" />
  42. {{end}}
  43. {{if .SearchLimit}}
  44. <meta name="_search_limit" content="{{.SearchLimit}}" />
  45. {{end}}
  46. {{if .GoGetImport}}
  47. <meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}">
  48. <meta name="go-source" content="{{.GoGetImport}} _ {{.GoDocDirectory}} {{.GoDocFile}}">
  49. {{end}}
  50. <script>
  51. {{SafeJS `/*
  52. @licstart The following is the entire license notice for the
  53. JavaScript code in this page.
  54. Copyright (c) 2016 The Gitea Authors
  55. Copyright (c) 2015 The Gogs Authors
  56. Permission is hereby granted, free of charge, to any person obtaining a copy
  57. of this software and associated documentation files (the "Software"), to deal
  58. in the Software without restriction, including without limitation the rights
  59. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  60. copies of the Software, and to permit persons to whom the Software is
  61. furnished to do so, subject to the following conditions:
  62. The above copyright notice and this permission notice shall be included in
  63. all copies or substantial portions of the Software.
  64. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  65. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  66. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  67. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  68. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  69. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  70. THE SOFTWARE.
  71. ---
  72. Licensing information for additional javascript libraries can be found at:
  73. {{StaticUrlPrefix}}/vendor/librejs.html
  74. @licend The above is the entire license notice
  75. for the JavaScript code in this page.
  76. */`}}
  77. </script>
  78. <script>
  79. window.config = {
  80. AppSubUrl: '{{AppSubUrl}}',
  81. StaticUrlPrefix: '{{StaticUrlPrefix}}',
  82. csrf: '{{.CsrfToken}}',
  83. HighlightJS: {{if .RequireHighlightJS}}true{{else}}false{{end}},
  84. Minicolors: {{if .RequireMinicolors}}true{{else}}false{{end}},
  85. SimpleMDE: {{if .RequireSimpleMDE}}true{{else}}false{{end}},
  86. Tribute: {{if .RequireTribute}}true{{else}}false{{end}},
  87. U2F: {{if .RequireU2F}}true{{else}}false{{end}},
  88. Heatmap: {{if .EnableHeatmap}}true{{else}}false{{end}},
  89. heatmapUser: {{if .HeatmapUser}}'{{.HeatmapUser}}'{{else}}null{{end}},
  90. };
  91. </script>
  92. <link rel="shortcut icon" type="image/png" href="{{StaticUrlPrefix}}/img/favicon.png" />
  93. <link rel="shortcut icon" type="image/svg" href="{{StaticUrlPrefix}}/img/favicon.svg" />
  94. <link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/assets/font-awesome/css/font-awesome.min.css">
  95. <link rel="preload" as="font" href="{{StaticUrlPrefix}}/fomantic/themes/default/assets/fonts/icons.woff2" type="font/woff2" crossorigin="anonymous">
  96. <link rel="preload" as="font" href="{{StaticUrlPrefix}}/fomantic/themes/default/assets/fonts/outline-icons.woff2" type="font/woff2" crossorigin="anonymous">
  97. {{if .RequireSimpleMDE}}
  98. <link rel="stylesheet" href="{{AppSubUrl}}/vendor/plugins/simplemde/simplemde.min.css">
  99. {{end}}
  100. {{if .RequireTribute}}
  101. <link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/plugins/tribute/tribute.css">
  102. {{end}}
  103. <link rel="stylesheet" href="{{StaticUrlPrefix}}/fomantic/semantic.min.css?v={{MD5 AppVer}}">
  104. <link rel="stylesheet" href="{{StaticUrlPrefix}}/css/index.css?v={{MD5 AppVer}}">
  105. <link rel="stylesheet" href="/custom-style.css">
  106. <noscript>
  107. <style>
  108. .dropdown:hover > .menu { display: block; }
  109. .ui.secondary.menu .dropdown.item > .menu { margin-top: 0; }
  110. </style>
  111. </noscript>
  112. {{if .RequireMinicolors}}
  113. <link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/plugins/jquery.minicolors/jquery.minicolors.css">
  114. {{end}}
  115. <style class="list-search-style"></style>
  116. {{if .PageIsUserProfile}}
  117. <meta property="og:title" content="{{.Owner.Name}}" />
  118. <meta property="og:type" content="profile" />
  119. <meta property="og:image" content="{{.Owner.AvatarLink}}" />
  120. <meta property="og:url" content="{{.Owner.HTMLURL}}" />
  121. {{if .Owner.Description}}
  122. <meta property="og:description" content="{{.Owner.Description}}">
  123. {{end}}
  124. {{else if .Repository}}
  125. {{if .Issue}}
  126. <meta property="og:title" content="{{.Issue.Title}}" />
  127. <meta property="og:url" content="{{.Issue.HTMLURL}}" />
  128. {{if .Issue.Content}}
  129. <meta property="og:description" content="{{.Issue.Content}}" />
  130. {{end}}
  131. {{else}}
  132. <meta property="og:title" content="{{.Repository.Name}}" />
  133. <meta property="og:url" content="{{.Repository.HTMLURL}}" />
  134. {{if .Repository.Description}}
  135. <meta property="og:description" content="{{.Repository.Description}}" />
  136. {{end}}
  137. {{end}}
  138. <meta property="og:type" content="object" />
  139. <meta property="og:image" content="{{.Repository.Owner.AvatarLink}}" />
  140. {{else}}
  141. <meta property="og:title" content="{{AppName}}">
  142. <meta property="og:type" content="website" />
  143. <meta property="og:image" content="{{StaticUrlPrefix}}/img/gitea-lg.png" />
  144. <meta property="og:url" content="{{AppUrl}}" />
  145. <meta property="og:description" content="{{MetaDescription}}">
  146. {{end}}
  147. <meta property="og:site_name" content="{{AppName}}" />
  148. {{if .IsSigned }}
  149. {{ if ne .SignedUser.Theme "gitea" }}
  150. <link rel="stylesheet" href="{{StaticUrlPrefix}}/css/theme-{{.SignedUser.Theme}}.css?v={{MD5 AppVer}}">
  151. {{end}}
  152. {{else if ne DefaultTheme "gitea"}}
  153. <link rel="stylesheet" href="{{StaticUrlPrefix}}/css/theme-{{DefaultTheme}}.css?v={{MD5 AppVer}}">
  154. {{end}}
  155. {{template "custom/header" .}}
  156. </head>
  157. <body>
  158. {{template "custom/body_outer_pre" .}}
  159. <div class="full height">
  160. {{template "custom/body_inner_pre" .}}
  161. {{if .IsSigned}}
  162. {{if gt .SignedUser.MaxRepoCreation 0}}
  163. {{/* a/the ‘first-class citizen’ gets the standard gitea navigation bar */}}
  164. <div class="ui top secondary stackable main menu following bar light">
  165. {{template "base/head_navbar" .}}
  166. </div><!-- end bar -->
  167. {{else}}
  168. <a class="ui primary right corner label link-action" href data-url="{{AppSubUrl}}/user/logout" data-redirect="{{AppSubUrl}}/"
  169. title="{{.i18n.Tr "signed_in_as"}} {{.SignedUser.Name}} — {{.i18n.Tr "sign_out"}}">
  170. <i class="icon">{{svg "octicon-sign-out" 16}}</i>
  171. </a>
  172. {{end}}
  173. {{else}}
  174. <a class="ui{{if .PageIsSignIn}} active{{end}} right corner label" rel="nofollow" href="{{AppSubUrl}}/user/login?redirect_to={{.Link}}"
  175. title="{{.i18n.Tr "sign_in"}}"
  176. >
  177. <i class="icon">{{svg "octicon-sign-in" 16}}</i>
  178. </a>
  179. {{end}}
  180. {{/*
  181. </div>
  182. </body>
  183. </html>
  184. */}}