qdm12 / stackedit-docker

StackEdit 5.14.5 Server in a light Docker container
https://hub.docker.com/r/qmcgaw/stackedit
MIT License
42 stars 16 forks source link

404 Page not found after linking a workspace #2

Closed OffCorner closed 5 years ago

OffCorner commented 5 years ago

Hey there, There is a bug where after linking to a workspace, stackedit redirects to the an url that ends with /app and throws a 404 page not found error (i.e. example.com/app#.....) (I managed to setup CouchDB and use that instead of Google Drive) It is possible to just cut out the "app"-part of the url; however, when adding the website to the homescreen on Android and iOS it defaults to this broken url and there is no way of changing this. Maybe I have done some kind of a mistake while installing the docker image.

qdm12 commented 5 years ago

I never tried it on mobile, and neither tried it with couchdb. I'll test it tomorrow. I can probably change some paths in the Golang HTTP server to rewrite and remove /app from URLS. If you want to give it a try:

git clone https://github.com/qdm12/stackedit-docker.git
cd stackedit-docker
# change main.go
docker build -t qmcgaw/stackedit .
docker run -d -p 8000:8000 qmcgaw/stackedit

It could be an issue with the Dockerfile too, I'll check.

OffCorner commented 5 years ago

I am feeling a bit miserable about all this... I keep getting an error when building: go: disabling cache (/.cache/go-build) due to initialization failure: mkdir /.cache: permission denied go: cannot use modules with build cache disabled It seems like i would have to change "XDG_CACHE_HOME" in go but I have to idea how to do that Link

I think adding the following in the main.go should work, right? http.HandleFunc("/app", func(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "/html/"+r.URL.Path[1:]) })

Anyways, thanks for your help!

qdm12 commented 5 years ago

Hi there, you should only build the docker image, it's much easier and not that slow. Don't bother building the go binary on your host.

I'll cross check with the official repository tomorrow as there may be a missing app directory I forgot to copy over. I will let you know. Thanks for trying to fix the issue :smile: !

qdm12 commented 5 years ago

I just pushed a rewrite of /app so that it should work. Let me know if it solves your problem by commenting or closing the issue. Thanks !

OffCorner commented 5 years ago

Hey there, it works! Thanks a lot for the super fast response every time 👍 Might at some point try to fork stackedit and change a few things around (couchdb only works when the database is public for example) but then I'd also have to fork your stackedit docker container. Or maybe it'd be possible to also set the git url in an environment variable and control it that way? but that all doesn't have anything to do with this issue which is why I am going to close it now. Thanks!

qdm12 commented 5 years ago

I can set a build argument to the Dockerfile or do another branch with a tag. If you have the time to fork and edit it, just let me know by creating an issue! Thanks.