How can I get Discourse to generate relative URLs for uploaded images?
I have a site that is available over HTTPS and a TOR .onion and I need a way to get images working for both.
How can I configure Discourse so that upload:// URLs are converted to relative URLs in the <img> tag? Where (which source file) does this URL generation take place?
Uploading works correctly both from the HTTPS domain and the TOR hidden service .onion but the actual HTML generated for a post uses a full URL which is a problem.
I’m assuming somewhere there is some code that does something like
This would require some internal changes, I am somewhat sympathetic cause it makes life a bit easier when changing domain names for sites that do not use A CDN.
Would have to be something like, IF no CDN configured then cook a relative url.
Vorrei aggiungere la mia voce a favore dei collegamenti interni relativi. Attualmente uso URL completi per fare riferimento, ad esempio, a un altro argomento sullo stesso sito.
Infatti, il nostro sito ha recentemente cambiato dominio (segnalando che la reindirizzazione è attualmente attiva):
E il nostro nuovo host, Communiteq (precedentemente DiscourseHosting), ha gentilmente in qualche modo sedato il nostro database per riflettere questo cambiamento.
Forse ci sono motivi tecnici per lo stato attuale? Forse in futuro potremmo usare qualcosa come %{THIS}/t/000? Come sviluppatore, i percorsi assoluti mi rendono solitamente nervoso. C’è anche la questione del passaggio da http: a https:, che abbiamo anche intrapreso (o almeno applicato in modo più rigoroso) come parte della suddetta migrazione. Questo sembra molto simile al caso d’uso di @mreach
Come sempre, molti ringraziamenti al team di Discourse per un prodotto meraviglioso. R.