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.

500.tmpl 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. {{/* This page should only depend the minimal template functions/variables, to avoid triggering new panics.
  2. * base template functions: AppName, AssetUrlPrefix, AssetVersion, AppSubUrl, DefaultTheme, Str2html
  3. * locale
  4. * ErrorMsg
  5. * SignedUser (optional)
  6. */}}
  7. <!DOCTYPE html>
  8. <html lang="{{.locale.Lang}}" class="theme-{{if .SignedUser.Theme}}{{.SignedUser.Theme}}{{else}}{{DefaultTheme}}{{end}}">
  9. <head>
  10. <meta name="viewport" content="width=device-width, initial-scale=1">
  11. <title>Internal Server Error - {{AppName}}</title>
  12. <link rel="icon" href="{{AssetUrlPrefix}}/img/favicon.svg" type="image/svg+xml">
  13. <link rel="alternate icon" href="{{AssetUrlPrefix}}/img/favicon.png" type="image/png">
  14. {{template "base/head_style" .}}
  15. </head>
  16. <body>
  17. <div class="full height">
  18. <nav class="ui container secondary stackable main menu" id="navbar">
  19. <div class="ui container gt-df">
  20. <div class="item brand gt-f1">
  21. <a href="{{AppSubUrl}}/" aria-label="{{.locale.Tr "home"}}">
  22. <img width="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{.locale.Tr "logo"}}" aria-hidden="true">
  23. </a>
  24. </div>
  25. <button class="item ui icon button">{{svg "octicon-three-bars"}}</button>{{/* a fake button to make the UI looks better*/}}
  26. </div>
  27. </nav>
  28. <div role="main" class="page-content status-page-500">
  29. <p class="gt-mt-5 center"><img src="{{AssetUrlPrefix}}/img/500.png" alt="Internal Server Error"></p>
  30. <div class="ui divider"></div>
  31. <div class="ui container gt-my-5">
  32. {{if .ErrorMsg}}
  33. <p>{{.locale.Tr "error.occurred"}}:</p>
  34. <pre class="gt-whitespace-pre-wrap gt-break-all">{{.ErrorMsg}}</pre>
  35. {{end}}
  36. <div class="center gt-mt-5">
  37. {{if or .SignedUser.IsAdmin .ShowFooterVersion}}<p>{{.locale.Tr "admin.config.app_ver"}}: {{AppVer}}</p>{{end}}
  38. {{if .SignedUser.IsAdmin}}<p>{{.locale.Tr "error.report_message" | Str2html}}</p>{{end}}
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. {{/* When a sub-template triggers an 500 error, its parent template has been partially rendered, then the 500 page
  44. will be rendered after that partially rendered page, the HTML/JS are totally broken. Use this inline script to try to move it to main viewport.
  45. And this page shouldn't include any other JS file, avoid duplicate JS execution (still due to the partial rendering).*/}}
  46. <script type="module">
  47. const embedded = document.querySelector('.page-content .page-content.status-page-500');
  48. if (embedded) {
  49. // move the 500 error page content to main view
  50. const embeddedParent = embedded.parentNode;
  51. let main = document.querySelector('.page-content');
  52. main = main ?? document.querySelector('body');
  53. main.prepend(document.createElement('hr'));
  54. main.prepend(embedded);
  55. embeddedParent.remove(); // remove the unrelated 500-page elements (eg: the duplicate nav bar)
  56. }
  57. </script>
  58. </body>
  59. </html>