fix: some caching issues
This commit is contained in:
parent
ab40bb06bf
commit
f3bb2ca0cb
@ -14,6 +14,7 @@ import { randomString } from '@/helpers/random';
|
|||||||
import crypto from 'crypto';
|
import crypto from 'crypto';
|
||||||
|
|
||||||
import type { Entries } from 'type-fest';
|
import type { Entries } from 'type-fest';
|
||||||
|
import { revalidatePath } from 'next/cache';
|
||||||
|
|
||||||
export type ArcadeUpdate = Partial<Pick<Arcade, 'visibility' | 'joinPrivacy' | 'name' | 'nickname' | 'country' | 'country_id' |
|
export type ArcadeUpdate = Partial<Pick<Arcade, 'visibility' | 'joinPrivacy' | 'name' | 'nickname' | 'country' | 'country_id' |
|
||||||
'state' | 'city' | 'region_id' | 'timezone' | 'ip'>>;
|
'state' | 'city' | 'region_id' | 'timezone' | 'ip'>>;
|
||||||
@ -89,20 +90,23 @@ export const updateArcade = async (id: number, update: ArcadeUpdate) => {
|
|||||||
.where('arcadeId', '=', id)
|
.where('arcadeId', '=', id)
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
revalidatePath('/arcade', 'page');
|
||||||
|
revalidatePath('/arcade/[arcadeId]', 'page');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const joinPublicArcade = async (arcade: number) => {
|
export const joinPublicArcade = async (arcade: number) => {
|
||||||
const user = await requireUser();
|
const user = await requireUser();
|
||||||
const arcadePrivacy = await db.selectFrom('arcade')
|
const arcadeData = await db.selectFrom('arcade')
|
||||||
.innerJoin('actaeon_arcade_ext as ext', 'ext.arcadeId', 'arcade.id')
|
.innerJoin('actaeon_arcade_ext as ext', 'ext.arcadeId', 'arcade.id')
|
||||||
.where('arcade.id', '=', arcade)
|
.where('arcade.id', '=', arcade)
|
||||||
.select('ext.joinPrivacy')
|
.select(['ext.joinPrivacy', 'ext.uuid'])
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
|
||||||
if (!arcadePrivacy)
|
if (!arcadeData)
|
||||||
return notFound();
|
return notFound();
|
||||||
|
|
||||||
if (arcadePrivacy.joinPrivacy !== JoinPrivacy.PUBLIC)
|
if (arcadeData.joinPrivacy !== JoinPrivacy.PUBLIC)
|
||||||
requirePermission(user.permissions, UserPermissions.ACMOD);
|
requirePermission(user.permissions, UserPermissions.ACMOD);
|
||||||
|
|
||||||
await db.insertInto('arcade_owner')
|
await db.insertInto('arcade_owner')
|
||||||
@ -112,6 +116,9 @@ export const joinPublicArcade = async (arcade: number) => {
|
|||||||
permissions: 1
|
permissions: 1
|
||||||
})
|
})
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
|
||||||
|
revalidatePath('/arcade', 'page');
|
||||||
|
revalidatePath(`/arcade/${arcadeData.uuid}`, 'page');
|
||||||
}
|
}
|
||||||
|
|
||||||
export const removeUserFromArcade = async (arcade: number, userId?: number) => {
|
export const removeUserFromArcade = async (arcade: number, userId?: number) => {
|
||||||
@ -127,6 +134,9 @@ export const removeUserFromArcade = async (arcade: number, userId?: number) => {
|
|||||||
.where('arcade', '=', arcade)
|
.where('arcade', '=', arcade)
|
||||||
.where('user', '=', userId)
|
.where('user', '=', userId)
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
|
||||||
|
revalidatePath('/arcade', 'page');
|
||||||
|
revalidatePath('/arcade/[arcadeId]', 'page');
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createArcadeLink = async (arcade: number, remainingUses: number | null) => {
|
export const createArcadeLink = async (arcade: number, remainingUses: number | null) => {
|
||||||
@ -142,6 +152,7 @@ export const createArcadeLink = async (arcade: number, remainingUses: number | n
|
|||||||
totalUses: 0
|
totalUses: 0
|
||||||
})
|
})
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
revalidatePath('/arcade/[arcadeId]', 'page');
|
||||||
return id;
|
return id;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -153,6 +164,7 @@ export const deleteArcadeLink = async (arcade: number, link: string) => {
|
|||||||
.where('arcadeId', '=', arcade)
|
.where('arcadeId', '=', arcade)
|
||||||
.where('id', '=', link)
|
.where('id', '=', link)
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
revalidatePath('/arcade/[arcadeId]', 'page');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createArcade = async (name: string) => {
|
export const createArcade = async (name: string) => {
|
||||||
@ -182,6 +194,7 @@ export const createArcade = async (name: string) => {
|
|||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
revalidatePath('/arcade', 'page');
|
||||||
redirect('/arcade/' + uuid);
|
redirect('/arcade/' + uuid);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -194,6 +207,7 @@ export const deleteArcade = async (id: number) => {
|
|||||||
.where('id', '=', id)
|
.where('id', '=', id)
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
|
||||||
|
revalidatePath('/arcade', 'page');
|
||||||
redirect('/arcade');
|
redirect('/arcade');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,4 +222,6 @@ export const setUserArcadePermissions = async ({ arcadeUser, arcade, permissions
|
|||||||
.where('user', '=', arcadeUser)
|
.where('user', '=', arcadeUser)
|
||||||
.where('arcade', '=', arcade)
|
.where('arcade', '=', arcade)
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
revalidatePath('/arcade', 'page');
|
||||||
|
revalidatePath('/arcade/[arcadeId]', 'page');
|
||||||
};
|
};
|
||||||
|
@ -7,6 +7,7 @@ import { requirePermission } from '@/helpers/permissions';
|
|||||||
import { addCardToUser } from '@/data/card';
|
import { addCardToUser } from '@/data/card';
|
||||||
import { AdminUser, getUsers } from '@/data/user';
|
import { AdminUser, getUsers } from '@/data/user';
|
||||||
import { ActionResult } from '@/types/action-result';
|
import { ActionResult } from '@/types/action-result';
|
||||||
|
import { revalidatePath } from 'next/cache';
|
||||||
|
|
||||||
export const getCards = async () => {
|
export const getCards = async () => {
|
||||||
const user = await requireUser();
|
const user = await requireUser();
|
||||||
@ -27,6 +28,9 @@ export const banUnbanCard = async (opts: { cardId: number, userId: number, isBan
|
|||||||
eb('user', '=', opts.userId)
|
eb('user', '=', opts.userId)
|
||||||
]))
|
]))
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
|
||||||
|
revalidatePath('/settings', 'page');
|
||||||
|
revalidatePath('/admin/users', 'page');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const lockUnlockCard = async (opts: { cardId: number, userId: number, isLock: boolean }) => {
|
export const lockUnlockCard = async (opts: { cardId: number, userId: number, isLock: boolean }) => {
|
||||||
@ -41,6 +45,9 @@ export const lockUnlockCard = async (opts: { cardId: number, userId: number, isL
|
|||||||
eb('user', '=', opts.userId)
|
eb('user', '=', opts.userId)
|
||||||
]))
|
]))
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
|
||||||
|
revalidatePath('/settings', 'page');
|
||||||
|
revalidatePath('/admin/users', 'page');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const adminAddCardToUser = async (user: number, code: string): Promise<ActionResult<{ data: AdminUser[] }>> => {
|
export const adminAddCardToUser = async (user: number, code: string): Promise<ActionResult<{ data: AdminUser[] }>> => {
|
||||||
@ -51,5 +58,8 @@ export const adminAddCardToUser = async (user: number, code: string): Promise<Ac
|
|||||||
if (res.error)
|
if (res.error)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
revalidatePath('/settings', 'page');
|
||||||
|
revalidatePath('/admin/users', 'page');
|
||||||
|
|
||||||
return { data: await getUsers() };
|
return { data: await getUsers() };
|
||||||
};
|
};
|
||||||
|
@ -5,6 +5,7 @@ import { db } from '@/db';
|
|||||||
import { chuniRating } from '@/helpers/chuni/rating';
|
import { chuniRating } from '@/helpers/chuni/rating';
|
||||||
import { CHUNI_MUSIC_PROPERTIES } from '@/helpers/chuni/music';
|
import { CHUNI_MUSIC_PROPERTIES } from '@/helpers/chuni/music';
|
||||||
import { UserPayload } from '@/types/user';
|
import { UserPayload } from '@/types/user';
|
||||||
|
import { revalidatePath } from 'next/cache';
|
||||||
|
|
||||||
export const getMusic = async (musicId?: number) => {
|
export const getMusic = async (musicId?: number) => {
|
||||||
const user = await getUser();
|
const user = await getUser();
|
||||||
@ -83,6 +84,9 @@ export const addFavoriteMusic = async (musicId: number) => {
|
|||||||
favKind: 1
|
favKind: 1
|
||||||
})
|
})
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
|
||||||
|
revalidatePath('/chuni/music', 'page');
|
||||||
|
revalidatePath(`/chuni/music/${musicId}`, 'page');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const removeFavoriteMusic = async (musicId: number) => {
|
export const removeFavoriteMusic = async (musicId: number) => {
|
||||||
@ -98,4 +102,7 @@ export const removeFavoriteMusic = async (musicId: number) => {
|
|||||||
eb('favKind', '=', 1)
|
eb('favKind', '=', 1)
|
||||||
]))
|
]))
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
|
||||||
|
revalidatePath('/chuni/music', 'page');
|
||||||
|
revalidatePath(`/chuni/music/${musicId}`, 'page');
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import { getUser, requireUser } from '@/actions/auth';
|
|||||||
import { Entries } from 'type-fest';
|
import { Entries } from 'type-fest';
|
||||||
import { CHUNI_NAMEPLATE_PROFILE_KEYS } from '@/components/chuni/nameplate';
|
import { CHUNI_NAMEPLATE_PROFILE_KEYS } from '@/components/chuni/nameplate';
|
||||||
import { getGlobalConfig } from '@/config';
|
import { getGlobalConfig } from '@/config';
|
||||||
|
import { revalidatePath } from 'next/cache';
|
||||||
|
|
||||||
type RecentRating = {
|
type RecentRating = {
|
||||||
scoreMax: string,
|
scoreMax: string,
|
||||||
@ -223,5 +224,10 @@ export const updateProfile = async (data: ProfileUpdate) => {
|
|||||||
.set(update)
|
.set(update)
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
|
revalidatePath('/chuni/dashboard', 'page');
|
||||||
|
revalidatePath('/chuni/userbox', 'page');
|
||||||
|
revalidatePath('/', 'page');
|
||||||
|
revalidatePath(`/user/${user.uuid}`, 'page')
|
||||||
|
|
||||||
return { error: false };
|
return { error: false };
|
||||||
};
|
};
|
||||||
|
@ -7,6 +7,7 @@ import { CompiledQuery, Transaction, sql } from 'kysely';
|
|||||||
import { syncUserFriends, withChuniRivalCount } from '@/data/friend';
|
import { syncUserFriends, withChuniRivalCount } from '@/data/friend';
|
||||||
import { SqlBool } from 'kysely';
|
import { SqlBool } from 'kysely';
|
||||||
import { Exact } from 'type-fest';
|
import { Exact } from 'type-fest';
|
||||||
|
import { revalidatePath } from 'next/cache';
|
||||||
|
|
||||||
export const getFriendRequests = async () => {
|
export const getFriendRequests = async () => {
|
||||||
const user = await getUser();
|
const user = await getUser();
|
||||||
@ -48,6 +49,9 @@ export const sendFriendRequest = async (toUser: number) => {
|
|||||||
uuid: sql`uuid_v4()`
|
uuid: sql`uuid_v4()`
|
||||||
})
|
})
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
|
||||||
|
revalidatePath('/user/[userId]', 'page');
|
||||||
|
revalidatePath('/friends', 'page');
|
||||||
}
|
}
|
||||||
|
|
||||||
export const unfriend = async (friend: number) => {
|
export const unfriend = async (friend: number) => {
|
||||||
@ -71,6 +75,9 @@ export const unfriend = async (friend: number) => {
|
|||||||
await syncUserFriends(user.id, trx);
|
await syncUserFriends(user.id, trx);
|
||||||
await syncUserFriends(friend, trx);
|
await syncUserFriends(friend, trx);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
revalidatePath('/user/[userId]', 'page');
|
||||||
|
revalidatePath('/friends', 'page');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const acceptFriendRequest = async (id: string) => {
|
export const acceptFriendRequest = async (id: string) => {
|
||||||
@ -110,6 +117,9 @@ export const acceptFriendRequest = async (id: string) => {
|
|||||||
await syncUserFriends(user.id, trx);
|
await syncUserFriends(user.id, trx);
|
||||||
await syncUserFriends(request.friend, trx);
|
await syncUserFriends(request.friend, trx);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
revalidatePath('/user/[userId]', 'page');
|
||||||
|
revalidatePath('/friends', 'page');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const rejectFriendRequest = async (id: string) => {
|
export const rejectFriendRequest = async (id: string) => {
|
||||||
@ -163,6 +173,9 @@ export const addFriendAsRival = async (friend: number) => {
|
|||||||
await syncUserFriends(user.id, trx);
|
await syncUserFriends(user.id, trx);
|
||||||
await syncUserFriends(friend, trx);
|
await syncUserFriends(friend, trx);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
revalidatePath('/user/[userId]', 'page');
|
||||||
|
revalidatePath('/friends', 'page');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const removeFriendAsRival = async (friend: number) => {
|
export const removeFriendAsRival = async (friend: number) => {
|
||||||
@ -174,4 +187,7 @@ export const removeFriendAsRival = async (friend: number) => {
|
|||||||
await syncUserFriends(user.id, trx);
|
await syncUserFriends(user.id, trx);
|
||||||
await syncUserFriends(friend, trx);
|
await syncUserFriends(friend, trx);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
revalidatePath('/user/[userId]', 'page');
|
||||||
|
revalidatePath('/friends', 'page');
|
||||||
};
|
};
|
||||||
|
@ -7,6 +7,7 @@ import { requireUser } from '@/actions/auth';
|
|||||||
import { requireArcadePermission } from '@/helpers/permissions';
|
import { requireArcadePermission } from '@/helpers/permissions';
|
||||||
import { ArcadePermissions } from '@/types/permissions';
|
import { ArcadePermissions } from '@/types/permissions';
|
||||||
import type { Entries } from 'type-fest';
|
import type { Entries } from 'type-fest';
|
||||||
|
import { revalidatePath } from 'next/cache';
|
||||||
|
|
||||||
export type CabUpdate = Omit<ArcadeCab, 'id' | 'arcade'>;
|
export type CabUpdate = Omit<ArcadeCab, 'id' | 'arcade'>;
|
||||||
|
|
||||||
@ -91,6 +92,9 @@ export const deleteMachine = async (arcade: number, machine: number) => {
|
|||||||
.where('arcade', '=', arcade)
|
.where('arcade', '=', arcade)
|
||||||
.where('id', '=', machine)
|
.where('id', '=', machine)
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
|
||||||
|
revalidatePath('/arcade', 'page');
|
||||||
|
revalidatePath('/arcade/[arcadeId]', 'page');
|
||||||
};
|
};
|
||||||
|
|
||||||
const validateUpdate = async (update: CabUpdate, cab: number | null) => {
|
const validateUpdate = async (update: CabUpdate, cab: number | null) => {
|
||||||
@ -129,6 +133,9 @@ export const updateMachine = async ({ arcade, machine, update }: { arcade: numbe
|
|||||||
.where('machine.arcade', '=', arcade)
|
.where('machine.arcade', '=', arcade)
|
||||||
.set(update)
|
.set(update)
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
|
||||||
|
revalidatePath('/arcade', 'page');
|
||||||
|
revalidatePath('/arcade/[arcadeId]', 'page');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createMachine = async ({ arcade, update }: { arcade: number, update: CabUpdate }) => {
|
export const createMachine = async ({ arcade, update }: { arcade: number, update: CabUpdate }) => {
|
||||||
@ -147,5 +154,8 @@ export const createMachine = async ({ arcade, update }: { arcade: number, update
|
|||||||
})
|
})
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
|
||||||
|
revalidatePath('/arcade', 'page');
|
||||||
|
revalidatePath('/arcade/[arcadeId]', 'page');
|
||||||
|
|
||||||
return { error: false, message: '', data: await getArcadeCabs({ arcade, user, permissions: arcadePermissions }) };
|
return { error: false, message: '', data: await getArcadeCabs({ arcade, user, permissions: arcadePermissions }) };
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import { hasPermission, requirePermission } from '@/helpers/permissions';
|
|||||||
import { makeValidator } from '@/types/validator-map';
|
import { makeValidator } from '@/types/validator-map';
|
||||||
import { DB } from '@/types/db';
|
import { DB } from '@/types/db';
|
||||||
import { randomString } from '@/helpers/random';
|
import { randomString } from '@/helpers/random';
|
||||||
|
import { revalidatePath } from 'next/cache';
|
||||||
|
|
||||||
const validator = makeValidator<TeamUpdate, DB['actaeon_teams'] | null>()
|
const validator = makeValidator<TeamUpdate, DB['actaeon_teams'] | null>()
|
||||||
.nonNullableKeys('name', 'joinPrivacy', 'visibility')
|
.nonNullableKeys('name', 'joinPrivacy', 'visibility')
|
||||||
@ -84,6 +85,8 @@ export const createTeam = async (name: string): Promise<ActionResult> => {
|
|||||||
await syncUserTeams(user.id, { chuniTeam }, trx);
|
await syncUserTeams(user.id, { chuniTeam }, trx);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
revalidatePath('/team', 'page');
|
||||||
|
|
||||||
redirect(`/team/${uuid}`);
|
redirect(`/team/${uuid}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -134,6 +137,9 @@ export const modifyTeam = async (team: string, update: TeamUpdate): Promise<Acti
|
|||||||
.set({ teamName: res.value.name })
|
.set({ teamName: res.value.name })
|
||||||
.executeTakeFirst()
|
.executeTakeFirst()
|
||||||
|
|
||||||
|
revalidatePath('/team', 'page');
|
||||||
|
revalidatePath(`/team/${team}`, 'page');
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -161,6 +167,9 @@ export const joinPublicTeam = async (team: string) => {
|
|||||||
|
|
||||||
await syncUserTeams(user.id, teamData, trx);
|
await syncUserTeams(user.id, teamData, trx);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
revalidatePath('/team', 'page');
|
||||||
|
revalidatePath(`/team/${team}`, 'page');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const removeUserFromTeam = async (team: string, userId?: number) => {
|
export const removeUserFromTeam = async (team: string, userId?: number) => {
|
||||||
@ -189,6 +198,9 @@ export const removeUserFromTeam = async (team: string, userId?: number) => {
|
|||||||
|
|
||||||
await syncUserTeams(userId, null, trx);
|
await syncUserTeams(userId, null, trx);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
revalidatePath('/team', 'page');
|
||||||
|
revalidatePath(`/team/${team}`, 'page');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deleteTeam = async (team: string) => {
|
export const deleteTeam = async (team: string) => {
|
||||||
@ -203,6 +215,9 @@ export const deleteTeam = async (team: string) => {
|
|||||||
.where('uuid', '=', teamData.uuid)
|
.where('uuid', '=', teamData.uuid)
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
revalidatePath('/team', 'page');
|
||||||
|
revalidatePath(`/team/${team}`, 'page');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deleteTeamLink = async (team: string, link: string) => {
|
export const deleteTeamLink = async (team: string, link: string) => {
|
||||||
@ -211,6 +226,8 @@ export const deleteTeamLink = async (team: string, link: string) => {
|
|||||||
.where('teamId', '=', teamData.uuid)
|
.where('teamId', '=', teamData.uuid)
|
||||||
.where('id', '=', link)
|
.where('id', '=', link)
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
|
||||||
|
revalidatePath(`/team/${team}`, 'page');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createTeamLink = async (team: string, remainingUses: number | null) => {
|
export const createTeamLink = async (team: string, remainingUses: number | null) => {
|
||||||
@ -226,5 +243,7 @@ export const createTeamLink = async (team: string, remainingUses: number | null)
|
|||||||
})
|
})
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
|
||||||
|
revalidatePath(`/team/${team}`, 'page');
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
};
|
};
|
||||||
|
@ -3,6 +3,8 @@ import { getGlobalConfig } from '@/config';
|
|||||||
import { UserPermissions } from '@/types/permissions';
|
import { UserPermissions } from '@/types/permissions';
|
||||||
import { SystemConfig } from './system-config';
|
import { SystemConfig } from './system-config';
|
||||||
|
|
||||||
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
export default async function SystemConfigPage() {
|
export default async function SystemConfigPage() {
|
||||||
await requireUser({ permission: UserPermissions.SYSADMIN });
|
await requireUser({ permission: UserPermissions.SYSADMIN });
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@ import { UserPermissions } from '@/types/permissions';
|
|||||||
import { AdminUserList } from './admin-user-list';
|
import { AdminUserList } from './admin-user-list';
|
||||||
import { getUsers } from '@/data/user';
|
import { getUsers } from '@/data/user';
|
||||||
|
|
||||||
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
export default async function AdminUsersPage() {
|
export default async function AdminUsersPage() {
|
||||||
await requireUser({ permission: UserPermissions.USERMOD });
|
await requireUser({ permission: UserPermissions.USERMOD });
|
||||||
const users = await getUsers();
|
const users = await getUsers();
|
||||||
|
@ -4,6 +4,8 @@ import { notFound } from 'next/navigation';
|
|||||||
import { ArcadeDetail } from './arcade';
|
import { ArcadeDetail } from './arcade';
|
||||||
import { PrivateVisibilityError } from '@/components/private-visibility-error';
|
import { PrivateVisibilityError } from '@/components/private-visibility-error';
|
||||||
|
|
||||||
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
export default async function ArcadeDetailPage({ params }: { params: { arcadeId: string }}) {
|
export default async function ArcadeDetailPage({ params }: { params: { arcadeId: string }}) {
|
||||||
const user = await getUser();
|
const user = await getUser();
|
||||||
const arcade = (await getArcades({ user, uuids: [params.arcadeId], includeUnlisted: true }))[0];
|
const arcade = (await getArcades({ user, uuids: [params.arcadeId], includeUnlisted: true }))[0];
|
||||||
|
@ -13,6 +13,8 @@ const getLocation = (arcade: Arcade) => {
|
|||||||
return out;
|
return out;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
export default async function ArcadePage() {
|
export default async function ArcadePage() {
|
||||||
const user = await getUser();
|
const user = await getUser();
|
||||||
const arcades = (await getArcades({ user })).filter(a => a.visible);
|
const arcades = (await getArcades({ user })).filter(a => a.visible);
|
||||||
|
@ -8,6 +8,8 @@ import { ChuniTopRatingSidebar } from './top-rating-sidebar';
|
|||||||
import { Button } from '@nextui-org/react';
|
import { Button } from '@nextui-org/react';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
|
|
||||||
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
export default async function ChuniDashboard() {
|
export default async function ChuniDashboard() {
|
||||||
const user = await requireUser();
|
const user = await requireUser();
|
||||||
const [profile, rating, playlog] = await Promise.all([
|
const [profile, rating, playlog] = await Promise.all([
|
||||||
|
@ -10,6 +10,8 @@ export const viewport: Viewport = {
|
|||||||
interactiveWidget: 'resizes-content'
|
interactiveWidget: 'resizes-content'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
export default async function ChuniUserboxPage() {
|
export default async function ChuniUserboxPage() {
|
||||||
const user = await requireUser();
|
const user = await requireUser();
|
||||||
const profile = await getUserData(user);
|
const profile = await getUserData(user);
|
||||||
|
@ -2,6 +2,8 @@ import { requireUser } from '@/actions/auth';
|
|||||||
import { getFriends } from '@/data/friend';
|
import { getFriends } from '@/data/friend';
|
||||||
import { Friends } from './friends';
|
import { Friends } from './friends';
|
||||||
|
|
||||||
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
export default async function FriendsPage() {
|
export default async function FriendsPage() {
|
||||||
const user = await requireUser();
|
const user = await requireUser();
|
||||||
const friends = await getFriends(user.id);
|
const friends = await getFriends(user.id);
|
||||||
|
@ -4,6 +4,8 @@ import { notFound } from 'next/navigation';
|
|||||||
import { PrivateVisibilityError } from '@/components/private-visibility-error';
|
import { PrivateVisibilityError } from '@/components/private-visibility-error';
|
||||||
import { TeamDetail } from './team';
|
import { TeamDetail } from './team';
|
||||||
|
|
||||||
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
export default async function TeamDetailPage({ params }: { params: { teamId: string }}) {
|
export default async function TeamDetailPage({ params }: { params: { teamId: string }}) {
|
||||||
const user = await getUser();
|
const user = await getUser();
|
||||||
const team = (await getTeams({ user, uuids: [params.teamId], showUnlisted: true }))[0];
|
const team = (await getTeams({ user, uuids: [params.teamId], showUnlisted: true }))[0];
|
||||||
|
@ -7,6 +7,8 @@ import { StarIcon } from '@heroicons/react/24/solid';
|
|||||||
import { Divider, Tooltip } from '@nextui-org/react';
|
import { Divider, Tooltip } from '@nextui-org/react';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
|
|
||||||
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
export default async function TeamPage() {
|
export default async function TeamPage() {
|
||||||
const user = await getUser();
|
const user = await getUser();
|
||||||
const teams = (await getTeams({ user }))
|
const teams = (await getTeams({ user }))
|
||||||
|
@ -5,6 +5,8 @@ import { getUserData as getChuniUserData } from '@/actions/chuni/profile';
|
|||||||
import { UserProfile } from './user-profile';
|
import { UserProfile } from './user-profile';
|
||||||
import { db } from '@/db';
|
import { db } from '@/db';
|
||||||
|
|
||||||
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
export default async function UserProfilePage({ params }: { params: { userId: string; }; }) {
|
export default async function UserProfilePage({ params }: { params: { userId: string; }; }) {
|
||||||
const viewingUser = await getUser();
|
const viewingUser = await getUser();
|
||||||
const user = await withUsersVisibleTo(viewingUser)
|
const user = await withUsersVisibleTo(viewingUser)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { revalidatePath } from 'next/cache';
|
||||||
import { db } from './db';
|
import { db } from './db';
|
||||||
|
|
||||||
export type GlobalConfig = {
|
export type GlobalConfig = {
|
||||||
@ -66,6 +67,9 @@ export const setGlobalConfig = async (update: Partial<GlobalConfig>) => {
|
|||||||
(CONFIG as any)[key] = res?.value ?? value;
|
(CONFIG as any)[key] = res?.value ?? value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ('chuni_allow_equip_unearned' in update)
|
||||||
|
revalidatePath('/chuni/userbox', 'page');
|
||||||
|
|
||||||
await db.transaction().execute(async trx => {
|
await db.transaction().execute(async trx => {
|
||||||
for (const [key, value] of Object.entries(update)) {
|
for (const [key, value] of Object.entries(update)) {
|
||||||
await trx.updateTable('actaeon_global_config')
|
await trx.updateTable('actaeon_global_config')
|
||||||
|
Loading…
Reference in New Issue
Block a user