From b417a77ebc9946226a6b2b234da60c7829941ddc Mon Sep 17 00:00:00 2001 From: Stuyk Date: Fri, 14 Jun 2024 14:24:50 -0600 Subject: [PATCH] feat: vscode transmitter extensions upport (#57) --- .gitignore | 1 + docs/changelog.md | 13 +++++ docs/static/transmitter-example.png | Bin 0 -> 15369 bytes docs/vscode-transmitter.md | 13 +++++ package.json | 5 +- src/main/client/startup.ts | 1 + src/main/client/system/vscodeTransmitter.ts | 13 +++++ src/main/server/startup.ts | 1 + src/main/server/systems/vscodeTransmitter.ts | 58 +++++++++++++++++++ src/main/shared/events/index.ts | 3 + src/scratchpad/.gitkeep | 0 src/scratchpad/README.md | 13 +++++ src/scratchpad/clientExample.pad | 4 ++ src/scratchpad/serverExample.pad | 5 ++ tsconfig.json | 9 ++- 15 files changed, 136 insertions(+), 3 deletions(-) create mode 100644 docs/static/transmitter-example.png create mode 100644 docs/vscode-transmitter.md create mode 100644 src/main/client/system/vscodeTransmitter.ts create mode 100644 src/main/server/systems/vscodeTransmitter.ts create mode 100644 src/scratchpad/.gitkeep create mode 100644 src/scratchpad/README.md create mode 100644 src/scratchpad/clientExample.pad create mode 100644 src/scratchpad/serverExample.pad diff --git a/.gitignore b/.gitignore index 0a504dc59..6668933f4 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ webview/pages/plugins.ts .env test/ tmp/ +src/scratchpad/*.ts src/plugins/sandbox-* diff --git a/docs/changelog.md b/docs/changelog.md index eae84a0c4..30810917b 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,18 @@ # Changelog +## Version 30 + +### Code Changes + +- Added a `vscode transmitter` for debug mode server and client. + - Allows for code to be executed from VSCode using the Rebar Transmitter + +### Docs Changes + +- Added vscode transmitter extension page + +--- + ## Version 29 ### Code Changes diff --git a/docs/static/transmitter-example.png b/docs/static/transmitter-example.png new file mode 100644 index 0000000000000000000000000000000000000000..52cb3f58bfdad35c3514d045a4ce5f7a168807df GIT binary patch literal 15369 zcmd6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?rZdiILq!V6z)0Ag=nXN~LPK>xl`!iKPC^SjM~Q3$dGW7*n_ z5Y1J3XGwIJa7NCJus?J)rQiMS_wT5RS?%h?e{O%2$>8QiiTK^gd%wEa@H#h%3^0Gw zFF!D$nyl6aFI0YSz^Y*^#sA$~bP=WD|7FwrSVj+iWm96BBlw|vrrYX22%bM}bE@RT H_51$^cuVGa literal 0 HcmV?d00001 diff --git a/docs/vscode-transmitter.md b/docs/vscode-transmitter.md new file mode 100644 index 000000000..d1779567b --- /dev/null +++ b/docs/vscode-transmitter.md @@ -0,0 +1,13 @@ +# VSCode Transmitter Extension + +Rebar has built in support for the `Rebar Transmitter` extension. + +This allows you to open a scratchpad under `src/scratchpad` and write code. + +Once the code is written you can `SELECT THE CODE WITH YOUR CURSOR` and then right-click to execute it while the server is running. + +![](./static/transmitter-example.png) + +## Download + +[https://marketplace.visualstudio.com/items?itemName=stuyk.rebar-transmitter](https://marketplace.visualstudio.com/items?itemName=stuyk.rebar-transmitter) diff --git a/package.json b/package.json index 1bef17953..524d47386 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "author": "stuyk", "type": "module", - "version": "29", + "version": "30", "scripts": { "dev": "nodemon -x pnpm start", "dev:linux": "nodemon -x pnpm start:linux", @@ -67,7 +67,8 @@ "*.mjs", "ignore*.ts", "autogen*.ts", - "webview/src/main.ts" + "webview/src/main.ts", + "src/scratchpad" ] } } diff --git a/src/main/client/startup.ts b/src/main/client/startup.ts index 7a022fa57..dd7afdb58 100644 --- a/src/main/client/startup.ts +++ b/src/main/client/startup.ts @@ -8,6 +8,7 @@ import './player/controls.js'; import './rmlui/index.js'; import './screen/index.js'; import './system/index.js'; +import './system/vscodeTransmitter.js'; import './virtualEntities/index.js'; import { useWebview } from './webview/index.js'; diff --git a/src/main/client/system/vscodeTransmitter.ts b/src/main/client/system/vscodeTransmitter.ts new file mode 100644 index 000000000..e65a5f39f --- /dev/null +++ b/src/main/client/system/vscodeTransmitter.ts @@ -0,0 +1,13 @@ +import alt from 'alt-client'; +import native from 'natives'; +import { Events } from '../../shared/events/index.js'; + +const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor; + +function handleCode(code: string) { + new AsyncFunction('alt', 'native', 'natives', 'game', code)(alt, native, native, native); +} + +if (alt.debug) { + alt.onServer(Events.systems.transmitter.execute, handleCode); +} diff --git a/src/main/server/startup.ts b/src/main/server/startup.ts index d7350ffb8..178883921 100644 --- a/src/main/server/startup.ts +++ b/src/main/server/startup.ts @@ -4,6 +4,7 @@ import '../translate/index.js'; import { useTranslate } from '@Shared/translate.js'; import { useConfig } from './config/index.js'; import { useDatabase } from './database/index.js'; +import './systems/vscodeTransmitter.js'; const config = useConfig(); const database = useDatabase(); diff --git a/src/main/server/systems/vscodeTransmitter.ts b/src/main/server/systems/vscodeTransmitter.ts new file mode 100644 index 000000000..8ce39fd25 --- /dev/null +++ b/src/main/server/systems/vscodeTransmitter.ts @@ -0,0 +1,58 @@ +import * as alt from 'alt-server'; +import { useRebar } from '@Server/index.js'; +import http from 'http'; +import { Events } from '../../shared/events/index.js'; + +const Rebar = useRebar(); +const PORT = 9269; +const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor; + +if (alt.debug) { + const server = http.createServer((req, res) => { + if (req.method !== 'POST') { + res.writeHead(405, { 'Content-Type': 'text/plain' }); + res.end('Must be a POST request \n'); + return; + } + + let body = ''; + req.on('data', (chunk) => { + body += chunk.toString(); + }); + + req.on('end', async () => { + if (req.url === '/server') { + await new AsyncFunction('alt', 'console', 'Rebar', body)( + { ...alt }, + { + ...console, + }, + { ...Rebar }, + ); + res.writeHead(200, { 'Content-Type': 'text/plain' }); + res.end('Code Executed on Server \n'); + return; + } + + if (alt.Player.all.length <= 0) { + res.writeHead(200, { 'Content-Type': 'text/plain' }); + res.end('No players on server to execute code against \n'); + return; + } + + for (let player of alt.Player.all) { + if (!player || !player.valid) { + return; + } + + player.emit(Events.systems.transmitter.execute, body); + } + + res.writeHead(200, { 'Content-Type': 'text/plain' }); + res.end('Code Executed on Client \n'); + return; + }); + }); + + server.listen(PORT); +} diff --git a/src/main/shared/events/index.ts b/src/main/shared/events/index.ts index f2b86068d..e3a8dd8ea 100644 --- a/src/main/shared/events/index.ts +++ b/src/main/shared/events/index.ts @@ -108,6 +108,9 @@ export const Events = { serverConfig: { set: 'systems:server:config:set', }, + transmitter: { + execute: 'systems:transmitter:execute', + }, }, view: { onServer: 'webview:on:server', diff --git a/src/scratchpad/.gitkeep b/src/scratchpad/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/src/scratchpad/README.md b/src/scratchpad/README.md new file mode 100644 index 000000000..35cbe828f --- /dev/null +++ b/src/scratchpad/README.md @@ -0,0 +1,13 @@ +# Scratchpad + +Files in here will not be transpiled. + +You can create as many as you want and they'll safely be ignored. + +Pair your scratchpad with the Rebar Transmitter VSCode extension. + +## Transmitter Usage + +When selecting code, make sure not to select imports. + +Selecting imports will prevent your code from executing. diff --git a/src/scratchpad/clientExample.pad b/src/scratchpad/clientExample.pad new file mode 100644 index 000000000..def8f06d5 --- /dev/null +++ b/src/scratchpad/clientExample.pad @@ -0,0 +1,4 @@ +import * as alt from 'alt-client'; +import * as native from 'natives'; + +// Execute anything below this line diff --git a/src/scratchpad/serverExample.pad b/src/scratchpad/serverExample.pad new file mode 100644 index 000000000..9f559f398 --- /dev/null +++ b/src/scratchpad/serverExample.pad @@ -0,0 +1,5 @@ +import * as alt from 'alt-server'; +import { useRebar } from '../main/server/index.js'; + +const Rebar = useRebar(); +// Execute anything below this line diff --git a/tsconfig.json b/tsconfig.json index cd716c8b1..4d0c2582f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -31,7 +31,14 @@ "declaration": true, "emitDeclarationOnly": false }, - "include": ["src/**/*.ts", "src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"], + "include": [ + "src/**/*.ts", + "src/**/*.ts", + "src/**/*.d.ts", + "src/**/*.tsx", + "src/**/*.vue", + "src/scratchpad/example.pad" + ], "exclude": [ "resources", "scripts",