mirror of https://github.com/halo-dev/halo
Merge remote-tracking branch 'origin/v1' into v1
commit
58e5da4ac5
|
@ -16,22 +16,22 @@ public class Theme implements Serializable {
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* theme name
|
||||
* Theme name
|
||||
*/
|
||||
private String themeName;
|
||||
|
||||
/**
|
||||
* is support setting options
|
||||
* Is support setting options
|
||||
*/
|
||||
private boolean hasOptions;
|
||||
|
||||
/**
|
||||
* is support update
|
||||
* Is support update
|
||||
*/
|
||||
private boolean hasUpdate;
|
||||
|
||||
/**
|
||||
* is internal theme
|
||||
* Is internal theme
|
||||
*/
|
||||
private boolean isInternal;
|
||||
}
|
||||
|
|
|
@ -200,9 +200,8 @@ public class HaloUtils {
|
|||
final BufferedImage image = ImageIO.read(new FileInputStream(file));
|
||||
return image.getWidth() + "x" + image.getHeight();
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to get read image file", e);
|
||||
throw new RuntimeException("Failed to get read image file",e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -224,7 +223,7 @@ public class HaloUtils {
|
|||
bufferedWriter = new BufferedWriter(fileWriter);
|
||||
bufferedWriter.write(data);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to export file", e);
|
||||
throw new RuntimeException("Failed to export file",e);
|
||||
} finally {
|
||||
if (null != bufferedWriter) {
|
||||
bufferedWriter.close();
|
||||
|
@ -298,7 +297,7 @@ public class HaloUtils {
|
|||
result.append(line);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to create baidu post", e);
|
||||
throw new RuntimeException("Failed to push posts to baidu",e);
|
||||
} finally {
|
||||
try {
|
||||
if (null != out) {
|
||||
|
|
|
@ -33,7 +33,7 @@ public class ThemeUtils {
|
|||
themes.addAll(getThemesByPath(getInternalThemesPath(), true));
|
||||
themes.addAll(getThemesByPath(getUsersThemesPath(), false));
|
||||
} catch (Exception e) {
|
||||
log.error("Themes scan failed", e);
|
||||
throw new RuntimeException("Themes scan failed",e);
|
||||
}
|
||||
return themes;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public class ThemeUtils {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Themes scan failed", e);
|
||||
throw new RuntimeException("Themes scan failed",e);
|
||||
}
|
||||
return themes;
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ public class ThemeUtils {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to get theme template", e);
|
||||
throw new RuntimeException("Failed to get theme template",e);
|
||||
}
|
||||
return templates;
|
||||
}
|
||||
|
|
|
@ -66,4 +66,10 @@ public class AdminController {
|
|||
|
||||
return "admin/admin_index";
|
||||
}
|
||||
|
||||
@GetMapping(value = "/login")
|
||||
public String login(){
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class AttachmentController {
|
|||
}
|
||||
|
||||
/**
|
||||
* attachments list
|
||||
* Attachments list
|
||||
*
|
||||
* @return template path: admin/admin_attachment
|
||||
*/
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
public class BackupController {
|
||||
|
||||
/**
|
||||
* backup manage
|
||||
* Backup manage
|
||||
*
|
||||
* @return template path: admin/admin_backup.ftl
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@ public class CategoryController {
|
|||
}
|
||||
|
||||
/**
|
||||
* categories manage
|
||||
* Categories manage
|
||||
*
|
||||
* @return template path: admin/admin_category.ftl
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,7 @@ public class PostController {
|
|||
}
|
||||
|
||||
/**
|
||||
* posts manage
|
||||
* Posts manage
|
||||
*
|
||||
* @param model model
|
||||
* @param status post status
|
||||
|
|
|
@ -3,8 +3,6 @@ package cc.ryanc.halo.web.controller.admin;
|
|||
import cc.ryanc.halo.logging.Logger;
|
||||
import cc.ryanc.halo.model.support.JsonResult;
|
||||
import cc.ryanc.halo.service.LogService;
|
||||
import cc.ryanc.halo.service.OptionService;
|
||||
import cc.ryanc.halo.utils.LocaleMessageUtil;
|
||||
import cc.ryanc.halo.utils.ThemeUtils;
|
||||
import cc.ryanc.halo.web.controller.admin.base.BaseController;
|
||||
import cc.ryanc.halo.web.controller.content.base.BaseContentController;
|
||||
|
@ -15,7 +13,6 @@ import cn.hutool.core.text.StrBuilder;
|
|||
import cn.hutool.core.util.RuntimeUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import freemarker.template.Configuration;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
|
@ -42,11 +39,7 @@ public class ThemeController extends BaseController {
|
|||
|
||||
private LogService logsService;
|
||||
|
||||
public ThemeController(Configuration configuration,
|
||||
OptionService optionService,
|
||||
LocaleMessageUtil localeMessageUtil,
|
||||
LogService logsService) {
|
||||
super(configuration, optionService, localeMessageUtil);
|
||||
public ThemeController(LogService logsService) {
|
||||
this.logsService = logsService;
|
||||
}
|
||||
|
||||
|
@ -70,7 +63,7 @@ public class ThemeController extends BaseController {
|
|||
* @param request request
|
||||
* @return JsonResult
|
||||
*/
|
||||
@GetMapping(value = "/set")
|
||||
@PostMapping(value = "/active")
|
||||
@ResponseBody
|
||||
@CacheEvict(value = "posts", allEntries = true, beforeInvocation = true)
|
||||
public JsonResult activeTheme(@RequestParam("themeName") String themeName,
|
||||
|
@ -208,7 +201,7 @@ public class ThemeController extends BaseController {
|
|||
* @param hasUpdate hasUpdate
|
||||
*/
|
||||
@GetMapping(value = "/options")
|
||||
public String setting(Model model,
|
||||
public String options(Model model,
|
||||
@RequestParam("theme") String theme,
|
||||
@RequestParam("hasUpdate") String hasUpdate) {
|
||||
model.addAttribute("themeDir", theme);
|
||||
|
|
|
@ -5,6 +5,7 @@ import cc.ryanc.halo.utils.LocaleMessageUtil;
|
|||
import cc.ryanc.halo.utils.ThemeUtils;
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.TemplateModelException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import static cc.ryanc.halo.model.support.HaloConst.OPTIONS;
|
||||
import static cc.ryanc.halo.model.support.HaloConst.THEMES;
|
||||
|
@ -17,19 +18,14 @@ import static cc.ryanc.halo.model.support.HaloConst.THEMES;
|
|||
*/
|
||||
public abstract class BaseController {
|
||||
|
||||
public final Configuration configuration;
|
||||
@Autowired
|
||||
public Configuration configuration;
|
||||
|
||||
public final OptionService optionService;
|
||||
@Autowired
|
||||
public OptionService optionService;
|
||||
|
||||
public final LocaleMessageUtil localeMessageUtil;
|
||||
|
||||
public BaseController(Configuration configuration,
|
||||
OptionService optionService,
|
||||
LocaleMessageUtil localeMessageUtil) {
|
||||
this.configuration = configuration;
|
||||
this.optionService = optionService;
|
||||
this.localeMessageUtil = localeMessageUtil;
|
||||
}
|
||||
@Autowired
|
||||
public LocaleMessageUtil localeMessageUtil;
|
||||
|
||||
/**
|
||||
* Clear all caches
|
||||
|
|
Loading…
Reference in New Issue