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

@@ -10,6 +10,8 @@ public interface SitePagesService {
String getVersion(String siteId);
/** 保存/更新页面配置 */
void savePages(String siteId, List<Map<String, Object>> entries);
/** 保存/更新页面配置(含认证方式) */
void savePages(String siteId, List<Map<String, Object>> entries, String authType, String authValue);
/** 获取所有站点页面配置列表(管理员) */
List<Map<String, Object>> listAll();
/** 删除站点页面配置 */

View File

@@ -53,8 +53,17 @@ public class SitePagesServiceImpl implements SitePagesService {
@Override
public void savePages(String siteId, List<Map<String, Object>> entries) {
savePages(siteId, entries, null, null);
}
@Override
public void savePages(String siteId, List<Map<String, Object>> entries, String authType, String authValue) {
try {
String json = om.writerWithDefaultPrettyPrinter().writeValueAsString(entries);
Map<String, Object> full = new LinkedHashMap<>();
full.put("entries", entries);
if (authType != null && !"NONE".equals(authType)) full.put("authType", authType);
if (authValue != null && !authValue.isBlank()) full.put("authValue", authValue);
String json = om.writerWithDefaultPrettyPrinter().writeValueAsString(full);
// 版本号递增
String currentVer = getVersion(siteId);
int nextVer = 1;