feat: implement primary account identifier and streamline add account flow via direct Steam login
This commit is contained in:
@@ -502,6 +502,18 @@ electron_1.ipcMain.handle('share-account-with-user', async (event, steamId, targ
|
||||
}
|
||||
throw new Error('Backend not configured');
|
||||
});
|
||||
electron_1.ipcMain.handle('revoke-account-access', async (event, steamId, targetSteamId) => {
|
||||
initBackend();
|
||||
if (backend)
|
||||
return await backend.revokeAccess(steamId, targetSteamId);
|
||||
throw new Error('Backend not configured');
|
||||
});
|
||||
electron_1.ipcMain.handle('revoke-all-account-access', async (event, steamId) => {
|
||||
initBackend();
|
||||
if (backend)
|
||||
return await backend.revokeAllAccess(steamId);
|
||||
throw new Error('Backend not configured');
|
||||
});
|
||||
electron_1.ipcMain.handle('get-community-accounts', async () => { initBackend(); return backend ? await backend.getCommunityAccounts() : []; });
|
||||
electron_1.ipcMain.handle('get-server-users', async () => { initBackend(); return backend ? await backend.getServerUsers() : []; });
|
||||
electron_1.ipcMain.handle('switch-account', async (event, loginName) => await handleSwitchAccount(loginName));
|
||||
|
||||
@@ -8,6 +8,8 @@ electron_1.contextBridge.exposeInMainWorld('electronAPI', {
|
||||
deleteAccount: (id) => electron_1.ipcRenderer.invoke('delete-account', id),
|
||||
switchAccount: (loginName) => electron_1.ipcRenderer.invoke('switch-account', loginName),
|
||||
shareAccountWithUser: (steamId, targetSteamId) => electron_1.ipcRenderer.invoke('share-account-with-user', steamId, targetSteamId),
|
||||
revokeAccountAccess: (steamId, targetSteamId) => electron_1.ipcRenderer.invoke('revoke-account-access', steamId, targetSteamId),
|
||||
revokeAllAccountAccess: (steamId) => electron_1.ipcRenderer.invoke('revoke-all-account-access', steamId),
|
||||
openExternal: (url) => electron_1.ipcRenderer.invoke('open-external', url),
|
||||
openSteamLogin: (steamId) => electron_1.ipcRenderer.invoke('open-steam-login', steamId),
|
||||
// Server Config & Auth
|
||||
|
||||
@@ -67,7 +67,8 @@ class BackendService {
|
||||
gameBans: account.gameBans,
|
||||
loginName: account.loginName,
|
||||
steamLoginSecure: account.steamLoginSecure,
|
||||
loginConfig: account.loginConfig
|
||||
loginConfig: account.loginConfig,
|
||||
sessionUpdatedAt: account.sessionUpdatedAt
|
||||
}, { headers: this.headers });
|
||||
}
|
||||
catch (e) {
|
||||
@@ -100,5 +101,34 @@ class BackendService {
|
||||
throw new Error(e.response?.data?.message || 'Failed to share account');
|
||||
}
|
||||
}
|
||||
async revokeAccess(steamId, targetSteamId) {
|
||||
if (!this.token)
|
||||
return;
|
||||
try {
|
||||
const response = await axios_1.default.delete(`${this.url}/api/sync/${steamId}/share`, {
|
||||
headers: this.headers,
|
||||
data: { targetSteamId }
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
catch (e) {
|
||||
console.error(`[Backend] Failed to revoke access for ${steamId} from ${targetSteamId}`);
|
||||
throw new Error(e.response?.data?.message || 'Failed to revoke access');
|
||||
}
|
||||
}
|
||||
async revokeAllAccess(steamId) {
|
||||
if (!this.token)
|
||||
return;
|
||||
try {
|
||||
const response = await axios_1.default.delete(`${this.url}/api/sync/${steamId}/share/all`, {
|
||||
headers: this.headers
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
catch (e) {
|
||||
console.error(`[Backend] Failed to revoke all access for ${steamId}`);
|
||||
throw new Error(e.response?.data?.message || 'Failed to revoke all access');
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.BackendService = BackendService;
|
||||
|
||||
Reference in New Issue
Block a user