Skip to content

Commit 4733a91

Browse files
authored
Fix Follow on Project
1 parent 1224cac commit 4733a91

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

features/follow-on-projects/script.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ export default async function ({ feature, console }) {
3030
(following ? "Unfollow" : "Follow") + " " + username;
3131
let data = await (
3232
await fetch(
33-
"https://scratch.mit.edu/site-api/users/followers/rgantzosTEST/remove/?usernames=" +
33+
"https://scratch.mit.edu/site-api/users/followers/" + username + "/remove/?usernames=" +
3434
auth.user.username,
3535
{
3636
headers: {
37-
"x-csrftoken": "VZ0lgYGuLZzG5nD4nNirmbbze7CulCmP",
37+
"x-csrftoken": document.cookie.match(/scratchcsrftoken=([^;]+)/)?.[1],
3838
"x-requested-with": "XMLHttpRequest",
3939
},
4040
referrer: "https://scratch.mit.edu/users/" + username + "/",
@@ -53,15 +53,14 @@ export default async function ({ feature, console }) {
5353
(following ? "Unfollow" : "Follow") + " " + username;
5454
let data = await (
5555
await fetch(
56-
"https://scratch.mit.edu/site-api/users/followers/rgantzosTEST/add/?usernames=" +
56+
"https://scratch.mit.edu/site-api/users/followers/" + username + "/add/?usernames=" +
5757
auth.user.username,
5858
{
5959
headers: {
60-
"x-csrftoken": "VZ0lgYGuLZzG5nD4nNirmbbze7CulCmP",
60+
"x-csrftoken": document.cookie.match(/scratchcsrftoken=([^;]+)/)?.[1],
6161
"x-requested-with": "XMLHttpRequest",
6262
},
6363
referrer: "https://scratch.mit.edu/users/" + username + "/",
64-
body: '{"id":"' + username + '"}',
6564
method: "PUT",
6665
mode: "cors",
6766
credentials: "include",

0 commit comments

Comments
 (0)