Skip to content

Commit eb676c0

Browse files
committed
Fix block count
1 parent cee549a commit eb676c0

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

features/block-count-in-mystuff.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,18 @@ if (window.location.href.startsWith("https://scratch.mit.edu/mystuff")) {
22
var stillLookingForBlockCount = true;
33

44
async function getBlockCount(projectId) {
5+
let { project_token } = await (await fetch("https://api.scratch.mit.edu/projects/" + projectId, {
6+
"headers": {
7+
"accept": "*/*",
8+
"x-token": (await ScratchTools.Session()).user.token,
9+
},
10+
"referrer": "https://scratch.mit.edu/",
11+
"referrerPolicy": "strict-origin-when-cross-origin",
12+
"body": null,
13+
"method": "GET",
14+
})).json()
515
var response = await fetch(
6-
"https://projects.scratch.mit.edu/" + projectId + "/"
16+
"https://projects.scratch.mit.edu/" + projectId + "/?token=" + project_token
717
);
818
if (response.ok) {
919
var data = await response.json();

0 commit comments

Comments
 (0)