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.
 
 
 
 
 

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