blockly 12 for blocklycraft @ spigot 1.9.4

This commit is contained in:
Anton Zykov 2025-07-14 13:23:38 +03:00
commit e48083d7c8
42 changed files with 8214 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules/

22
client/.npmignore Normal file
View File

@ -0,0 +1,22 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Dependency directories
node_modules/
# Generated files
dist/
build/
.DS_Store
# Optional npm cache directory
.npm
# IDEs and editors
.idea
*.sublime-workspace
.vscode/*

4828
client/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

35
client/package.json Normal file
View File

@ -0,0 +1,35 @@
{
"name": "hello-world",
"version": "1.0.0",
"description": "A sample app using Blockly",
"main": "index.js",
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --mode production",
"start": "webpack serve --mode development"
},
"keywords": [
"blockly"
],
"author": "",
"license": "Apache-2.0",
"devDependencies": {
"@types/js-cookie": "^3.0.6",
"css-loader": "^6.7.1",
"html-webpack-plugin": "^5.5.0",
"source-map-loader": "^4.0.1",
"style-loader": "^3.3.1",
"ts-loader": "^9.4.2",
"typescript": "^5.0.2",
"webpack": "^5.76.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.11.1"
},
"dependencies": {
"@blockly/continuous-toolbox": "^7.0.1",
"blockly": "^12.0.0",
"js-cookie": "^3.0.5",
"nano": "^10.1.4"
}
}

View File

@ -0,0 +1 @@
export * from './text';

View File

@ -0,0 +1,45 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { Order } from 'blockly/javascript';
import * as Blockly from 'blockly/core';
export const addText = {
block: Blockly.common.createBlockDefinitionsFromJsonArray([{
// category: 'text',
type: 'add_text',
message0: 'Add text %1',
args0: [
{
type: 'input_value',
name: 'TEXT',
check: 'String',
},
],
previousStatement: null,
nextStatement: null,
colour: 160,
tooltip: '',
helpUrl: '',
}]),
toJS: (block: Blockly.Block, generator: Blockly.CodeGenerator) => {
const text = generator.valueToCode(block, 'TEXT', Order.NONE) || "''";
const addText = generator.provideFunction_(
'addText',
`function ${generator.FUNCTION_NAME_PLACEHOLDER_}(text) {
// Add text to the output area.
const outputDiv = document.getElementById('output');
const textEl = document.createElement('p');
textEl.innerText = text;
outputDiv.appendChild(textEl);
}`,
);
// Generate the function call for this block.
const code = `${addText}(${text});\n`;
return code;
},
};

View File

@ -0,0 +1,2 @@
export * from './example';
export * from './minecraft';

View File

@ -0,0 +1,34 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { Order } from 'blockly/javascript';
import * as Blockly from 'blockly/core';
export const minecraftBlockGet = {
block: Blockly.common.createBlockDefinitionsFromJsonArray([{
// category: 'text',
type: 'minecraft_block_get',
message0: 'Get block at %1',
inputsInline: true,
args0: [
{
type: 'input_value',
name: 'LOCATION',
check: 'Location',
},
],
output: 'Material',
colour: '#e08080',
tooltip: '',
helpUrl: '',
}]),
toJS: (block: Blockly.Block, generator: Blockly.CodeGenerator) => {
// const location = block.getFieldValue('LOCATION');
const location = generator.valueToCode(block, 'LOCATION', Order.NONE) || "''";
const code = `${location}.getBlock().getType()\n`;
return [code, Order.ATOMIC];
},
};

View File

@ -0,0 +1,50 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { Order } from 'blockly/javascript';
import * as Blockly from 'blockly/core';
export const minecraftBlockPower = {
block: Blockly.common.createBlockDefinitionsFromJsonArray([{
// category: 'text',
type: 'minecraft_block_power',
message0: 'Power block at %1',
inputsInline: true,
args0: [
{
type: 'input_value',
name: 'LOCATION',
check: 'Location',
},
],
previousStatement: null,
nextStatement: null,
colour: '#e08080',
tooltip: '',
helpUrl: '',
}]),
toJS: (block: Blockly.Block, generator: Blockly.CodeGenerator) => {
const changeBlockData = generator.provideFunction_(
'changeBlockData',
`function ${generator.FUNCTION_NAME_PLACEHOLDER_}(location, callback, player) {
var block = location.getBlock();
echo(player, block.getPropertyForName('power'));
// block.setBlockData(callback(block.getBlockData()));
}`,
);
// const location = block.getFieldValue('LOCATION');
const location = generator.valueToCode(block, 'LOCATION', Order.NONE) || "''";
const code = `
${changeBlockData}(${location}, function (data) {
// data.setPowered(true);
echo(player, data);
return data;
}, player);\n`;
return code;
},
};

View File

@ -0,0 +1,41 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { Order } from 'blockly/javascript';
import * as Blockly from 'blockly/core';
export const minecraftBlockSet = {
block: Blockly.common.createBlockDefinitionsFromJsonArray([{
// category: 'text',
type: 'minecraft_block_set',
message0: 'Set block at %1 to %2',
inputsInline: true,
args0: [
{
type: 'input_value',
name: 'LOCATION',
check: 'Location',
},
{
type: 'input_value',
name: 'MATERIAL',
check: 'Material',
},
],
previousStatement: null,
nextStatement: null,
colour: '#e08080',
tooltip: '',
helpUrl: '',
}]),
toJS: (block: Blockly.Block, generator: Blockly.CodeGenerator) => {
// const location = block.getFieldValue('LOCATION');
const location = generator.valueToCode(block, 'LOCATION', Order.NONE) || "''";
const material = generator.valueToCode(block, 'MATERIAL', Order.NONE) || "''";
const code = `${location}.getBlock().setType(${material});\n`;
return code;
},
};

View File

@ -0,0 +1,4 @@
export * from './blockSet';
export * from './blockGet';
export * from './blockPower';
export * from './shape';

View File

@ -0,0 +1,101 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { Order } from 'blockly/javascript';
import * as Blockly from 'blockly/core';
export const minecraftBlockSetCube = {
block: Blockly.common.createBlockDefinitionsFromJsonArray([{
// category: 'text',
type: 'minecraft_block_set_cube',
message0: 'Cube centered at %1 size x:%2 y:%3 z:%4 set to %5',
inputsInline: true,
args0: [
{
type: 'input_value',
name: 'LOCATION',
check: 'Location',
},
{
type: 'input_value',
name: 'X',
check: 'Number',
},
{
type: 'input_value',
name: 'Y',
check: 'Number',
},
{
type: 'input_value',
name: 'Z',
check: 'Number',
},
// {
// type: 'field_number',
// name: 'X',
// value: 1,
// min: 1,
// max: 200,
// precision: 0,
// },
// {
// type: 'field_number',
// name: 'Y',
// value: 1,
// min: 1,
// max: 200,
// precision: 0,
// },
// {
// type: 'field_number',
// name: 'Z',
// value: 1,
// min: 1,
// max: 200,
// precision: 0,
// },
{
type: 'input_value',
name: 'MATERIAL',
check: 'Material',
},
],
previousStatement: null,
nextStatement: null,
colour: '#e08080',
tooltip: '',
helpUrl: '',
}]),
toJS: (block: Blockly.Block, generator: Blockly.CodeGenerator) => {
const blockSetShape = generator.provideFunction_(
'blockSetShape',
`function ${generator.FUNCTION_NAME_PLACEHOLDER_}(location, material, positions) {
var block = location.getBlock();
for (var i = 0; i < positions.length; i++) {
var pos = positions[i];
block.getRelative(pos[0], pos[1], pos[2]).setType(material);
}
}`,
);
// const location = block.getFieldValue('LOCATION');
const location = generator.valueToCode(block, 'LOCATION', Order.NONE) || "''";
const material = generator.valueToCode(block, 'MATERIAL', Order.NONE) || "''";
const x = Number(generator.valueToCode(block, 'X', Order.NONE) ?? 1);
const y = Number(generator.valueToCode(block, 'Y', Order.NONE) ?? 1);
const z = Number(generator.valueToCode(block, 'Z', Order.NONE) ?? 1);
const code = `var positions = [];
for (var xi = 0; xi < ${x}; xi++)
for (var yi = 0; yi < ${y}; yi++)
for (var zi = 0; zi < ${z}; zi++)
positions.push([xi - ${Math.floor(x / 2)}, yi - ${Math.floor(y / 2)}, zi - ${Math.floor(z / 2)}]);
${blockSetShape}(${location}, ${material}, positions);\n`;
return code;
},
};

View File

@ -0,0 +1,101 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { Order } from 'blockly/javascript';
import * as Blockly from 'blockly/core';
export const minecraftBlockSetCylinder = {
block: Blockly.common.createBlockDefinitionsFromJsonArray([{
// category: 'text',
type: 'minecraft_block_set_cylinder',
message0: 'Cylinder centered at %1 diameter:%2 height:%3 set to %4',
inputsInline: true,
args0: [
{
type: 'input_value',
name: 'LOCATION',
check: 'Location',
},
{
type: 'input_value',
name: 'D',
check: 'Number',
},
{
type: 'input_value',
name: 'H',
check: 'Number',
},
// {
// type: 'field_number',
// name: 'X',
// value: 1,
// min: 1,
// max: 200,
// precision: 0,
// },
// {
// type: 'field_number',
// name: 'Y',
// value: 1,
// min: 1,
// max: 200,
// precision: 0,
// },
// {
// type: 'field_number',
// name: 'Z',
// value: 1,
// min: 1,
// max: 200,
// precision: 0,
// },
{
type: 'input_value',
name: 'MATERIAL',
check: 'Material',
},
],
previousStatement: null,
nextStatement: null,
colour: '#e08080',
tooltip: '',
helpUrl: '',
}]),
toJS: (block: Blockly.Block, generator: Blockly.CodeGenerator) => {
const blockSetShape = generator.provideFunction_(
'blockSetShape',
`function ${generator.FUNCTION_NAME_PLACEHOLDER_}(location, material, positions) {
var block = location.getBlock();
for (var i = 0; i < positions.length; i++) {
var pos = positions[i];
block.getRelative(pos[0], pos[1], pos[2]).setType(material);
}
}`,
);
// const location = block.getFieldValue('LOCATION');
const location = generator.valueToCode(block, 'LOCATION', Order.NONE) || "''";
const material = generator.valueToCode(block, 'MATERIAL', Order.NONE) || "''";
const d = Number(generator.valueToCode(block, 'D', Order.NONE) ?? 1);
const h = Number(generator.valueToCode(block, 'H', Order.NONE) ?? 1);
const code = `var positions = [];
for (var yi = 0; yi < ${h}; yi++)
for (var xi = 0; xi < ${d/2}; xi++) {
var sz = Math.sqrt(${(d / 2) * (d / 2)} - xi * xi);
for (var zi = 0; zi < sz; zi++) {
positions.push([Math.round(xi), yi, Math.round(zi)]);
positions.push([Math.round(xi), yi, Math.round(-zi)]);
positions.push([Math.round(-xi), yi, Math.round(zi)]);
positions.push([Math.round(-xi), yi, Math.round(-zi)]);
}
}
${blockSetShape}(${location}, ${material}, positions);\n`;
return code;
},
};

View File

@ -0,0 +1,2 @@
export * from './cube';
export * from './cylinder';

View File

@ -0,0 +1,44 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { Order } from 'blockly/javascript';
import * as Blockly from 'blockly/core';
export const minecraftCommand = {
block: Blockly.common.createBlockDefinitionsFromJsonArray([{
// category: 'text',
type: 'minecraft_command',
message0: 'Command %1 %2',
args0: [
{
type: 'field_input',
name: 'NAME',
text: 'name',
},
{
"type": "input_statement",
"name": "STATEMENT",
"check": "Local"
},
],
previousStatement: null,
nextStatement: null,
colour: '#e08080',
tooltip: '',
helpUrl: '',
}]),
toJS: (block: Blockly.Block, generator: Blockly.CodeGenerator) => {
const name = block.getFieldValue('NAME');
const statement = generator.statementToCode(block, 'STATEMENT') || '';
const code = `command(
'${name}',
function ( parameters, player ) {
${statement}
}
);`;
return code;
},
};

View File

@ -0,0 +1,32 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { Order } from 'blockly/javascript';
import * as Blockly from 'blockly/core';
export const minecraftEcho = {
block: Blockly.common.createBlockDefinitionsFromJsonArray([{
type: 'minecraft_echo',
message0: 'Print %1',
args0: [
{
type: 'input_value',
name: 'VALUE',
// check: 'Number',
},
],
previousStatement: null,
nextStatement: null,
colour: '#e08080',
tooltip: '',
helpUrl: '',
}]),
toJS: (block: Blockly.Block, generator: Blockly.CodeGenerator) => {
const value = generator.valueToCode(block, 'VALUE', Order.ATOMIC) || "''";
const code = `echo(player, ${value});\n`;
return code;
},
};

View File

@ -0,0 +1,6 @@
export * from './command';
export * from './echo';
export * from './location';
export * from './block';
export * from './material';
export * from './scheduler';

View File

@ -0,0 +1,7 @@
export * from './playerLocation';
export * from './playerLookAtLocation';
export * from './xyzLocation';
export * from './locationMoveForward';
export * from './locationMove';
export * from './locationLook';
export * from './locationTurn';

View File

@ -0,0 +1,91 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { Order } from 'blockly/javascript';
import * as Blockly from 'blockly/core';
enum Direction {
'Up' = 'UP',
'Down' = 'DOWN',
'North' = 'NORTH',
'South' = 'SOUTH',
'East' = 'EAST',
'West' = 'WEST',
};
function yawByDirection(direction: Direction): number {
switch (direction) {
case Direction.Up:
return -90;
case Direction.Down:
return 90;
default:
return 0;
}
}
function pitchByDirection(direction: Direction): number {
switch (direction) {
case Direction.East:
return -90;
case Direction.South:
return 0;
case Direction.West:
return 90;
case Direction.North:
return 180;
default:
return 0;
}
}
export const minecraftLookLocation = {
block: Blockly.common.createBlockDefinitionsFromJsonArray([{
type: 'minecraft_location_look',
message0: 'Look %1 to %2',
args0: [
{
type: 'input_value',
name: 'LOCATION',
check: 'Location',
},
{
type: 'field_dropdown',
name: 'DIRECTION',
options: [
['Up', 'UP'],
['Down', 'DOWN'],
['East', 'EAST'],
['West', 'WEST'],
['North', 'NORTH'],
['South', 'SOUTH'],
],
},
],
previousStatement: null,
nextStatement: null,
colour: '#e08080',
tooltip: '',
helpUrl: '',
}]),
toJS: (block: Blockly.Block, generator: Blockly.CodeGenerator) => {
const locationLook = generator.provideFunction_(
'locationLook',
`function ${generator.FUNCTION_NAME_PLACEHOLDER_}(location, yaw, pitch) {
location.setYaw(yaw);
location.setPitch(pitch);
}`,
);
const location = generator.valueToCode(block, 'LOCATION', Order.NONE) || "''";
const direction = block.getFieldValue('DIRECTION');
const yaw = yawByDirection(direction);
const pitch = pitchByDirection(direction);
const code = `${locationLook}(${location}, ${yaw}, ${pitch})\n`;
return code;
},
};

View File

@ -0,0 +1,51 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { Order } from 'blockly/javascript';
import * as Blockly from 'blockly/core';
export const minecraftMoveLocation = {
block: Blockly.common.createBlockDefinitionsFromJsonArray([{
type: 'minecraft_location_move',
message0: 'Move %1 by %2 %3 %4',
// output: 'Location',
args0: [
{
type: 'input_value',
name: 'LOCATION',
check: 'Location',
},
{
type: 'field_number',
name: 'X',
precision: 0,
},
{
type: 'field_number',
name: 'Y',
precision: 0,
},
{
type: 'field_number',
name: 'Z',
precision: 0,
},
],
previousStatement: null,
nextStatement: null,
colour: '#e08080',
tooltip: '',
helpUrl: '',
}]),
toJS: (block: Blockly.Block, generator: Blockly.CodeGenerator) => {
const location = generator.valueToCode(block, 'LOCATION', Order.NONE) || "''";
const x = block.getFieldValue('X');
const y = block.getFieldValue('Y');
const z = block.getFieldValue('Z');
const code = `${location}.add(${x}, ${y}, ${z});\n`;
return code;
},
};

View File

@ -0,0 +1,46 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { Order } from 'blockly/javascript';
import * as Blockly from 'blockly/core';
export const minecraftMoveForwardLocation = {
block: Blockly.common.createBlockDefinitionsFromJsonArray([{
type: 'minecraft_location_move_forward',
message0: 'Move %1 forward by %2',
// output: 'Location',
args0: [
{
type: 'input_value',
name: 'LOCATION',
check: 'Location',
},
{
type: 'field_number',
name: 'DELTA',
precision: 0,
},
],
previousStatement: null,
nextStatement: null,
colour: '#e08080',
tooltip: '',
helpUrl: '',
}]),
toJS: (block: Blockly.Block, generator: Blockly.CodeGenerator) => {
const locationMove = generator.provideFunction_(
'locationMove',
`function ${generator.FUNCTION_NAME_PLACEHOLDER_}(location, delta) {
location.add(location.getDirection().multiply(delta));
}`,
);
const location = generator.valueToCode(block, 'LOCATION', Order.NONE) || "''";
const delta = block.getFieldValue('DELTA');
const code = `${locationMove}(${location}, ${delta});\n`;
return code;
},
};

View File

@ -0,0 +1,45 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { Order } from 'blockly/javascript';
import * as Blockly from 'blockly/core';
export const minecraftTurnLocation = {
block: Blockly.common.createBlockDefinitionsFromJsonArray([{
type: 'minecraft_location_turn',
message0: 'Turn %1 by %2 %3',
// output: 'Location',
args0: [
{
type: 'input_value',
name: 'LOCATION',
check: 'Location',
},
{
type: 'field_number',
name: 'YAW',
precision: 2,
},
{
type: 'field_number',
name: 'PITCH',
precision: 2,
},
],
previousStatement: null,
nextStatement: null,
colour: '#e08080',
tooltip: '',
helpUrl: '',
}]),
toJS: (block: Blockly.Block, generator: Blockly.CodeGenerator) => {
const location = generator.valueToCode(block, 'LOCATION', Order.NONE) || "''";
const yaw = block.getFieldValue('YAW');
const pitch = block.getFieldValue('PITCH');
const code = `${location}.setYaw((${yaw}, ${pitch});\n`;
return code;
},
};

View File

@ -0,0 +1,24 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { Order } from 'blockly/javascript';
import * as Blockly from 'blockly/core';
export const minecraftPlayerLocation = {
block: Blockly.common.createBlockDefinitionsFromJsonArray([{
type: 'minecraft_player_location',
message0: 'Player location',
output: 'Location',
args0: [],
colour: '#e08080',
tooltip: '',
helpUrl: '',
}]),
toJS: (block: Blockly.Block, generator: Blockly.CodeGenerator) => {
const code = `player.getLocation()`;
return [code, Order.ATOMIC];
},
};

View File

@ -0,0 +1,24 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { Order } from 'blockly/javascript';
import * as Blockly from 'blockly/core';
export const minecraftPlayerLookAtLocation = {
block: Blockly.common.createBlockDefinitionsFromJsonArray([{
type: 'minecraft_player_look_at_location',
message0: 'Player look at location',
output: 'Location',
args0: [],
colour: '#e08080',
tooltip: '',
helpUrl: '',
}]),
toJS: (block: Blockly.Block, generator: Blockly.CodeGenerator) => {
const code = `player.getTargetBlock(null, 1000).getLocation()`;
return [code, Order.ATOMIC];
},
};

View File

@ -0,0 +1,43 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { Order } from 'blockly/javascript';
import * as Blockly from 'blockly/core';
export const minecraftXyzLocation = {
block: Blockly.common.createBlockDefinitionsFromJsonArray([{
type: 'minecraft_xyz_location',
message0: 'Location x:%1 y:%2 z:%3',
output: 'Location',
args0: [
{
type: 'field_number',
name: 'X',
precision: 0,
},
{
type: 'field_number',
name: 'Y',
precision: 0,
},
{
type: 'field_number',
name: 'Z',
precision: 0,
},
],
colour: '#e08080',
tooltip: '',
helpUrl: '',
}]),
toJS: (block: Blockly.Block, generator: Blockly.CodeGenerator) => {
const x = block.getFieldValue('X');
const y = block.getFieldValue('Y');
const z = block.getFieldValue('Z');
const code = `new org.bukkit.Location(player.getWorld(), ${x}, ${y}, ${z})`;
return [code, Order.ATOMIC];
},
};

View File

@ -0,0 +1 @@
export * from './namedMaterial';

View File

@ -0,0 +1,348 @@
export const materials = [
['AIR', 'AIR'],
['STONE', 'STONE'],
['GRASS', 'GRASS'],
['DIRT', 'DIRT'],
['COBBLESTONE', 'COBBLESTONE'],
['WOOD', 'WOOD'],
['SAPLING', 'SAPLING'],
['BEDROCK', 'BEDROCK'],
['WATER', 'WATER'],
['STATIONARY_WATER', 'STATIONARY_WATER'],
['LAVA', 'LAVA'],
['STATIONARY_LAVA', 'STATIONARY_LAVA'],
['SAND', 'SAND'],
['GRAVEL', 'GRAVEL'],
['GOLD_ORE', 'GOLD_ORE'],
['IRON_ORE', 'IRON_ORE'],
['COAL_ORE', 'COAL_ORE'],
['LOG', 'LOG'],
['LEAVES', 'LEAVES'],
['SPONGE', 'SPONGE'],
['GLASS', 'GLASS'],
['LAPIS_ORE', 'LAPIS_ORE'],
['LAPIS_BLOCK', 'LAPIS_BLOCK'],
['DISPENSER', 'DISPENSER'],
['SANDSTONE', 'SANDSTONE'],
['NOTE_BLOCK', 'NOTE_BLOCK'],
['BED_BLOCK', 'BED_BLOCK'],
['POWERED_RAIL', 'POWERED_RAIL'],
['DETECTOR_RAIL', 'DETECTOR_RAIL'],
['PISTON_STICKY_BASE', 'PISTON_STICKY_BASE'],
['WEB', 'WEB'],
['LONG_GRASS', 'LONG_GRASS'],
['DEAD_BUSH', 'DEAD_BUSH'],
['PISTON_BASE', 'PISTON_BASE'],
['PISTON_EXTENSION', 'PISTON_EXTENSION'],
['WOOL', 'WOOL'],
['PISTON_MOVING_PIECE', 'PISTON_MOVING_PIECE'],
['YELLOW_FLOWER', 'YELLOW_FLOWER'],
['RED_ROSE', 'RED_ROSE'],
['BROWN_MUSHROOM', 'BROWN_MUSHROOM'],
['RED_MUSHROOM', 'RED_MUSHROOM'],
['GOLD_BLOCK', 'GOLD_BLOCK'],
['IRON_BLOCK', 'IRON_BLOCK'],
['DOUBLE_STEP', 'DOUBLE_STEP'],
['STEP', 'STEP'],
['BRICK', 'BRICK'],
['TNT', 'TNT'],
['BOOKSHELF', 'BOOKSHELF'],
['MOSSY_COBBLESTONE', 'MOSSY_COBBLESTONE'],
['OBSIDIAN', 'OBSIDIAN'],
['TORCH', 'TORCH'],
['FIRE', 'FIRE'],
['MOB_SPAWNER', 'MOB_SPAWNER'],
['WOOD_STAIRS', 'WOOD_STAIRS'],
['CHEST', 'CHEST'],
['REDSTONE_WIRE', 'REDSTONE_WIRE'],
['DIAMOND_ORE', 'DIAMOND_ORE'],
['DIAMOND_BLOCK', 'DIAMOND_BLOCK'],
['WORKBENCH', 'WORKBENCH'],
['CROPS', 'CROPS'],
['SOIL', 'SOIL'],
['FURNACE', 'FURNACE'],
['BURNING_FURNACE', 'BURNING_FURNACE'],
['SIGN_POST', 'SIGN_POST'],
['WOODEN_DOOR', 'WOODEN_DOOR'],
['LADDER', 'LADDER'],
['RAILS', 'RAILS'],
['COBBLESTONE_STAIRS', 'COBBLESTONE_STAIRS'],
['WALL_SIGN', 'WALL_SIGN'],
['LEVER', 'LEVER'],
['STONE_PLATE', 'STONE_PLATE'],
['IRON_DOOR_BLOCK', 'IRON_DOOR_BLOCK'],
['WOOD_PLATE', 'WOOD_PLATE'],
['REDSTONE_ORE', 'REDSTONE_ORE'],
['GLOWING_REDSTONE_ORE', 'GLOWING_REDSTONE_ORE'],
['REDSTONE_TORCH_OFF', 'REDSTONE_TORCH_OFF'],
['REDSTONE_TORCH_ON', 'REDSTONE_TORCH_ON'],
['STONE_BUTTON', 'STONE_BUTTON'],
['SNOW', 'SNOW'],
['ICE', 'ICE'],
['SNOW_BLOCK', 'SNOW_BLOCK'],
['CACTUS', 'CACTUS'],
['CLAY', 'CLAY'],
['SUGAR_CANE_BLOCK', 'SUGAR_CANE_BLOCK'],
['JUKEBOX', 'JUKEBOX'],
['FENCE', 'FENCE'],
['PUMPKIN', 'PUMPKIN'],
['NETHERRACK', 'NETHERRACK'],
['SOUL_SAND', 'SOUL_SAND'],
['GLOWSTONE', 'GLOWSTONE'],
['PORTAL', 'PORTAL'],
['JACK_O_LANTERN', 'JACK_O_LANTERN'],
['CAKE_BLOCK', 'CAKE_BLOCK'],
['DIODE_BLOCK_OFF', 'DIODE_BLOCK_OFF'],
['DIODE_BLOCK_ON', 'DIODE_BLOCK_ON'],
// deprecated
['LOCKED_CHEST', 'LOCKED_CHEST'],
['STAINED_GLASS', 'STAINED_GLASS'],
['TRAP_DOOR', 'TRAP_DOOR'],
['MONSTER_EGGS', 'MONSTER_EGGS'],
['SMOOTH_BRICK', 'SMOOTH_BRICK'],
['HUGE_MUSHROOM_1', 'HUGE_MUSHROOM_1'],
['HUGE_MUSHROOM_2', 'HUGE_MUSHROOM_2'],
['IRON_FENCE', 'IRON_FENCE'],
['THIN_GLASS', 'THIN_GLASS'],
['MELON_BLOCK', 'MELON_BLOCK'],
['PUMPKIN_STEM', 'PUMPKIN_STEM'],
['MELON_STEM', 'MELON_STEM'],
['VINE', 'VINE'],
['FENCE_GATE', 'FENCE_GATE'],
['BRICK_STAIRS', 'BRICK_STAIRS'],
['SMOOTH_STAIRS', 'SMOOTH_STAIRS'],
['MYCEL', 'MYCEL'],
['WATER_LILY', 'WATER_LILY'],
['NETHER_BRICK', 'NETHER_BRICK'],
['NETHER_FENCE', 'NETHER_FENCE'],
['NETHER_BRICK_STAIRS', 'NETHER_BRICK_STAIRS'],
['NETHER_WARTS', 'NETHER_WARTS'],
['ENCHANTMENT_TABLE', 'ENCHANTMENT_TABLE'],
['BREWING_STAND', 'BREWING_STAND'],
['CAULDRON', 'CAULDRON'],
['ENDER_PORTAL', 'ENDER_PORTAL'],
['ENDER_PORTAL_FRAME', 'ENDER_PORTAL_FRAME'],
['ENDER_STONE', 'ENDER_STONE'],
['DRAGON_EGG', 'DRAGON_EGG'],
['REDSTONE_LAMP_OFF', 'REDSTONE_LAMP_OFF'],
['REDSTONE_LAMP_ON', 'REDSTONE_LAMP_ON'],
['WOOD_DOUBLE_STEP', 'WOOD_DOUBLE_STEP'],
['WOOD_STEP', 'WOOD_STEP'],
['COCOA', 'COCOA'],
['SANDSTONE_STAIRS', 'SANDSTONE_STAIRS'],
['EMERALD_ORE', 'EMERALD_ORE'],
['ENDER_CHEST', 'ENDER_CHEST'],
['TRIPWIRE_HOOK', 'TRIPWIRE_HOOK'],
['TRIPWIRE', 'TRIPWIRE'],
['EMERALD_BLOCK', 'EMERALD_BLOCK'],
['SPRUCE_WOOD_STAIRS', 'SPRUCE_WOOD_STAIRS'],
['BIRCH_WOOD_STAIRS', 'BIRCH_WOOD_STAIRS'],
['JUNGLE_WOOD_STAIRS', 'JUNGLE_WOOD_STAIRS'],
['COMMAND', 'COMMAND'],
['BEACON', 'BEACON'],
['COBBLE_WALL', 'COBBLE_WALL'],
['FLOWER_POT', 'FLOWER_POT'],
['CARROT', 'CARROT'],
['POTATO', 'POTATO'],
['WOOD_BUTTON', 'WOOD_BUTTON'],
['SKULL', 'SKULL'],
['ANVIL', 'ANVIL'],
['TRAPPED_CHEST', 'TRAPPED_CHEST'],
['GOLD_PLATE', 'GOLD_PLATE'],
['IRON_PLATE', 'IRON_PLATE'],
['REDSTONE_COMPARATOR_OFF', 'REDSTONE_COMPARATOR_OFF'],
['REDSTONE_COMPARATOR_ON', 'REDSTONE_COMPARATOR_ON'],
['DAYLIGHT_DETECTOR', 'DAYLIGHT_DETECTOR'],
['REDSTONE_BLOCK', 'REDSTONE_BLOCK'],
['QUARTZ_ORE', 'QUARTZ_ORE'],
['HOPPER', 'HOPPER'],
['QUARTZ_BLOCK', 'QUARTZ_BLOCK'],
['QUARTZ_STAIRS', 'QUARTZ_STAIRS'],
['ACTIVATOR_RAIL', 'ACTIVATOR_RAIL'],
['DROPPER', 'DROPPER'],
['STAINED_CLAY', 'STAINED_CLAY'],
['STAINED_GLASS_PANE', 'STAINED_GLASS_PANE'],
['LEAVES_2', 'LEAVES_2'],
['LOG_2', 'LOG_2'],
['ACACIA_STAIRS', 'ACACIA_STAIRS'],
['DARK_OAK_STAIRS', 'DARK_OAK_STAIRS'],
['HAY_BLOCK', 'HAY_BLOCK'],
['CARPET', 'CARPET'],
['HARD_CLAY', 'HARD_CLAY'],
['COAL_BLOCK', 'COAL_BLOCK'],
['PACKED_ICE', 'PACKED_ICE'],
['DOUBLE_PLANT', 'DOUBLE_PLANT'],
['IRON_SPADE', 'IRON_SPADE'],
['IRON_PICKAXE', 'IRON_PICKAXE'],
['IRON_AXE', 'IRON_AXE'],
['FLINT_AND_STEEL', 'FLINT_AND_STEEL'],
['APPLE', 'APPLE'],
['BOW', 'BOW'],
['ARROW', 'ARROW'],
['COAL', 'COAL'],
['DIAMOND', 'DIAMOND'],
['IRON_INGOT', 'IRON_INGOT'],
['GOLD_INGOT', 'GOLD_INGOT'],
['IRON_SWORD', 'IRON_SWORD'],
['WOOD_SWORD', 'WOOD_SWORD'],
['WOOD_SPADE', 'WOOD_SPADE'],
['WOOD_PICKAXE', 'WOOD_PICKAXE'],
['WOOD_AXE', 'WOOD_AXE'],
['STONE_SWORD', 'STONE_SWORD'],
['STONE_SPADE', 'STONE_SPADE'],
['STONE_PICKAXE', 'STONE_PICKAXE'],
['STONE_AXE', 'STONE_AXE'],
['DIAMOND_SWORD', 'DIAMOND_SWORD'],
['DIAMOND_SPADE', 'DIAMOND_SPADE'],
['DIAMOND_PICKAXE', 'DIAMOND_PICKAXE'],
['DIAMOND_AXE', 'DIAMOND_AXE'],
['STICK', 'STICK'],
['BOWL', 'BOWL'],
['MUSHROOM_SOUP', 'MUSHROOM_SOUP'],
['GOLD_SWORD', 'GOLD_SWORD'],
['GOLD_SPADE', 'GOLD_SPADE'],
['GOLD_PICKAXE', 'GOLD_PICKAXE'],
['GOLD_AXE', 'GOLD_AXE'],
['STRING', 'STRING'],
['FEATHER', 'FEATHER'],
['SULPHUR', 'SULPHUR'],
['WOOD_HOE', 'WOOD_HOE'],
['STONE_HOE', 'STONE_HOE'],
['IRON_HOE', 'IRON_HOE'],
['DIAMOND_HOE', 'DIAMOND_HOE'],
['GOLD_HOE', 'GOLD_HOE'],
['SEEDS', 'SEEDS'],
['WHEAT', 'WHEAT'],
['BREAD', 'BREAD'],
['LEATHER_HELMET', 'LEATHER_HELMET'],
['LEATHER_CHESTPLATE', 'LEATHER_CHESTPLATE'],
['LEATHER_LEGGINGS', 'LEATHER_LEGGINGS'],
['LEATHER_BOOTS', 'LEATHER_BOOTS'],
['CHAINMAIL_HELMET', 'CHAINMAIL_HELMET'],
['CHAINMAIL_CHESTPLATE', 'CHAINMAIL_CHESTPLATE'],
['CHAINMAIL_LEGGINGS', 'CHAINMAIL_LEGGINGS'],
['CHAINMAIL_BOOTS', 'CHAINMAIL_BOOTS'],
['IRON_HELMET', 'IRON_HELMET'],
['IRON_CHESTPLATE', 'IRON_CHESTPLATE'],
['IRON_LEGGINGS', 'IRON_LEGGINGS'],
['IRON_BOOTS', 'IRON_BOOTS'],
['DIAMOND_HELMET', 'DIAMOND_HELMET'],
['DIAMOND_CHESTPLATE', 'DIAMOND_CHESTPLATE'],
['DIAMOND_LEGGINGS', 'DIAMOND_LEGGINGS'],
['DIAMOND_BOOTS', 'DIAMOND_BOOTS'],
['GOLD_HELMET', 'GOLD_HELMET'],
['GOLD_CHESTPLATE', 'GOLD_CHESTPLATE'],
['GOLD_LEGGINGS', 'GOLD_LEGGINGS'],
['GOLD_BOOTS', 'GOLD_BOOTS'],
['FLINT', 'FLINT'],
['PORK', 'PORK'],
['GRILLED_PORK', 'GRILLED_PORK'],
['PAINTING', 'PAINTING'],
['GOLDEN_APPLE', 'GOLDEN_APPLE'],
['SIGN', 'SIGN'],
['WOOD_DOOR', 'WOOD_DOOR'],
['BUCKET', 'BUCKET'],
['WATER_BUCKET', 'WATER_BUCKET'],
['LAVA_BUCKET', 'LAVA_BUCKET'],
['MINECART', 'MINECART'],
['SADDLE', 'SADDLE'],
['IRON_DOOR', 'IRON_DOOR'],
['REDSTONE', 'REDSTONE'],
['SNOW_BALL', 'SNOW_BALL'],
['BOAT', 'BOAT'],
['LEATHER', 'LEATHER'],
['MILK_BUCKET', 'MILK_BUCKET'],
['CLAY_BRICK', 'CLAY_BRICK'],
['CLAY_BALL', 'CLAY_BALL'],
['SUGAR_CANE', 'SUGAR_CANE'],
['PAPER', 'PAPER'],
['BOOK', 'BOOK'],
['SLIME_BALL', 'SLIME_BALL'],
['STORAGE_MINECART', 'STORAGE_MINECART'],
['POWERED_MINECART', 'POWERED_MINECART'],
['EGG', 'EGG'],
['COMPASS', 'COMPASS'],
['FISHING_ROD', 'FISHING_ROD'],
['WATCH', 'WATCH'],
['GLOWSTONE_DUST', 'GLOWSTONE_DUST'],
['RAW_FISH', 'RAW_FISH'],
['COOKED_FISH', 'COOKED_FISH'],
['INK_SACK', 'INK_SACK'],
['BONE', 'BONE'],
['SUGAR', 'SUGAR'],
['CAKE', 'CAKE'],
['BED', 'BED'],
['DIODE', 'DIODE'],
['COOKIE', 'COOKIE'],
// MapView
['MAP', 'MAP'],
['SHEARS', 'SHEARS'],
['MELON', 'MELON'],
['PUMPKIN_SEEDS', 'PUMPKIN_SEEDS'],
['MELON_SEEDS', 'MELON_SEEDS'],
['RAW_BEEF', 'RAW_BEEF'],
['COOKED_BEEF', 'COOKED_BEEF'],
['RAW_CHICKEN', 'RAW_CHICKEN'],
['COOKED_CHICKEN', 'COOKED_CHICKEN'],
['ROTTEN_FLESH', 'ROTTEN_FLESH'],
['ENDER_PEARL', 'ENDER_PEARL'],
['BLAZE_ROD', 'BLAZE_ROD'],
['GHAST_TEAR', 'GHAST_TEAR'],
['GOLD_NUGGET', 'GOLD_NUGGET'],
['NETHER_STALK', 'NETHER_STALK'],
// Potion
['POTION', 'POTION'],
['GLASS_BOTTLE', 'GLASS_BOTTLE'],
['SPIDER_EYE', 'SPIDER_EYE'],
['FERMENTED_SPIDER_EYE', 'FERMENTED_SPIDER_EYE'],
['BLAZE_POWDER', 'BLAZE_POWDER'],
['MAGMA_CREAM', 'MAGMA_CREAM'],
['BREWING_STAND_ITEM', 'BREWING_STAND_ITEM'],
['CAULDRON_ITEM', 'CAULDRON_ITEM'],
['EYE_OF_ENDER', 'EYE_OF_ENDER'],
['SPECKLED_MELON', 'SPECKLED_MELON'],
['MONSTER_EGG', 'MONSTER_EGG'],
['EXP_BOTTLE', 'EXP_BOTTLE'],
['FIREBALL', 'FIREBALL'],
['BOOK_AND_QUILL', 'BOOK_AND_QUILL'],
['WRITTEN_BOOK', 'WRITTEN_BOOK'],
['EMERALD', 'EMERALD'],
['ITEM_FRAME', 'ITEM_FRAME'],
['FLOWER_POT_ITEM', 'FLOWER_POT_ITEM'],
['CARROT_ITEM', 'CARROT_ITEM'],
['POTATO_ITEM', 'POTATO_ITEM'],
['BAKED_POTATO', 'BAKED_POTATO'],
['POISONOUS_POTATO', 'POISONOUS_POTATO'],
['EMPTY_MAP', 'EMPTY_MAP'],
['GOLDEN_CARROT', 'GOLDEN_CARROT'],
['SKULL_ITEM', 'SKULL_ITEM'],
['CARROT_STICK', 'CARROT_STICK'],
['NETHER_STAR', 'NETHER_STAR'],
['PUMPKIN_PIE', 'PUMPKIN_PIE'],
['FIREWORK', 'FIREWORK'],
['FIREWORK_CHARGE', 'FIREWORK_CHARGE'],
['ENCHANTED_BOOK', 'ENCHANTED_BOOK'],
['REDSTONE_COMPARATOR', 'REDSTONE_COMPARATOR'],
['NETHER_BRICK_ITEM', 'NETHER_BRICK_ITEM'],
['QUARTZ', 'QUARTZ'],
['EXPLOSIVE_MINECART', 'EXPLOSIVE_MINECART'],
['HOPPER_MINECART', 'HOPPER_MINECART'],
['IRON_BARDING', 'IRON_BARDING'],
['GOLD_BARDING', 'GOLD_BARDING'],
['DIAMOND_BARDING', 'DIAMOND_BARDING'],
['LEASH', 'LEASH'],
['NAME_TAG', 'NAME_TAG'],
['COMMAND_MINECART', 'COMMAND_MINECART'],
['GOLD_RECORD', 'GOLD_RECORD'],
['GREEN_RECORD', 'GREEN_RECORD'],
['RECORD_3', 'RECORD_3'],
['RECORD_4', 'RECORD_4'],
['RECORD_5', 'RECORD_5'],
['RECORD_6', 'RECORD_6'],
['RECORD_7', 'RECORD_7'],
['RECORD_8', 'RECORD_8'],
['RECORD_9', 'RECORD_9'],
['RECORD_10', 'RECORD_10'],
['RECORD_11', 'RECORD_11'],
['RECORD_12', 'RECORD_12'],
];

View File

@ -0,0 +1,32 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { Order } from 'blockly/javascript';
import * as Blockly from 'blockly/core';
import { materials as options } from './materials';
export const minecraftNamedMaterial = {
block: Blockly.common.createBlockDefinitionsFromJsonArray([{
type: 'minecraft_named_material',
message0: 'Material %1',
output: 'Material',
args0: [
{
type: 'field_dropdown',
name: 'NAME',
options: options.sort((a, b) => a[0].localeCompare(b[0])),
},
],
colour: '#e08080',
tooltip: '',
helpUrl: '',
}]),
toJS: (block: Blockly.Block, generator: Blockly.CodeGenerator) => {
const name = block.getFieldValue('NAME');
const code = `org.bukkit.Material.${String(name).toUpperCase()}`;
return [code, Order.ATOMIC];
},
};

View File

@ -0,0 +1 @@
export * from './runLater';

View File

@ -0,0 +1,43 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import * as Blockly from 'blockly/core';
export const minecraftSchedulerRunLater = {
block: Blockly.common.createBlockDefinitionsFromJsonArray([{
// category: 'text',
type: 'minecraft_scheduler_run_later',
message0: 'Wait %1 ticks, then %2',
args0: [
{
type: 'field_number',
name: 'DELAY',
precision: 0,
},
{
"type": "input_statement",
"name": "STATEMENT",
"check": "Local"
},
],
previousStatement: null,
nextStatement: null,
colour: '#e08080',
tooltip: '',
helpUrl: '',
}]),
toJS: (block: Blockly.Block, generator: Blockly.CodeGenerator) => {
const delay = block.getFieldValue('DELAY');
const statement = generator.statementToCode(block, 'STATEMENT') || '';
const code = `server.scheduler.runTaskLater(global.plugin,
() => {
${statement}
},
${delay},
);`;
return code;
},
};

61
client/src/index.css Normal file
View File

@ -0,0 +1,61 @@
body {
margin: 0;
max-width: 100vw;
}
pre,
code {
overflow: auto;
}
#pageContainer {
display: flex;
width: 100%;
max-width: 100vw;
height: 100vh;
}
#overlay {
position: relative;
flex-basis: 100%;
height: 100%;
min-width: 600px;
}
#outputDiv {
position: absolute;
top: 0;
left: 40%;
width: 60%;
height: 100%;
opacity: 0.5;
pointer-events: none;
z-index: 2;
}
#blocklyDiv {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
}
#outputPane {
display: flex;
flex-direction: column;
width: 400px;
flex: 0 0 400px;
overflow: auto;
/* margin: 1rem; */
}
#generatedCode {
background-color: rgb(247, 240, 228);
margin: 0px;
}
#output {
height: 50%;
}

20
client/src/index.html Normal file
View File

@ -0,0 +1,20 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Blockly Sample App</title>
</head>
<body>
<div id="pageContainer">
<div id="outputPane" style="display:none">
<pre id="generatedCode"><code></code></pre>
<div id="output"></div>
</div>
<div id="overlay">
<pre id="outputDiv"><code></code></pre>
<div id="blocklyDiv"></div>
</div>
<!-- <div><button onClick="ws.clear(); save_ws()">aaa</button></div> -->
</div>
</body>
</html>

125
client/src/index.ts Normal file
View File

@ -0,0 +1,125 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import * as Blockly from 'blockly';
import * as newBlocks from './blocks';
import { javascriptGenerator } from 'blockly/javascript';
import { save, load } from './serialization';
import { toolbox } from './toolbox';
import { registerContinuousToolbox } from '@blockly/continuous-toolbox';
import Cookies from 'js-cookie';
import * as nano from 'nano';
import './index.css';
function randomValueHex(length: number) {
let hex = '';
for (let i = 0; i < length; i++)
hex += Math.floor(Math.random() * 256).toString(16);
return hex;
}
let browserId = Cookies.get('id');
if (!browserId) {
browserId = randomValueHex(24);
if (!Cookies.get('id'))
Cookies.set('id', browserId);
}
const blocks = Object.values(newBlocks).reduce((acc, val) => {
acc = { ...acc, ...val.block };
return acc;
}, {});
const generators = Object.values(newBlocks).reduce((acc, val) => {
acc = { ...acc, [Object.keys(val.block)[0]]: val.toJS };
return acc;
}, {});
// Register the blocks and generator with Blockly
Blockly.common.defineBlocks(blocks);
Object.assign(javascriptGenerator.forBlock, generators);
registerContinuousToolbox();
// Set up UI elements and inject Blockly
const codeDiv = document.getElementById('outputDiv')?.firstChild;
const outputDiv = document.getElementById('output');
const blocklyDiv = document.getElementById('blocklyDiv');
if (!blocklyDiv) {
throw new Error(`div with id 'blocklyDiv' not found`);
}
const ws = Blockly.inject(
blocklyDiv,
{
toolbox,
plugins: {
flyoutsVerticalToolbox: 'ContinuousFlyout',
metricsManager: 'ContinuousMetrics',
toolbox: 'ContinuousToolbox',
},
},
);
// This function resets the code and output divs, shows the
// generated code from the workspace, and evals the code.
// In a real application, you probably shouldn't use `eval`.
const runCode = () => {
const code = javascriptGenerator.workspaceToCode(ws as Blockly.Workspace);
// console.dir(code);
try {
fetch(
'http://10.0.64.121:8081/set/' + browserId,
{
method: 'POST',
body: code,
}
);
}
catch (err) {
window.alert('Error');
}
if (codeDiv) codeDiv.textContent = code;
// if (outputDiv) outputDiv.innerHTML = '';
// eval(code);
};
if (ws) {
(window as any)['ws'] = ws;
(window as any)['save_ws'] = () => save(ws);
// Load the initial state from storage and run the code.
load(ws);
runCode();
// Every time the workspace changes state, save the changes to storage.
ws.addChangeListener((e: Blockly.Events.Abstract) => {
// UI events are things like scrolling, zooming, etc.
// No need to save after one of these.
if (e.isUiEvent) return;
save(ws);
});
// Whenever the workspace changes meaningfully, run the code again.
ws.addChangeListener((e: Blockly.Events.Abstract) => {
// Don't run the code when the workspace finishes loading; we're
// already running it once when the application starts.
// Don't run the code during drags; we might have invalid state.
if (
e.isUiEvent ||
e.type == Blockly.Events.FINISHED_LOADING ||
ws.isDragging()
) {
return;
}
runCode();
});
}

View File

@ -0,0 +1,260 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Plugin overview.
*/
import * as Blockly from 'blockly/core';
import {getLocaleDateString} from './utils';
/**
* Class for a date input field.
*/
export class FieldDate extends Blockly.FieldTextInput {
/**
* Serializable fields are saved by the XML renderer, non-serializable fields
* are not. Editable fields should also be serializable.
*/
SERIALIZABLE = true;
/**
* Class for a date input field. Derived from the Closure library date
* picker.
*
* @param value The initial value of the field. Should be in
* 'YYYY-MM-DD' format. Defaults to the current date.
* @param validator A function that is called to validate
* changes to the field's value. Takes in a date string & returns a
* validated date string ('YYYY-MM-DD' format), or null to abort the
* change.
* @param config A map of options used to configure the field.
*/
constructor(
value?: string,
validator?: FieldDateValidator,
config?: FieldDateConfig,
) {
super(value, validator, config);
}
/**
* Constructs a FieldDate from a JSON arg object.
*
* @param options A JSON object with options (date).
* @returns The new field instance.
* @package
* @nocollapse
*/
static fromJson(options: FieldDateFromJsonConfig): FieldDate {
const {date, ...fieldDateConfig} = options;
// `this` might be a subclass of FieldDate if that class doesn't
// override the static fromJson method.
return new this(date, undefined, fieldDateConfig);
}
/* eslint-disable @typescript-eslint/naming-convention */
/**
* Ensures that the input value is a valid date. Additionally, if the date
* string provided includes a time, the time will be removed and the date for
* relative to the user's timezone will be used.
*
* @param newValue The input value. Ex: '2023-04-28'
* @returns A valid date string, or null if invalid.
* @override
*/
protected doClassValidation_(newValue?: string): string | null {
if (!newValue) return null;
const newDate = typeof newValue === 'string' ? new Date(newValue) : null;
if (!newDate || isNaN(newDate.getTime())) return null;
// NOTE: 'newValue' should be a valid date format here.
if (isISOFormat(newValue)) return newValue;
// Assume the time needs to be corrected.
return toLocalISOString(newDate);
}
/**
* Get the text to display on the block when the input hasn't spawned in.
*
* @returns The text to display on the block.
* @override
*/
protected getText_(): string | null {
const value = this.getValue();
if (!value) return null;
// NOTE: There may be discrepancies between the text and the input based on
// browser. For example, 'en-US' would display the text '2/14/2020', then
// clicking in Safari on iOS would display 'Feb 14, 2020'.
return getLocaleDateString(value);
}
/**
* Renders the field. If the picker is shown make sure it has the current
* date selected.
*/
protected render_() {
super.render_();
}
/**
* Shows the inline free-text editor on top of the text along with the date
* editor.
*
* @param e Optional mouse event that triggered the field to
* open, or undefined if triggered programmatically.
* @override
*/
protected showEditor_(e?: Event) {
// Pass in `true` for `quietInput` to disable modal inputs for the date
// block without setting `this.sourceBlock_.workspace.options.modalInputs`,
// which would impact the entire workspace.
super.showEditor_(e, true);
// Even though `quietInput` was set true, focus on the element.
this.htmlInput_?.focus({
preventScroll: true,
});
this.htmlInput_?.select();
this.showDropdown();
}
/**
* Updates the size of the field based on the text.
*
* @param margin margin to use when positioning the text element.
* @override
*/
protected updateSize_(margin?: number) {
// Add margin so that the date input's datepicker icon doesn't clip with
// the text when sized for the date.
super.updateSize_((margin ?? 0) + 20);
}
/**
* Shows the datepicker.
*/
private showDropdown(): void {
if (!this.htmlInput_) return;
Blockly.utils.dom.addClass(this.htmlInput_, 'blocklyDateInput');
// Delay showing the picker until the editor has a chance to position
window.requestAnimationFrame(() => {
// NOTE: HTMLInputElement.showPicker() is not available in earlier
// TypeScript versions (like 4.7.4), so casting to `any` to be compatible
// with dev scripts. Additionally, it's not available for date inputs for
// Safari. For browser compatibility of showPicker, see:
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/showPicker
/* eslint-disable @typescript-eslint/no-explicit-any */
(this.htmlInput_ as any).showPicker();
/* eslint-enable @typescript-eslint/no-explicit-any */
});
}
/**
* Create the html input and set it to type date.
*
* @returns The newly created date input editor.
*/
protected widgetCreate_(): HTMLInputElement {
// NOTE: field_input should return HTMLInputElement for this.
const htmlInput = super.widgetCreate_() as HTMLInputElement;
htmlInput.type = 'date';
return htmlInput;
}
/* eslint-enable @typescript-eslint/naming-convention */
}
/**
* NOTE: There are a few minor ways to tweak the datepicker CSS, though they're
* not consistent across browsers.
*
* @see{@link https://developer.mozilla.org/en-US/docs/Learn/Forms/Property_compatibility_table_for_form_controls#date_pickers}
*
* Below are a few ways this can be tweaked on *some* browsers:
* Blockly.Css.register(`
* ::-webkit-datetime-edit { }
* ::-webkit-datetime-edit-fields-wrapper { }
* ::-webkit-datetime-edit-text { }
* ::-webkit-datetime-edit-month-field { }
* ::-webkit-datetime-edit-day-field { }
* ::-webkit-datetime-edit-year-field { }
* ::-webkit-inner-spin-button { }
* ::-webkit-calendar-picker-indicator { }
* `);
*/
if (Blockly.utils.userAgent.MAC) {
// NOTE: By default, 4 px padding total are added within the User Agent
// Shadow Content on Safari on MAC. Remove the padding so the inner input
// matches the outer input's height and, by extension, the height of the text
// node.
Blockly.Css.register(`
input.blocklyDateInput::-webkit-datetime-edit,
input.blocklyDateInput::-webkit-datetime-edit-month-field,
input.blocklyDateInput::-webkit-datetime-edit-day-field,
input.blocklyDateInput::-webkit-datetime-edit-year-field {
padding: 0;
}
`);
}
Blockly.fieldRegistry.register('field_date', FieldDate);
/**
* A config object for defining a field date.
*/
export interface FieldDateConfig extends Blockly.FieldTextInputConfig {
// NOTE: spellcheck is defined for FieldInput though irrelevant for FieldDate.
spellcheck?: never;
}
/**
* Options used to define a field date from JSON.
*/
export interface FieldDateFromJsonConfig extends FieldDateConfig {
date?: string;
}
export type FieldDateValidator = Blockly.FieldTextInputValidator;
/**
* Validate a string value to see if it matches the format.
*
* @param value The value to validate the format for.
* @returns true if the value is in 'yyyy-mm-dd' format.
* @example
* isISOFormat('2000-02-20T00:00:00Z') === false
* isISOFormat('2000-02-20') === true
*/
export function isISOFormat(value: string): boolean {
const valueMatch = value.match(/\d\d\d\d-\d\d-\d\d/);
// If it matches ####-##-## and is the same as its input string,
// then assume this is the right format
return valueMatch !== null && valueMatch[0] === valueMatch.input;
}
/**
* Convert the date to ISO format for the current timezone.
*
* @param date The date to convert to an ISO string.
* @returns The string in 'yyyy-mm-dd' format, though for the current timezone.
* Ex: new Date('2000-02-20')
*/
export function toLocalISOString(date: Date) {
// NOTE: If the date is Feb 20, 2000 at 23:00 for GMT-6, it would be
// '2000-02-21' at GMT+0, which is what `date.toISOString()` would return.
// For a user whose timezone is GMT-6, this should return '2000-02-20'.
// For a user whose timezone is GMT-5, that date should return '2000-02-21'.
return date
.toLocaleDateString('en-US')
.replace(/(\d+)\/(\d+)\/(\d+)/, '$3-$1-$2')
.replace(/-(\d)(?!\d)/g, '-0$1');
}
// NOTE: Set default here instead of in class so it's available at Field.
FieldDate.prototype.DEFAULT_VALUE = toLocalISOString(new Date());

View File

@ -0,0 +1,32 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import * as Blockly from 'blockly/core';
const storageKey = 'mainWorkspace';
/**
* Saves the state of the workspace to browser's local storage.
* @param workspace Blockly workspace to save.
*/
export const save = function (workspace: Blockly.Workspace) {
const data = Blockly.serialization.workspaces.save(workspace);
window.localStorage?.setItem(storageKey, JSON.stringify(data));
};
/**
* Loads saved state from local storage into the given workspace.
* @param workspace Blockly workspace to load into.
*/
export const load = function (workspace: Blockly.Workspace) {
const data = window.localStorage?.getItem(storageKey);
if (!data) return;
// Don't emit events during loading.
Blockly.Events.disable();
Blockly.serialization.workspaces.load(JSON.parse(data), workspace, undefined);
Blockly.Events.enable();
};

632
client/src/toolbox/index.ts Normal file
View File

@ -0,0 +1,632 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/*
This toolbox contains nearly every single built-in block that Blockly offers,
in addition to the custom block 'add_text' this sample app adds.
You probably don't need every single block, and should consider either rewriting
your toolbox from scratch, or carefully choosing whether you need each block
listed here.
*/
import { category as minecraft } from './minecraft';
export const toolbox = {
kind: 'categoryToolbox',
contents: [
minecraft,
{
kind: 'category',
name: 'Logic',
categorystyle: 'logic_category',
contents: [
{
kind: 'block',
type: 'controls_if',
},
{
kind: 'block',
type: 'logic_compare',
},
{
kind: 'block',
type: 'logic_operation',
},
{
kind: 'block',
type: 'logic_negate',
},
{
kind: 'block',
type: 'logic_boolean',
},
{
kind: 'block',
type: 'logic_null',
},
{
kind: 'block',
type: 'logic_ternary',
},
],
},
{
kind: 'category',
name: 'Loops',
categorystyle: 'loop_category',
contents: [
{
kind: 'block',
type: 'controls_repeat_ext',
inputs: {
TIMES: {
shadow: {
type: 'math_number',
fields: {
NUM: 10,
},
},
},
},
},
{
kind: 'block',
type: 'controls_whileUntil',
},
{
kind: 'block',
type: 'controls_for',
inputs: {
FROM: {
shadow: {
type: 'math_number',
fields: {
NUM: 1,
},
},
},
TO: {
shadow: {
type: 'math_number',
fields: {
NUM: 10,
},
},
},
BY: {
shadow: {
type: 'math_number',
fields: {
NUM: 1,
},
},
},
},
},
{
kind: 'block',
type: 'controls_forEach',
},
{
kind: 'block',
type: 'controls_flow_statements',
},
],
},
{
kind: 'category',
name: 'Math',
categorystyle: 'math_category',
contents: [
{
kind: 'block',
type: 'math_number',
fields: {
NUM: 123,
},
},
{
kind: 'block',
type: 'math_arithmetic',
inputs: {
A: {
shadow: {
type: 'math_number',
fields: {
NUM: 1,
},
},
},
B: {
shadow: {
type: 'math_number',
fields: {
NUM: 1,
},
},
},
},
},
{
kind: 'block',
type: 'math_single',
inputs: {
NUM: {
shadow: {
type: 'math_number',
fields: {
NUM: 9,
},
},
},
},
},
{
kind: 'block',
type: 'math_trig',
inputs: {
NUM: {
shadow: {
type: 'math_number',
fields: {
NUM: 45,
},
},
},
},
},
{
kind: 'block',
type: 'math_constant',
},
{
kind: 'block',
type: 'math_number_property',
inputs: {
NUMBER_TO_CHECK: {
shadow: {
type: 'math_number',
fields: {
NUM: 0,
},
},
},
},
},
{
kind: 'block',
type: 'math_round',
fields: {
OP: 'ROUND',
},
inputs: {
NUM: {
shadow: {
type: 'math_number',
fields: {
NUM: 3.1,
},
},
},
},
},
{
kind: 'block',
type: 'math_on_list',
fields: {
OP: 'SUM',
},
},
{
kind: 'block',
type: 'math_modulo',
inputs: {
DIVIDEND: {
shadow: {
type: 'math_number',
fields: {
NUM: 64,
},
},
},
DIVISOR: {
shadow: {
type: 'math_number',
fields: {
NUM: 10,
},
},
},
},
},
{
kind: 'block',
type: 'math_constrain',
inputs: {
VALUE: {
shadow: {
type: 'math_number',
fields: {
NUM: 50,
},
},
},
LOW: {
shadow: {
type: 'math_number',
fields: {
NUM: 1,
},
},
},
HIGH: {
shadow: {
type: 'math_number',
fields: {
NUM: 100,
},
},
},
},
},
{
kind: 'block',
type: 'math_random_int',
inputs: {
FROM: {
shadow: {
type: 'math_number',
fields: {
NUM: 1,
},
},
},
TO: {
shadow: {
type: 'math_number',
fields: {
NUM: 100,
},
},
},
},
},
{
kind: 'block',
type: 'math_random_float',
},
{
kind: 'block',
type: 'math_atan2',
inputs: {
X: {
shadow: {
type: 'math_number',
fields: {
NUM: 1,
},
},
},
Y: {
shadow: {
type: 'math_number',
fields: {
NUM: 1,
},
},
},
},
},
],
},
{
kind: 'category',
name: 'Text',
categorystyle: 'text_category',
contents: [
{
kind: 'block',
type: 'text',
},
{
kind: 'block',
type: 'text_join',
},
{
kind: 'block',
type: 'text_append',
inputs: {
TEXT: {
shadow: {
type: 'text',
fields: {
TEXT: '',
},
},
},
},
},
{
kind: 'block',
type: 'text_length',
inputs: {
VALUE: {
shadow: {
type: 'text',
fields: {
TEXT: 'abc',
},
},
},
},
},
{
kind: 'block',
type: 'text_isEmpty',
inputs: {
VALUE: {
shadow: {
type: 'text',
fields: {
TEXT: '',
},
},
},
},
},
{
kind: 'block',
type: 'text_indexOf',
inputs: {
VALUE: {
block: {
type: 'variables_get',
},
},
FIND: {
shadow: {
type: 'text',
fields: {
TEXT: 'abc',
},
},
},
},
},
{
kind: 'block',
type: 'text_charAt',
inputs: {
VALUE: {
block: {
type: 'variables_get',
},
},
},
},
{
kind: 'block',
type: 'text_getSubstring',
inputs: {
STRING: {
block: {
type: 'variables_get',
},
},
},
},
{
kind: 'block',
type: 'text_changeCase',
inputs: {
TEXT: {
shadow: {
type: 'text',
fields: {
TEXT: 'abc',
},
},
},
},
},
{
kind: 'block',
type: 'text_trim',
inputs: {
TEXT: {
shadow: {
type: 'text',
fields: {
TEXT: 'abc',
},
},
},
},
},
{
kind: 'block',
type: 'text_count',
inputs: {
SUB: {
shadow: {
type: 'text',
},
},
TEXT: {
shadow: {
type: 'text',
},
},
},
},
{
kind: 'block',
type: 'text_replace',
inputs: {
FROM: {
shadow: {
type: 'text',
},
},
TO: {
shadow: {
type: 'text',
},
},
TEXT: {
shadow: {
type: 'text',
},
},
},
},
{
kind: 'block',
type: 'text_reverse',
inputs: {
TEXT: {
shadow: {
type: 'text',
},
},
},
},
{
kind: 'block',
type: 'add_text',
inputs: {
TEXT: {
shadow: {
type: 'text',
fields: {
TEXT: 'abc',
},
},
},
},
},
],
},
{
kind: 'category',
name: 'Lists',
categorystyle: 'list_category',
contents: [
{
kind: 'block',
type: 'lists_create_with',
},
{
kind: 'block',
type: 'lists_create_with',
},
{
kind: 'block',
type: 'lists_repeat',
inputs: {
NUM: {
shadow: {
type: 'math_number',
fields: {
NUM: 5,
},
},
},
},
},
{
kind: 'block',
type: 'lists_length',
},
{
kind: 'block',
type: 'lists_isEmpty',
},
{
kind: 'block',
type: 'lists_indexOf',
inputs: {
VALUE: {
block: {
type: 'variables_get',
},
},
},
},
{
kind: 'block',
type: 'lists_getIndex',
inputs: {
VALUE: {
block: {
type: 'variables_get',
},
},
},
},
{
kind: 'block',
type: 'lists_setIndex',
inputs: {
LIST: {
block: {
type: 'variables_get',
},
},
},
},
{
kind: 'block',
type: 'lists_getSublist',
inputs: {
LIST: {
block: {
type: 'variables_get',
},
},
},
},
{
kind: 'block',
type: 'lists_split',
inputs: {
DELIM: {
shadow: {
type: 'text',
fields: {
TEXT: ',',
},
},
},
},
},
{
kind: 'block',
type: 'lists_sort',
},
{
kind: 'block',
type: 'lists_reverse',
},
],
},
{
kind: 'sep',
},
{
kind: 'category',
name: 'Variables',
categorystyle: 'variable_category',
custom: 'VARIABLE',
},
{
kind: 'category',
name: 'Functions',
categorystyle: 'procedure_category',
custom: 'PROCEDURE',
},
],
};

View File

@ -0,0 +1,72 @@
export const category = {
kind: 'category',
name: 'Minecraft',
// categorystyle: 'minecraft_category',
colour: "#e08080",
contents: [
{
kind: 'block',
type: 'minecraft_command',
},
{
kind: 'block',
type: 'minecraft_echo',
},
{
kind: 'block',
type: 'minecraft_scheduler_run_later',
},
{
kind: 'block',
type: 'minecraft_block_set_cube',
},
{
kind: 'block',
type: 'minecraft_block_set_cylinder',
},
{
kind: 'block',
type: 'minecraft_block_set',
},
{
kind: 'block',
type: 'minecraft_block_get',
},
{
kind: 'block',
type: 'minecraft_block_power',
},
{
kind: 'block',
type: 'minecraft_xyz_location',
},
{
kind: 'block',
type: 'minecraft_player_location',
},
{
kind: 'block',
type: 'minecraft_player_look_at_location',
},
{
kind: 'block',
type: 'minecraft_named_material',
},
{
kind: 'block',
type: 'minecraft_location_move',
},
{
kind: 'block',
type: 'minecraft_location_move_forward',
},
{
kind: 'block',
type: 'minecraft_location_look',
},
{
kind: 'block',
type: 'minecraft_location_turn',
},
],
};

13
client/tsconfig.json Normal file
View File

@ -0,0 +1,13 @@
{
"compilerOptions": {
"baseUrl": "./",
"outDir": "dist",
"declaration": true,
"declarationMap": true,
"module": "ES2015",
"moduleResolution": "node",
"target": "ES2015",
"strict": true,
"allowSyntheticDefaultImports": true
}
}

73
client/webpack.config.js Normal file
View File

@ -0,0 +1,73 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
// Base config that applies to either development or production mode.
const config = {
entry: './src/index.ts',
watch: true,
watchOptions: {
aggregateTimeout: 200,
poll: 1000,
ignored: '**/node_modules',
},
output: {
// Compile the source files into a bundle.
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
clean: true,
},
// Enable webpack-dev-server to get hot refresh of the app.
devServer: {
static: './build',
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
// Load CSS files. They can be imported into JS files.
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
plugins: [
// Generate the HTML index page based on our template.
// This will output the same index page with the bundle we
// created above added in a script tag.
new HtmlWebpackPlugin({
template: 'src/index.html',
}),
],
};
module.exports = (env, argv) => {
if (argv.mode === 'development') {
// Set the output path to the `build` directory
// so we don't clobber production builds.
config.output.path = path.resolve(__dirname, 'build');
// Generate source maps for our code for easier debugging.
// Not suitable for production builds. If you want source maps in
// production, choose a different one from https://webpack.js.org/configuration/devtool
config.devtool = 'eval-cheap-module-source-map';
// Include the source maps for Blockly for easier debugging Blockly code.
config.module.rules.push({
test: /(blockly\/.*\.js)$/,
use: [require.resolve('source-map-loader')],
enforce: 'pre',
});
// Ignore spurious warnings from source-map-loader
// It can't find source maps for some Closure modules and that is expected
config.ignoreWarnings = [/Failed to parse source map/];
}
return config;
};

780
server/package-lock.json generated Normal file
View File

@ -0,0 +1,780 @@
{
"name": "server",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "server",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"body-parser": "^2.2.0",
"cors": "^2.8.5",
"express": "^5.1.0"
}
},
"node_modules/accepts": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",
"integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==",
"dependencies": {
"mime-types": "^3.0.0",
"negotiator": "^1.0.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/body-parser": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.0.tgz",
"integrity": "sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg==",
"dependencies": {
"bytes": "^3.1.2",
"content-type": "^1.0.5",
"debug": "^4.4.0",
"http-errors": "^2.0.0",
"iconv-lite": "^0.6.3",
"on-finished": "^2.4.1",
"qs": "^6.14.0",
"raw-body": "^3.0.0",
"type-is": "^2.0.0"
},
"engines": {
"node": ">=18"
}
},
"node_modules/bytes": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/call-bind-apply-helpers": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
"dependencies": {
"es-errors": "^1.3.0",
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/call-bound": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
"get-intrinsic": "^1.3.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/content-disposition": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.0.tgz",
"integrity": "sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg==",
"dependencies": {
"safe-buffer": "5.2.1"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/content-type": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie": {
"version": "0.7.2",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie-signature": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz",
"integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==",
"engines": {
"node": ">=6.6.0"
}
},
"node_modules/cors": {
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
"dependencies": {
"object-assign": "^4",
"vary": "^1"
},
"engines": {
"node": ">= 0.10"
}
},
"node_modules/debug": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz",
"integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==",
"dependencies": {
"ms": "^2.1.3"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
"dependencies": {
"call-bind-apply-helpers": "^1.0.1",
"es-errors": "^1.3.0",
"gopd": "^1.2.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
},
"node_modules/encodeurl": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
"integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/es-define-property": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-errors": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-object-atoms": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
"dependencies": {
"es-errors": "^1.3.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
},
"node_modules/etag": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/express": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz",
"integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==",
"dependencies": {
"accepts": "^2.0.0",
"body-parser": "^2.2.0",
"content-disposition": "^1.0.0",
"content-type": "^1.0.5",
"cookie": "^0.7.1",
"cookie-signature": "^1.2.1",
"debug": "^4.4.0",
"encodeurl": "^2.0.0",
"escape-html": "^1.0.3",
"etag": "^1.8.1",
"finalhandler": "^2.1.0",
"fresh": "^2.0.0",
"http-errors": "^2.0.0",
"merge-descriptors": "^2.0.0",
"mime-types": "^3.0.0",
"on-finished": "^2.4.1",
"once": "^1.4.0",
"parseurl": "^1.3.3",
"proxy-addr": "^2.0.7",
"qs": "^6.14.0",
"range-parser": "^1.2.1",
"router": "^2.2.0",
"send": "^1.1.0",
"serve-static": "^2.2.0",
"statuses": "^2.0.1",
"type-is": "^2.0.1",
"vary": "^1.1.2"
},
"engines": {
"node": ">= 18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/finalhandler": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.0.tgz",
"integrity": "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==",
"dependencies": {
"debug": "^4.4.0",
"encodeurl": "^2.0.0",
"escape-html": "^1.0.3",
"on-finished": "^2.4.1",
"parseurl": "^1.3.3",
"statuses": "^2.0.1"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/forwarded": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/fresh": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz",
"integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/function-bind": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-intrinsic": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
"es-define-property": "^1.0.1",
"es-errors": "^1.3.0",
"es-object-atoms": "^1.1.1",
"function-bind": "^1.1.2",
"get-proto": "^1.0.1",
"gopd": "^1.2.0",
"has-symbols": "^1.1.0",
"hasown": "^2.0.2",
"math-intrinsics": "^1.1.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
"dependencies": {
"dunder-proto": "^1.0.1",
"es-object-atoms": "^1.0.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/gopd": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-symbols": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/hasown": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
"dependencies": {
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/http-errors": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
"integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
"dependencies": {
"depd": "2.0.0",
"inherits": "2.0.4",
"setprototypeof": "1.2.0",
"statuses": "2.0.1",
"toidentifier": "1.0.1"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/http-errors/node_modules/statuses": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/iconv-lite": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"node_modules/ipaddr.js": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
"engines": {
"node": ">= 0.10"
}
},
"node_modules/is-promise": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="
},
"node_modules/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/media-typer": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz",
"integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/merge-descriptors": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz",
"integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/mime-db": {
"version": "1.54.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",
"integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.1.tgz",
"integrity": "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==",
"dependencies": {
"mime-db": "^1.54.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
},
"node_modules/negotiator": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz",
"integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/object-inspect": {
"version": "1.13.4",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/on-finished": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
"dependencies": {
"ee-first": "1.1.1"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"dependencies": {
"wrappy": "1"
}
},
"node_modules/parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/path-to-regexp": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.2.0.tgz",
"integrity": "sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ==",
"engines": {
"node": ">=16"
}
},
"node_modules/proxy-addr": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
"dependencies": {
"forwarded": "0.2.0",
"ipaddr.js": "1.9.1"
},
"engines": {
"node": ">= 0.10"
}
},
"node_modules/qs": {
"version": "6.14.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz",
"integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==",
"dependencies": {
"side-channel": "^1.1.0"
},
"engines": {
"node": ">=0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/range-parser": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/raw-body": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.0.tgz",
"integrity": "sha512-RmkhL8CAyCRPXCE28MMH0z2PNWQBNk2Q09ZdxM9IOOXwxwZbN+qbWaatPkdkWIKL2ZVDImrN/pK5HTRz2PcS4g==",
"dependencies": {
"bytes": "3.1.2",
"http-errors": "2.0.0",
"iconv-lite": "0.6.3",
"unpipe": "1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/router": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",
"integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==",
"dependencies": {
"debug": "^4.4.0",
"depd": "^2.0.0",
"is-promise": "^4.0.0",
"parseurl": "^1.3.3",
"path-to-regexp": "^8.0.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
]
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"node_modules/send": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/send/-/send-1.2.0.tgz",
"integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==",
"dependencies": {
"debug": "^4.3.5",
"encodeurl": "^2.0.0",
"escape-html": "^1.0.3",
"etag": "^1.8.1",
"fresh": "^2.0.0",
"http-errors": "^2.0.0",
"mime-types": "^3.0.1",
"ms": "^2.1.3",
"on-finished": "^2.4.1",
"range-parser": "^1.2.1",
"statuses": "^2.0.1"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/serve-static": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz",
"integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==",
"dependencies": {
"encodeurl": "^2.0.0",
"escape-html": "^1.0.3",
"parseurl": "^1.3.3",
"send": "^1.2.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
},
"node_modules/side-channel": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
"integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
"dependencies": {
"es-errors": "^1.3.0",
"object-inspect": "^1.13.3",
"side-channel-list": "^1.0.0",
"side-channel-map": "^1.0.1",
"side-channel-weakmap": "^1.0.2"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-list": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz",
"integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",
"dependencies": {
"es-errors": "^1.3.0",
"object-inspect": "^1.13.3"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-map": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
"dependencies": {
"call-bound": "^1.0.2",
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.5",
"object-inspect": "^1.13.3"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-weakmap": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
"dependencies": {
"call-bound": "^1.0.2",
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.5",
"object-inspect": "^1.13.3",
"side-channel-map": "^1.0.1"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/statuses": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/toidentifier": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
"engines": {
"node": ">=0.6"
}
},
"node_modules/type-is": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz",
"integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==",
"dependencies": {
"content-type": "^1.0.5",
"media-typer": "^1.1.0",
"mime-types": "^3.0.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
}
}
}

18
server/package.json Normal file
View File

@ -0,0 +1,18 @@
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "tsx src/index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^2.2.0",
"cors": "^2.8.5",
"express": "^5.1.0"
}
}

23
server/src/index.ts Normal file
View File

@ -0,0 +1,23 @@
// Importing express module
import express from "express";
import bodyParser from 'body-parser';
import cors from 'cors';
import * as fs from 'fs';
const app = express();
app.use(cors())
app.use(bodyParser.text());
// Handling GET / request
app.post("/set/:file", (req, res) => {
fs.writeFileSync(`/home/anton/minecraft_scriptcraft/scriptcraft/plugins/blocklycraft/aggtaa/${req.params.file}.js`, req.body, 'utf-8');
// res.send("This is the express server " + JSON.stringify(req.body));
res.send('');
});
app.listen(8081, () => {
console.log("Server is Running");
});