Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ class Feature {
finalFeature = el;
}
});
this.requestPermissions = async function(...permissions) {
return await ScratchTools.sendMessage("request-perms", permissions)
}
this.data = finalFeature;
this.msg = function (string) {
return this.data.localesData[`${this.data.id}/`+string] || `ScratchTools.${this.data.id}.${string}`;
Expand Down
17 changes: 17 additions & 0 deletions api/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,23 @@
ScratchTools.type = "Website";
}

ScratchTools.MESSAGES = []
ScratchTools.sendMessage = function(id, content) {
let uuid = UUID()

Check failure

Code scanning / CodeQL

Insecure randomness High

This uses a cryptographically insecure random number generated at
Math.random()
in a security context.
chrome.runtime.sendMessage(ScratchTools.id, { message: id, content, source: "message-api", uuid });
return new Promise((resolve, reject) => {
ScratchTools.MESSAGES.push({ message: id, source: "message-api", uuid, resolve });
});
}

function UUID() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (char) {
const random = Math.random() * 16 | 0;
const value = char === 'x' ? random : (random & 0x3 | 0x8);
return value.toString(16);
});
}

var storagePromises = [];
ScratchTools.storage = {
get: async function (key) {
Expand Down
7 changes: 7 additions & 0 deletions api/update/changelogs/forum.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"active": false,
"title": "Forum Changes for {{ version }}",
"description": "",
"changes": []
}

63 changes: 63 additions & 0 deletions api/update/changelogs/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"active": true,
"title": "Project Page Changes for {{ version }}",
"description": "ScratchTools is introducing many new project page and editor features that will revolutionize the way that you use Scratch. You can enable them on the settings page.",
"changes": [
{
"icon": "gradient.svg",
"slogan": "Rotate gradient colors in the paint editor"
},
{
"icon": "align.svg",
"slogan": "Align shapes and objects in the paint editor"
},
{
"icon": "align.svg",
"slogan": "Quickly center text in your project instructions"
},
{
"icon": "extend.svg",
"slogan": "Extend C-blocks around code when dragging them"
},
{
"icon": "filesize.svg",
"slogan": "View file sizes for any asset"
},
{
"icon": "font.svg",
"slogan": "Use dozens of extra fonts in the paint editor"
},
{
"icon": "nocloud.svg",
"slogan": "Temporarily disable cloud variables in projects"
},
{
"icon": "opacity.svg",
"slogan": "Customize the opacity of stage variable monitors"
},
{
"icon": "outline.svg",
"slogan": "Customize and round lines and shape outlines"
},
{
"icon": "reaction.svg",
"slogan": "Add and view emoji reactions on any project"
},
{
"icon": "record.svg",
"slogan": "Record and save videos of your project stage"
},
{
"icon": "shapes.svg",
"slogan": "Unite, subtract, intersect, and exclude shapes"
},
{
"icon": "thumbnail.svg",
"slogan": "Upload custom project thumbnails"
},
{
"icon": "upload.svg",
"slogan": "Upload WEBP images as costumes and sprites"
}
]
}
28 changes: 28 additions & 0 deletions api/update/changelogs/website.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"active": true,
"title": "Website Changes for {{ version }}",
"description": "ScratchTools is introducing many new features for the Scratch website. You can enable them on the settings page.",
"changes": [
{
"icon": "change.svg",
"slogan": "Customize what tag is used by default on the explore page"
},
{
"icon": "gift.svg",
"slogan": "A ScratchTools selection of featured projects"
},
{
"icon": "filter.svg",
"slogan": "Filter through studio, explore, and searched projects"
},
{
"icon": "date.svg",
"slogan": "See when a studio was created"
},
{
"icon": "countdown.svg",
"slogan": "View how many replies are left in a thread"
}
]
}

1 change: 1 addition & 0 deletions api/update/icons/align.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions api/update/icons/change.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions api/update/icons/countdown.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions api/update/icons/date.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions api/update/icons/extend.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions api/update/icons/filesize.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions api/update/icons/filter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions api/update/icons/font.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions api/update/icons/gift.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions api/update/icons/gradient.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading