Fix playground bugs and remove TypeScript compiler

- Fix BUG1: JavaScript timeout with proper thread interruption using ScheduledExecutorService
- Fix BUG2: Add URL regex validation before execution in playground test API
- Fix BUG3: Register published parsers to CustomParserRegistry on save/update/delete
- Remove TypeScript compiler functionality (tsCompiler.js, dependencies, UI)
- Add password authentication for playground access
- Add mobile responsive layout support
- Load playground parsers on application startup
This commit is contained in:
q
2026-01-02 19:24:47 +08:00
parent c79702eba8
commit 66b9bcc53a
10 changed files with 865 additions and 490 deletions

View File

@@ -170,54 +170,4 @@ export const playgroundApi = {
}
},
/**
* 保存TypeScript代码及其编译结果
*/
async saveTypeScriptCode(parserId, tsCode, es5Code, compileErrors, compilerVersion, compileOptions, isValid) {
try {
const response = await axios.post('/v2/playground/typescript', {
parserId,
tsCode,
es5Code,
compileErrors,
compilerVersion,
compileOptions,
isValid
});
return response.data;
} catch (error) {
throw new Error(error.response?.data?.error || error.response?.data?.msg || error.message || '保存TypeScript代码失败');
}
},
/**
* 根据parserId获取TypeScript代码
*/
async getTypeScriptCode(parserId) {
try {
const response = await axios.get(`/v2/playground/typescript/${parserId}`);
return response.data;
} catch (error) {
throw new Error(error.response?.data?.error || error.response?.data?.msg || error.message || '获取TypeScript代码失败');
}
},
/**
* 更新TypeScript代码
*/
async updateTypeScriptCode(parserId, tsCode, es5Code, compileErrors, compilerVersion, compileOptions, isValid) {
try {
const response = await axios.put(`/v2/playground/typescript/${parserId}`, {
tsCode,
es5Code,
compileErrors,
compilerVersion,
compileOptions,
isValid
});
return response.data;
} catch (error) {
throw new Error(error.response?.data?.error || error.response?.data?.msg || error.message || '更新TypeScript代码失败');
}
}
};