A clean, Markdown-based publishing platform made for writers. Write together, and build a community. https://writefreely.org
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.
 
 
 
 
 

201 lines
7.1 KiB

  1. {{define "admin"}}
  2. {{template "header" .}}
  3. <style type="text/css">
  4. h2 {font-weight: normal;}
  5. ul.pagenav {list-style: none;}
  6. form {
  7. margin: 0 0 2em;
  8. }
  9. form dt {
  10. line-height: inherit;
  11. }
  12. .ui.divider:not(.vertical):not(.horizontal) {
  13. border-top: 1px solid rgba(34,36,38,.15);
  14. border-bottom: 1px solid rgba(255,255,255,.1);
  15. }
  16. .ui.divider {
  17. margin: 1rem 0;
  18. line-height: 1;
  19. height: 0;
  20. font-weight: 700;
  21. text-transform: uppercase;
  22. letter-spacing: .05em;
  23. color: rgba(0,0,0,.85);
  24. -webkit-user-select: none;
  25. -moz-user-select: none;
  26. -ms-user-select: none;
  27. user-select: none;
  28. -webkit-tap-highlight-color: transparent;
  29. font-size: 1rem;
  30. }
  31. .invisible {
  32. display: none;
  33. }
  34. </style>
  35. <script>
  36. function savePage(el) {
  37. var $btn = el.querySelector('input[type=submit]');
  38. $btn.value = 'Saving...';
  39. $btn.disabled = true;
  40. }
  41. </script>
  42. <div class="content-container snug">
  43. <h1>Admin Dashboard</h1>
  44. {{if .Message}}<p>{{.Message}}</p>{{end}}
  45. <ul class="pagenav">
  46. {{if not .SingleUser}}
  47. <li><a href="#page-about">Edit About page</a></li>
  48. <li><a href="#page-privacy">Edit Privacy page</a></li>
  49. {{end}}
  50. <li><a href="#reset-pass">Reset user password</a></li>
  51. <li><a href="#config">Configuration</a></li>
  52. <li><a href="#monitor">Application monitor</a></li>
  53. </ul>
  54. <hr />
  55. {{if not .SingleUser}}
  56. <h2>Site</h2>
  57. <h3 id="page-about">About page</h3>
  58. <p>Describe what your instance is <a href="/about" target="page">about</a>. <em>Accepts Markdown</em>.</p>
  59. <form method="post" action="/admin/update/about" onsubmit="savePage(this)">
  60. <textarea id="about-editor" class="section codable norm edit-page" name="content">{{.AboutPage}}</textarea>
  61. <input type="submit" value="Save" />
  62. </form>
  63. <h3 id="page-privacy">Privacy page</h3>
  64. <p>Outline your <a href="/privacy" target="page">privacy policy</a>. <em>Accepts Markdown</em>.</p>
  65. <form method="post" action="/admin/update/privacy" onsubmit="savePage(this)">
  66. <textarea id="privacy-editor" class="section codable norm edit-page" name="content">{{.PrivacyPage}}</textarea>
  67. <input type="submit" value="Save" />
  68. </form>
  69. <hr />
  70. {{end}}
  71. <h2>Users</h2>
  72. <h3><a name="reset-pass"></a>reset password</h3>
  73. <pre><code>writefreely --reset-pass &lt;username&gt;</code></pre>
  74. <hr />
  75. <h2><a name="config"></a>App Configuration</h2>
  76. {{if .ConfigMessage}}<p class="success" style="text-align: center">{{.ConfigMessage}}</p>{{end}}
  77. <form action="/admin/update/config" method="post">
  78. <div class="ui attached table segment">
  79. <dl class="dl-horizontal admin-dl-horizontal">
  80. <dt{{if .Config.SingleUser}} class="invisible"{{end}}>Site Name</dt>
  81. <dd{{if .Config.SingleUser}} class="invisible"{{end}}><input type="text" name="site_name" id="site_name" class="inline" value="{{.Config.SiteName}}" style="width: 14em;" /></dd>
  82. <dt{{if .Config.SingleUser}} class="invisible"{{end}}>Site Description</dt>
  83. <dd{{if .Config.SingleUser}} class="invisible"{{end}}><input type="text" name="site_desc" id="site_desc" class="inline" value="{{.Config.SiteDesc}}" style="width: 14em;" /></dd>
  84. <dt>Host</dt>
  85. <dd>{{.Config.Host}}</dd>
  86. <dt>User Mode</dt>
  87. <dd>{{if .Config.SingleUser}}Single user{{else}}Multiple users{{end}}</dd>
  88. <dt{{if .Config.SingleUser}} class="invisible"{{end}}><label for="open_registration">Open Registrations</label></dt>
  89. <dd{{if .Config.SingleUser}} class="invisible"{{end}}><input type="checkbox" name="open_registration" id="open_registration" {{if .Config.OpenRegistration}}checked="checked"{{end}} /></dd>
  90. <dt><label for="min_username_len">Minimum Username Length</label></dt>
  91. <dd><input type="number" name="min_username_len" id="min_username_len" class="inline" min="1" max="100" value="{{.Config.MinUsernameLen}}" /></dd>
  92. <dt{{if .Config.SingleUser}} class="invisible"{{end}}><label for="max_blogs">Maximum Blogs per User</label></dt>
  93. <dd{{if .Config.SingleUser}} class="invisible"{{end}}><input type="number" name="max_blogs" id="max_blogs" class="inline" min="1" value="{{.Config.MaxBlogs}}" /></dd>
  94. <dt><label for="federation">Federation</label></dt>
  95. <dd><input type="checkbox" name="federation" id="federation" {{if .Config.Federation}}checked="checked"{{end}} /></dd>
  96. <dt><label for="public_stats">Public Stats</label></dt>
  97. <dd><input type="checkbox" name="public_stats" id="public_stats" {{if .Config.PublicStats}}checked="checked"{{end}} /></dd>
  98. <dt><label for="private">Private Instance</label></dt>
  99. <dd><input type="checkbox" name="private" id="private" {{if .Config.Private}}checked="checked"{{end}} /></dd>
  100. <dt{{if .Config.SingleUser}} class="invisible"{{end}}><label for="local_timeline">Local Timeline</label></dt>
  101. <dd{{if .Config.SingleUser}} class="invisible"{{end}}><input type="checkbox" name="local_timeline" id="local_timeline" {{if .Config.LocalTimeline}}checked="checked"{{end}} /></dd>
  102. </dl>
  103. <input type="submit" value="Save Configuration" />
  104. </div>
  105. </form>
  106. <hr />
  107. <h2><a name="monitor"></a>Application</h2>
  108. <div class="ui attached table segment">
  109. <dl class="dl-horizontal admin-dl-horizontal">
  110. <dt>Server Uptime</dt>
  111. <dd>{{.SysStatus.Uptime}}</dd>
  112. <dt>Current Goroutines</dt>
  113. <dd>{{.SysStatus.NumGoroutine}}</dd>
  114. <div class="ui divider"></div>
  115. <dt>Current memory usage</dt>
  116. <dd>{{.SysStatus.MemAllocated}}</dd>
  117. <dt>Total mem allocated</dt>
  118. <dd>{{.SysStatus.MemTotal}}</dd>
  119. <dt>Memory obtained</dt>
  120. <dd>{{.SysStatus.MemSys}}</dd>
  121. <dt>Pointer lookup times</dt>
  122. <dd>{{.SysStatus.Lookups}}</dd>
  123. <dt>Memory allocate times</dt>
  124. <dd>{{.SysStatus.MemMallocs}}</dd>
  125. <dt>Memory free times</dt>
  126. <dd>{{.SysStatus.MemFrees}}</dd>
  127. <div class="ui divider"></div>
  128. <dt>Current heap usage</dt>
  129. <dd>{{.SysStatus.HeapAlloc}}</dd>
  130. <dt>Heap memory obtained</dt>
  131. <dd>{{.SysStatus.HeapSys}}</dd>
  132. <dt>Heap memory idle</dt>
  133. <dd>{{.SysStatus.HeapIdle}}</dd>
  134. <dt>Heap memory in use</dt>
  135. <dd>{{.SysStatus.HeapInuse}}</dd>
  136. <dt>Heap memory released</dt>
  137. <dd>{{.SysStatus.HeapReleased}}</dd>
  138. <dt>Heap objects</dt>
  139. <dd>{{.SysStatus.HeapObjects}}</dd>
  140. <div class="ui divider"></div>
  141. <dt>Bootstrap stack usage</dt>
  142. <dd>{{.SysStatus.StackInuse}}</dd>
  143. <dt>Stack memory obtained</dt>
  144. <dd>{{.SysStatus.StackSys}}</dd>
  145. <dt>MSpan structures in use</dt>
  146. <dd>{{.SysStatus.MSpanInuse}}</dd>
  147. <dt>MSpan structures obtained</dt>
  148. <dd>{{.SysStatus.HeapSys}}</dd>
  149. <dt>MCache structures in use</dt>
  150. <dd>{{.SysStatus.MCacheInuse}}</dd>
  151. <dt>MCache structures obtained</dt>
  152. <dd>{{.SysStatus.MCacheSys}}</dd>
  153. <dt>Profiling bucket hash table obtained</dt>
  154. <dd>{{.SysStatus.BuckHashSys}}</dd>
  155. <dt>GC metadata obtained</dt>
  156. <dd>{{.SysStatus.GCSys}}</dd>
  157. <dt>Other system allocation obtained</dt>
  158. <dd>{{.SysStatus.OtherSys}}</dd>
  159. <div class="ui divider"></div>
  160. <dt>Next GC recycle</dt>
  161. <dd>{{.SysStatus.NextGC}}</dd>
  162. <dt>Since last GC</dt>
  163. <dd>{{.SysStatus.LastGC}}</dd>
  164. <dt>Total GC pause</dt>
  165. <dd>{{.SysStatus.PauseTotalNs}}</dd>
  166. <dt>Last GC pause</dt>
  167. <dd>{{.SysStatus.PauseNs}}</dd>
  168. <dt>GC times</dt>
  169. <dd>{{.SysStatus.NumGC}}</dd>
  170. </dl>
  171. </div>
  172. </div>
  173. <script>
  174. history.replaceState(null, "", "/admin"+window.location.hash);
  175. </script>
  176. {{template "footer" .}}
  177. {{template "body-end" .}}
  178. {{end}}