Skip to content

Commit

Permalink
some proto stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Ianyourgod committed Apr 5, 2024
1 parent 04452a7 commit b3cb2c0
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 8 deletions.
6 changes: 0 additions & 6 deletions api/v1/db/project.proto

This file was deleted.

14 changes: 14 additions & 0 deletions api/v1/db/protobufs/project.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package project;
syntax = "proto3";

import "sprite.proto";

message Project {
repeated Sprite sprites = 1;
// monitors
// extension data
// extensions
string metaSemver = 5;
string metaVm = 6;
string agent = 7;
}
81 changes: 81 additions & 0 deletions api/v1/db/protobufs/sprite.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package Sprite;
syntax = "proto3";

message _varValue {
string name = 1;
string value = 2;
}

message _listValue {
string name = 1;
repeated string value = 2;
}

message block {
string opcode = 1;
string next = 2;
string parent = 3;
// map<string, ...> inputs = 4;
// map<string, ...> fields = 5;
bool shadow = 6;
bool topLevel = 7;
}

message comment {
string blockId = 1;
float x = 2;
float y = 3;
int32 width = 4;
int32 height = 5;
bool minimized = 6;
string text = 7;
}

message costume {
string name = 1;
int32 bitmapResolution = 2;
string dataFormat = 3;
string assetId = 4;
string md5ext = 5;
int32 rotationCenterX = 6;
int32 rotationCenterY = 7;
}

message sound {
string name = 1;
string assetId = 2;
string dataFormat = 3;
int32 rate = 4;
int32 sampleCount = 5;
string md5ext = 6;
}

message customVar {
string type = 1;
string id = 2;
string name = 3;
string value = 4;
}

message Sprite {
string id = 1;
bool isStage = 2;
string name = 3;
map<string, _varValue> variables = 4;
map<string, _listValue> lists = 5;
map<string, string> broadcasts = 6;
repeated customVar customVars = 7;
map<string, block> blocks = 8;
map<string, comment> comments = 9;
int32 currentCostume = 10;
repeated costume costumes = 11;
repeated sound sounds = 12;
int32 volume = 13;
int32 layerOrder = 14;
int32 x = 15;
int32 y = 16;
int32 size = 17;
int32 direction = 18; // should be int 16 or smth but that dont exist for some reason
bool draggable = 19;
string rotationStyle = 20;
}
6 changes: 4 additions & 2 deletions api/v1/routes/projects/uploadProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = (app, utils) => {
]), async (req, res) => {
const packet = req.body;

if (!await utils.UserManager.checkUser(packet.username, packet.password)) {
if (!await utils.UserManager.loginWithToken(packet.username, packet.password)) {
return utils.error(res, 401, "Invalid credentials");
}

Expand All @@ -34,6 +34,8 @@ module.exports = (app, utils) => {
}

// upload the project
// utils.UserManager.publishProject();
utils.UserManager.publishProject(
jsonFile,
);
});
}

0 comments on commit b3cb2c0

Please sign in to comment.