cameri / nostream

A Nostr Relay written in TypeScript
MIT License
741 stars 190 forks source link

User-modifiable templates need work #269

Open s3x-jay opened 1 year ago

s3x-jay commented 1 year ago

This issue is part bug report and part enhancement request.

IMHO, the goal should be that there are user-modifiable templates for:

The problem is currently when someone goes to the home page of the site there's a 301 (permanent) redirect to /invoices - even though that URL serves index.html, not invoices.html

To me the 301 is a bug and in the interim that redirect should be changed to a 302 (line 70 in rootRequestHandler.ts) otherwise when things are finally fixed/improved there will be a period when some people can't get to the home page of the relay since their browser remembers the 301 and takes them to /invoices.

The other issue with the home page is that you only get a home page if some form of payments is turned on. Otherwise there's just a text message saying "Please use a Nostr client to connect." Those webmasters need a home page and legal documents as well.

But while that's under consideration there's another use case that hasn't really been supported so far - the case of a private relay with no payments and everyone is added via whitelisting. Those webmasters would want to use a no payments home page. I suppose they could strip the payment section out of index.html, but how how do they configure settings.yaml?

I see two possible approaches to the issues above: 1) Continue to have the "get invoice" on the home page of the relay (but either omitted when payments aren't active - or using separate templates for with and without payments) 2) Have a dedicated template for the home page and "get invoice" on a separate, page/template (webmasters who don't take payments would simply omit the link to the "get invoice" page).

Next, terms.html doesn't seem to be used at all. I'm guessing that's because when issue #160 came to light terms.html was probably merged with index.html (all the terms seem to have been replicated into index.html at some point). IMHO, terms should be one of those longish legal documents - a CYA document for the website owner. Personally my plan is to have a fairly short, readable run-down of what the rules are on the home page, and then link to the legalese.

Similarly, many jurisdictions require a privacy policy page in addition to a terms of service page, so that would be a good add.

invoices.html is fine as far as I can tell. The only issue with it is the confusion with the /invoices url which doesn't serve invoices.html. invoices.html is really post-invoice while /invoices is get-invoice. Perhaps rename it "post-invoice.html" and then have the get invoice functionality on a "get-invoice.html" template (which would be in line with option 2 above).

If you do nothing else with this, please change the 301 redirect to a 302 redirect. It should be quick and simple and it will eliminate headaches down the road.