Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
6b8cbf6
Create RockytheProtogen/FSApi.js
rkxspace Jul 7, 2024
a510e03
Made permission prompt to open file. Added close.
rkxspace Jul 8, 2024
2731111
I put the permission prompt in the wrong function, so I made a new one.
rkxspace Jul 8, 2024
9261736
Changed stuff for the last time today
rkxspace Jul 8, 2024
c545108
Code cleanup, just to keep it a little neater.
rkxspace Jul 8, 2024
dc9cacd
Revamped Stream read to implement delay and chunks
rkxspace Jul 8, 2024
4874840
Images, and fix FSApi breaking on write.
rkxspace Jul 8, 2024
2b09a46
Additional parameters for file open and labelling.
rkxspace Jul 8, 2024
1e7778f
Rename file to be more precise.
rkxspace Jul 8, 2024
541e129
Better contributions
rkxspace Jul 8, 2024
a5f946d
You can now open directories and view their contents.
rkxspace Jul 8, 2024
1952a47
Additional Changes
rkxspace Jul 9, 2024
b812909
Blank file.type is now checked and replaced with "unknown"
rkxspace Jul 9, 2024
b66ecc5
Local Validate, Lint, and Format
rkxspace Jul 9, 2024
fc53fb1
Added file slots
rkxspace Jul 9, 2024
0a54b08
Minimize null, and format
rkxspace Jul 9, 2024
1452616
Added /Folder/file.ext read
rkxspace Jul 9, 2024
035b648
Added Create/Delete File/Folder with reindexing option
rkxspace Jul 9, 2024
b717e3b
Fixed new block
rkxspace Jul 9, 2024
eb9f6a3
Note to self: Replace all breaks things
rkxspace Jul 9, 2024
f4c6b9f
Finishing up. Should be ready!
rkxspace Jul 10, 2024
cf54c4f
Remove Dev branch warning
rkxspace Jul 10, 2024
9e1069d
Code Cleanup 1
rkxspace Jul 10, 2024
2a0b019
Removed back to back if statements in place of mappings
rkxspace Jul 10, 2024
5a88e17
Validate, Lint, Format
rkxspace Jul 10, 2024
173a081
Removed lines
rkxspace Jul 10, 2024
d963309
Create NEW FSAAPI extension.
rkxspace Jul 10, 2024
61d6619
Added some quick CONST stuff
rkxspace Jul 10, 2024
bd41744
Preparing File/Folder data variables for later use
rkxspace Jul 10, 2024
8c0dbe3
Additional changes
rkxspace Jul 10, 2024
0d4c11c
Figuring out how to add Toaster-UI
rkxspace Jul 11, 2024
7becb32
Toaster spotted!?!?!
rkxspace Jul 11, 2024
0a5f1d2
Could not implement Toaster-UI.
rkxspace Jul 11, 2024
4714ad4
Note: Being tired does not help at all.
rkxspace Jul 11, 2024
72737ef
Local Format
rkxspace Jul 11, 2024
b0d3908
Push minor changes
rkxspace Jul 11, 2024
0503a20
"Good one-liners that will get you dismissed on the spot!"
rkxspace Jul 11, 2024
446bcfe
Stream read code dragged over.
rkxspace Jul 11, 2024
491a498
added 750 MB file hard limit
rkxspace Jul 11, 2024
0f20afe
I watched someone google "google", oh the pain.
rkxspace Jul 11, 2024
720bd01
"You'll live forever tonight" - ミラクルミュージカル
rkxspace Jul 11, 2024
abbafaa
Begin implementation of writing system
rkxspace Jul 11, 2024
c65eced
Added memory WRITE and PUSH
rkxspace Jul 11, 2024
bd36ff6
I configured stuff in vscode. Mostly ESLint and Prettier.
rkxspace Jul 12, 2024
f6f0fb8
added ::-da\\clear for clearing file
rkxspace Jul 12, 2024
5cf6340
Sneaky gitwatch trying to get through. Not on my watch.
rkxspace Jul 12, 2024
662dc79
Ah yes, an accidental nap
rkxspace Jul 12, 2024
b159c76
Read and write works as intended. (I think)
rkxspace Jul 12, 2024
ee3b5ca
Merge branch 'TurboWarp:master' into master
rkxspace Jul 13, 2024
2bc0413
Update for possible compliance in recent comments.
rkxspace Jul 13, 2024
ad73384
Prettier+ just made this thing slightly less readable to me
rkxspace Jul 13, 2024
4940289
Finish FILES
rkxspace Jul 13, 2024
f7b4b45
Begin work on folders
rkxspace Jul 13, 2024
cb51123
Idk
rkxspace Jul 13, 2024
ba53c79
Hmmm... yes... a commit
rkxspace Jul 14, 2024
908ec69
Run format and catch error in iGFC(iDH)
rkxspace Jul 15, 2024
1dac235
Read file stuff
rkxspace Jul 15, 2024
00f6261
Attempt 1 at squashing dumb bug
rkxspace Jul 15, 2024
5a3fef2
Fixed the bug
rkxspace Jul 15, 2024
51f1d92
Yippee
rkxspace Jul 16, 2024
8b968d6
Reuse existing code to create and delete files in folders
rkxspace Jul 18, 2024
9a8d6ce
more stuff, idk
rkxspace Jul 18, 2024
c558160
Whats grass?
rkxspace Jul 21, 2024
0355b0d
Merge branch 'TurboWarp:master' into master
rkxspace Aug 29, 2024
e3681de
Merge branch 'TurboWarp:master' into master
rkxspace Sep 15, 2024
b70b723
Start rewrite 3! Can't wait for 4 (jk last rewrite)
acemmerson Sep 15, 2024
aaf3b78
Yippee
acemmerson Sep 15, 2024
b61bd4a
Rewrite 3 Update 1
acemmerson Sep 16, 2024
1d86645
I forgot what I changed, but I added stuff
rkxspace Dec 24, 2024
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
268 changes: 268 additions & 0 deletions extensions/RockytheProtogen/FileSystemAccessAPI/fsa-api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
(function (Scratch) {
"use strict";

if (!Scratch.extensions.unsandboxed) {
throw new Error("File System Access API must run unsandboxed.");
}

class rtpfsaapi {
getInfo() {
return {
id: "rtpfsaapi",
name: "File System Access API",
blocks: [
{
opcode: "filepicker",
blockType: "reporter",
text: "window.showOpenFilePicker([json])",
arguments: {
json: {
type: "string",
},
},
},
{
opcode: "filesavepicker",
blockType: "reporter",
text: "window.showSaveFilePicker([json])",
arguments: {
json: {
type: "string",
},
},
},
{
opcode: "folderpicker",
blockType: "reporter",
text: "window.showDirectoryPicker([json])",
arguments: {
json: {
type: "string",
},
},
},
{
opcode: "isSameEntry",
blockType: "Boolean",
text: "[handle].isSameEntry([Chandle])",
arguments: {
handle: {
acceptReporters: true,
},
Chandle: {
acceptReporters: true,
}
},
},
{
opcode: "queryHandlePermission",
blockType: "reporter",
text: "[handle].queryPermission([permissions])",
arguments: {
handle: {
acceptReporters: true,
},
permissions: {
type: "string"
}
},
},
{
opcode: "requestHandlePermission",
blockType: "command",
text: "[handle].requestPermission([permissions])",
arguments: {
handle: {
acceptReporters: true,
},
permissions: {
type: "string"
}
},
},
{
opcode: "remove",
blockType: "command",
text: "[handle].remove()",
arguments: {
handle: {
acceptReporters: true,
},
},
},
{
opcode: "kind",
blockType: "reporter",
text: "[handle].kind",
arguments: {
handle: {
acceptReporters: true,
},
},
},
{
opcode: "name",
blockType: "reporter",
text: "[handle].name",
arguments: {
handle: {
acceptReporters: true,
},
},
},
{
opcode: "getFile",
blockType: "reporter",
text: "[handle].getFile()",
arguments: {
handle: {
acceptReporters: true,
},
},
},
{
opcode: "text",
blockType: "reporter",
text: "[handle].text()",
arguments: {
handle: {
acceptReporters: true,
},
},
},
{
opcode: "arrayBuffer",
blockType: "reporter",
text: "[handle].arrayBuffer()",
arguments: {
handle: {
acceptReporters: true,
},
},
},
{
opcode: "arrayFromArrayBuffer",
blockType: "reporter",
text: "new Uint8Array([arrayBuffer])",
arguments: {
handle: {
acceptReporters: true,
},
},
},
],
};
}
filepicker(args) {
try {
return window.showOpenFilePicker(JSON.parse(args.json));
} catch (err) {
return err;
}
}
filesavepicker(args) {
try {
return window.showSaveFilePicker(JSON.parse(args.json));
} catch (err) {
return err;
}
}
folderpicker(args) {
try {
return window.showDirectoryPicker(JSON.parse(args.json));
} catch (err) {
return err;
}
}
getFile(args) {
try {
let handle;
[handle] = args.handle;
return handle.getFile();
} catch (err) {
return err;
}
}
slice(args) {
try {
let handle;
const parameters = args.start.split(",");
console.log(parameters);
handle = args.handle;
return handle.slice(parameters[0], parameters[1]);
} catch (err) {
return err;
}
}
text(args) {
try {
let handle;
handle = args.handle;
return handle.text();
} catch (err) {
return err;
}
}
arrayBuffer(args) {
try {
let handle;
handle = args.handle;
return handle.arrayBuffer();
} catch (err) {
return err;
}
}
arrayFromArrayBuffer(args) {
return new Uint8Array(args.arrayBuffer);
}
queryHandlePermission(args) {
try {
let handle;
[handle] = args.handle;
return handle.queryPermission(JSON.parse(args.permissions))
} catch (err) {
return err;
}
}
isSameEntry(args) {
try {
let handle;
let Chandle;
[handle] = args.handle;
[Chandle] = args.Chandle;
return handle.isSameEntry(Chandle)
} catch (err) {
return err;
}
}
remove(args) {
let handle;
[handle] = args.handle;
handle.remove()
}
requestHandlePermission(args) {
let handle;
[handle] = args.handle;
handle.requestPermission(JSON.parse(args.permissions))
}
kind(args) {
try {
let handle;
[handle] = args.handle;
return handle.kind;
} catch (err) {
return err;
}
}
name(args) {
try {
let handle;
[handle] = args.handle;
return handle.name;
} catch (err) {
return err;
}
}
}
Scratch.extensions.register(new rtpfsaapi());
})(Scratch);
Binary file added images/RockytheProtogen/FSA-API-TW-V2B.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading