feat: 页面配置增加authType认证方式(NONE/COOKIE/TOKEN/BASIC/API_KEY)

This commit is contained in:
mediabot-pt
2026-07-06 01:26:09 +08:00
parent 817d1e09e0
commit 821f0b909d
4 changed files with 64 additions and 14 deletions

View File

@@ -48,12 +48,14 @@ public class SitePagesController {
@PutMapping("/api/v1/sites/{siteId}/pages")
public ApiResponse<Void> savePages(
@PathVariable String siteId, @RequestBody Map<String, Object> payload) {
@SuppressWarnings("unchecked")
var entries = (List<Map<String, Object>>) payload.get("entries");
if (entries == null || entries.isEmpty()) return ApiResponse.error(400, "entries is required");
sitePagesService.savePages(siteId, entries);
return ApiResponse.success();
}
@SuppressWarnings("unchecked")
var entries = (List<Map<String, Object>>) payload.get("entries");
if (entries == null || entries.isEmpty()) return ApiResponse.error(400, "entries is required");
String authType = (String) payload.get("authType");
String authValue = (String) payload.get("authValue");
sitePagesService.savePages(siteId, entries, authType, authValue);
return ApiResponse.success();
}
@GetMapping("/api/v1/admin/site-pages")
public ApiResponse<List<Map<String, Object>>> adminList(HttpServletRequest request) {
@@ -115,7 +117,9 @@ public class SitePagesController {
checkAdmin(request);
@SuppressWarnings("unchecked")
var entries = (List<Map<String, Object>>) payload.get("entries");
sitePagesService.savePages("default:" + type, entries != null ? entries : List.of());
String authType = (String) payload.get("authType");
String authValue = (String) payload.get("authValue");
sitePagesService.savePages("default:" + type, entries != null ? entries : List.of(), authType, authValue);
return ApiResponse.success();
}