diff --git a/features/follow-on-projects/data.json b/features/follow-on-projects/data.json index c48afd30..995a9938 100644 --- a/features/follow-on-projects/data.json +++ b/features/follow-on-projects/data.json @@ -2,6 +2,7 @@ "title": "Follow on Project Page", "description": "Follow users directly from the project page instead of going to their profile.", "credits": [ + { "username": "MaterArc", "url": "https://scratch.mit.edu/users/MaterArc/" }, { "username": "green_thing_game2", "url": "https://scratch.mit.edu/users/green_thing_game2/" }, { "username": "rgantzos", "url": "https://scratch.mit.edu/users/rgantzos/" } ], diff --git a/features/follow-on-projects/script.js b/features/follow-on-projects/script.js index 7cbafa6c..6162ece9 100644 --- a/features/follow-on-projects/script.js +++ b/features/follow-on-projects/script.js @@ -30,11 +30,11 @@ export default async function ({ feature, console }) { (following ? "Unfollow" : "Follow") + " " + username; let data = await ( await fetch( - "https://scratch.mit.edu/site-api/users/followers/rgantzosTEST/remove/?usernames=" + + "https://scratch.mit.edu/site-api/users/followers/" + username + "/remove/?usernames=" + auth.user.username, { headers: { - "x-csrftoken": "VZ0lgYGuLZzG5nD4nNirmbbze7CulCmP", + "x-csrftoken": document.cookie.match(/scratchcsrftoken=([^;]+)/)?.[1], "x-requested-with": "XMLHttpRequest", }, referrer: "https://scratch.mit.edu/users/" + username + "/", @@ -53,15 +53,14 @@ export default async function ({ feature, console }) { (following ? "Unfollow" : "Follow") + " " + username; let data = await ( await fetch( - "https://scratch.mit.edu/site-api/users/followers/rgantzosTEST/add/?usernames=" + + "https://scratch.mit.edu/site-api/users/followers/" + username + "/add/?usernames=" + auth.user.username, { headers: { - "x-csrftoken": "VZ0lgYGuLZzG5nD4nNirmbbze7CulCmP", + "x-csrftoken": document.cookie.match(/scratchcsrftoken=([^;]+)/)?.[1], "x-requested-with": "XMLHttpRequest", }, referrer: "https://scratch.mit.edu/users/" + username + "/", - body: '{"id":"' + username + '"}', method: "PUT", mode: "cors", credentials: "include",