diff --git a/package.json b/package.json index 06e75a5dd..c20c74153 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webgal-terre", - "version": "4.4.8", + "version": "4.4.9", "private": true, "scripts": { "dev": "concurrently \"yarn dev:terre\" \"yarn dev:origine\" \"yarn dev:start-dev-server\"", diff --git a/packages/dev-server/index.js b/packages/dev-server/index.js index d9c9be64d..200248dee 100644 --- a/packages/dev-server/index.js +++ b/packages/dev-server/index.js @@ -1,12 +1,17 @@ const express = require("express"); const { createProxyMiddleware } = require("http-proxy-middleware"); +const { env } = require("process") + const app = express(); app.set("port", "80"); -app.all("*", function(req, res, next) { +app.all("*", function (req, res, next) { // 解决跨域问题 res.header("Access-Control-Allow-Origin", "*"); - res.header("Access-Control-Allow-Headers", "Content-Type,Content-Length, Authorization, Accept,X-Requested-With"); + res.header( + "Access-Control-Allow-Headers", + "Content-Type,Content-Length, Authorization, Accept,X-Requested-With" + ); res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS"); if (req.method === "OPTIONS") { res.send(200); @@ -15,21 +20,32 @@ app.all("*", function(req, res, next) { } }); -app.use(createProxyMiddleware("/api", { - target: "http://localhost:3001",// http代理跨域目标接口 - changeOrigin: true -})); +let WEBGAL_PORT = 3000; // default port +if (env.WEBGAL_PORT) { + WEBGAL_PORT = Number.parseInt(env.WEBGAL_PORT); +} + +app.use( + createProxyMiddleware("/api", { + target: `http://localhost:${WEBGAL_PORT + 1}`, // http代理跨域目标接口 + changeOrigin: true, + }) +); -app.use(createProxyMiddleware("/games", { - target: "http://localhost:3001",// http代理跨域目标接口 - changeOrigin: true, -})); +app.use( + createProxyMiddleware("/games", { + target: `http://localhost:${WEBGAL_PORT + 1}`, // http代理跨域目标接口 + changeOrigin: true, + }) +); -app.use(createProxyMiddleware("/", { - target: "http://localhost:3000",// http代理跨域目标接口 - ws:true, - changeOrigin: true -})); +app.use( + createProxyMiddleware("/", { + target: `http://localhost:${WEBGAL_PORT}`, // http代理跨域目标接口 + ws: true, + changeOrigin: true, + }) +); app.listen(app.get("port"), () => { console.log(`反向代理已开启,端口:${app.get("port")}`); diff --git a/packages/origine2/openapi.ts b/packages/origine2/openapi.ts index 084d1c9f1..3f40b6974 100644 --- a/packages/origine2/openapi.ts +++ b/packages/origine2/openapi.ts @@ -4,9 +4,15 @@ import axios from 'axios'; import {writeFileSync} from 'fs'; -import { exec } from 'child_process'; +import { exec } from 'child_process' +import { env } from 'process'; -const SWAGGER_URL = 'http://localhost:3001/api-json'; +let WEBGAL_PORT = 3000; // default port +if (env.WEBGAL_PORT) { + WEBGAL_PORT = Number.parseInt(env.WEBGAL_PORT); +}; + +const SWAGGER_URL = `http://localhost:${WEBGAL_PORT + 1}/api-json`; const SWAGGER_JSON_PATH = './src/config/swagger.json'; const API_OUTPUT_PATH = './src/api'; diff --git a/packages/origine2/package.json b/packages/origine2/package.json index ec3240466..8f98e0f81 100644 --- a/packages/origine2/package.json +++ b/packages/origine2/package.json @@ -1,10 +1,10 @@ { "name": "webgal-origine-2", "private": true, - "version": "4.4.8", + "version": "4.4.9", "license": "MPL-2.0", "scripts": { - "dev": "vite --port=3000 --host", + "dev": "vite --host", "build": "node version-sync.js && tsc && vite build --base=./", "build-lowram": "node version-sync.js && tsc && node --max_old_space_size=512000 ./node_modules/bin/vite build --base=./", "preview": "vite preview", @@ -13,6 +13,8 @@ }, "dependencies": { "@fluentui/react": "^8.77.3", + "@fluentui/react-components": "^9.44.1", + "@fluentui/react-icons": "^2.0.224", "@fluentui/react-icons-mdl2": "^1.3.41", "@icon-park/react": "^1.4.2", "@monaco-editor/react": "^4.4.5", diff --git a/packages/origine2/src/App.css b/packages/origine2/src/App.css index 9f450a33d..f74f5f48c 100644 --- a/packages/origine2/src/App.css +++ b/packages/origine2/src/App.css @@ -1,5 +1,8 @@ .App { text-align: center; + background-color: #fafafa; + width: 100%; + height: 100%; } .App-logo { diff --git a/packages/origine2/src/App.tsx b/packages/origine2/src/App.tsx index 7ac2f8cd3..6ce7071af 100644 --- a/packages/origine2/src/App.tsx +++ b/packages/origine2/src/App.tsx @@ -51,9 +51,10 @@ function App() { }, triggerCharacters: ["-", "", ":", "\n"] }); }); + return ( // 将编辑器的根元素占满整个视口 -
{t('about.slogan')}
{t('about.currentVersion')}: {`${__INFO.version} (${new Date(__INFO.buildTime).toLocaleString('zh-CN', dateTimeOptions).replaceAll('/', '-')})`}{ isNewRelease && - + {t('about.downloadLatest')} } @@ -109,20 +99,20 @@ const About: React.FunctionComponent = () => {