admin.html (6469B)
1 {{template "_header" .}} 2 <h1>Settings</h1> 3 4 {{if .Data.Error}} 5 <div style="background-color: #f8d7da; color: #721c24; padding: 10px; border: 1px solid #f5c6cb; border-radius: 4px; margin-bottom: 20px;"> 6 <strong>Error:</strong> {{.Data.Error}} 7 </div> 8 {{end}} 9 10 {{if .Data.Success}} 11 <div style="background-color: #d4edda; color: #155724; padding: 10px; border: 1px solid #c3e6cb; border-radius: 4px; margin-bottom: 20px;"> 12 <strong>Success:</strong> {{.Data.Success}} 13 </div> 14 {{end}} 15 16 <form method="post" style="max-width: 600px;"> 17 <div style="margin-bottom: 20px;"> 18 <label for="database_path" style="display: block; font-weight: bold; margin-bottom: 5px;">Database Path:</label> 19 <input type="text" id="database_path" name="database_path" value="{{.Data.Config.DatabasePath}}" required 20 style="width: 100%; padding: 8px; font-size: 14px;" 21 placeholder="./database.db"> 22 <small style="color: #666;">Path to SQLite database file (requires restart if changed)</small> 23 </div> 24 25 <div style="margin-bottom: 20px;"> 26 <label for="upload_dir" style="display: block; font-weight: bold; margin-bottom: 5px;">Upload Directory:</label> 27 <input type="text" id="upload_dir" name="upload_dir" value="{{.Data.Config.UploadDir}}" required 28 style="width: 100%; padding: 8px; font-size: 14px;" 29 placeholder="uploads"> 30 <small style="color: #666;">Directory where uploaded files are stored</small> 31 </div> 32 33 <div style="margin-bottom: 20px;"> 34 <label for="server_port" style="display: block; font-weight: bold; margin-bottom: 5px;">Server Port:</label> 35 <input type="text" id="server_port" name="server_port" value="{{.Data.Config.ServerPort}}" required 36 style="width: 100%; padding: 8px; font-size: 14px;" 37 placeholder=":8080"> 38 <small style="color: #666;">Port for web server (format: :8080, requires restart if changed)</small> 39 </div> 40 41 <div style="margin-bottom: 20px;"> 42 <label for="instance_name" style="display: block; font-weight: bold; margin-bottom: 5px;">Instance Name:</label> 43 <input type="text" id="instance_name" name="instance_name" value="{{.Data.Config.InstanceName}}" required 44 style="width: 100%; padding: 8px; font-size: 14px;" 45 placeholder="Taggart"> 46 <small style="color: #666;">Instance Name, used in header and title bar</small> 47 </div> 48 49 <div style="margin-bottom: 20px;"> 50 <label for="gallery_size" style="display: block; font-weight: bold; margin-bottom: 5px;">Gallery Size:</label> 51 <input type="text" id="gallery_size" name="gallery_size" value="{{.Data.Config.GallerySize}}" required 52 style="width: 100%; padding: 8px; font-size: 14px;" 53 placeholder="400px"> 54 <small style="color: #666;">Size of previews used in galleries</small> 55 </div> 56 57 <div style="margin-bottom: 20px;"> 58 <label for="items_per_page" style="display: block; font-weight: bold; margin-bottom: 5px;">Items per Page:</label> 59 <input type="text" id="items_per_page" name="items_per_page" value="{{.Data.Config.ItemsPerPage}}" required 60 style="width: 100%; padding: 8px; font-size: 14px;" 61 placeholder="100"> 62 <small style="color: #666;">Items per page in galleries</small> 63 </div> 64 65 <button type="submit" style="background-color: #007bff; color: white; padding: 10px 20px; border: none; border-radius: 4px; font-size: 16px; cursor: pointer;"> 66 Save Settings 67 </button> 68 </form> 69 70 <hr style="margin: 40px 0;"> 71 72 <h2>Tag Aliases</h2> 73 <p style="color: #666; margin-bottom: 20px;"> 74 Define tag aliases so that multiple tag values are treated as equivalent when searching or filtering. 75 For example, if you alias "colour/blue" with "colour/navy", searching for either will show files tagged with both. 76 </p> 77 78 <div id="aliases-section" style="max-width: 800px;"> 79 <div id="alias-groups"></div> 80 81 <button onclick="addAliasGroup()" style="background-color: #28a745; color: white; padding: 8px 16px; border: none; border-radius: 4px; font-size: 14px; cursor: pointer; margin-top: 10px;"> 82 + Add Alias Group 83 </button> 84 85 <form method="post" id="aliases-form" style="margin-top: 20px;"> 86 <input type="hidden" name="action" value="save_aliases"> 87 <input type="hidden" name="aliases_json" id="aliases_json"> 88 <button type="submit" style="background-color: #007bff; color: white; padding: 10px 20px; border: none; border-radius: 4px; font-size: 16px; cursor: pointer;"> 89 Save Aliases 90 </button> 91 </form> 92 </div> 93 94 <script>window.initialAliasGroups = {{.Data.Config.TagAliases}};</script><script src="/static/tag-alias.js" defer></script> 95 96 <div style="margin-top: 40px; padding: 20px; background-color: #f8f9fa; border-radius: 5px;"> 97 <h3>Current Configuration:</h3> 98 <ul> 99 <li><strong>Database:</strong> {{.Data.Config.DatabasePath}}</li> 100 <li><strong>Upload Directory:</strong> {{.Data.Config.UploadDir}}</li> 101 <li><strong>Server Port:</strong> {{.Data.Config.ServerPort}}</li> 102 <li><strong>Instance Name:</strong> {{.Data.Config.InstanceName}}</li> 103 <li><strong>Gallery Size:</strong> {{.Data.Config.GallerySize}}</li> 104 <li><strong>Items per Page:</strong> {{.Data.Config.ItemsPerPage}}</li> 105 </ul> 106 107 <h4>Configuration File:</h4> 108 <p>Settings are stored in <code>config.json</code> in the application directory.</p> 109 </div> 110 111 <hr style="margin: 40px 0;"> 112 113 <h2>Database Maintenance</h2> 114 115 <form method="post" style="margin-bottom: 20px;"> 116 <input type="hidden" name="action" value="backup"> 117 <button type="submit" style="background-color: #28a745; color: white; padding: 10px 20px; border: none; border-radius: 4px; font-size: 16px; cursor: pointer;"> 118 Backup Database 119 </button> 120 <small style="color: #666; margin-left: 10px;">Creates a timestamped backup of the database file</small> 121 </form> 122 123 <form method="post"> 124 <input type="hidden" name="action" value="vacuum"> 125 <button type="submit" style="background-color: #6f42c1; color: white; padding: 10px 20px; border: none; border-radius: 4px; font-size: 16px; cursor: pointer;"> 126 Vacuum Database 127 </button> 128 <small style="color: #666; margin-left: 10px;">Reclaims unused space and optimizes database performance</small> 129 </form> 130 131 {{template "_footer"}}