Discuss Scratch
- Discussion Forums
- » Open Source Projects
- » Using custom storage with scratch-gui
- paulallington
- New to Scratch
12 posts
Using custom storage with scratch-gui
I'm trying to build (what felt like a) really simple project using scratch-gui, and building custom storage in to it, but I can't find any documentation anywhere, but I thought I'd seen it done. If I want to pass in a project id, and pull that project out of a database/file store somewhere (the mechanism doesn't matter), and then save it back to the same place, how would one do that?
- apple502j
- Scratcher
1000+ posts
Using custom storage with scratch-gui
You need to pass projectHost to the GUI, like this: https://github.com/LLK/scratch-www/blob/develop/src/views/preview/presentation.jsx#L343
You need API server for it. It must implement three things: GET /id for getting project.json, POST / for new project, and PUT /id for saving.
You need API server for it. It must implement three things: GET /id for getting project.json, POST / for new project, and PUT /id for saving.
署名は、ディスカッションフォーラムの機能である。署名は、その人のすべての投稿の下部に追加される。署名は、BBCodeで記述できる。 署名を追加/変更/削除したい場合は、ディスカッションフォーラムのホームの一番下に行き、「Change your signature」を押す。署名の大きさは150pxまでである。これには、改行、画像を含む。- Japanese Scratch-Wiki 「署名」
- paulallington
- New to Scratch
12 posts
Using custom storage with scratch-gui
https://github.com/LLK/scratch-www/blob/develop/src/views/preview/presentation.jsx#L343Ah brilliant - that's exactly what I'm looking for thanks. Is there any docs/proper definition of what the api server needs to look like somewhere, error handling, json definition etc? You need to pass projectHost to the GUI, like this:
You need API server for it. It must implement three things: GET /id for getting project.json, POST / for new project, and PUT /id for saving.
- paulallington
- New to Scratch
12 posts
Using custom storage with scratch-gui
I managed to put the projectHost in, and if I pass a projectId through then I can see it makes a call to “GET” the project. However I couldn't see how it would be saved. I tried setting the “canSave” property, however that just added another Save button to the menu, but it doesn't do anything. Is there something else I need to do in order to allow it to save projects as well?
Thanks for your help on this, it's much appreciated!
Thanks for your help on this, it's much appreciated!
- apple502j
- Scratcher
1000+ posts
Using custom storage with scratch-gui
When saving, there are 2 things that needs to be saved - projects and assets (sounds and costumes).
This is set using assetHost (similar to projectHost) and needs 2 APIs - GET /internalapi/asset/md5ext/get/ and POST /md5ext
md5ext is MD5 and its extension, like 0cc175b9c0f1b6a831c399e269772661.svg
This is set using assetHost (similar to projectHost) and needs 2 APIs - GET /internalapi/asset/md5ext/get/ and POST /md5ext
md5ext is MD5 and its extension, like 0cc175b9c0f1b6a831c399e269772661.svg
署名は、ディスカッションフォーラムの機能である。署名は、その人のすべての投稿の下部に追加される。署名は、BBCodeで記述できる。 署名を追加/変更/削除したい場合は、ディスカッションフォーラムのホームの一番下に行き、「Change your signature」を押す。署名の大きさは150pxまでである。これには、改行、画像を含む。- Japanese Scratch-Wiki 「署名」
- paulallington
- New to Scratch
12 posts
Using custom storage with scratch-gui
How does projectHost work though? When I added it, Save didn't do anything - it didn't POST to the projectHost api that I set
- Wowfunhappy
- Scratcher
27 posts
Using custom storage with scratch-gui
Hello, apologies for the bump. Did you manage to get anywhere with this? I'd like to do the same thing. I'm trying to build (what felt like a) really simple project using scratch-gui, and building custom storage in to it, but I can't find any documentation anywhere, but I thought I'd seen it done. If I want to pass in a project id, and pull that project out of a database/file store somewhere (the mechanism doesn't matter), and then save it back to the same place, how would one do that?
Last edited by Wowfunhappy (June 23, 2022 22:41:58)
- Discussion Forums
- » Open Source Projects
- » Using custom storage with scratch-gui