feat: Enhance deployment logic for multiple Git providers

- Added support for handling commit normalization across GitHub, GitLab, and Gitea in the deployment API.
- Implemented a new utility function to determine the provider based on request headers.
- Improved deployment path validation to ensure consistency across different source types.
- Cleaned up the code by removing redundant checks and enhancing readability.
This commit is contained in:
Mauricio Siu
2025-03-23 03:55:11 -06:00
parent a067abd3e4
commit 95f79f2afb
5 changed files with 122 additions and 30 deletions

View File

@@ -32,26 +32,26 @@ const { handler, api } = betterAuth({
clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
},
},
...(!IS_CLOUD && {
async trustedOrigins() {
const admin = await db.query.member.findFirst({
where: eq(schema.member.role, "owner"),
with: {
user: true,
},
});
// ...(!IS_CLOUD && {
// async trustedOrigins() {
// const admin = await db.query.member.findFirst({
// where: eq(schema.member.role, "owner"),
// with: {
// user: true,
// },
// });
if (admin) {
return [
...(admin.user.serverIp
? [`http://${admin.user.serverIp}:3000`]
: []),
...(admin.user.host ? [`https://${admin.user.host}`] : []),
];
}
return [];
},
}),
// if (admin) {
// return [
// ...(admin.user.serverIp
// ? [`http://${admin.user.serverIp}:3000`]
// : []),
// ...(admin.user.host ? [`https://${admin.user.host}`] : []),
// ];
// }
// return [];
// },
// }),
emailVerification: {
sendOnSignUp: true,
autoSignInAfterVerification: true,