fix: github app creation name conflicting with already existing Dokploy-Time names

appended a 5-char random string to the name creation as to prevent
conflicts with other existing Dokploy GitHub apps.
This commit is contained in:
rainwashed
2025-07-28 17:18:30 -04:00
parent 17e9154887
commit 9bc6411c98
@@ -24,12 +24,14 @@ export const AddGithubProvider = () => {
const [isOrganization, setIsOrganization] = useState(false); const [isOrganization, setIsOrganization] = useState(false);
const [organizationName, setOrganization] = useState(""); const [organizationName, setOrganization] = useState("");
const randomString = () => Math.random().toString(36).slice(2, 8);
useEffect(() => { useEffect(() => {
const url = document.location.origin; const url = document.location.origin;
const manifest = JSON.stringify( const manifest = JSON.stringify(
{ {
redirect_url: `${origin}/api/providers/github/setup?organizationId=${activeOrganization?.id}&userId=${session?.user?.id}`, redirect_url: `${origin}/api/providers/github/setup?organizationId=${activeOrganization?.id}&userId=${session?.user?.id}`,
name: `Dokploy-${format(new Date(), "yyyy-MM-dd")}`, name: `Dokploy-${format(new Date(), "yyyy-MM-dd")}-${randomString()}`,
url: origin, url: origin,
hook_attributes: { hook_attributes: {
url: `${url}/api/deploy/github`, url: `${url}/api/deploy/github`,
@@ -118,11 +120,10 @@ export const AddGithubProvider = () => {
: "https://github.com/settings/installations" : "https://github.com/settings/installations"
} }
className={`text-muted-foreground text-sm hover:underline duration-300 className={`text-muted-foreground text-sm hover:underline duration-300
${ ${isOrganization && !organizationName
isOrganization && !organizationName ? "pointer-events-none opacity-50"
? "pointer-events-none opacity-50" : ""
: "" }`}
}`}
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
> >