Add agent workflows & stuff
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import Authentik from '@auth/core/providers/authentik';
|
||||
import GitHub from '@auth/core/providers/github';
|
||||
import {
|
||||
convexAuth,
|
||||
getAuthUserId,
|
||||
@@ -21,6 +22,12 @@ export const { auth, signIn, signOut, store, isAuthenticated } = convexAuth({
|
||||
clientSecret: process.env.AUTH_AUTHENTIK_SECRET,
|
||||
issuer: process.env.AUTH_AUTHENTIK_ISSUER,
|
||||
}),
|
||||
GitHub({
|
||||
allowDangerousEmailAccountLinking: true,
|
||||
clientId: process.env.AUTH_GITHUB_ID ?? process.env.GITHUB_APP_CLIENT_ID,
|
||||
clientSecret:
|
||||
process.env.AUTH_GITHUB_SECRET ?? process.env.GITHUB_APP_CLIENT_SECRET,
|
||||
}),
|
||||
Password,
|
||||
],
|
||||
});
|
||||
@@ -39,6 +46,7 @@ const getAuthAccountById = async (ctx: QueryCtx, userId: Id<'users'>) => {
|
||||
const authAccount = await ctx.db
|
||||
.query('authAccounts')
|
||||
.withIndex('userIdAndProvider', (q) => q.eq('userId', userId))
|
||||
.order('desc')
|
||||
.first();
|
||||
if (!authAccount) throw new ConvexError('Auth account not found');
|
||||
return authAccount;
|
||||
@@ -83,7 +91,12 @@ export const updateUser = mutation({
|
||||
if (args.image !== undefined) {
|
||||
const oldImage = user.image as Id<'_storage'> | undefined;
|
||||
patch.image = args.image;
|
||||
if (oldImage && oldImage !== args.image) {
|
||||
if (
|
||||
oldImage &&
|
||||
oldImage !== args.image &&
|
||||
!oldImage.startsWith('http://') &&
|
||||
!oldImage.startsWith('https://')
|
||||
) {
|
||||
await ctx.storage.delete(oldImage);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user