GithubHelp home page GithubHelp logo

scratchfoundation / scratch-storage Goto Github PK

View Code? Open in Web Editor NEW
57.0 34.0 126.0 3.6 MB

Load and store project and asset files for Scratch 3.0

License: BSD 3-Clause "New" or "Revised" License

JavaScript 99.87% Shell 0.13%

scratch-storage's Introduction

scratch-storage

Scratch Storage is a library for loading and storing project and asset files for Scratch 3.0

CircleCI

Coverage Status Greenkeeper badge

Installation

This requires you to have Node.js installed.

In your own Node.js environment/application:

npm install https://github.com/scratchfoundation/scratch-storage.git

If you want to edit/play yourself (requires Git):

git clone https://github.com/scratchfoundation/scratch-storage.git
cd scratch-storage
npm install

Using scratch-storage

From HTML

<script src="scratch-storage/dist/web/scratch-storage.js"></script>
<script>
    var storage = new Scratch.Storage();
    // continue to "Storage API Quick Start" section below
</script>

From Node.js / Webpack

var storage = require('scratch-storage');
// continue to "Storage API Quick Start" section below

Storage API Quick Start

Once you have an instance of scratch-storage, add some web sources. For each source you'll need to provide a function to generate a URL for a supported type of asset:

/**
 * @param {Asset} asset - calculate a URL for this asset.
 * @returns {string} a URL to download a project asset (PNG, WAV, etc.)
 */
var getAssetUrl = function (asset) {
    var assetUrlParts = [
        'https://assets.example.com/path/to/assets/',
        asset.assetId,
        '.',
        asset.dataFormat,
        '/get/'
    ];
    return assetUrlParts.join('');
};

Then, let the storage module know about your source:

storage.addWebStore(
    [AssetType.ImageVector, AssetType.ImageBitmap, AssetType.Sound],
    getAssetUrl);

If you're using ES6 you may be able to simplify all of the above quite a bit:

storage.addWebStore(
    [AssetType.ImageVector, AssetType.ImageBitmap, AssetType.Sound],
    asset => `https://assets.example.com/path/to/assets/${asset.assetId}.${asset.dataFormat}/get/`);

Once the storage module is aware of the sources you need, you can start loading assets:

storage.load(AssetType.Sound, soundId).then(function (soundAsset) {
    // `soundAsset` is an `Asset` object. File contents are stored in `soundAsset.data`.
});

If you'd like to use scratch-storage with scratch-vm you must "attach" the storage module to the VM:

vm.attachStorage(storage);

Testing

To run all tests:

npm test

To show test coverage:

npm run coverage

Committing

This project uses semantic release to ensure version bumps follow semver so that projects using the config don't break unexpectedly.

In order to automatically determine the type of version bump necessary, semantic release expects commit messages to be formatted following conventional-changelog.

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>

subject and body are your familiar commit subject and body. footer is where you would include BREAKING CHANGE and ISSUES FIXED sections if applicable.

type is one of:

  • fix: A bug fix Causes a patch release (0.0.x)
  • feat: A new feature Causes a minor release (0.x.0)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • refactor: A code change that neither fixes a bug nor adds a feature
  • perf: A code change that improves performance May or may not cause a minor release. It's not clear.
  • test: Adding missing tests or correcting existing tests
  • ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit

Use the commitizen CLI to make commits formatted in this way:

npm install -g commitizen
npm install

Now you're ready to make commits using git cz.

Breaking changes

If you're committing a change that makes an API change, or will otherwise require changes to existing code, ensure your commit specifies a breaking change. In your commit body, prefix the changes with "BREAKING CHANGE: " This will cause a major version bump so downstream projects must choose to upgrade and will not break the build unexpectedly.

Donate

We provide Scratch free of charge, and want to keep it that way! Please consider making a donation to support our continued engineering, design, community, and resource development efforts. Donations of any size are appreciated. Thank you!

scratch-storage's People

Contributors

adroitwhiz avatar aeons avatar andreynikitin avatar benjiwheeler avatar cwillisf avatar dependabot-preview[bot] avatar ericrosenbaum avatar fsih avatar gengshenghong avatar greenkeeper[bot] avatar kchadha avatar ktbee avatar meyerhot95 avatar mraerino avatar mzgoddard avatar p3nny avatar paulkaplan avatar renovate-bot avatar renovate[bot] avatar rschamp avatar semantic-release-bot avatar skripted-io avatar thisandagain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scratch-storage's Issues

Scratch which not binary file

This Issue is not a problem. So, I deleted Issue Template. It's an idea.

Scratch lastest version is 3. But it still doesn't work with git.
I thought that there is a way to make workable with git.
It's ... Make Scratch program data not binary.
I have opened .sb3 before, it was filled with .png,.wav,svg,json file.
File of png and wav are binary, but we can trans text file.
png-->svg
wav-->I don't know. But, Sound Programming file is good for this. Pitch of sound, time, etc are written in json. I'm sorry for I don't know audio file well.

If scratch works with git, children all over the world can learn git.
And, it's not binary and some server library is made, we can use scratch like js, ruby. Scratch will be not the only GUI.

I wonder if you think, it's happy. (I want to tell thank you before that, you read this)

403 errors are swallowed by fetch tool POST

The asset server is configured to return a JSON body along with a 403, but this line of code is ignoring the fact that you can get both a response AND not be successful https://github.com/LLK/scratch-storage/blob/develop/src/FetchTool.js#L45

We should be rejecting that promise chain on 403s, but because of the way the fetch tool returns just the text response and not the status, and does not reject the response itself, there is no way for the promise chain to fail.

/cc @cwillisf @BryceLTaylor @kchadha this is the reason that you do not get the "project failed to save" when you get authentication gets bumped by signing in to another computer. You can clearly see the 403s when you try to save, but they are being swallowed, and since nothing actually uses the response body we aren't catching the error elsewhere.

Don't call hasOwnProperty directly on our objects #2682

There was a recent security warning that warned against calling property functions on your own objects that you assume have been inherited from Object.prototype. E.g., don't do obj1.hasOwnProperty(propName).

Instead, you can call the original function, e.g. Object.prototype.hasOwnProperty.call(obj1, propName).

Static assets give 404 errors (but still load)

Expected Behavior

Loading static assets should leave the console quiet.

Actual Behavior

When you load a static asset, for example https://llk.github.io/scratch-gui/develop/static/extension-assets/scratch3_music/instruments/1-piano/36.mp3, it works, but you also get a 404 error because storage first looks for it on the assets server:

Failed to load https://cdn.assets.scratch.mit.edu/internalapi/asset/instruments/1-piano/36.mp3/get/: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://llk.github.io' is therefore not allowed access. The response had HTTP status code 404.

Steps to Reproduce

Load the music extension and check the console.

An in-range update of semantic-release is breaking the build 🚨

The devDependency semantic-release was updated from 15.13.11 to 15.13.12.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

semantic-release is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for v15.13.12

15.13.12 (2019-04-15)

Bug Fixes

  • package: update resolve-from to version 5.0.0 (6f3c21a)
Commits

The new version differs by 1 commits.

  • 6f3c21a fix(package): update resolve-from to version 5.0.0

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of webpack is breaking the build 🚨

The devDependency webpack was updated from 4.30.0 to 4.31.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

webpack is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for v4.31.0

Features

  • add errors-warnings stats preset

Bugfixes

  • allow top-level return in non-ESM modules
Commits

The new version differs by 23 commits.

  • 2e1e179 4.31.0
  • b17543e Merge pull request #8919 from vincentrodriguez/errors-and-warnings-only-preset
  • fed4c3d Merge pull request #8985 from webpack/dependabot/npm_and_yarn/react-dom-16.8.6
  • d05435c Merge pull request #9062 from webpack/dependabot/npm_and_yarn/eslint-plugin-jest-22.5.1
  • 8bf8b82 Merge pull request #9066 from webpack/dependabot/npm_and_yarn/eslint-config-prettier-4.2.0
  • 00d0038 Merge pull request #9096 from webpack/dependabot/npm_and_yarn/glob-7.1.4
  • dbd856e Merge pull request #9098 from webpack/dependabot/npm_and_yarn/simple-git-1.113.0
  • 13045f1 chore(deps-dev): bump simple-git from 1.110.0 to 1.113.0
  • 5800043 chore(deps-dev): bump glob from 7.1.3 to 7.1.4
  • 084ca0b chore(deps-dev): bump eslint-config-prettier from 4.1.0 to 4.2.0
  • 022d1b7 chore(deps-dev): bump eslint-plugin-jest from 22.4.1 to 22.5.1
  • 81cf088 Merge pull request #9046 from mwijngaard/master
  • dc6dd51 Allow top-level return in script parsing. Fixes issue 8509 in master, like PR 8510 fixed it for 'next'
  • 42db81a Merge pull request #9029 from EugeneHlushko/mode/warning
  • 84ca105 mode(warning) update mode warning snapshot hash

There are 23 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Add .mp3 to AssetType list

AssetType.js lists supported file types, but does not include mp3. It should, right? How and where and why does this matter?

PR to load assets in a web worker not accepted because storage is issuing puts on the asset server

@picklesrus discovered in the bug hunt that Scratch is issuing puts to update assets on the asset server when it should be using Posts.

We shouldn't ever try to update the md5 hash because they are unique and changing the image should have a new md5 hash.

The server doesn't accept puts, anyway and was sending back 405 errors while saving assets.

This came from testing scratchfoundation/scratch-gui#4726, which we reverted on develop.

Creating new assets is difficult

Expected Behavior

There should be a straightforward way to create a new empty Asset object, or to create a new Asset with externally-defined contents, without relying on an environment-specific data type.

Actual Behavior

Doing so currently requires creating a Buffer, which is a Node.js-only type. This means there's no good way to create or fill an Asset in environment-neutral code.

Steps to Reproduce

See scratchfoundation/scratch-vm#915

Server assets deleted / replaced for no reason.

I have no idea for a better place for this issue, but there it is.

One of my project got most of its assets deleted / replaced for no reason. I didn't even went on the project for days, didn't edit it either.

The project ID is 138198909.

The manifest still shows the correct asset hashes for some images, but for the others (most of them), when loaded, the default "asset not found / question mark on grey background" shows up.
image

You can see must of the ID's got replaced with 8e768a5a5a01891b05c01c9ca15eb6aa (costumes 1 to 6, zero is still as it was before)
https://assets.scratch.mit.edu/internalapi/asset/8e768a5a5a01891b05c01c9ca15eb6aa.svg/get/

It wasn't the case a few days ago tho.

`new Buffer(...)` is deprecated

Expected Behavior

Deprecated APIs should not be used.

Actual Behavior

The file BuiltinHelper.js calls new Buffer(...) as part of establishing its default assets. This call has been deprecated since Node 6.0.0 and in some contexts causes a message similar to this:

[DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

Although in this case the actual code is not a security concern, I still think this should get a relatively high priority. This is because the message can sometimes be seen by the user (for example, if scratch-desktop is started from a terminal) and warns about security, which could worry users.

Replace `crypto`

crypto is a node built-in module that does not work on the browser (it uses Buffer objects, but only typed arrays are available in the browser, and they are not equivalent).

We need a module that works on the browser also for computing md5s

Self-hosted storage

Also faced difficulties with saving projects to my self-hosted backend with API and authentication.

Installed scratch-blocks, scratch-vm, scratch-storage separately (git clone), link them with scratch-gui.

What to do next? In the end, I want to get a working "Save now" button sending a request to my backend.

Add auto-save function for scratch 3.x

I am using the scratch 3.x desktop version. One thing bothering me is that the application does not have an auto-save function.
My child often forgot to save its project modification. What's more, the saving function always ask for a new storage path, which
is unnecssarily, this should be the behavior of "save as.." function.

Replace got

got is a wrapper for node's http library. It currently does not work at all in an environment of an iOS webview, and the newest version seems to not work in browsers/webpack at all.

I suggest replacing it with something else. In our fork, I have replaced it with whatwg-fetch with great success, except the fact that tests fail, since it's a polyfill for browsers (isomorphic-fetch is outdated and doesn't allow for the same API across node/browser).

If you want, I can submit a PR with my changes.

CE-144 Suggestion: Don't store useragent strings within the project.json

On projects.scratch.mit.edu/xxxxxxxx/, at the end of a JSON, you can see one's useragent string, which I believe is an unnecessary invasion of Scratchers' privacy.
My suggestion is to make future projects' JSON not include one's full useragent string.

Note: The project ID was intentionally censored to protect Scratcher privacy.

Another note: If this is not possible for any reason, feel free to reject or only partially implement my suggestion.

Yet another note (sorry if this is annoying): The reason why I never post on the fourms is because I am not allowed to. Please don't ask about this one.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Pending Status Checks

These updates await pending status checks. To force their creation now, click the checkbox below.

  • chore(deps): update babel monorepo to v7.24.6 (@babel/core, @babel/plugin-transform-runtime, @babel/preset-env)

Other Branches

These updates are pending. To force PRs open, click the checkbox below.

  • fix(deps): lock file maintenance

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci-cd.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • wagoid/commitlint-github-action v5@5ce82f5d814d4010519d15f0552aec4f17a1e1fe
  • actions/setup-node v3@1a4442cacd436585916779262731d5b162bc6ec7
.github/workflows/commitlint.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • wagoid/commitlint-github-action v5@5ce82f5d814d4010519d15f0552aec4f17a1e1fe
npm
package.json
  • @babel/runtime ^7.21.0
  • arraybuffer-loader ^1.0.3
  • base64-js ^1.3.0
  • cross-fetch ^3.1.5
  • fastestsmallesttextencoderdecoder ^1.0.7
  • js-md5 ^0.7.3
  • minilog ^3.1.0
  • worker-loader ^2.0.0
  • @babel/core 7.24.5
  • @babel/plugin-transform-runtime 7.24.3
  • @babel/polyfill 7.12.1
  • @babel/preset-env 7.24.5
  • @commitlint/cli 18.6.1
  • @commitlint/config-conventional 18.6.3
  • @commitlint/travis-cli 8.3.6
  • @types/jest 29.5.12
  • babel-eslint 10.1.0
  • babel-loader 8.3.0
  • eslint 8.57.0
  • eslint-config-scratch 9.0.8
  • eslint-plugin-jest 27.9.0
  • eslint-plugin-react 7.34.1
  • file-loader 4.3.0
  • husky 8.0.3
  • jest 29.7.0
  • json ^9.0.4
  • scratch-semantic-release-config 1.0.14
  • semantic-release 19.0.5
  • uglifyjs-webpack-plugin 2.2.0
  • webpack 4.47.0
  • webpack-cli 3.3.12
nvm
.nvmrc
  • node v16

  • Check this box to trigger a request for Renovate to run again on this repository

WebLoader does not try next source if request returns a 404 response

Expected Behavior

If an asset request returns a 404 response the WebLoader should skip that source and try the next.

Actual Behavior

The 404 response body is returned.

Steps to Reproduce

class Storage extends ScratchStorage {
    constructor () {
        super();
        this.addWebSource(
            [this.AssetType.Project],
            asset => `https://example.com/${asset.assetId}`
        );
    }
}

const storage = new Storage();
storage.load(storage.AssetType.Project, "x", storage.DataFormat.JSON)
    .then(project => console.log("I did load this:", project))
    .catch(e => console.error("Loading failed"));

I'll try to submit a PR for this.

WebHelper returns strange object after project json PUT; creating new project using POST does not return id

At the bottom of WebHelper:store(), the body parameter appears to be a JSON string, not a JSON object:

screen shot 2018-10-03 at 9 59 07 pm

Object.assign does currently convert the string to an object, but it does it character by character:

screen shot 2018-10-03 at 10 00 11 pm

The code here that was setting the id does succeed in doing that -- as long as the assetId is already set:

(If it's an integer value, setting it succeeds:)
screen shot 2018-10-03 at 10 00 51 pm

(...but if we're relying on the number being extracted from body, that doesn't work:)
screen shot 2018-10-03 at 10 01 04 pm

So it seems what we really need to do is to JSON.parse the body -- at least before we try to access its content-name property.

Existing behavior:
PUT (updating project with id) response:
screen shot 2018-10-03 at 11 00 19 pm

POST (creating new project) response:
screen shot 2018-10-03 at 11 02 06 pm

Behavior should be:
PUT (updating project with id) response:
screen shot 2018-10-03 at 10 46 35 pm

POST (creating new project) response:
screen shot 2018-10-03 at 10 54 55 pm

Remove support for loading projects

Projects have never been saved using scratch-storage (it is done inside scratch-www & scratch-gui). They are loaded using scratch-storage, though.

It should be removed to reduce dead code. This also makes Asset immutable, and ensures all assets have MD5 id.

scratch-storage incorrectly assumes all bitmaps are PNGs

Expected Behavior

scratch-storage should be able to load JPG and GIF costumes, as present in the Scratch 2.0 costume library.

Actual Behavior

scratch-storage assumes all bitmap costumes are PNGs, so it tries to load JPG and GIF costumes with the wrong exception. This results in a 404 and a failure to load the costume.

Steps to Reproduce

  1. Open your browser's network tab
  2. Load project 152639677 in a version of scratch-vm or scratch-gui which uses scratch-storage
  3. Look for a 404 on this address: https://cdn.assets.scratch.mit.edu/internalapi/asset/4f234884958b11023d44abc010ad50ec.png/get/

Can't load gzip SVG assets when importing scratch-storage into another project

I'm running into a problem where all the dependencies are already inlined when importing scratch-storage into a project. For got this leads to a build that has unzipResponse inlined, even though it's not supported in the browser.

I think the problem is that got is getting inlined as a "devDependency" for the Node.js target. When the built scratch-storage npm package is run in the browser, got is hitting a codepath that isn't supported for web.

Expected Behavior

Loading a SVG from a server with gzip compression enabled shouldn't throw an error.

Actual Behavior

I get an exception: Uncaught TypeError: Cannot read property 'bind' of undefined and the asset fails to load.

screen shot 2017-08-04 at 3 41 50 pm

Steps to Reproduce

Sample code:

import Storage from 'scratch-storage';

const storage = new Storage();
const assetType = storage.AssetType.ImageVector;
storage.addWebSource([assetType], asset => `/s/${asset.assetId}.${asset.dataFormat}`);
storage.load(assetType, '09dc888b0b7df19f70d81588ae73420e').then(/* ... */);

I'm seeing this fail in the browser when /s/09dc888b0b7df19f70d81588ae73420e.svg is returned with Content-Encoding: gzip.

Operating System and Browser

Mac OS 10.12.5
Chrome 60.0.3112.90

Using scratch-storage

I try to follow doc on
https://github.com/LLK/scratch-storage

After Installation session
npm install https://github.com/LLK/scratch-storage.git

it is
Using scratch-storage
From HTML

<script src="scratch-storage/dist/web/scratch-storage.js"></script> <script> var storage = new Scratch.Storage(); // continue to "Storage API Quick Start" section below </script>

How to apply save function to scratch? How they get to know each other?

May I ask where shoud I put those code to? Is there more detailed docs that I can refer to?

Thanks

scratch-storage not deploying to npm

since we moved from travis-ci.org to travis-ci.com, scratch-storage has not been deploying to npm. The problem is that the travis-after-all library assumes travis-ci.org.

We should stop using the deprecated travis-after-all library, and update our .travis.yml file to use a deploy section rather than an after_script section.

PR for loading library images through storage did not go in because it raises too many questions

During the Bug Hunt today we decided to remove this pr scratchfoundation/scratch-gui#4644 since it seems to be making the experience worse on lower end devices, such as the Raspberry Pi and a slower Windows machine.

According to @thisandagain the libraries were loading more slowly but the libraries seemed "locked up"

He says: "It was a little hard to describe. They would load more slowly, but I could tell that loading the libraries was locking up the RPi less (less CPU and/or memory pressure)."

One can replicate the experience by opening the network tab of the console, choosing a slower connection and turning off caching. Then load the libraries.

An in-range update of webpack is breaking the build 🚨

The devDependency webpack was updated from 4.35.3 to 4.36.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

webpack is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v4.36.0

Features

  • SourceMapDevToolPlugin append option now supports the default placeholders in addition to [url]
  • Arrays in resolve and parser options (Rule and Loader API) support backreferences with "..." when overriding options.
Commits

The new version differs by 42 commits.

  • 95d21bb 4.36.0
  • aa1216c Merge pull request #9422 from webpack/feature/dot-dot-dot-merge
  • b3ec775 improve merging of resolve and parsing options
  • 53a5ae2 Merge pull request #9419 from vankop/remove-valid-jsdoc-rule
  • ab75240 Merge pull request #9413 from webpack/dependabot/npm_and_yarn/ajv-6.10.2
  • 0bdabf4 Merge pull request #9418 from webpack/dependabot/npm_and_yarn/eslint-plugin-jsdoc-15.5.2
  • f207cdc remove valid jsdoc rule in favour of eslint-plugin-jsdoc
  • 31333a6 chore(deps-dev): bump eslint-plugin-jsdoc from 15.3.9 to 15.5.2
  • 036adf0 Merge pull request #9417 from webpack/dependabot/npm_and_yarn/eslint-plugin-jest-22.8.0
  • 37d4480 Merge pull request #9411 from webpack/dependabot/npm_and_yarn/simple-git-1.121.0
  • ce2a183 chore(deps-dev): bump eslint-plugin-jest from 22.7.2 to 22.8.0
  • 0beeb7e Merge pull request #9391 from vankop/create-hash-typescript
  • bf1a24a #9391 resolve super call discussion
  • bd7d95b #9391 resolve discussions, AbstractMethodError
  • 4190638 chore(deps): bump ajv from 6.10.1 to 6.10.2

There are 42 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Question: what error status does the API raise?

According to #100, the server may raise 403. However, there is no documentation about what errors they can raise.

  • For example, currently large sounds raise 503. However, it should raise 413, or at least 400 with some custom results.
  • Does it raise 401 for invalid session?
  • Same for 415 (for invalid asset)

It's hard to configure multiple POST URLs per asset type

When remixing or creating a project as a copy, we use query strings to modify the URL, e.g. /?is_copy=1&title=My Project Title. Since we only rely on storage looking up the right handler based on the asset id, we don't have a way to dynamically set parameters for a particular store().

We need to do some thinking on the design of store since it now doesn't work ideally for either of the servers we're using it for. Our config for assets hack around the current design, which was created around project creation: https://github.com/LLK/scratch-gui/blob/develop/src/lib/storage.js#L24-L28, and we aren't using it at all for project creation anymore because of this URL issue.

Inconsistent handling of missing costumes (web site vs. desktop app)

Expected Behavior

Loading into the desktop app a project which refers to a missing costume should cause that costume to appear as a placeholder image, just like it does on the Scratch website.

Actual Behavior

Loading into the desktop app a project which refers to a missing costume causes an error message and prevents the project from loading at all.

Note that this means a single missing costume will prevent using the desktop app to recover any other data from a project -- even intact sprites, costumes, or sounds.

Steps to Reproduce

  1. Open the standalone Scratch app on a Mac or Windows computer
  2. Load a project which refers to a missing costume

Example project: Missing Blue Guy (broken).sb3.zip

Screenshots

image

When this happens, the developer console looks like this:
image

Check for window.localStorage before using LocalHelper

Expected Behavior

Please describe what should happen
Using storage in an environment with localStorage unavailable should not cause an error

Actual Behavior

Describe what actually happens
While using storage in a packaged Chrome extension, you get a warning:

window.localStorage is not available in packaged apps. Use chrome.storage.local instead.

Steps to Reproduce

Explain what someone needs to do in order to see what's described in Actual behavior above
Use storage in a packaged Chrome extension.

ProxyTool#store should not try multiple tools on server errors

The ProxyTool#store method should only try one of the registered tools if it gets a non-200 response from the server. The cascade should only be used if there is an error thrown related to creating the request, not from server errors.

This is causing multiple failing requests to be issued when storing an asset, even when the asset is rejected from the server (e.g. 400, 413, 403).

/cc @cwillisf

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.