mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Merge pull request #19 from Dokploy/10-connecting-github-is-returning-404
fix(#10): slugify the appName and remove weird characters
This commit is contained in:
@@ -31,6 +31,14 @@ export const generateName = () => {
|
|||||||
n2[Math.round(Math.random() * (n2.length - 1))]
|
n2[Math.round(Math.random() * (n2.length - 1))]
|
||||||
}`;
|
}`;
|
||||||
};
|
};
|
||||||
|
function slugify(text: string) {
|
||||||
|
return text
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/[\s\^&*()+=!]+/g, "-")
|
||||||
|
.replace(/[\$.,*+~()'"!:@^&]+/g, "")
|
||||||
|
.replace(/-+/g, "-")
|
||||||
|
.replace(/^-+|-+$/g, "");
|
||||||
|
}
|
||||||
|
|
||||||
export const GithubSetup = () => {
|
export const GithubSetup = () => {
|
||||||
const [isOrganization, setIsOrganization] = useState(false);
|
const [isOrganization, setIsOrganization] = useState(false);
|
||||||
@@ -98,12 +106,17 @@ export const GithubSetup = () => {
|
|||||||
your GitHub account.
|
your GitHub account.
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<Link
|
<div className="flex flex-row gap-4">
|
||||||
href={`https://github.com/apps/${data.githubAppName}/installations/new?state=gh_setup:${data?.authId}`}
|
<Link
|
||||||
className={buttonVariants({ className: "w-fit" })}
|
href={`https://github.com/apps/${slugify(
|
||||||
>
|
data.githubAppName,
|
||||||
Install Github App
|
)}/installations/new?state=gh_setup:${data?.authId}`}
|
||||||
</Link>
|
className={buttonVariants({ className: "w-fit" })}
|
||||||
|
>
|
||||||
|
Install Github App
|
||||||
|
</Link>
|
||||||
|
<RemoveGithubApp />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ export const RemoveGithubApp = () => {
|
|||||||
await mutateAsync()
|
await mutateAsync()
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
await refetch();
|
await refetch();
|
||||||
|
utils.admin.one.invalidate();
|
||||||
await utils.admin.haveGithubConfigured.invalidate();
|
await utils.admin.haveGithubConfigured.invalidate();
|
||||||
toast.success("Github application deleted succesfully.");
|
toast.success("Github application deleted succesfully.");
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user