ckolderup / postmarks

a single-user bookmarking website designed to live on the Fediverse
https://postmarks.glitch.me
MIT License
452 stars 38 forks source link

Not being redirected to create new bookmark #151

Open iambijayd opened 8 months ago

iambijayd commented 8 months ago

It looks like there's a bug when creating a new bookmark using the provided js function. My server was running properly, but it's not getting redirected to create bookmark page as expected.

GIF showing the issue

ezgif com-video-to-gif(5)

My env file

Screenshot 2023-10-16 200207

ckolderup commented 8 months ago

Thanks for reporting! I think there are two issues here:

the PUBLIC_BASE_URL needs to not have the http:// in front of it-- maybe the documentation should be more clear about that? We use the value in many places in the code where we're not generating links (related to ActivityPub stuff), so we add the HTTP protocol handler in front of the value only when we're doing that.

However... in this case, the code used to generate the bookmarklet is hardcoded to 'https', which isn't going to work for localhost URLs in this particular case. Elsewhere, if we're just generating links from page to page on the site, a // prefix would work because it will just inherit whatever protocol the page the link is on is already using. But in this case it's the bookmarklet running the embedded JS. I'm not sure how we can elegantly have all the information we need in this scenario–maybe we need an HTTP_ONLY env var that defaults to false?

iambijayd commented 8 months ago

The hardcoded 'https' is pain when developing/using on localhost.

I'm not sure how we can elegantly have all the information we need in this scenario–maybe we need an HTTP_ONLY env var that defaults to false?

could be the solution