Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

目录加密-目录输入密码访问-看不见文章 #1470

Closed
dingguangyi0 opened this issue Sep 9, 2021 · 12 comments · Fixed by #1471
Closed

目录加密-目录输入密码访问-看不见文章 #1470

dingguangyi0 opened this issue Sep 9, 2021 · 12 comments · Fixed by #1471
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@dingguangyi0
Copy link
Contributor

dingguangyi0 commented Sep 9, 2021

是什么版本出现了此问题?

1.4.11

使用的什么数据库?

H2

使用的哪种方式部署?

Docker

在线站点地址

https://www.ycdr.fun/

发生了什么?

  1. 设置加密目录-目录访问文章 列表为空
  2. 问题分析 逻辑有问题
//run.halo.app.controller.content.model.CategoryModel#listPost  85

//该方法请求目录列表 status 状态是写死的 为 0  PUBLISHED
// 应该增加判断 如果目录有密码 查询条件 应该是 0 3 
//我本地修改后没有此问题了

        final Category category = categoryService.getBySlugOfNonNull(slug, true);
        if (!authenticationService.categoryAuthentication(category.getId(), null)) {
            model.addAttribute("slug", category.getSlug());
            model.addAttribute("type", EncryptTypeEnum.CATEGORY.getName());
            if (themeService.templateExists(POST_PASSWORD_TEMPLATE + SUFFIX_FTL)) {
                return themeService.render(POST_PASSWORD_TEMPLATE);
            }
            return "common/template/" + POST_PASSWORD_TEMPLATE;
        }
       // 此处为我的修改
        Set<PostStatus> status=Sets.immutableEnumSet(PostStatus.PUBLISHED);
        if (StringUtils.isNotBlank(category.getPassword())) {
            status = Sets.immutableEnumSet(PostStatus.PUBLISHED,PostStatus.INTIMATE);
        }
      //修改结束
        CategoryDTO categoryDTO = categoryService.convertTo(category);

        final Pageable pageable = PageRequest.of(page - 1,
            optionService.getArchivesPageSize(),
            Sort.by(DESC, "topPriority", "createTime"));
        Page<Post> postPage =
            postCategoryService.pagePostBy(category.getId(), status, pageable);
        Page<PostListVO> posts = postService.convertToListVo(postPage);
  1. 不清楚是否是我使用错误
  2. 主题使用的是雪
  3. 我的网站 每日计划 为加密目录 密码为1 ,文章有四篇 目前显示不出来

相关日志输出

No response

附加信息

No response

@dingguangyi0 dingguangyi0 added the kind/bug Categorizes issue or PR as related to a bug. label Sep 9, 2021
@dingguangyi0 dingguangyi0 changed the title 目录加密-目录输入秘密访问-看不见文章 目录加密-目录输入密码访问-看不见文章 Sep 9, 2021
@dingguangyi0
Copy link
Contributor Author

我的网站 | 我临时修复了

@ruibaby
Copy link
Member

ruibaby commented Sep 9, 2021

欢迎提交 PR。

@ruibaby
Copy link
Member

ruibaby commented Sep 9, 2021

/assign @dingguangyi0

@dingguangyi0
Copy link
Contributor Author

不清楚是我分析的问题吗 ? 全局的代码并没有看 ,怕该错了

@dingguangyi0
Copy link
Contributor Author

欢迎提交 PR。

好的

@dingguangyi0
Copy link
Contributor Author

@ruibaby 你好,按照官方操作文档设置代码格式过程中发现 https://docs.halo.run/developer-guide/core/code-style 官方文档,按照文档操作,在idea版本2021.1 , checkstyle idea 版本是 5.5 情况下 checkstyle.xml 创建失败,不清楚咱们 checkstyle.xml使用的版本是多少

@ruibaby
Copy link
Member

ruibaby commented Sep 9, 2021

@dingguangyi0 提示什么?

@dingguangyi0
Copy link
Contributor Author

com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module LineLength - Property 'fileExtensions' does not exist, please check the documentation
at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:477)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:198)
at org.infernus.idea.checkstyle.service.cmd.OpCreateChecker.execute(OpCreateChecker.java:61)
at org.infernus.idea.checkstyle.service.cmd.OpCreateChecker.execute(OpCreateChecker.java:26)
at org.infernus.idea.checkstyle.service.CheckstyleActionsImpl.executeCommand(CheckstyleActionsImpl.java:130)
at org.infernus.idea.checkstyle.service.CheckstyleActionsImpl.createChecker(CheckstyleActionsImpl.java:60)
at org.infernus.idea.checkstyle.service.CheckstyleActionsImpl.createChecker(CheckstyleActionsImpl.java:51)
at org.infernus.idea.checkstyle.checker.CheckerFactoryWorker.run(CheckerFactoryWorker.java:46)
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Property 'fileExtensions' does not exist, please check the documentation
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.tryCopyProperty(AutomaticBean.java:223)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:191)
at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:472)
... 7 more

@dingguangyi0
Copy link
Contributor Author

@ruibaby 你好,checkstyle idea 新版本已经把设置转移到 tools ,我自己这边降低版本 5.3 5.2 idea2021安装不成功,5.4 可以安装成功 设置文件版本从8.23 - 6.19 我这边都试了一下 ,都无法创建成功,而且错误不太一样,麻烦告知下 你那边 开发idea和checkstyle idea 版本

@dingguangyi0
Copy link
Contributor Author

@ruibaby 我看咱们配置文件是依照谷歌格式 的,现在checkstyle idea 官网默认提供谷歌 和 sun 格式化 就是为了解决 checkstyle idea 升级造成的低版本xml不兼容问题,我们是否可以直接使用checkstyle idea 提供的那?

@ruibaby
Copy link
Member

ruibaby commented Sep 9, 2021

@dingguangyi0
Copy link
Contributor Author

@ruibaby 好的 我尝试一下8.39 ,文档可以说明一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
2 participants