HaschekSolutions / pictshare

:camera: PictShare is an open source image, mp4, pastebin hosting service with a simple resizing and upload API that you can host yourself. :rice_scene:
https://www.pictshare.net
Apache License 2.0
819 stars 123 forks source link

Hosting from a sub-directory? #101

Closed sehailey closed 4 years ago

sehailey commented 4 years ago

This does not appear to play nicely with subdirectory hosting. I set up nginx to correctly access the directory but all of the static content was 404 and did not include the subdirectory in the request (even though it was included in the url in the config file).

thomasdeurloo commented 4 years ago

Having same issue. Al sources/actions/href in the templates are started with a slash, causing the references to start at the site root, making in impossible to run from subdir.

<link href="/css/bootstrap.min.css" rel="stylesheet">

removing the first slash will solve this issue

<link href="css/bootstrap.min.css" rel="stylesheet">

sehailey commented 4 years ago

Thanks for the suggestion @thomasdeurloo . Removing all of the front slashes from the template (including /api and /js) got me some of the way there. However, trying to open the file after uploading still results in a 404.

Note that the info it gives after the upload is conflicting:

20140167_10102035618795688_5662779144755663256_n.jpg uploaded as r1l50s.jpg
URL: https://websiteURL/pix/r1l50s.jpg

the URL is clickable and is the correct URL (but leads to a 404), whereas the r1l50s.jpg is also clickable, but leads to https://websiteURL/r1l50s.jpg which is the incorrect URL (and also leads to a 404).

I wish I could be more helpful by e.g. making a pull request, but php is not my forte.

thomasdeurloo commented 4 years ago

I think there must be one slash left ;) in pictshare.js: href='/"+o.hash+"'

geek-at commented 4 years ago

Sorry we dropped support for sub directory hosting with the rewrite. Might implement later but for now it's not supported