mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 22:46:06 +02:00
Backup friend order
This commit is contained in:
@@ -9182,6 +9182,40 @@ speechSynthesis.getVoices();
|
|||||||
this.deleteFriend(id);
|
this.deleteFriend(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.saveFriendOrder();
|
||||||
|
};
|
||||||
|
|
||||||
|
$app.methods.saveFriendOrder = async function () {
|
||||||
|
var currentTime = Date.now();
|
||||||
|
var lastStoreTime = await configRepository.getString(
|
||||||
|
`VRCX_lastStoreTime_${API.currentUser.id}`,
|
||||||
|
''
|
||||||
|
);
|
||||||
|
// store once every week
|
||||||
|
if (lastStoreTime && currentTime - lastStoreTime < 604800000) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var storedData = {};
|
||||||
|
try {
|
||||||
|
var data = await configRepository.getString(
|
||||||
|
`VRCX_friendOrder_${API.currentUser.id}`
|
||||||
|
);
|
||||||
|
if (data) {
|
||||||
|
var storedData = JSON.parse(data);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
storedData[currentTime] = Array.from(this.friends.keys());
|
||||||
|
await configRepository.setString(
|
||||||
|
`VRCX_friendOrder_${API.currentUser.id}`,
|
||||||
|
JSON.stringify(storedData)
|
||||||
|
);
|
||||||
|
await configRepository.setString(
|
||||||
|
`VRCX_lastStoreTime_${API.currentUser.id}`,
|
||||||
|
currentTime
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
$app.methods.addFriend = function (id, state) {
|
$app.methods.addFriend = function (id, state) {
|
||||||
|
|||||||
Reference in New Issue
Block a user