commit 40b4f8827bd690fe08b0c08ebc6f25de26e3df84
parent 6a3370ea740165340a9a2ea2cc234f55bc8c75a0
Author: breadcat <breadcat@users.noreply.github.com>
Date: Fri, 26 Sep 2025 23:31:31 +0100
I'll get around to this implementing these values eventually, I swear
Diffstat:
2 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/main.go b/main.go
@@ -36,9 +36,12 @@ type File struct {
}
type Config struct {
- DatabasePath string `json:"database_path"`
- UploadDir string `json:"upload_dir"`
- ServerPort string `json:"server_port"`
+ DatabasePath string `json:"database_path"`
+ UploadDir string `json:"upload_dir"`
+ ServerPort string `json:"server_port"`
+ InstanceName string `json:"instance_name"`
+ GallerySize string `json:"gallery_size"`
+ ItemsPerPage string `json:"items_per_page"`
}
type TagDisplay struct {
@@ -733,6 +736,9 @@ func settingsHandler(w http.ResponseWriter, r *http.Request) {
DatabasePath: strings.TrimSpace(r.FormValue("database_path")),
UploadDir: strings.TrimSpace(r.FormValue("upload_dir")),
ServerPort: strings.TrimSpace(r.FormValue("server_port")),
+ InstanceName: strings.TrimSpace(r.FormValue("instance_name")),
+ GallerySize: strings.TrimSpace(r.FormValue("gallery_size")),
+ ItemsPerPage: strings.TrimSpace(r.FormValue("items_per_page")),
}
if err := validateConfig(newConfig); err != nil {
diff --git a/templates/settings.html b/templates/settings.html
@@ -38,6 +38,30 @@
<small style="color: #666;">Port for web server (format: :8080, requires restart if changed)</small>
</div>
+ <div style="margin-bottom: 20px;">
+ <label for="instance_name" style="display: block; font-weight: bold; margin-bottom: 5px;">Instance Name:</label>
+ <input type="text" id="instance_name" name="instance_name" value="{{.Data.Config.InstanceName}}" required
+ style="width: 100%; padding: 8px; font-size: 14px;"
+ placeholder=":8080">
+ <small style="color: #666;">Instance Name, used in header and title bar</small>
+ </div>
+
+ <div style="margin-bottom: 20px;">
+ <label for="gallery_size" style="display: block; font-weight: bold; margin-bottom: 5px;">Gallery Size:</label>
+ <input type="text" id="gallery_size" name="gallery_size" value="{{.Data.Config.GallerySize}}" required
+ style="width: 100%; padding: 8px; font-size: 14px;"
+ placeholder=":8080">
+ <small style="color: #666;">Size of previews used in galleries</small>
+ </div>
+
+ <div style="margin-bottom: 20px;">
+ <label for="items_per_page" style="display: block; font-weight: bold; margin-bottom: 5px;">Items per Page:</label>
+ <input type="text" id="items_per_page" name="items_per_page" value="{{.Data.Config.ItemsPerPage}}" required
+ style="width: 100%; padding: 8px; font-size: 14px;"
+ placeholder=":8080">
+ <small style="color: #666;">Items per page in galleries</small>
+ </div>
+
<button type="submit" style="background-color: #007bff; color: white; padding: 10px 20px; border: none; border-radius: 4px; font-size: 16px;">
Save Settings
</button>
@@ -49,6 +73,9 @@
<li><strong>Database:</strong> {{.Data.Config.DatabasePath}}</li>
<li><strong>Upload Directory:</strong> {{.Data.Config.UploadDir}}</li>
<li><strong>Server Port:</strong> {{.Data.Config.ServerPort}}</li>
+ <li><strong>Instance Name:</strong> {{.Data.Config.InstanceName}}</li>
+ <li><strong>Gallery Size:</strong> {{.Data.Config.GallerySize}}</li>
+ <li><strong>Items per Page:</strong> {{.Data.Config.ItemsPerPage}}</li>
</ul>
<h4>Configuration File:</h4>