Skip to content

Commit

Permalink
Merge pull request #339 from OpenWebGAL/dev
Browse files Browse the repository at this point in the history
4.5.10
  • Loading branch information
MakinoharaShoko authored Nov 17, 2024
2 parents 0300a39 + 88de0e5 commit fc4c720
Show file tree
Hide file tree
Showing 56 changed files with 2,170 additions and 954 deletions.
4 changes: 2 additions & 2 deletions installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

; 常量
!define NAME "WebGal_Terre"
!define VERSION "4.4.3.1" ; 版本号变量
!define VERSION "4.5.10" ; 版本号变量
!define PRODUCT_VERSION "${VERSION}.0"
!define COPYRIGHT "Mahiru - https://github.com/MakinoharaShoko" ; 版权信息
!define ICON_PATH ".\assets\nsis.ico"
Expand All @@ -25,7 +25,7 @@ Icon "${ICON_PATH}"
!define MUI_UNICON "${ICON_PATH}"
!define MUI_ABORTWARNING ; 退出时警告
; 默认安装路径
InstallDir "$PROGRAMFILES\${NAME}"
InstallDir "$LOCALAPPDATA\${NAME}"

; 版本信息
VIAddVersionKey ProductName "${NAME} Installer" ; product name
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webgal-terre",
"version": "4.5.9",
"version": "4.5.10",
"private": true,
"scripts": {
"dev": "concurrently \"yarn dev:terre\" \"yarn dev:origine\" \"yarn dev:start-dev-server\"",
Expand Down
5 changes: 4 additions & 1 deletion packages/origine2/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "webgal-origine-2",
"private": true,
"version": "4.5.9",
"version": "4.5.10",
"license": "MPL-2.0",
"scripts": {
"dev": "lingui extract && lingui compile --typescript && vite --host",
Expand All @@ -28,6 +28,7 @@
"@fluentui/react-components": "^9.44.1",
"@fluentui/react-icons": "^2.0.224",
"@fluentui/react-icons-mdl2": "^1.3.41",
"@fluentui/react-list-preview": "^0.4.0",
"@icon-park/react": "^1.4.2",
"@lingui/macro": "^4.8.0",
"@lingui/react": "^4.8.0",
Expand All @@ -44,6 +45,7 @@
"monaco-editor-wrapper": "~4.2.1",
"monaco-languageclient": "~8.3.1",
"monaco-textmate": "^3.0.1",
"natural-compare-lite": "^1.4.0",
"onigasm": "^2.2.5",
"primereact": "^9.5.0",
"react": "^18.0.0",
Expand All @@ -58,6 +60,7 @@
"@lingui/cli": "^4.8.0",
"@lingui/vite-plugin": "^4.8.0",
"@types/lodash": "^4.14.182",
"@types/natural-compare-lite": "^1.4.2",
"@types/react": "^18.0.0",
"@types/react-beautiful-dnd": "^13.1.2",
"@types/react-dom": "^18.0.0",
Expand Down
113 changes: 75 additions & 38 deletions packages/origine2/src/api/Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@
* ---------------------------------------------------------------
*/

export interface CompletionDto {
/** Editor input value for which the completion is required */
editorValue: string;
/** Parameters required for completion */
params: object;
}

export interface CreateNewFileDto {
/** The source path where the directory will be created */
source: string;
Expand Down Expand Up @@ -54,6 +47,26 @@ export interface EditTextFileDto {
textFile: string;
}

export interface TemplateConfigDto {
/** The name of the template */
name: string;
/** The id of the template */
id: string;
/** The webgal version of the template */
'webgal-version': string;
}

export interface GameInfoDto {
/** The name of the game */
name: string;
/** The dir of the game */
dir: string;
/** The cover of the game */
cover: string;
/** The template config of the game */
template: TemplateConfigDto;
}

export interface CreateGameDto {
/** The name of the game to be created */
gameName: string;
Expand Down Expand Up @@ -120,16 +133,36 @@ export interface RenameDto {
newName: string;
}

export interface TemplateInfoDto {
/** The name of the template */
name: string;
/** The id of the template */
id: string;
/** The webgal version of the template */
'webgal-version': string;
/** The dir of the template */
dir: string;
}

export interface CreateTemplateDto {
/** The name of the template to be created */
templateName: string;
/** The dir of the template */
templateDir: string;
}

export interface UpdateTemplateConfigDto {
/** The dir of the template */
templateDir: string;
/** The new config of the template */
newTemplateConfig: TemplateConfigDto;
}

export interface ApplyTemplateToGameDto {
/** The template name to apply */
templateName: string;
templateDir: string;
/** The game name to be applied. */
gameName: string;
gameDir: string;
}

export interface GetStyleByClassNameDto {
Expand Down Expand Up @@ -293,23 +326,6 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
...params,
}),

/**
* No description
*
* @tags LSP
* @name LspControllerCompile
* @summary Get code completions based on given input
* @request POST:/api/lsp/compile
*/
lspControllerCompile: (data: CompletionDto, params: RequestParams = {}) =>
this.request<void, void>({
path: `/api/lsp/compile`,
method: 'POST',
body: data,
type: ContentType.Json,
...params,
}),

/**
* No description
*
Expand Down Expand Up @@ -451,9 +467,10 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @request GET:/api/manageGame/gameList
*/
manageGameControllerGetGameList: (params: RequestParams = {}) =>
this.request<void, any>({
this.request<GameInfoDto[], any>({
path: `/api/manageGame/gameList`,
method: 'GET',
format: 'json',
...params,
}),

Expand Down Expand Up @@ -780,9 +797,10 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @request GET:/api/manageTemplate/templateList
*/
manageTemplateControllerGetTemplateList: (params: RequestParams = {}) =>
this.request<void, any>({
this.request<TemplateInfoDto[], void>({
path: `/api/manageTemplate/templateList`,
method: 'GET',
format: 'json',
...params,
}),

Expand All @@ -795,7 +813,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @request POST:/api/manageTemplate/createTemplate
*/
manageTemplateControllerCreateTemplate: (data: CreateTemplateDto, params: RequestParams = {}) =>
this.request<void, any>({
this.request<void, void>({
path: `/api/manageTemplate/createTemplate`,
method: 'POST',
body: data,
Expand All @@ -809,12 +827,30 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @tags Manage Template
* @name ManageTemplateControllerGetTemplateConfig
* @summary Get Template Configuration
* @request GET:/api/manageTemplate/getTemplateConfig/{templateName}
* @request GET:/api/manageTemplate/getTemplateConfig/{templateDir}
*/
manageTemplateControllerGetTemplateConfig: (templateName: string, params: RequestParams = {}) =>
this.request<void, void>({
path: `/api/manageTemplate/getTemplateConfig/${templateName}`,
manageTemplateControllerGetTemplateConfig: (templateDir: string, params: RequestParams = {}) =>
this.request<TemplateConfigDto, void>({
path: `/api/manageTemplate/getTemplateConfig/${templateDir}`,
method: 'GET',
format: 'json',
...params,
}),

/**
* No description
*
* @tags Manage Template
* @name ManageTemplateControllerUpdateTemplateConfig
* @summary Update template configuration
* @request PUT:/api/manageTemplate/updateTemplateConfig
*/
manageTemplateControllerUpdateTemplateConfig: (data: UpdateTemplateConfigDto, params: RequestParams = {}) =>
this.request<void, void>({
path: `/api/manageTemplate/updateTemplateConfig`,
method: 'PUT',
body: data,
type: ContentType.Json,
...params,
}),

Expand All @@ -824,11 +860,11 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @tags Manage Template
* @name ManageTemplateControllerDeleteTemplate
* @summary Delete Template
* @request DELETE:/api/manageTemplate/delete/{templateName}
* @request DELETE:/api/manageTemplate/delete/{templateDir}
*/
manageTemplateControllerDeleteTemplate: (templateName: string, params: RequestParams = {}) =>
manageTemplateControllerDeleteTemplate: (templateDir: string, params: RequestParams = {}) =>
this.request<void, void>({
path: `/api/manageTemplate/delete/${templateName}`,
path: `/api/manageTemplate/delete/${templateDir}`,
method: 'DELETE',
...params,
}),
Expand All @@ -855,15 +891,16 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
*
* @tags Manage Template
* @name ManageTemplateControllerGetStyleByClassName
* @summary Apply template to a game
* @summary Get style by class name
* @request POST:/api/manageTemplate/getStyleByClassName
*/
manageTemplateControllerGetStyleByClassName: (data: GetStyleByClassNameDto, params: RequestParams = {}) =>
this.request<void, void>({
this.request<string, void>({
path: `/api/manageTemplate/getStyleByClassName`,
method: 'POST',
body: data,
type: ContentType.Json,
format: 'json',
...params,
}),
};
Expand Down
5 changes: 3 additions & 2 deletions packages/origine2/src/components/Assets/Assets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { dirNameToExtNameMap } from "@/pages/editor/ChooseFile/chooseFileConfig"
import useSWR, { useSWRConfig } from "swr";
import { t } from '@lingui/macro';
import Upload from "./Upload";
import naturalCompare from 'natural-compare-lite';

export interface IFile {
extName: string;
Expand Down Expand Up @@ -64,8 +65,8 @@ export default function Assets({ basePath, isProtected = false, fileConfig, file
const dirInfo = (data.dirInfo as IFile[]).map((item) => ({ ...item, path: currentPathString + '/' + item.name }));
const dirs = dirInfo.filter((item) => item.isDir);
const files = dirInfo.filter((item) => !item.isDir).filter(e => e.name !== '.gitkeep');
dirs.sort((a, b) => a.name.localeCompare(b.name));
files.sort((a, b) => a.name.localeCompare(b.name));
dirs.sort((a, b) => naturalCompare(a.name, b.name));
files.sort((a, b) => naturalCompare(a.name, b.name));
return [...dirs, ...files];
} else return [];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import useSWR from "swr";

const GameEditorProvider = ({ children }: { children: ReactNode }) => {
const page = useEditorStore.use.page();
const gameName = useEditorStore.use.subPage();
const gameDir = useEditorStore.use.subPage();

if (page !== 'game' || !gameName) {
if (page !== 'game' || !gameDir) {
redirect('dashboard', 'game');
};

const { data: gameList, isLoading: gameListLoading } = useSWR("game-list", gameListFetcher);
const fristLoading = gameListLoading && !gameList;
const inGameList = gameList && gameList.length > 0 && gameList.some((game) => game.dir === gameName);
const inGameList = gameList && gameList.length > 0 && gameList.some((game) => game.dir === gameDir);

if (!fristLoading && !inGameList) {
redirect('dashboard', 'game');
Expand All @@ -27,7 +27,7 @@ const GameEditorProvider = ({ children }: { children: ReactNode }) => {
{
fristLoading &&
<div style={{ height: '100vh', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<Spinner labelPosition="below" label={gameName} />
<Spinner labelPosition="below" label={gameDir} />
</div>
}
{inGameList && !fristLoading && <GameEditorContextProvider>{children}</GameEditorContextProvider>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import useSWR from "swr";

const TemplateEditorProvider = ({ children }: { children: ReactNode }) => {
const page = useEditorStore.use.page();
const templateName = useEditorStore.use.subPage();
const templateDir = useEditorStore.use.subPage();

if (page !== 'template' || !templateName) {
if (page !== 'template' || !templateDir) {
redirect('dashboard', 'template');
}

const {data: templateList, isLoading: templateListLoading} = useSWR("template-list", templateListFetcher);
const fristLoading = templateListLoading && !templateList;
const inTemplateList = templateList && templateList.length > 0 && templateList.some((template) => template.dir === templateName);
const inTemplateList = templateList && templateList.length > 0 && templateList.some((template) => template.dir === templateDir);

if (!fristLoading && !inTemplateList) {
redirect('dashboard', 'template');
Expand All @@ -27,7 +27,7 @@ const TemplateEditorProvider = ({ children }: { children: ReactNode }) => {
{
fristLoading &&
<div style={{ height: '100vh', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<Spinner labelPosition="below" label={templateName} />
<Spinner labelPosition="below" label={templateDir} />
</div>
}
{inTemplateList && !fristLoading && <TemplateEditorContextProvider>{children}</TemplateEditorContextProvider>}
Expand Down
4 changes: 2 additions & 2 deletions packages/origine2/src/config/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export interface Info {
}

export const __INFO: Info = {
version: '4.5.9',
buildTime: '2024-11-03T16:28:55.197Z', // 编译时会通过 version-sync.js 自动更新
version: '4.5.10',
buildTime: '2024-11-17T12:04:20.507Z', // 编译时会通过 version-sync.js 自动更新
};
Loading

0 comments on commit fc4c720

Please sign in to comment.