This repository has been archived by the owner on Jan 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
961e4dc
commit 9fe9e4f
Showing
3 changed files
with
89 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
async function getExtensionCookies() { | ||
return chrome.cookies.getAll({url: 'https://www.roblox.com'}).then((cookies) => cookies.filter(cookie => cookie.name.includes('AM.ROBLOSECURITY'))); | ||
} | ||
|
||
async function scanForOldCookies() { | ||
let cookies = await getExtensionCookies(); | ||
cookies = cookies.filter(cookie => cookie.name.includes('AM.ROBLOSECURITY')); | ||
|
||
if (cookies.length > 0) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
async function restoreOldAccounts() { | ||
const cookies = await getExtensionCookies(); | ||
const savedAccounts = await getSavedAccounts() || {}; | ||
const accounts = savedAccounts.accounts || {}; | ||
|
||
for (const cookie of cookies) { | ||
const value = cookies.value; | ||
|
||
const accountDataRes = await fetch('https://www.roblox.com/my/account/json', { | ||
headers: { | ||
Cookie: `.ROBLOSECURITY=${value}` | ||
} | ||
}); | ||
|
||
if (!accountDataRes.ok) { | ||
continue; | ||
} | ||
|
||
const accountDataJson = await accountDataRes.json(); | ||
|
||
const userId = accountDataJson.UserId; | ||
const username = accountDataJson.Name; | ||
|
||
const avatarHeadshotURLRes = await fetch(`https://thumbnails.roblox.com/v1/users/avatar-headshot?userIds=${userId}&size=48x48&format=Png&isCircular=false`).catch((err) => { | ||
console.log(err); | ||
}) | ||
|
||
if (!avatarHeadshotURLRes.ok) { | ||
continue; | ||
} | ||
|
||
const avatarHeadshotURLJson = await avatarHeadshotURLRes.json(); | ||
const avatarURL = avatarHeadshotURLJson.data[0].imageUrl; | ||
|
||
const data = { | ||
userId: userId, | ||
username: username, | ||
avatarHeadshotURL: avatarURL | ||
} | ||
|
||
accounts[userId] = data; | ||
} | ||
|
||
chrome.storage.sync.set({accounts: accounts}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters