mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 12:54:38 +03:00
Separate UI (#1299)
* Add custom_ui_location to serve UI from filesystem
This commit is contained in:
@@ -234,9 +234,21 @@ func Start() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
customUILocation := c.GetCustomUILocation()
|
||||||
|
|
||||||
// Serve the web app
|
// Serve the web app
|
||||||
r.HandleFunc("/*", func(w http.ResponseWriter, r *http.Request) {
|
r.HandleFunc("/*", func(w http.ResponseWriter, r *http.Request) {
|
||||||
ext := path.Ext(r.URL.Path)
|
ext := path.Ext(r.URL.Path)
|
||||||
|
|
||||||
|
if customUILocation != "" {
|
||||||
|
if r.URL.Path == "index.html" || ext == "" {
|
||||||
|
r.URL.Path = "/"
|
||||||
|
}
|
||||||
|
|
||||||
|
http.FileServer(http.Dir(customUILocation)).ServeHTTP(w, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if ext == ".html" || ext == "" {
|
if ext == ".html" || ext == "" {
|
||||||
data, _ := uiBox.Find("index.html")
|
data, _ := uiBox.Find("index.html")
|
||||||
_, _ = w.Write(data)
|
_, _ = w.Write(data)
|
||||||
|
|||||||
@@ -106,6 +106,10 @@ const Language = "language"
|
|||||||
// this should be manually configured only
|
// this should be manually configured only
|
||||||
const CustomServedFolders = "custom_served_folders"
|
const CustomServedFolders = "custom_served_folders"
|
||||||
|
|
||||||
|
// UI directory. Overrides to serve the UI from a specific location
|
||||||
|
// rather than use the embedded UI.
|
||||||
|
const CustomUILocation = "custom_ui_location"
|
||||||
|
|
||||||
// Interface options
|
// Interface options
|
||||||
const MenuItems = "menu_items"
|
const MenuItems = "menu_items"
|
||||||
|
|
||||||
@@ -523,6 +527,10 @@ func (i *Instance) GetCustomServedFolders() URLMap {
|
|||||||
return viper.GetStringMapString(CustomServedFolders)
|
return viper.GetStringMapString(CustomServedFolders)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (i *Instance) GetCustomUILocation() string {
|
||||||
|
return viper.GetString(CustomUILocation)
|
||||||
|
}
|
||||||
|
|
||||||
// Interface options
|
// Interface options
|
||||||
func (i *Instance) GetMenuItems() []string {
|
func (i *Instance) GetMenuItems() []string {
|
||||||
if viper.IsSet(MenuItems) {
|
if viper.IsSet(MenuItems) {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
### ✨ New Features
|
### ✨ New Features
|
||||||
|
* Support serving UI from specific directory location.
|
||||||
* Added details, death date, hair color, and weight to Performers.
|
* Added details, death date, hair color, and weight to Performers.
|
||||||
* Added details to Studios.
|
* Added details to Studios.
|
||||||
* Added [perceptual dupe checker](/settings?tab=duplicates).
|
* Added [perceptual dupe checker](/settings?tab=duplicates).
|
||||||
|
|||||||
@@ -115,4 +115,20 @@ These options are typically not exposed in the UI and must be changed manually i
|
|||||||
|
|
||||||
| Field | Remarks |
|
| Field | Remarks |
|
||||||
|-------|---------|
|
|-------|---------|
|
||||||
|
| `custom_served_folders` | A map of URLs to file system folders. See below. |
|
||||||
|
| `custom_ui_location` | The file system folder where the UI files will be served from, instead of using the embedded UI. Empty to disable. Stash must be restarted to take effect. |
|
||||||
| `max_upload_size` | Maximum file upload size for import files. Defaults to 1GB. |
|
| `max_upload_size` | Maximum file upload size for import files. Defaults to 1GB. |
|
||||||
|
|
||||||
|
### Custom served folders
|
||||||
|
|
||||||
|
Custom served folders are served when the server handles a request with the `/custom` URL prefix. The following is an example configuration:
|
||||||
|
|
||||||
|
```
|
||||||
|
custom_served_folders:
|
||||||
|
/: D:\stash\static
|
||||||
|
/foo: D:\bar
|
||||||
|
```
|
||||||
|
|
||||||
|
With the above configuration, a request for `/custom/foo/bar.png` would serve `D:\bar\bar.png`.
|
||||||
|
|
||||||
|
The `/` entry matches anything that is not otherwise mapped by the other entries. For example, `/custom/baz/xyz.png` would serve `D:\stash\static\baz\xyz.png`.
|
||||||
|
|||||||
Reference in New Issue
Block a user