feat: implement granular access revocation and global unsharing in the account permissions dialog

This commit is contained in:
2026-02-21 02:45:01 +01:00
parent 7d1e19d881
commit 1f5d2e08e5
6 changed files with 372 additions and 126 deletions

View File

@@ -40,6 +40,8 @@ interface AccountsContextType {
switchAccount: (loginName: string) => Promise<void>;
openSteamLogin: (steamId: string) => Promise<void>;
shareAccountWithUser: (steamId: string, targetSteamId: string) => Promise<any>;
revokeAccountAccess: (steamId: string, targetSteamId: string) => Promise<any>;
revokeAllAccountAccess: (steamId: string) => Promise<any>;
// Server Methods
updateServerConfig: (config: Partial<ServerConfig>) => Promise<void>;
@@ -136,6 +138,18 @@ export const AccountsProvider: React.FC<{ children: React.ReactNode }> = ({ chil
return res;
};
const revokeAccountAccess = async (steamId: string, targetSteamId: string) => {
const res = await (window as any).electronAPI.revokeAccountAccess(steamId, targetSteamId);
await syncNow();
return res;
};
const revokeAllAccountAccess = async (steamId: string) => {
const res = await (window as any).electronAPI.revokeAllAccountAccess(steamId);
await syncNow();
return res;
};
const updateServerConfig = async (config: Partial<ServerConfig>) => {
const updated = await (window as any).electronAPI.updateServerConfig(config);
setServerConfig(updated);
@@ -159,7 +173,7 @@ export const AccountsProvider: React.FC<{ children: React.ReactNode }> = ({ chil
<AccountsContext.Provider value={{
accounts, serverConfig, isLoading, isSyncing, addAccount, updateAccount, deleteAccount,
switchAccount, openSteamLogin, updateServerConfig, loginToServer,
getCommunityAccounts, getServerUsers, shareAccountWithUser, syncNow, refreshAccounts
getCommunityAccounts, getServerUsers, shareAccountWithUser, revokeAccountAccess, revokeAllAccountAccess, syncNow, refreshAccounts
}}>
{children}
</AccountsContext.Provider>