chore: bump version to 1.3.3
This commit is contained in:
@@ -49,10 +49,6 @@ class SteamClientService {
|
||||
return null;
|
||||
return path_1.default.join(this.steamPath, 'config', 'config.vdf');
|
||||
}
|
||||
/**
|
||||
* Safe Atomic Write: Writes to a temp file and renames it.
|
||||
* This prevents file corruption if the app crashes during write.
|
||||
*/
|
||||
safeWriteVdf(filePath, data) {
|
||||
const tempPath = `${filePath}.tmp_${Date.now()}`;
|
||||
const dir = path_1.default.dirname(filePath);
|
||||
@@ -61,7 +57,6 @@ class SteamClientService {
|
||||
fs_1.default.mkdirSync(dir, { recursive: true });
|
||||
const vdfContent = (0, simple_vdf_1.stringify)(data);
|
||||
fs_1.default.writeFileSync(tempPath, vdfContent, 'utf-8');
|
||||
// Atomic rename
|
||||
fs_1.default.renameSync(tempPath, filePath);
|
||||
}
|
||||
catch (e) {
|
||||
@@ -77,7 +72,6 @@ class SteamClientService {
|
||||
if (loginUsersPath && fs_1.default.existsSync(loginUsersPath)) {
|
||||
this.readLocalAccounts();
|
||||
chokidar_1.default.watch(loginUsersPath, { persistent: true, ignoreInitial: true }).on('change', () => {
|
||||
console.log(`[SteamClient] loginusers.vdf changed, re-scanning...`);
|
||||
this.readLocalAccounts();
|
||||
});
|
||||
}
|
||||
@@ -89,7 +83,7 @@ class SteamClientService {
|
||||
try {
|
||||
const content = fs_1.default.readFileSync(filePath, 'utf-8');
|
||||
if (!content.trim())
|
||||
return; // Empty file
|
||||
return;
|
||||
const data = (0, simple_vdf_1.parse)(content);
|
||||
if (!data || !data.users)
|
||||
return;
|
||||
@@ -99,8 +93,7 @@ class SteamClientService {
|
||||
if (!user || !user.AccountName)
|
||||
continue;
|
||||
accounts.push({
|
||||
steamId: steamId64,
|
||||
accountName: user.AccountName,
|
||||
steamId: steamId64, accountName: user.AccountName,
|
||||
personaName: user.PersonaName || user.AccountName,
|
||||
timestamp: parseInt(user.Timestamp) || 0
|
||||
});
|
||||
@@ -108,9 +101,7 @@ class SteamClientService {
|
||||
if (this.onAccountsChanged)
|
||||
this.onAccountsChanged(accounts);
|
||||
}
|
||||
catch (error) {
|
||||
console.error('[SteamClient] Error parsing loginusers.vdf:', error);
|
||||
}
|
||||
catch (error) { }
|
||||
}
|
||||
extractAccountConfig(accountName) {
|
||||
const configPath = this.getConfigVdfPath();
|
||||
@@ -123,7 +114,6 @@ class SteamClientService {
|
||||
return (accounts && accounts[accountName]) ? accounts[accountName] : null;
|
||||
}
|
||||
catch (e) {
|
||||
console.error('[SteamClient] Failed to extract config.vdf data');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -131,17 +121,7 @@ class SteamClientService {
|
||||
const configPath = this.getConfigVdfPath();
|
||||
if (!configPath)
|
||||
return;
|
||||
let data = {
|
||||
InstallConfigStore: {
|
||||
Software: {
|
||||
Valve: {
|
||||
Steam: {
|
||||
Accounts: {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
let data = { InstallConfigStore: { Software: { Valve: { Steam: { Accounts: {} } } } } };
|
||||
if (fs_1.default.existsSync(configPath)) {
|
||||
try {
|
||||
const content = fs_1.default.readFileSync(configPath, 'utf-8');
|
||||
@@ -151,18 +131,23 @@ class SteamClientService {
|
||||
}
|
||||
catch (e) { }
|
||||
}
|
||||
// Ensure safe nesting
|
||||
if (!data.InstallConfigStore)
|
||||
data.InstallConfigStore = {};
|
||||
if (!data.InstallConfigStore.Software)
|
||||
data.InstallConfigStore.Software = {};
|
||||
if (!data.InstallConfigStore.Software.Valve)
|
||||
data.InstallConfigStore.Software.Valve = {};
|
||||
if (!data.InstallConfigStore.Software.Valve.Steam)
|
||||
data.InstallConfigStore.Software.Valve.Steam = {};
|
||||
if (!data.InstallConfigStore.Software.Valve.Steam.Accounts)
|
||||
data.InstallConfigStore.Software.Valve.Steam.Accounts = {};
|
||||
data.InstallConfigStore.Software.Valve.Steam.Accounts[accountName] = accountData;
|
||||
const ensurePath = (obj, keys) => {
|
||||
let curr = obj;
|
||||
for (const key of keys) {
|
||||
if (!curr[key] || typeof curr[key] !== 'object')
|
||||
curr[key] = {};
|
||||
curr = curr[key];
|
||||
}
|
||||
return curr;
|
||||
};
|
||||
const steamAccounts = ensurePath(data, ['InstallConfigStore', 'Software', 'Valve', 'Steam', 'Accounts']);
|
||||
// FAILPROOF: Force crucial flags that Steam uses to decide session validity
|
||||
steamAccounts[accountName] = {
|
||||
...accountData,
|
||||
RememberPassword: "1",
|
||||
AllowAutoLogin: "1",
|
||||
Timestamp: Math.floor(Date.now() / 1000).toString()
|
||||
};
|
||||
try {
|
||||
this.safeWriteVdf(configPath, data);
|
||||
console.log(`[SteamClient] Safely injected session for ${accountName}`);
|
||||
@@ -220,6 +205,7 @@ class SteamClientService {
|
||||
}
|
||||
catch (e) { }
|
||||
}
|
||||
// Injection of the actual authentication blob
|
||||
if (accountConfig && accountName) {
|
||||
this.injectAccountConfig(accountName, accountConfig);
|
||||
}
|
||||
@@ -232,11 +218,7 @@ class SteamClientService {
|
||||
for (const regPath of regLocations) {
|
||||
if (!fs_1.default.existsSync(path_1.default.dirname(regPath)))
|
||||
continue;
|
||||
let regData = { Registry: { HKCU: { Software: { Valve: { Steam: {
|
||||
AutoLoginUser: "",
|
||||
RememberPassword: "1",
|
||||
AlreadyLoggedIn: "1"
|
||||
} } } } } };
|
||||
let regData = { Registry: { HKCU: { Software: { Valve: { Steam: { AutoLoginUser: "", RememberPassword: "1", AlreadyLoggedIn: "1" } } } } } };
|
||||
if (fs_1.default.existsSync(regPath)) {
|
||||
try {
|
||||
const content = fs_1.default.readFileSync(regPath, 'utf-8');
|
||||
@@ -246,7 +228,6 @@ class SteamClientService {
|
||||
}
|
||||
catch (e) { }
|
||||
}
|
||||
// Deep merge helper
|
||||
const ensurePath = (obj, keys) => {
|
||||
let curr = obj;
|
||||
for (const key of keys) {
|
||||
|
||||
Reference in New Issue
Block a user