Download src/types/verification.ts from felix-fx/fx-1: direct link, hf CLI and curl.
- Browser
- Download file 3.6 kB
-
https://huggingface.co/felix-fx/fx-1/resolve/main/src/types/verification.ts
- Command line
-
hf download hf://felix-fx/fx-1/src/types/verification.ts
-
curl -L -o verification.ts https://huggingface.co/felix-fx/fx-1/resolve/main/src/types/verification.ts
3.6 kB
| /** | |
| * نظام التوثيق والرتب المتطور | |
| * - أخضر: المالك (Owner) - صلاحيات كاملة | |
| * - أزرق: مطوري الموقع (Website Developers) - صلاحيات إدارية | |
| * - بنفسجي: مطوري الإضافات (Addon Developers) - صلاحيات محدودة | |
| */ | |
| export type VerificationType = 'owner' | 'developer' | 'addon_developer' | 'user'; | |
| export type VerificationColor = 'green' | 'blue' | 'purple' | 'gray'; | |
| export interface VerificationBadge { | |
| type: VerificationType; | |
| color: VerificationColor; | |
| label: string; | |
| description: string; | |
| permissions: Permission[]; | |
| icon: string; | |
| } | |
| export type Permission = | |
| | 'manage_developers' | |
| | 'manage_verifications' | |
| | 'access_dashboard' | |
| | 'manage_addons' | |
| | 'manage_reviews' | |
| | 'manage_users' | |
| | 'view_analytics' | |
| | 'edit_addon_info' | |
| | 'upload_addon' | |
| | 'view_dashboard'; | |
| export interface UserVerification { | |
| id: string; | |
| user_id: string; | |
| username: string; | |
| verification_type: VerificationType; | |
| verified_at: string; | |
| verified_by: string; | |
| reason?: string; | |
| permissions: Permission[]; | |
| is_active: boolean; | |
| expires_at?: string; | |
| metadata?: { | |
| addon_ids?: string[]; | |
| managed_by?: string; | |
| notes?: string; | |
| }; | |
| } | |
| export interface DeveloperProfile { | |
| id: string; | |
| user_id: string; | |
| username: string; | |
| display_name: string; | |
| avatar_url?: string; | |
| verification: UserVerification; | |
| addon_count: number; | |
| total_downloads: number; | |
| rating: number; | |
| joined_at: string; | |
| is_active: boolean; | |
| } | |
| export const VERIFICATION_CONFIG: Record<VerificationType, VerificationBadge> = { | |
| owner: { | |
| type: 'owner', | |
| color: 'green', | |
| label: 'المالك', | |
| description: 'مالك الموقع - صلاحيات كاملة', | |
| icon: '👑', | |
| permissions: [ | |
| 'manage_developers', | |
| 'manage_verifications', | |
| 'access_dashboard', | |
| 'manage_addons', | |
| 'manage_reviews', | |
| 'manage_users', | |
| 'view_analytics', | |
| ] | |
| }, | |
| developer: { | |
| type: 'developer', | |
| color: 'blue', | |
| label: 'مطور الموقع', | |
| description: 'مطور موقع Minecraft FX', | |
| icon: '💻', | |
| permissions: [ | |
| 'manage_verifications', | |
| 'access_dashboard', | |
| 'manage_addons', | |
| 'manage_reviews', | |
| 'view_analytics', | |
| 'view_dashboard' | |
| ] | |
| }, | |
| addon_developer: { | |
| type: 'addon_developer', | |
| color: 'purple', | |
| label: 'مطور إضافات', | |
| description: 'مطور إضافات معتمد', | |
| icon: '🎨', | |
| permissions: [ | |
| 'edit_addon_info', | |
| 'upload_addon', | |
| 'view_dashboard' | |
| ] | |
| }, | |
| user: { | |
| type: 'user', | |
| color: 'gray', | |
| label: 'مستخدم عادي', | |
| description: 'مستخدم عادي', | |
| icon: '👤', | |
| permissions: [] | |
| } | |
| }; | |
| export const getVerificationBadge = (type: VerificationType): VerificationBadge => { | |
| return VERIFICATION_CONFIG[type]; | |
| }; | |
| export const hasPermission = (verification: UserVerification | null, permission: Permission): boolean => { | |
| if (!verification || !verification.is_active) return false; | |
| return verification.permissions.includes(permission); | |
| }; | |
| export const canAccessDashboard = (verification: UserVerification | null): boolean => { | |
| return hasPermission(verification, 'access_dashboard'); | |
| }; | |
| export const canManageVerifications = (verification: UserVerification | null): boolean => { | |
| return hasPermission(verification, 'manage_verifications'); | |
| }; | |
| export const canManageDevelopers = (verification: UserVerification | null): boolean => { | |
| return hasPermission(verification, 'manage_developers'); | |
| }; | |