We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cee549a commit eb676c0Copy full SHA for eb676c0
1 file changed
features/block-count-in-mystuff.js
@@ -2,8 +2,18 @@ if (window.location.href.startsWith("https://scratch.mit.edu/mystuff")) {
2
var stillLookingForBlockCount = true;
3
4
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()
15
var response = await fetch(
- "https://projects.scratch.mit.edu/" + projectId + "/"
16
+ "https://projects.scratch.mit.edu/" + projectId + "/?token=" + project_token
17
);
18
if (response.ok) {
19
var data = await response.json();
0 commit comments