ContentBox icon indicating copy to clipboard operation
ContentBox copied to clipboard

Domain aliases gp

Open gpickin opened this issue 2 years ago • 2 comments

Add the ability to handle DomainAliases for a Site. Give the user an updated UI to handle multi domain names and regex.

gpickin avatar Apr 14 '22 20:04 gpickin

A couple of cleanup items on this PR - one which can eliminate a bunch of boilerplate when going back and forth between JSON. Once those two items are completed, this is good to merge

jclausen avatar Jun 17 '22 17:06 jclausen

Since there hadn't been any movement on this PR, I went ahead and made the changes I recommended above. I've tested this and it looks good to merge for v6 @lmajano .

jclausen avatar Oct 15 '22 14:10 jclausen

@gpickin I have revised this pr from head to two and I cannot find myself to think of why the domain aliases should be stored as json with a domain and domainRegex entry. You ONLY every use the domainRegex in order to do domain discovery and be able to present the right domain at runtime when constructing the domain based URLs. In essence, a domain alias, is only needed to identify a domain, not to construct it's domain, since that is coming from the server name and host headers sent.

I would prefer if the domainAliases is just stored as a list of regex patterns that can identify the domain. This way we will avoid all the unnecessary serialization/deserialization to match an incoming host on EVERY request to a specific pattern. I am ok with everything else. Do you concur? @gpickin @jclausen

lmajano avatar Oct 25 '22 12:10 lmajano

@lmajano Either way you are going to be converting from arrays to strings and back again - because of the way Alpine is going to handle that x-model. With your preference, you would need to stringify in the handler for population, then de-stringify for the some lookup on an array of aliases.

Personally, I like the idea of maintaining typing from front end to back end and I think JSON storage works well, in this case, to do that. In short, I think this is an OK use case for it.

jclausen avatar Oct 26 '22 13:10 jclausen

I am going to have to tweak this PR because as it stands, the detection is ok, but site link constructions are not because they are always relying on the domain being the actual domain you are visiting. The issue with that is that from the admin, you can be in domain a managing domain c and the links get created incorrectly.

lmajano avatar Oct 29 '22 09:10 lmajano

merged manually. Please see commit here: https://github.com/Ortus-Solutions/ContentBox/commit/6dd24e255ab1d75289c2f43674d0a90242d990ad

lmajano avatar Oct 18 '23 17:10 lmajano