How to check if a contract is OZ's UUPSProxy

Is there any way to check if a contract is OZ's UUPSProxy ?

I let users to deploy the contracts by themselves in my framework, meaning that they might make a mistake or something and deploy the contract directly or with other proxies.

What's the good way of checking in solidity that the contract they deployed is actually UUPSProxy ?

One way I could find is:

try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
                require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
            } catch {
                revert("ERC1967Upgrade: new implementation is not UUPS");

But this seems problematic.

Reason: Instead of having newImplementation which is a new logic contract, i only have acces to the proxy contract and because of this, I can't call proxiableUUID as it's protected by notDelegated call.

What would be the safe way to detect/figure this out ?

I don't think it's possible. Why do you need to check if it's a UUPSProxy ?

I have a contract that has a function deploy (virtual)

my customers can inherit from this contract, override the deploy and inside it, deploy their contract. in the end, they return the deployed contract which gets back to my in another contract.

In that contract, i need to check which proxy they used to deploy it... Could be ways to solve it like(returning some variable so that they can help me figure it out) but can't trust this. needed a way to directly check it on the contract.

If you always want them to deploy an UUPS proxy why don't you make the virtual function deployImplementation and then you make sure to deploy UUPS in your code?