diff --git a/web-front/src/views/Playground.vue b/web-front/src/views/Playground.vue index 22ed46d..5fe85b4 100644 --- a/web-front/src/views/Playground.vue +++ b/web-front/src/views/Playground.vue @@ -21,7 +21,7 @@ 正在检查访问权限... -
+
@@ -787,6 +787,11 @@ async function parseById( const editorTheme = computed(() => { return isDarkMode.value ? 'vs-dark' : 'vs'; }); + + // 计算属性:是否需要显示密码输入界面 + const shouldShowAuthUI = computed(() => { + return !loading.value && !authChecking.value && !authed.value; + }); // 编辑器配置 const editorOptions = { @@ -1613,6 +1618,7 @@ curl "${baseUrl}/json/parser?url=${encodeURIComponent(exampleUrl)}" testing, isDarkMode, editorTheme, + shouldShowAuthUI, editorOptions, // 加载和认证 loading, diff --git a/web-service/src/main/java/cn/qaiu/lz/web/controller/PlaygroundApi.java b/web-service/src/main/java/cn/qaiu/lz/web/controller/PlaygroundApi.java index d7a6f22..3abdebd 100644 --- a/web-service/src/main/java/cn/qaiu/lz/web/controller/PlaygroundApi.java +++ b/web-service/src/main/java/cn/qaiu/lz/web/controller/PlaygroundApi.java @@ -311,10 +311,17 @@ public class PlaygroundApi { /** * 获取types.js文件内容 * + * @param ctx 路由上下文 * @param response HTTP响应 */ @RouteMapping(value = "/types.js", method = RouteMethod.GET) - public void getTypesJs(HttpServerResponse response) { + public void getTypesJs(RoutingContext ctx, HttpServerResponse response) { + // 权限检查 + if (!checkAuth(ctx)) { + ResponseUtil.fireJsonResultResponse(response, JsonResult.error("未授权访问")); + return; + } + try (InputStream inputStream = getClass().getClassLoader() .getResourceAsStream("custom-parsers/types.js")) {