ArchiveTeam / seesaw-kit

Making a reusable toolkit for writing seesaw scripts
Other
69 stars 30 forks source link

Support different mount-point / path for webserver #129

Open SpraxDev opened 1 year ago

SpraxDev commented 1 year ago

I'm currently trying to setup a couple of warriors using the official Docker images. I wanted to host all of them behind one convenient domain like warriors.example.com/reddit/ using nginx as my reverse proxy.

This already works for the assets loaded but seems to break for the SockJS-Script. It is requesting /info instead of /reddit/info in my case (same goes for /api/all-projects).

The problem seems to be at https://github.com/ArchiveTeam/seesaw-kit/blob/2dc0bad6f62500681194c62166be98ee80a068e2/seesaw/public/script.js#L2 and got introduces in fa119214bf909caff9f1611dceb1f4ea879b5c4e.


I couldn't find any reason for SockJS getting a custom built URL in the first place instead of just providing the current URL. Maybe adding the current path or using the current full URL would work here as SockJS already preprocessed the given URL? (var conn = new SockJS(window.location.protocol + '//' + window.location.host + window.location.pathname);) https://github.com/ArchiveTeam/seesaw-kit/blob/699b0d215768c2208b5b48844c9f0f75bd6a1cbc/seesaw/public/sockjs-0.3.js#L300-L320


To fix the /api routes it should be possible to just let the browser handle everything and calling a relative uri at https://github.com/ArchiveTeam/seesaw-kit/blob/2dc0bad6f62500681194c62166be98ee80a068e2/seesaw/public/script.js#L274-L306