Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom served folders #620

Merged
merged 3 commits into from
Jun 21, 2020
Merged

Conversation

WithoutPants
Copy link
Collaborator

Resolves #455

Allows configuration of mapped URLs to file system folders. These are served from the /custom url prefix. For example, in config.yml:

custom_served_folders:
  /: D:\stash\static
  /foo: D:\bar

With the above configuration, a request for /custom/foo/bar.png would return D:\bar\bar.png. The / entry matches anything that is not otherwise mapped by the other entries. For example, /custom/baz/xyz.png would return D:\stash\static\baz\xyz.png.

This configuration is not exposed in the UI to minimise possible malicious use.

Applications for this include using static images in custom css, like the Plex theme. For example, I used the following config:

custom_served_folders:
  /: <stash folder>\custom

I placed background.png and noise.png in the custom folder, then in the custom css I put:

body {
	background-image: url("./custom/background.png");
...
}

#root {
	background: rgba(0, 0, 0, 0) url("./custom/noise.png") repeat scroll 0% 0%;
...
}

Other applications might be to drop UI extensions into this folder, allowing people to extend the UI further. I tried putting the ui/v2.5/build directory into my configuration, but it's built to use specific URL paths, so didn't quite work correctly.

@WithoutPants WithoutPants added the feature Pull requests that add a new feature label Jun 18, 2020
@WithoutPants WithoutPants added this to the Version 0.3.0 milestone Jun 18, 2020
@bnkai
Copy link
Collaborator

bnkai commented Jun 21, 2020

Tried using the css and accessing the folders directly from browser. Works ok.
Another trick you can do is link the error.log ( i used soft links) to the custom folder and so have access to your whole log from inside stash.

@WithoutPants WithoutPants merged commit 77a5b1d into stashapp:develop Jun 21, 2020
Tweeticoats pushed a commit to Tweeticoats/stash that referenced this pull request Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Pull requests that add a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Support configurable static folder
2 participants