From 3981777a0576b63d151724214a935166ff7d05d5 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Sat, 21 Dec 2024 20:23:44 -0300 Subject: [PATCH] new(online.gbui): UI OK. --- package.json | 1 + packages/core.gbapp/services/GBDeployer.ts | 2 +- packages/core.gbapp/services/GBMinService.ts | 11 +- packages/default.gbui/aggregated_code.md | 1961 +++++++++++++++++ packages/default.gbui/public/favicon.ico | Bin 693 -> 0 bytes .../default.gbui/public/images/logo-gb.png | Bin 1451 -> 0 bytes .../public/images/pragmatismo-logo.png | Bin 17074 -> 0 bytes .../public/images/pragmatismo-powered-by.png | Bin 6614 -> 0 bytes packages/default.gbui/public/js/webchat.js | 2 - 9 files changed, 1972 insertions(+), 5 deletions(-) create mode 100644 packages/default.gbui/aggregated_code.md delete mode 100644 packages/default.gbui/public/favicon.ico delete mode 100644 packages/default.gbui/public/images/logo-gb.png delete mode 100644 packages/default.gbui/public/images/pragmatismo-logo.png delete mode 100644 packages/default.gbui/public/images/pragmatismo-powered-by.png delete mode 100644 packages/default.gbui/public/js/webchat.js diff --git a/package.json b/package.json index f9aad051..ed6d8227 100644 --- a/package.json +++ b/package.json @@ -130,6 +130,7 @@ "cli-progress": "3.12.0", "cli-spinner": "0.2.10", "core-js": "3.38.1", + "cors": "2.8.5", "csv-database": "0.9.2", "data-forge": "1.10.2", "date-diff": "1.0.2", diff --git a/packages/core.gbapp/services/GBDeployer.ts b/packages/core.gbapp/services/GBDeployer.ts index fbef4fc6..43344b50 100644 --- a/packages/core.gbapp/services/GBDeployer.ts +++ b/packages/core.gbapp/services/GBDeployer.ts @@ -559,7 +559,7 @@ export class GBDeployer implements IGBDeployer { } if (download) { - GBLogEx.verbose(min, `Downloading ${itemPath}...`); + GBLogEx.info(min, `Downloading: ${itemPath}...`); const url = item['@microsoft.graph.downloadUrl']; const response = await fetch(url); diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index f774fd64..e2cedfe0 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -39,6 +39,7 @@ import arrayBufferToBuffer from 'arraybuffer-to-buffer'; import { Semaphore } from 'async-mutex'; import { Mutex } from 'async-mutex'; import chokidar from 'chokidar'; +import cors from 'cors'; import { AutoSaveStateMiddleware, BotFrameworkAdapter, @@ -158,11 +159,17 @@ export class GBMinService { public async buildMin(instances: IGBInstance[]): Promise { // Servers default UI on root address '/' if web enabled. - if (process.env.DISABLE_WEB !== 'true') { + if (process.env.DISABLE_WEB !== 'true' || process.env.ENABLE_INSTANCE_ON_URL) { // Servers the bot information object via HTTP so clients can get // instance information stored on server. - + GBServer.globals.server.use(cors({ + origin: 'http://localhost:8081', + methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'], + allowedHeaders: ['Content-Type', 'Authorization', 'x-requested-with' + , 'x-ms-bot-agent' + ] + })); GBServer.globals.server.get('/instances/:botId', this.handleGetInstanceForClient.bind(this)); } diff --git a/packages/default.gbui/aggregated_code.md b/packages/default.gbui/aggregated_code.md new file mode 100644 index 00000000..3d81aebe --- /dev/null +++ b/packages/default.gbui/aggregated_code.md @@ -0,0 +1,1961 @@ +```sh ./a.sh +#!/bin/bash + +# Help message function +show_help() { + echo "Usage: $0 [directory] [output_file]" + echo + echo "Aggregates code files into a single markdown file with code blocks" + echo + echo "Arguments:" + echo " directory Directory to scan for code files (default: current directory)" + echo " output_file Output file name (default: aggregated_code.md)" + echo + echo "Example:" + echo " $0 ./my_project output.md" +} + +# Default values +dir="${1:-.}" +output_file="${2:-aggregated_code.md}" + +# Show help if requested +if [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then + show_help + exit 0 +fi + +# Check if directory exists +if [ ! -d "$dir" ]; then + echo "Error: Directory '$dir' not found!" + exit 1 +fi + +# Clear or create output file +> "$output_file" + +# Find and process files +find "$dir" -type f \( -name "*.py" -o -name "*.js" -o -name "*.ts" -o -name "*.jsx" -o -name "*.tsx" -o -name "*.html" -o -name "*.css" -o -name "*.java" -o -name "*.cpp" -o -name "*.c" -o -name "*.sh" \) | while read -r file; do + # Get the file extension + ext="${file##*.}" + + # Add the markdown code block header + echo -e "\`\`\`$ext $file" >> "$output_file" + + # Add the file content + cat "$file" >> "$output_file" + + # Add the closing code block + echo -e "\`\`\`\n" >> "$output_file" +done + +echo "Files have been aggregated into $output_file"``` + +```html ./public/index.html + + + + + + + + + + + + {title} | General Bots + + + + +
+ + +``` + +```js ./src/players/GBUrlPlayer.js +/*****************************************************************************\ +| █████ █████ ██ █ █████ █████ ████ ██ ████ █████ █████ ███ ® | +| ██ █ ███ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ | +| ██ ███ ████ █ ██ █ ████ █████ ██████ ██ ████ █ █ █ ██ | +| ██ ██ █ █ ██ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ | +| █████ █████ █ ███ █████ ██ ██ ██ ██ █████ ████ █████ █ ███ | +| | +| General Bots Copyright (c) pragmatismo.cloud. All rights reserved. | +| Licensed under the AGPL-3.0. | +| | +| According to our dual licensing model, this program can be used either | +| under the terms of the GNU Affero General Public License, version 3, | +| or under a proprietary license. | +| | +| The texts of the GNU Affero General Public License with an additional | +| permission and of our proprietary license can be found at and | +| in the LICENSE file you have received along with this program. | +| | +| This program is distributed in the hope that it will be useful, | +| but WITHOUT ANY WARRANTY; without even the implied warranty of | +| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | +| GNU Affero General Public License for more details. | +| | +| "General Bots" is a registered trademark of pragmatismo.cloud. | +| The licensing of the program under the AGPLv3 does not imply a | +| trademark license. Therefore any rights, title and interest in | +| our trademarks remain entirely with us. | +| | +\*****************************************************************************/ + +import React, { Component } from "react"; + +class GBUrlPlayer extends Component { + constructor() { + super(); + this.state = { + src: "" + }; + } + + play(url) { + this.setState({ src: url }); + } + + stop() { + this.setState({ src: "" }); + } + render() { + return ( +
+