wokring models and image genration model and admin apges

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-03 17:28:18 +00:00
parent 52600c9dca
commit a1016ec1c2
15 changed files with 1119 additions and 25 deletions

View File

@@ -8,7 +8,8 @@ interface AdminRouteProps {
/**
* AdminRoute component - guards routes requiring admin or staff privileges
* Redirects to dashboard if user is not admin/staff
* OR users belonging to the aws-admin account
* Redirects to dashboard if user doesn't meet requirements
*/
export default function AdminRoute({ children }: AdminRouteProps) {
const { user, isAuthenticated } = useAuthStore();
@@ -19,12 +20,14 @@ export default function AdminRoute({ children }: AdminRouteProps) {
return null;
}
// Check if user is admin or staff
// Check if user is admin/staff OR belongs to aws-admin account
const isAdmin = user?.role === 'admin' || user?.is_staff === true;
const isAwsAdminAccount = user?.account?.name === 'aws-admin' || user?.account?.slug === 'aws-admin';
const hasAccess = isAdmin || isAwsAdminAccount;
if (!isAdmin) {
// Redirect non-admin users to dashboard
console.log('AdminRoute: User is not admin/staff, redirecting to dashboard');
if (!hasAccess) {
// Redirect unauthorized users to dashboard
console.log('AdminRoute: User does not have admin access, redirecting to dashboard');
return <Navigate to="/" state={{ from: location }} replace />;
}

View File

@@ -91,9 +91,8 @@ export default function ImageServiceCard({
const model = imageSettings.runwareModel || 'runware:97@1';
// Map model ID to display name
const modelDisplayNames: Record<string, string> = {
'runware:97@1': 'HiDream-I1 Full',
'runware:gen3a_turbo': 'Gen3a Turbo',
'runware:gen3a': 'Gen3a',
'runware:97@1': 'Hi Dream Full - Standard',
'civitai:618692@691639': 'Bria 3.2 - Premium',
};
const displayName = modelDisplayNames[model] || model;
return `Runware ${displayName}`;