Skip to content

Commit 4086805

Browse files
authored
Merge pull request #1014 from MaterArc/fix-follow-on-project
Fix Follow on Project
2 parents 3630c9d + 7eb39e3 commit 4086805

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

features/follow-on-projects/data.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"title": "Follow on Project Page",
33
"description": "Follow users directly from the project page instead of going to their profile.",
44
"credits": [
5+
{ "username": "MaterArc", "url": "https://scratch.mit.edu/users/MaterArc/" },
56
{ "username": "green_thing_game2", "url": "https://scratch.mit.edu/users/green_thing_game2/" },
67
{ "username": "rgantzos", "url": "https://scratch.mit.edu/users/rgantzos/" }
78
],

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)