feat: implement comprehensive admin dashboard for server management and user oversight
This commit is contained in:
@@ -27,6 +27,7 @@ export interface ServerConfig {
|
||||
token?: string;
|
||||
serverSteamId?: string;
|
||||
enabled: boolean;
|
||||
isAdmin?: boolean;
|
||||
}
|
||||
|
||||
interface AccountsContextType {
|
||||
@@ -51,6 +52,13 @@ interface AccountsContextType {
|
||||
getCommunityAccounts: () => Promise<any[]>;
|
||||
getServerUsers: () => Promise<any[]>;
|
||||
refreshAccounts: (showLoading?: boolean) => Promise<void>;
|
||||
|
||||
// Admin Methods
|
||||
adminGetStats: () => Promise<any>;
|
||||
adminGetUsers: () => Promise<any[]>;
|
||||
adminDeleteUser: (userId: string) => Promise<void>;
|
||||
adminGetAccounts: () => Promise<any[]>;
|
||||
adminRemoveAccount: (steamId: string) => Promise<void>;
|
||||
}
|
||||
|
||||
const AccountsContext = createContext<AccountsContextType | undefined>(undefined);
|
||||
@@ -174,11 +182,19 @@ export const AccountsProvider: React.FC<{ children: React.ReactNode }> = ({ chil
|
||||
return await (window as any).electronAPI.getServerUsers();
|
||||
};
|
||||
|
||||
// --- Admin Methods ---
|
||||
const adminGetStats = async () => (window as any).electronAPI.adminGetStats();
|
||||
const adminGetUsers = async () => (window as any).electronAPI.adminGetUsers();
|
||||
const adminDeleteUser = async (userId: string) => (window as any).electronAPI.adminDeleteUser(userId);
|
||||
const adminGetAccounts = async () => (window as any).electronAPI.adminGetAccounts();
|
||||
const adminRemoveAccount = async (steamId: string) => (window as any).electronAPI.adminRemoveAccount(steamId);
|
||||
|
||||
return (
|
||||
<AccountsContext.Provider value={{
|
||||
accounts, serverConfig, isLoading, isSyncing, addAccount, updateAccount, deleteAccount,
|
||||
switchAccount, openSteamAppLogin, openSteamLogin, updateServerConfig, loginToServer,
|
||||
getCommunityAccounts, getServerUsers, shareAccountWithUser, revokeAccountAccess, revokeAllAccountAccess, syncNow, refreshAccounts
|
||||
getCommunityAccounts, getServerUsers, shareAccountWithUser, revokeAccountAccess, revokeAllAccountAccess, syncNow, refreshAccounts,
|
||||
adminGetStats, adminGetUsers, adminDeleteUser, adminGetAccounts, adminRemoveAccount
|
||||
}}>
|
||||
{children}
|
||||
</AccountsContext.Provider>
|
||||
|
||||
Reference in New Issue
Block a user