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}`;

View File

@@ -332,8 +332,13 @@ const AppSidebar: React.FC = () => {
{items
.filter((nav) => {
// Filter out admin-only items for non-admin users
if (nav.adminOnly && user?.role !== 'admin' && !user?.is_staff) {
return false;
// Allow access for: admin role, staff users, or aws-admin account members
if (nav.adminOnly) {
const isAdmin = user?.role === 'admin' || user?.is_staff === true;
const isAwsAdminAccount = user?.account?.name === 'aws-admin' || user?.account?.slug === 'aws-admin';
if (!isAdmin && !isAwsAdminAccount) {
return false;
}
}
return true;
})

View File

@@ -552,9 +552,8 @@ export default function Integration() {
});
},
options: [
{ value: 'runware:97@1', label: 'HiDream-I1 Full - $0.009 per image' },
{ value: 'runware:gen3a_turbo', label: 'Gen3a Turbo - $0.009 per image' },
{ value: 'runware:gen3a', label: 'Gen3a - $0.009 per image' },
{ value: 'runware:97@1', label: 'Hi Dream Full - Standard' },
{ value: 'civitai:618692@691639', label: 'Bria 3.2 - Premium' },
],
});
}
@@ -922,9 +921,8 @@ export default function Integration() {
? (() => {
// 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',
};
return modelDisplayNames[integrations.image_generation.runwareModel] || integrations.image_generation.runwareModel;
})()