未验证 提交 92e139dd 编写于 作者: 智布道's avatar 智布道 👁 提交者: GitHub

Merge branch 'master' into patch-1

......@@ -21,3 +21,4 @@
hs_err_pid*
/.idea/
*.iml
/blog-core/src/main/resources/config/application-center-prod.yml
**OneBlog** 一个简洁美观、功能强大并且自适应的Java博客。使用springboot开发,前端使用Bootstrap。支持移动端自适应,配有完备的前台和后台管理功能。
![JDK](https://img.shields.io/badge/JDK-1.8-green.svg)
![Maven](https://img.shields.io/badge/Maven-3.3.1-green.svg)
![MySQL](https://img.shields.io/badge/MySQL-5.6.4-green.svg)
![Redis](https://img.shields.io/badge/Redis-3.0.503-green.svg)
[![license](https://img.shields.io/badge/license-GPL%20v3-yellow.svg)](https://gitee.com/yadong.zhang/DBlog/blob/master/LICENSE)
<p align="center">
<img src="/docs/_media/logo.png" style="width: 300px"></img>
</p>
<p align="center">
<strong>OneBlog 一个简洁美观、功能强大并且自适应的Java博客。使用springboot开发,前端使用Bootstrap。支持移动端自适应,配有完备的前台和后台管理功能。</strong>
</p>
<p align="center">
<img src="https://img.shields.io/badge/Maven-3.3.1-green.svg" ></img>
<a target="_blank" href="https://gitee.com/yadong.zhang/DBlog/blob/master/LICENSE">
<img src="https://img.shields.io/badge/license-GPL%20v3-yellow.svg" ></img>
</a>
<a target="_blank" href="https://www.oracle.com/technetwork/java/javase/downloads/index.html">
<img src="https://img.shields.io/badge/JDK-1.8+-blue.svg" ></img>
</a>
<img src="https://img.shields.io/badge/MySQL-5.6.4-red.svg" ></img>
<img src="https://img.shields.io/badge/Redis-3.0.503-orange.svg" ></img>
</p>
<p align="center">
<strong>开源地址:</strong> <a target="_blank" href='https://gitee.com/yadong.zhang/DBlog'>Gitee</a> | <a target="_blank" href='https://github.com/zhangyd-c/OneBlog'>Github</a>
</p>
<p align="center">
<strong>QQ群:</strong>230017570
</p>
----
......@@ -12,10 +28,10 @@
**看文档!看文档!看文档!**,初次使用, 请先**看文档!**
1. 本项目配有相关[帮助文档](https://gitee.com/yadong.zhang/DBlog/wikis) 。文档中包括**基本的项目说明****shiro标签使用****七牛云配置**和一些常见的**异常问题解决方案**。使用时碰到问题请**优先**查阅【[帮助文档](https://gitee.com/yadong.zhang/DBlog/wikis)】。因为现在好多朋友问的问题大部分都写在【[帮助文档](https://gitee.com/yadong.zhang/DBlog/wikis)】中了,希望各位朋友能自己翻阅下相关资料,高效提问,避免重复问题!
1. 本项目配有相关[帮助文档](https://docs.zhyd.me) 。文档中包括**基本的项目说明****shiro标签使用****七牛云配置**和一些常见的**异常问题解决方案**。使用时碰到问题请**优先**查阅【[帮助文档](https://docs.zhyd.me)】。因为现在好多朋友问的问题大部分都写在【[帮助文档](https://docs.zhyd.me)】中了,希望各位朋友能自己翻阅下相关资料,高效提问,避免重复问题!
2. **提问题**前请优先阅读【[如何向开源社区提问题](https://github.com/seajs/seajs/issues/545)】&【[提问的智慧](http://www.dianbo.org/9238/stone/tiwendezhihui.htm)
3. **提问题**时请优先选择[Gitee Issues](https://gitee.com/yadong.zhang/DBlog/issues)(方便问题追踪和一对一解决),其次[我的博客-留言板](https://www.zhyd.me/guestbook),再次QQ群(QQ群消息较多,提问请注意节奏、时机),最次加我QQ好友直接提问(不推荐)
4. 本项目唯一官网:[https://www.zhyd.me](https://www.zhyd.me)
3. **提问题**时请优先选择[Gitee Issues](https://gitee.com/yadong.zhang/DBlog/issues)(方便问题追踪和一对一解决),其次[我的博客-留言板](https://docs.zhyd.me/guestbook),再次QQ群(QQ群消息较多,提问请注意节奏、时机),最次加我QQ好友直接提问(不推荐)
4. 本项目唯一官网:[https://docs.zhyd.me](https://docs.zhyd.me)
5. 本项目开源地址:[Gitee](https://gitee.com/yadong.zhang/DBlog) | [Github](https://github.com/zhangyd-c/OneBlog)
6. 本项目修改记录,详情请移步[这里](https://gitee.com/yadong.zhang/DBlog/blob/master/update.md)
7. 如果你想贡献代码,请先阅读[这篇文章](https://gitee.com/yadong.zhang/DBlog/blob/master/contribution.md)
......@@ -42,27 +58,14 @@ ps: 虽然我知道,大部分人都是来了**直接下载源代码**后就潇
- **百度推送**:支持百度推送功能,加速百度搜索引擎收录博文
- **评论系统**:自研的评论系统,支持显示用户地址、浏览器和os信息,后台可审核评论、开启匿名评论、回复和邮件通知评论
- **权限管理**:后台配备完善的权限管理
- **SEO**:自带robots、sitemap等seo模板,实现自动生成robots和sitemap
- **实时通讯**:管理员可向在线的用户发送实时消息(需用户授权 - 基于websocket实现,具体参考[DBlog建站之Websocket的使用](https://www.zhyd.me/article/111)
- **完善的 SEO 方案**:自带robots、sitemap等seo模板,实现自动生成robots和sitemap
- **实时通讯**:管理员可向在线的用户发送实时消息(需用户授权 - 基于websocket实现,具体参考[DBlog建站之Websocket的使用](https://docs.zhyd.me/article/111)
- **系统配置支持快速配置**:可通过后台手动修改诸如域名信息、SEO优化、赞赏码、七牛云以及更新维护通知等
- **多种文件存储**:集成七牛云、阿里云OSS,实现文件云存储,同时支持本地文件存储
- **文件搬运工**:集成[blog-hunter](https://gitee.com/yadong.zhang/blog-hunter)实现“文章搬运工”功能,支持一键同步imooc、csdn、iteye或者cnblogs上的文章,可抓取列表和单个文章
- **第三方授权登录**:集成[JustAuth](https://gitee.com/yadong.zhang/JustAuth)实现第三方授权登录
# Demo 演示
[前台demo](http://dblog-web.zhyd.me/)
[后台demo(root,123456)](http://dblog-admin.zhyd.me)
![admin端首页](https://images.gitee.com/uploads/images/2019/0129/191117_221c6064_784199.png "admin-index.png")
![admin端文章列表也](https://images.gitee.com/uploads/images/2019/0129/191135_21e4f61c_784199.png "admin-article.png")
![admin端发布文章页](https://images.gitee.com/uploads/images/2019/0129/191150_0d28d51a_784199.png "admin-publish-article.png")
![admin端系统配置页](https://images.gitee.com/uploads/images/2019/0129/191203_cc6941e4_784199.png "admin-config.png")
![admin端文章搬运工](https://images.gitee.com/uploads/images/2019/0129/191214_5e8f3c34_784199.png "admin-spider.png")
![admin端文章搬运工](https://images.gitee.com/uploads/images/2019/0129/191237_d015fcda_784199.png "admin-spider2.png")
![web端首页-pc](https://images.gitee.com/uploads/images/2019/0129/191409_d2604f7d_784199.png "web-index-pc.png")
![web端首页-mobile](https://images.gitee.com/uploads/images/2019/0129/191428_c76317e8_784199.png "web-index.png")
![web端文章详情页](https://images.gitee.com/uploads/images/2019/0129/191448_a2777443_784199.png "web-article-detail.png")
- **文章搬运工**:集成[blog-hunter](https://gitee.com/yadong.zhang/blog-hunter)实现“文章搬运工”功能,支持一键同步imooc、csdn、iteye或者cnblogs上的文章,可抓取列表和单个文章
- **第三方授权登录**:集成 [JustAuthPlus(JAP)](https://gitee.com/fujieid/jap) 实现第三方授权登录
- **自定义网站内容**:管理员可自定义“关于本站”、“留言板”、“友情链接”、“免责声明”、“Footer”、“鼠标点击时的气泡文字”、“热门搜索的待选项”等内容
- **流控**:针对异常IP的连续大量访问,系统会自动封禁该IP。
----
......@@ -74,7 +77,6 @@ ps: 虽然我知道,大部分人都是来了**直接下载源代码**后就潇
| blog-admin | 后台管理模块 | 该模块作为单独项目打包部署 |
| blog-web | 前台模块 | 该模块作为单独项目打包部署 |
| blog-file | 文件存储功能模块 | 支持local、七牛云和阿里云OSS |
| ~~blog-spider~~ | 爬虫相关代码模块 | 已使用[blog-hunter](https://gitee.com/yadong.zhang/blog-hunter)插件替代 |
# 技术栈
......@@ -97,47 +99,57 @@ ps: 虽然我知道,大部分人都是来了**直接下载源代码**后就潇
- ...
# 使用方法(以blog-web项目为例)
# 快速开始
## Docker Compose(推荐)
1. 在任意位置下分别创建 `.env``docker-compose.yml`(可以参考或直接复制`docs/docker/docker-compose-prod.yml`的内容) 文件
2. 执行 `docker-compose -p oneblog up -d`
## Docker Compose
1. 打包项目 `mvn clean package -Dmaven.test.skip=true -Pdev`
2. 进入 `docs/docker` 目录
3. 按照注释修改 `.env` 文件
4. 执行 `docker-compose -p oneblog up -d`
## 源码方式
> `blog-web` 和 `blog-admin` 的运行方式一样
1. 使用IDE导入本项目
2. 新建数据库`CREATE DATABASE dblog;`
3. 导入数据库`docs/db/dblog.sql`
4. 初始化数据库`docs/db/init_data.sql`
3. 导入数据库`docs/docker/mysql/dblog.sql`
4. 初始化数据库`docs/docker/mysql/init_data.sql`
5. 修改配置文件
1. 数据库链接属性(在`[blog-core]/resources/config/application-center-{env}.yml`配置文件中搜索`datasource`或定位到L.5)
2. redis配置(在`[blog-core]/resources/config/application-center-{env}.yml`配置文件中搜索`redis`或定位到L.14)
3. 以上两个必备的配置项修改完成后就能启动项目了。关于其他配置项,请参考后台“系统配置”页面
6. 运行项目(三种方式,任选其一)
1. 项目根目录下执行`mvn -X clean package -Dmaven.test.skip=true -Ptest`编译打包(注:-Ptest中的test为环境标识),然后cd到blog-web目录下执行`java -jar target/blog-web.jar`
2.`blog-web`项目根目录下执行`mvn spring-boot:run`(注,如果报依赖错误,可在相关的依赖模块先执行install操作)
3. 直接运行`BlogWebApplication.java`
7. 浏览器访问`http://127.0.0.1:8443`
8. `blog-admin`项目的启动方式与`blog-web`类似,请参考上面的使用说明
# 后续扩展
- [ ] 1. 页面缓存
- [ ] 2. cc防护
- [ ] 3. 配套小程序
- [ ] 4. 待续...
...
6. 运行项目:直接运行 `blog-web/src/main/java/com/zyd/blog/BlogWebApplication.java` 或者 `blog-admin/src/main/java/com/zyd/blog/BlogAdminApplication.java`
7. 浏览器访问`http://127.0.0.1:{port}`
> 后台默认账号密码:root/123456
# Who is using?
- [张亚东博客](https://www.zhyd.me)
- [攻城狮不是猫博客](http://www.jsdblog.com)
- [小公举的博客](https://loveyatou.top/)
- [陈晓雷的博客](http://www.csxll.top)
- [Li Pan's 博客](http://www.lipan.xyz/)
- [MTR小站](https://www.itmtr.cn/)
- [怀念时光](https://blog.earic.club/)
- [Java干货铺子](http://www.itsoku.com/)
- [介龙平博客](https://www.jlpyyf.com/)
- [大数据施工现场](http://blog.sev7e0.site/)
- [fireflyi博客](https://www.fireflyi.com/)
- [AIAS编程有道](http://www.piqiandong.com/)
- [btmcheck博客](https://btmcheck.com/)
- [我的博客](http://www.chenyunkeji.com/)
烦请各位使用OneBlog的朋友,能留下你的网址(没别的意思,只是看看有多少人而已) - [点这儿](https://gitee.com/yadong.zhang/DBlog/issues/ILIAQ)
烦请各位使用 OneBlog 的朋友,能留下你的网址 - [点这儿](https://gitee.com/yadong.zhang/DBlog/issues/ILIAQ)
----
# 预览
![web端首页-pc](docs/_media/1601f937.png)
![web端文章详情页](docs/_media/e922c529.png)
![web端文章详情页 - 私密文章](docs/_media/ff9a84a3.png)
![web端文章详情页 - 私密文章](docs/_media/cd37ba37.png)
![web端首页-mobile](https://images.gitee.com/uploads/images/2019/0129/191428_c76317e8_784199.png "web端首页-mobile")
![admin端首页](https://images.gitee.com/uploads/images/2019/0129/191117_221c6064_784199.png "admin端首页")
![admin端文章列表也](https://images.gitee.com/uploads/images/2019/0129/191135_21e4f61c_784199.png "admin端文章列表也")
![admin端发布文章页](https://images.gitee.com/uploads/images/2019/0129/191150_0d28d51a_784199.png "admin端发布文章页")
![admin端系统配置页](https://images.gitee.com/uploads/images/2019/0129/191203_cc6941e4_784199.png "admin端系统配置页")
![admin端文章搬运工](https://images.gitee.com/uploads/images/2019/0129/191214_5e8f3c34_784199.png "admin端文章搬运工")
![admin端文章搬运工](https://images.gitee.com/uploads/images/2019/0129/191237_d015fcda_784199.png "admin端文章搬运工")
----
......@@ -149,8 +161,8 @@ ps: 虽然我知道,大部分人都是来了**直接下载源代码**后就潇
**QQ群**
1. 1群[![](https://images.gitee.com/uploads/images/2019/0129/191256_a40bceba_784199.png)](https://shang.qq.com/wpa/qunwpa?idkey=3571c554a143eff1e15807de033a240196c6b493b25b903d1d37571cfb6040aa)**已升为1000人群**
2. 2群[![](https://images.gitee.com/uploads/images/2019/0129/191256_a40bceba_784199.png)](https://shang.qq.com/wpa/qunwpa?idkey=38594b12fb0ec66459f0dba0316648a5c4bb71ea613289e5b57b8f44ad83ebc9)**人很少**
1. 1群[![](https://images.gitee.com/uploads/images/2019/0129/191256_a40bceba_784199.png)](https://shang.qq.com/wpa/qunwpa?idkey=3571c554a143eff1e15807de033a240196c6b493b25b903d1d37571cfb6040aa)
2. 2群[![](https://images.gitee.com/uploads/images/2019/0129/191256_a40bceba_784199.png)](https://shang.qq.com/wpa/qunwpa?idkey=38594b12fb0ec66459f0dba0316648a5c4bb71ea613289e5b57b8f44ad83ebc9)
# 赞助
......@@ -162,7 +174,7 @@ ps: 虽然我知道,大部分人都是来了**直接下载源代码**后就潇
# 生命不息,折腾不止! 更多信息,请关注:
1. [我的博客](https://www.zhyd.me)
1. [我的博客](https://docs.zhyd.me)
2. [我的微博](http://weibo.com/211230415)
3. [我的头条号](http://www.toutiao.com/c/user/3286958681/)
4. [我的imooc](http://www.imooc.com/u/1175248/articles)
......@@ -176,6 +188,7 @@ ps: 虽然我知道,大部分人都是来了**直接下载源代码**后就潇
- [emoji表情列表](https://github.com/caiyongji/emoji-list#nature): emoji表情列表
- [blog-hunter](https://github.com/zhangyd-c/blog-hunter): 博客猎手,基于webMagic的博客爬取工具,支持慕课、csdn、iteye、cnblogs、掘金和V2EX等各大主流博客平台。
- [JustAuth](https://gitee.com/yadong.zhang/JustAuth): 史上最全的整合第三方登录的工具,目前已支持Github、Gitee、微博、钉钉、百度、Coding、腾讯云开发者平台、OSChina、支付宝、QQ、微信、淘宝、Google、Facebook、抖音、领英、小米、微软和今日头条等第三方平台的授权登录。 Login, so easy!
- [JAP](https://gitee.com/fujieid/jap): 一款开源的登录认证中间件,基于模块化设计,并且与业务高度解耦,使用起来非常灵活,开发者可以毫不费力地将 JAP 集成到任何 web 应用程序中,就像集成 JustAuth 一样,简单方便。
- 待续...
# 开源协议
......
# 环境版本
FROM anapsix/alpine-java:8_server-jre_unlimited
MAINTAINER yadong.zhang0415@gmail.com
# JVM调优参数等额外参数
ENV PARAMS ""
ENV TZ=PRC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# 指定容器端口
EXPOSE 8085
# 添加本地 JAR 到容器内
ADD target/blog-admin.jar app.jar
# 容器启动后执行的命令
ENTRYPOINT ["java", "-jar","app.jar" , "-Djava.security.egd=file:/dev/./urandom","$PARAMS"]
......@@ -12,13 +12,31 @@
<parent>
<groupId>com.zyd</groupId>
<artifactId>blog</artifactId>
<version>2.2.2</version>
<version>2.2.5</version>
</parent>
<dependencies>
<dependency>
<groupId>com.zyd</groupId>
<artifactId>blog-core</artifactId>
<exclusions>
<exclusion>
<artifactId>lombok</artifactId>
<groupId>org.projectlombok</groupId>
</exclusion>
<exclusion>
<artifactId>mybatis-spring-boot-starter</artifactId>
<groupId>org.mybatis.spring.boot</groupId>
</exclusion>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
<exclusion>
<artifactId>kotlin-stdlib-common</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
......
......@@ -9,7 +9,7 @@ import org.springframework.boot.web.servlet.ServletComponentScan;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......
......@@ -14,7 +14,7 @@ import javax.servlet.http.HttpServletResponse;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......
......@@ -32,7 +32,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......
......@@ -5,7 +5,7 @@ package com.zyd.blog.controller;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......@@ -14,9 +14,9 @@ import com.zyd.blog.business.annotation.BussinessLog;
import com.zyd.blog.business.entity.Article;
import com.zyd.blog.business.service.BizArticleService;
import com.zyd.blog.business.service.SysConfigService;
import com.zyd.blog.core.BlogHunterConfigProvider;
import com.zyd.blog.core.websocket.server.ZydWebsocketServer;
import com.zyd.blog.util.ResultUtil;
import me.zhyd.hunter.config.HunterConfigTemplate;
import me.zhyd.hunter.config.platform.Platform;
import me.zhyd.hunter.enums.ExitWayEnum;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
......@@ -35,7 +35,7 @@ import org.springframework.web.servlet.ModelAndView;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......@@ -45,9 +45,9 @@ public class RenderController {
@Autowired
private BizArticleService articleService;
@Autowired
private SysConfigService configService;
@Autowired
private ZydWebsocketServer websocketServer;
@Autowired
private BlogHunterConfigProvider blogHunterConfigProvider;
@RequiresAuthentication
@BussinessLog("进入首页")
......@@ -104,7 +104,7 @@ public class RenderController {
public ModelAndView edit(@PathVariable("id") Long id, Model model) {
model.addAttribute("id", id);
Article article = articleService.getByPrimaryKey(id);
if(article.getIsMarkdown()){
if (article.getIsMarkdown()) {
return ResultUtil.view("article/publish-md");
}
return ResultUtil.view("article/publish");
......@@ -200,7 +200,7 @@ public class RenderController {
@GetMapping("/remover")
public ModelAndView remover(Model model) {
model.addAttribute("exitWayList", ExitWayEnum.values());
model.addAttribute("spiderConfig", HunterConfigTemplate.configTemplate.toJSONString());
model.addAttribute("spiderConfig", blogHunterConfigProvider.getBlogHunterConfig());
model.addAttribute("platforms", Platform.values());
return ResultUtil.view("laboratory/remover");
}
......@@ -211,4 +211,11 @@ public class RenderController {
public ModelAndView files(Model model) {
return ResultUtil.view("file/list");
}
@RequiresPermissions("socials")
@BussinessLog("进入社会化登录配置管理页面")
@GetMapping("/socials")
public ModelAndView socials(Model model) {
return ResultUtil.view("social/list");
}
}
......@@ -26,7 +26,7 @@ import java.util.Map;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......
......@@ -32,7 +32,7 @@ import java.util.Map;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......
......@@ -27,7 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......
......@@ -19,7 +19,7 @@ import java.util.Map;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......
......@@ -18,7 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2019/2/14 11:37
* @since 1.0
*/
......
......@@ -9,8 +9,10 @@ import com.zyd.blog.business.enums.TemplateKeyEnum;
import com.zyd.blog.business.service.MailService;
import com.zyd.blog.business.service.SysLinkService;
import com.zyd.blog.business.vo.LinkConditionVO;
import com.zyd.blog.framework.exception.ZhydLinkException;
import com.zyd.blog.framework.object.PageResult;
import com.zyd.blog.framework.object.ResponseVO;
import com.zyd.blog.util.RegexUtils;
import com.zyd.blog.util.ResultUtil;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
......@@ -25,7 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......@@ -49,6 +51,9 @@ public class RestLinkController {
@BussinessLog("添加友情链接")
public ResponseVO add(Link link) {
link.setSource(LinkSourceEnum.ADMIN);
if (!RegexUtils.isUrl(link.getUrl())) {
throw new ZhydLinkException("链接地址无效!");
}
linkService.insert(link);
mailService.send(link, TemplateKeyEnum.TM_LINKS);
return ResultUtil.success("成功");
......@@ -78,6 +83,9 @@ public class RestLinkController {
@PostMapping("/edit")
@BussinessLog("编辑友情链接")
public ResponseVO edit(Link link) {
if (!RegexUtils.isUrl(link.getUrl())) {
throw new ZhydLinkException("链接地址无效!");
}
try {
linkService.updateSelective(link);
} catch (Exception e) {
......
......@@ -25,7 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......
......@@ -22,7 +22,7 @@ import java.util.Date;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/8/14 14:37
* @since 1.0
*/
......
......@@ -25,7 +25,7 @@ import java.util.List;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......
......@@ -27,7 +27,7 @@ import java.util.List;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......
package com.zyd.blog.controller;
import com.github.pagehelper.PageInfo;
import com.zyd.blog.business.annotation.BussinessLog;
import com.zyd.blog.business.entity.SocialConfig;
import com.zyd.blog.business.enums.ResponseStatus;
import com.zyd.blog.business.service.SysSocialConfigService;
import com.zyd.blog.business.vo.SocialConfigConditionVO;
import com.zyd.blog.framework.object.PageResult;
import com.zyd.blog.framework.object.ResponseVO;
import com.zyd.blog.util.ResultUtil;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Social Config
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://docs.zhyd.me
* @date 2021/4/27 14:37
* @since 1.0
*/
@RestController
@RequestMapping("/social/config")
public class RestSocialConfigController {
@Autowired
private SysSocialConfigService sysSocialConfigService;
@RequiresPermissions("socials")
@PostMapping("/list")
public PageResult list(SocialConfigConditionVO vo) {
vo.setPageSize(Integer.MAX_VALUE);
PageInfo<SocialConfig> pageInfo = sysSocialConfigService.findPageBreakByCondition(vo);
return ResultUtil.tablePage(pageInfo);
}
@RequiresPermissions("social:add")
@PostMapping(value = "/add")
@BussinessLog("添加社会化登录配置")
public ResponseVO add(SocialConfig socialConfig) {
sysSocialConfigService.insert(socialConfig);
return ResultUtil.success("社会化登录配置添加成功!");
}
@RequiresPermissions(value = {"social:batchDelete", "social:delete"}, logical = Logical.OR)
@PostMapping(value = "/remove")
@BussinessLog("删除社会化登录配置")
public ResponseVO remove(Long[] ids) {
if (null == ids) {
return ResultUtil.error(500, "请至少选择一条记录");
}
for (Long id : ids) {
sysSocialConfigService.removeByPrimaryKey(id);
}
return ResultUtil.success("成功删除 [" + ids.length + "] 个社会化登录配置");
}
@RequiresPermissions("social:get")
@PostMapping("/get/{id}")
@BussinessLog("获取社会化登录配置详情")
public ResponseVO get(@PathVariable Long id) {
return ResultUtil.success(null, this.sysSocialConfigService.getByPrimaryKey(id));
}
@RequiresPermissions("social:edit")
@PostMapping("/edit")
@BussinessLog("编辑社会化登录配置")
public ResponseVO edit(SocialConfig socialConfig) {
try {
sysSocialConfigService.updateSelective(socialConfig);
} catch (Exception e) {
e.printStackTrace();
return ResultUtil.error("社会化登录配置修改失败!");
}
return ResultUtil.success(ResponseStatus.SUCCESS);
}
}
......@@ -22,7 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......
......@@ -22,7 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......
......@@ -22,7 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......@@ -83,7 +83,7 @@ public class RestTypeController {
@PostMapping("/listAll")
public ResponseVO listType() {
return ResultUtil.success(null, typeService.listTypeForMenu());
return ResultUtil.success(null, typeService.listAll());
}
@PostMapping("/listParent")
......
......@@ -22,7 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......
......@@ -25,7 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......
package com.zyd.blog.core;
import com.alibaba.fastjson.JSON;
import com.zyd.blog.business.service.SysConfigService;
import lombok.extern.slf4j.Slf4j;
import me.zhyd.hunter.config.HunterConfigTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0.0
* @since 1.0.0
*/
@Slf4j
@Component
public class BlogHunterConfigProvider {
@Autowired
private SysConfigService sysConfigService;
public String getBlogHunterConfig() {
String config = sysConfigService.getSpiderConfig();
if (StringUtils.isEmpty(config) || "{}".equals(config)) {
return HunterConfigTemplate.configTemplate.toJSONString();
}
try {
return JSON.parseObject(config).toJSONString();
} catch (Exception e) {
log.error("blog-hunter 的配置文件格式错误!将启用默认的 `src/main/resources/HunterConfig.json` 内容!", e);
}
return "{}";
}
}
package com.zyd.blog.core.config;
import org.apache.shiro.util.ClassUtils;
import org.apache.shiro.util.UnknownClassException;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;
public class MyClassResolvingObjectInputStream extends ObjectInputStream {
public MyClassResolvingObjectInputStream(InputStream inputStream) throws IOException {
super(inputStream);
}
protected Class<?> resolveClass(ObjectStreamClass osc) throws IOException, ClassNotFoundException {
try {
String s = osc.getName();
// 干掉常见的gadget,为了避免 [ ; 符号,必须使用contains方法
// 简单的使用 s.equals 可能导致fastjson 以前出现的黑名单逃逸问题
if (s.contains("java.util.PriorityQueue") || s.contains("xsltc.trax.TemplatesImpl")) {
throw new ClassNotFoundException("Unable to load Dangerous ObjectStreamClass [" + osc + "]");
}
if (s.contains("org.apache.")) {
// 直接干掉了 org.apache ,但是要保留shiro自己
if (s.startsWith("org.apache.shiro.subject.")) {
return ClassUtils.forName(s);
}
throw new ClassNotFoundException("Unable to load Dangerous ObjectStreamClass [" + osc + "]");
}
// 使用白名单保证业务的正常开展
if (s.startsWith("java.lang") || s.startsWith("java.util")) {
return ClassUtils.forName(s);
} else {
throw new ClassNotFoundException("Unable to load Dangerous ObjectStreamClass [" + osc + "]");
}
} catch (UnknownClassException var3) {
throw new ClassNotFoundException("Unable to load ObjectStreamClass [" + osc + "]: ", var3);
}
}
}
\ No newline at end of file
package com.zyd.blog.core.config;
import org.apache.shiro.io.SerializationException;
import org.apache.shiro.io.Serializer;
import java.io.*;
public class MySecSerializer<T> implements Serializer<T> {
public MySecSerializer() {
}
public byte[] serialize(T o) throws SerializationException {
if (o == null) {
String msg = "argument cannot be null.";
throw new IllegalArgumentException(msg);
} else {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
BufferedOutputStream bos = new BufferedOutputStream(baos);
try {
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(o);
oos.close();
return baos.toByteArray();
} catch (IOException var6) {
String msg = "Unable to serialize object [" + o + "]. In order for the DefaultSerializer to serialize this object, the [" + o.getClass().getName() + "] class must implement java.io.Serializable.";
throw new SerializationException(msg, var6);
}
}
}
public T deserialize(byte[] serialized) throws SerializationException {
if (serialized == null) {
String msg = "argument cannot be null.";
throw new IllegalArgumentException(msg);
} else {
ByteArrayInputStream bais = new ByteArrayInputStream(serialized);
BufferedInputStream bis = new BufferedInputStream(bais);
try {
ObjectInputStream ois = new MyClassResolvingObjectInputStream(bis);
T deserialized = (T) ois.readObject();
ois.close();
return deserialized;
} catch (Exception var6) {
String msg = "Unable to deserialize argument byte array.";
throw new SerializationException(msg, var6);
}
}
}
}
......@@ -6,7 +6,6 @@ import com.zyd.blog.core.shiro.realm.ShiroRealm;
import com.zyd.blog.framework.property.RedisProperties;
import com.zyd.blog.framework.property.ShiroProperties;
import com.zyd.blog.framework.redis.CustomRedisManager;
import org.apache.shiro.codec.Base64;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
......@@ -27,6 +26,9 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.core.annotation.Order;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import java.security.NoSuchAlgorithmException;
import java.util.Map;
/**
......@@ -34,7 +36,7 @@ import java.util.Map;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......@@ -223,9 +225,38 @@ public class ShiroConfig {
*/
public CookieRememberMeManager rememberMeManager() {
CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager();
// 使用自定义的序列化类
cookieRememberMeManager.setSerializer(new MySecSerializer<>());
cookieRememberMeManager.setCookie(rememberMeCookie());
//rememberMe cookie加密的密钥 建议每个项目都不一样 默认AES算法 密钥长度(128 256 512 位)
cookieRememberMeManager.setCipherKey(Base64.decode("1QWLxg+NYmxraMoxAXu/Iw=="));
//rememberMe cookie加密的密钥 建议每个项目都不一样 默认AES算法 密钥长度(128 192 256 位)
cookieRememberMeManager.setCipherKey(GenerateCipherKey.generateNewKey());
return cookieRememberMeManager;
}
/**
* 解决 shiro 反序列化漏洞
*
* https://blog.csdn.net/qq_34775355/article/details/106643678
*/
public static class GenerateCipherKey {
/**
* 随机生成秘钥,参考org.apache.shiro.crypto.AbstractSymmetricCipherService#generateNewKey(int)
*
* @return byte[]
*/
public static byte[] generateNewKey() {
KeyGenerator kg;
try {
kg = KeyGenerator.getInstance("AES");
} catch (NoSuchAlgorithmException var5) {
String msg = "Unable to acquire AES algorithm. This is required to function.";
throw new IllegalStateException(msg, var5);
}
// 满足合规应使用256位
kg.init(256);
SecretKey key = kg.generateKey();
return key.getEncoded();
}
}
}
......@@ -9,7 +9,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/7/15 15:03
* @since 1.0
*/
......
......@@ -19,7 +19,7 @@ import javax.servlet.http.HttpServletResponse;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/7/15 15:24
* @since 1.0
*/
......
......@@ -5,7 +5,7 @@ import java.util.Map;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2019/2/11 10:07
* @since 1.8
*/
......
......@@ -30,7 +30,7 @@ import java.util.Map;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/25 14:37
* @since 1.0
*/
......@@ -46,6 +46,7 @@ public class ShiroServiceImpl implements ShiroService {
/**
* 初始化权限
*/
@Override
public Map<String, String> loadFilterChainDefinitions() {
/*
配置访问权限
......@@ -84,6 +85,7 @@ public class ShiroServiceImpl implements ShiroService {
/**
* 重新加载权限
*/
@Override
public void updatePermission() {
ShiroFilterFactoryBean shirFilter = SpringContextHolder.getBean(ShiroFilterFactoryBean.class);
synchronized (shirFilter) {
......@@ -136,6 +138,7 @@ public class ShiroServiceImpl implements ShiroService {
*
* @param roleId
*/
@Override
public void reloadAuthorizingByRoleId(Long roleId) {
List<User> userList = userService.listByRoleId(roleId);
if (CollectionUtils.isEmpty(userList)) {
......
......@@ -11,7 +11,7 @@ import org.apache.shiro.authc.credential.SimpleCredentialsMatcher;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......
......@@ -22,7 +22,7 @@ import java.util.concurrent.TimeUnit;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......
......@@ -29,7 +29,7 @@ import java.util.Set;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
*/
......@@ -78,8 +78,10 @@ public class ShiroRealm extends AuthorizingRealm {
// 赋予角色
List<Role> roleList = roleService.listRolesByUserId(userId);
for (Role role : roleList) {
info.addRole(role.getName());
if (null != roleList) {
for (Role role : roleList) {
info.addRole(role.getName());
}
}
// 赋予权限
......
......@@ -9,7 +9,7 @@ import org.springframework.web.socket.server.standard.ServerEndpointExporter;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/18 11:48
* @since 1.0
*/
......@@ -25,4 +25,4 @@ public class WebSocketConfig {
return new ServerEndpointExporter();
}
}
\ No newline at end of file
}
......@@ -15,7 +15,7 @@ import java.util.concurrent.atomic.AtomicInteger;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/18 11:48
* @since 1.0
*/
......
......@@ -15,7 +15,7 @@ import java.util.Set;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/18 11:48
* @since 1.0
*/
......
......@@ -20,22 +20,21 @@
"domain": "blog.csdn.net",
"titleRegex": "//h1[@class=title-article]/html()",
"authorRegex": "//a[@class=follow-nickName]/html()",
"releaseDateRegex": "//div[@class=article-bar-top]/span[@class=time]/html()",
"releaseDateRegex": "//div[@class=article-bar-top]/div[@class='bar-content']/span[@class=time]/html()",
"contentRegex": "//div[@id=content_views]/html()",
"tagRegex": "//span[@class=artic-tag-box]/a[@class=tag-link]/html()",
"targetLinksRegex": ".*blog\\.csdn\\.net/{uid}/article/details/[0-9a-zA-Z]{1,15}",
"targetLinksRegex": "(((http|ftp|https):\\/\\/[0-9a-zA-Z]{1,15}.blog.csdn.net/article/details/[0-9a-zA-Z]{1,15})|((http|ftp|https):\\/\\/blog.csdn.net/{uid}/article/details/[0-9a-zA-Z]{1,15}))",
"header": [
"Host=blog.csdn.net",
"Referer=https://blog.csdn.net/{uid}/article/list/1"
],
"cookie": "uuid_tt_dd=10_10331769530-1547536548454-504065; __yadk_uid=eg5NQPFTcIj2VFX6xv3ZJR5C8Q6PVnhm; smidV2=201901161027267de8378708fa178ab707894a70a126f100f32016b8489dd20; UN=u011197448; _ga=GA1.2.1772643969.1548209590; UM_distinctid=16882db136258b-0ce8092de75b71-6655742e-13c680-16882db1363437; gr_user_id=adf433f5-b683-45d5-80dd-caf4b7110360; _dg_id.40e39cb6d36d5282.c482=d846039aa9f3ff23%7C%7C%7C1548746364%7C%7C%7C1%7C%7C%7C1548746364%7C%7C%7C1548746364%7C%7C%7C%7C%7C%7Cf00a97bae3087c52%7C%7C%7Chttps%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DvtlNP9hvgRV6hAa9E1qaewZSIyCGR03ISdsDpTn-zP6muC9Cyop5IucCWeBKKtany7DrcUXgLmy83PTI98aNbSymNKzXgMUYl_c8xbxdt_W%26wd%3D%26eqid%3D85e43a6f000de5ab000000025c4ffe71%7C%7C%7Chttps%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DvtlNP9hvgRV6hAa9E1qaewZSIyCGR03ISdsDpTn-zP6muC9Cyop5IucCWeBKKtany7DrcUXgLmy83PTI98aNbSymNKzXgMUYl_c8xbxdt_W%26wd%3D%26eqid%3D85e43a6f000de5ab000000025c4ffe71%7C%7C%7C1%7C%7C%7Cundefined; pt_7cd998c4=uid=XsOJJs2ynt2SEUray9/meA&nid=1&vid=skmHxYQg4a0C8dk8c5hQuA&vn=1&pvn=1&sact=1548746403744&to_flag=0&pl=lW7Wzh7yRjgqeNTTgGYbFw*pt*1548746363475; ADHOC_MEMBERSHIP_CLIENT_ID1.0=c85c851e-bf2b-2e69-9332-5ef1b69d869d; BT=1551156352906; Hm_ct_6bcd52f51e9b3dce32bec4a3997715ac=1788*1*PC_VC!5744*1*u011197448!6525*1*10_10331769530-1547536548454-504065; dc_session_id=10_1553784106452.549598; bdshare_firstime=1555313012400; acw_tc=2760823b15578883310602927e32b811a6a04228c70de517201efc5c6a91ba; SESSION=a5fb6772-59f5-441a-9728-9d485c859155; dc_tos=prksrn; Hm_lvt_6bcd52f51e9b3dce32bec4a3997715ac=1557888343,1557888344,1557910597,1557974435; Hm_lpvt_6bcd52f51e9b3dce32bec4a3997715ac=1557974435; c-login-auto=5; acw_sc__v3=5cdcd164b6b2dd555c665f17642d63ea924e82cf; acw_sc__v2=5cdcd15e0d1889a5308a8f22e3c72110f788dbce",
"entryUrls": [
"https://blog.csdn.net/{uid}/article/list/1"
]
},
"iteye": {
"domain": "{uid}.iteye.com",
"titleRegex": "//div[@class=blog_title]/h3/a/html()",
"titleRegex": "//div[@class=blog_title]/h3/text()",
"authorRegex": "//div[@id=blog_owner_name]/html()",
"releaseDateRegex": "//div[@class=blog_bottom]/ul/li[1]/html()",
"contentRegex": "//div[@class=iteye-blog-content-contain]/html()",
......@@ -98,5 +97,46 @@
"entryUrls": [
"https://www.v2ex.com/member/{uid}"
]
},
"oschina": {
"domain": "oschina.net",
"titleRegex": "//h1[@class=article-box__title]/a/text()",
"authorRegex": "//div[@class=article-box__meta]/div[@class=item-list]/div[2]/a/html()",
"releaseDateRegex": "//div[@class=article-box__meta]/div[@class=item-list]/div[4]/html()",
"contentRegex": "//div[@class=content]/html()",
"tagRegex": "//div[@class=tags-box]/div[@class=tags-box__inner]/a/html()",
"targetLinksRegex": "https://my.oschina.net/.*/blog/[0-9]{1,10}",
"header": [
"Host=my.oschina.net",
"Referer=https://my.oschina.net"
],
"entryUrls": [
"https://my.oschina.net/{uid}",
"https://my.oschina.net/u/{uid}"
]
},
"jianshu": {
"resolver": {
"releaseDate": {
"type": "regex",
"clazz": "java.lang.Long",
"operator": "* 1000"
}
},
"domain": "jianshu.com",
"titleRegex": "//h1[@class=_1RuRku]/text()",
"authorRegex": "//span[@class=_22gUMi]/html()",
"releaseDateRegex": ".*\"first_shared_at\":([0-9]+),.*",
"contentRegex": "//article[@class=_2rhmJa]/html()",
"tagRegex": "//div",
"targetLinksRegex": "/p/[0-9a-zA-Z]{1,15}",
"header": [
"Host=www.jianshu.com",
"Referer=https://www.jianshu.com/p/{uid}"
],
"entryUrls": [
"https://www.jianshu.com/p/{uid}",
"https://www.jianshu.com/u/{uid}"
]
}
}
\ No newline at end of file
}
# Server settings
server:
tomcat:
basedir: /var/tmp/website-blog-admin
basedir: /var/tmp/oneblog/blog-admin
# SPRING PROFILES
spring:
profiles:
include: [center-dev]
# 指定默认MimeMessage的编码,默认为: UTF-8
mail:
default-encoding: UTF-8
# 指定SMTP server使用的协议,默认为: smtp
protocol: smtp
# 指定SMTP server host.
host: xxx
port: 465
# 指定SMTP server的用户名.
username: xxx
# 指定SMTP server登录密码:
password: xxx
# 指定是否在启动时测试邮件服务器连接,默认为false
test-connection: false
properties:
mail.smtp.auth: true
# 腾讯企业邮箱 下两个配置必须!!!
mail.smtp.ssl.enable: true
mail.smtp.socketFactory.class: javax.net.ssl.SSLSocketFactory
mail.smtp.socketFactory.port: 465
mail.smtp.starttls.enable: true
mail.smtp.starttls.required: true
mail.smtp.connectiontimeout: 50000
mail.smtp.timeout: 30000
mail.smtp.writetimeout: 50000
# Redis数据库索引(默认为0)
redis:
jedis:
pool:
# 连接池最大连接数(使用负值表示没有限制)
max-active: 8
# 连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
# 连接池中的最大空闲连接
max-idle: 8
# 连接池中的最小空闲连接
min-idle: 0
# 连接超时时间(毫秒)
timeout: 5000ms
# 默认的数据过期时间,主要用于shiro权限管理
expire: 2592000
# logging settings
logging:
path: /var/tmp/website-blog-admin
config: classpath:logback-spring.xml
path: /var/tmp/oneblog/blog-admin
####################################自定义配置##########################################
app:
# 是否启用kaptcha验证码
enableKaptcha: false
enableKaptcha: ${ONEBLOG_APP_ENABLE_KAPTCHA:false}
# 启用后,项目在启动时会打印数据库(Mysql和Redis)链接信息(包含密码)
# 代码请参考
enabledConfigLog: true
enabledConfigLog: ${ONEBLOG_APP_ENABLE_CONFIGLOG:false}
# shiro配置项
shiro:
loginUrl: "/passport/login/"
......
# Server settings
server:
tomcat:
basedir: /var/tmp/website-blog-admin
# SPRING PROFILES
spring:
profiles:
include: [center-test]
# 指定默认MimeMessage的编码,默认为: UTF-8
mail:
default-encoding: UTF-8
# 指定SMTP server使用的协议,默认为: smtp
protocol: smtp
# 指定SMTP server host.
host: xxx
port: 465
# 指定SMTP server的用户名.
username: xxx
# 指定SMTP server登录密码:
password: xxx
# 指定是否在启动时测试邮件服务器连接,默认为false
test-connection: false
properties:
mail.smtp.auth: true
# 腾讯企业邮箱 下两个配置必须!!!
mail.smtp.ssl.enable: true
mail.smtp.socketFactory.class: javax.net.ssl.SSLSocketFactory
mail.smtp.socketFactory.port: 465
mail.smtp.starttls.enable: true
mail.smtp.starttls.required: true
mail.smtp.connectiontimeout: 50000
mail.smtp.timeout: 30000
mail.smtp.writetimeout: 50000
# Redis数据库索引(默认为0)
redis:
jedis:
pool:
# 连接池最大连接数(使用负值表示没有限制)
max-active: 8
# 连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
# 连接池中的最大空闲连接
max-idle: 8
# 连接池中的最小空闲连接
min-idle: 0
# 连接超时时间(毫秒)
timeout: 5000ms
# 默认的数据过期时间,主要用于shiro权限管理
expire: 2592000
# logging settings
logging:
path: /var/tmp/website-blog-admin
####################################自定义配置##########################################
app:
# 是否启用kaptcha验证码
enableKaptcha: false
# 启用后,项目在启动时会打印数据库(Mysql和Redis)链接信息(包含密码)
# 代码请参考
enabledConfigLog: false
# shiro配置项
shiro:
loginUrl: "/passport/login/"
successUrl: "/"
unauthorizedUrl: "/error/403"
####################################自定义配置##########################################
${AnsiColor.BLUE}
====================================================================================================================================
欢迎使用 OneBlog 博客系统(原DBlog) - Powered By https://www.zhyd.me
欢迎使用 OneBlog 博客系统(原DBlog) - Powered By https://docs.zhyd.me
官方开源地址(Gitee):https://gitee.com/yadong.zhang/DBlog
官方开源地址(Github):https://github.com/zhangyd-c/OneBlog
唯一官方QQ群:190886500
......@@ -16,4 +16,4 @@ ${AnsiColor.BLUE}
|___/
当前SpringBoot版本 :: ${spring-boot.version}
====================================================================================================================================
\ No newline at end of file
====================================================================================================================================
......@@ -26,31 +26,23 @@
</layout>
</appender>
<logger name="org.springframework.core.env" level="ERROR"/>
<logger name="us.codecraft.webmagic.downloader" level="WARN"/>
<logger name="com.zyd.blog.framework.runner" level="INFO"/>
<logger name="org.springframework.core.env" level="DEBUG"/>
<logger name="us.codecraft.webmagic.downloader" level="DEBUG"/>
<logger name="com.zyd.blog.framework.runner" level="DEBUG"/>
<!-- 测试环境+开发环境,日志级别为INFO且不写日志文件 -->
<springProfile name="test,dev">
<logger name="com.zyd.blog" additivity="false">
<appender-ref ref="STDOUT"/>
</logger>
<root level="INFO">
<springProfile name="dev">
<root level="DEDBUG">
<appender-ref ref="STDOUT"/>
</root>
</springProfile>
<!-- 生产环境. 日志级别为WARN且写日志文件-->
<springProfile name="prod">
<logger name="com.zyd.blog" additivity="false">
<appender-ref ref="STDOUT"/>
<appender-ref ref="FILE" />
</logger>
<root level="WARN">
<appender-ref ref="STDOUT"/>
<appender-ref ref="FILE" />
</root>
</springProfile>
</configuration>
\ No newline at end of file
</configuration>
......@@ -3,7 +3,7 @@
*
* 项目页面模板核心CSS
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2017-04-01
* @since 1.0
......@@ -5171,4 +5171,4 @@ ul, menu, dir {
.pointer {
cursor: pointer;
}
\ No newline at end of file
}
......@@ -24,7 +24,7 @@
target.data_list = null; //用于存放格式化后的数据-按父分组
target.data_obj = null; //用于存放格式化后的数据-按id存对象
// 在外层包装一下div,样式用的bootstrap-table的
var _main_div = $("<div class='bootstrap-tree-table'></div>");
var _main_div = $("<div class='bootstrap-tree-table' style='overflow: hidden;overflow-x: auto;'></div>");
target.before(_main_div);
_main_div.append(target);
target.addClass("table table-hover treetable-table");
......@@ -36,7 +36,7 @@
}
// 工具条在外层包装一下div,样式用的bootstrap-table的
if (options.toolbar) {
var _tool_div = $("<div class='treetable-bars pull-left'></div>");
var _tool_div = $("<div class='treetable-bars'></div>");
_tool_div.append($(options.toolbar));
_main_div.before(_tool_div);
}
......@@ -183,7 +183,7 @@
});
target.append(tbody);
//动态设置表头宽度
thead.css("width", tbody.children(":first").css("width"));
thead.css("width", "100%");
registerExpanderEvent();
registerRowClickEvent();
};
......
......@@ -3,7 +3,7 @@
* 项目核心Js类,负责项目前端模板方面的初始化等操作
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018-04-25
* @since 1.0
......@@ -12,7 +12,7 @@ var editor = null, simplemde = null;
var zhyd = window.zhyd || {
combox: {
init: function () {
init: function (mockComboxCallback) {
$('select[target=combox]').each(function (e) {
var $this = $(this);
var url = $this.data("url");
......@@ -47,6 +47,10 @@ var zhyd = window.zhyd || {
var liTpl = '{{#data}}<li data-value="{{id}}">{{name}}</li>{{/data}}';
var html = Mustache.render(liTpl, json);
$this.html(html);
if ($.isFunction(mockComboxCallback)) {
mockComboxCallback();
}
}
}
});
......@@ -75,11 +79,13 @@ var zhyd = window.zhyd || {
function add() {
var thisId = $(this).data("value");
var thisText = $(this).text().trim();
console.log(thisText);
$this.tagsinput('add', {"id": thisId, "name": thisText}, {add: false});
}
$($bindBox).find("li").each(function () {
var $li = $(this);
console.log(222222)
$li.bind('click', add);
});
$(".bootstrap-tagsinput input").bind('keydown', function (event) {
......@@ -103,7 +109,7 @@ var zhyd = window.zhyd || {
}
});
})
}, 500);
}, 700);
}
},
initTextSlider: function () {
......@@ -562,8 +568,7 @@ $(document).ready(function () {
});
}
});
zhyd.combox.init();
zhyd.tagsInput.init();
zhyd.combox.init(zhyd.tagsInput.init);
zhyd.mask.init();
/**
......@@ -582,7 +587,7 @@ $(document).ready(function () {
});
var notice = [
'<strong>Hi Boy!</strong> 前台首页的 “轮播”只会显示“推荐文章”哦',
'<strong class="red">Hi Boy! 前台首页的 “轮播”只会显示“推荐文章”哦</strong>',
'要想百度搜索引擎快速收录文章,可以试试“推送”功能哦',
'批量推送文章到百度可以一次提交多篇文章哦',
'碰到页面显示和数据库内容不一致的情况,可以先考虑清下redis缓存哦',
......@@ -592,7 +597,7 @@ $(document).ready(function () {
];
var $noticeBox = $("#notice-box");
var tpl = '{{#data}}<li class="scrolltext-title">'
+ '<a href="javascript:void(0)" rel="bookmark">{{&.}}</a>'
+ '{{&.}}'
+ '</li>{{/data}}';
var html = Mustache.render(tpl, {"data": $.tool.shuffle(notice)});
$noticeBox.html(html);
......@@ -606,4 +611,4 @@ $(document).ready(function () {
window.location.href = $this.data("href");
})
})
});
\ No newline at end of file
});
......@@ -5,7 +5,450 @@
* @since 1.0
*/
var zhyd = window.zhyd || {};
//扩展echart图表样式
zhyd.chartConfig = {
"color": [
"#5470c6",
"#91cc75",
"#fac858",
"#ee6666",
"#73c0de",
"#3ba272",
"#fc8452",
"#9a60b4",
"#ea7ccc",
"#60c0dd",
"#d7504b",
"#c6e579",
"#f4e001",
"#f0805a",
"#26c0c0"
],
// "backgroundColor": "rgba(254,248,239,1)",
"textStyle": {},
"title": {
"textStyle": {
"color": "#27727b"
},
"subtextStyle": {
"color": "#aaaaaa"
}
},
"line": {
"itemStyle": {
"borderWidth": 1
},
"lineStyle": {
"width": "3"
},
"symbolSize": "5",
"symbol": "emptyCircle",
"smooth": false
},
"radar": {
"itemStyle": {
"borderWidth": 1
},
"lineStyle": {
"width": "3"
},
"symbolSize": "5",
"symbol": "emptyCircle",
"smooth": false
},
"bar": {
"itemStyle": {
"barBorderWidth": 0,
"barBorderColor": "#ccc"
}
},
"pie": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
},
"scatter": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
},
"boxplot": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
},
"parallel": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
},
"sankey": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
},
"funnel": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
},
"gauge": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
},
"candlestick": {
"itemStyle": {
"color": "#c1232b",
"color0": "#b5c334",
"borderColor": "#c1232b",
"borderColor0": "#b5c334",
"borderWidth": 1
}
},
"graph": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"lineStyle": {
"width": 1,
"color": "#aaaaaa"
},
"symbolSize": "5",
"symbol": "emptyCircle",
"smooth": false,
"color": [
"#c1232b",
"#27727b",
"#fcce10",
"#e87c25",
"#b5c334",
"#fe8463",
"#9bca63",
"#fad860",
"#f3a43b",
"#60c0dd",
"#d7504b",
"#c6e579",
"#f4e001",
"#f0805a",
"#26c0c0"
],
"label": {
"color": "#eeeeee"
}
},
"map": {
"itemStyle": {
"normal": {
"areaColor": "#dddddd",
"borderColor": "#eeeeee",
"borderWidth": 0.5
},
"emphasis": {
"areaColor": "#fe994e",
"borderColor": "#444",
"borderWidth": 1
}
},
"label": {
"normal": {
"textStyle": {
"color": "#c1232b"
}
},
"emphasis": {
"textStyle": {
"color": "rgb(100,0,0)"
}
}
}
},
"geo": {
"itemStyle": {
"normal": {
"areaColor": "#dddddd",
"borderColor": "#eeeeee",
"borderWidth": 0.5
},
"emphasis": {
"areaColor": "#fe994e",
"borderColor": "#444",
"borderWidth": 1
}
},
"label": {
"normal": {
"textStyle": {
"color": "#c1232b"
}
},
"emphasis": {
"textStyle": {
"color": "rgb(100,0,0)"
}
}
}
},
"categoryAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#27727b"
}
},
"axisTick": {
"show": true,
"lineStyle": {
"color": "#27727b"
}
},
"axisLabel": {
"show": true,
"textStyle": {
"color": "#333"
}
},
"splitLine": {
"show": false,
"lineStyle": {
"color": [
"#ccc"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"rgba(250,250,250,0.3)",
"rgba(200,200,200,0.3)"
]
}
}
},
"valueAxis": {
"axisLine": {
"show": false,
"lineStyle": {
"color": "#333"
}
},
"axisTick": {
"show": false,
"lineStyle": {
"color": "#333"
}
},
"axisLabel": {
"show": true,
"textStyle": {
"color": "#333"
}
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#ccc"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"rgba(250,250,250,0.3)",
"rgba(200,200,200,0.3)"
]
}
}
},
"logAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#27727b"
}
},
"axisTick": {
"show": true,
"lineStyle": {
"color": "#333"
}
},
"axisLabel": {
"show": true,
"textStyle": {
"color": "#333"
}
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#ccc"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"rgba(250,250,250,0.3)",
"rgba(200,200,200,0.3)"
]
}
}
},
"timeAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#27727b"
}
},
"axisTick": {
"show": true,
"lineStyle": {
"color": "#333"
}
},
"axisLabel": {
"show": true,
"textStyle": {
"color": "#333"
}
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#ccc"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"rgba(250,250,250,0.3)",
"rgba(200,200,200,0.3)"
]
}
}
},
"toolbox": {
"iconStyle": {
"normal": {
"borderColor": "#c1232b"
},
"emphasis": {
"borderColor": "#e87c25"
}
}
},
"legend": {
"textStyle": {
"color": "#333333"
}
},
"tooltip": {
"axisPointer": {
"lineStyle": {
"color": "#27727b",
"width": 1
},
"crossStyle": {
"color": "#27727b",
"width": 1
}
}
},
"timeline": {
"lineStyle": {
"color": "#293c55",
"width": 1
},
"itemStyle": {
"normal": {
"color": "#27727b",
"borderWidth": 1
},
"emphasis": {
"color": "#72d4e0"
}
},
"controlStyle": {
"normal": {
"color": "#27727b",
"borderColor": "#27727b",
"borderWidth": 0.5
},
"emphasis": {
"color": "#27727b",
"borderColor": "#27727b",
"borderWidth": 0.5
}
},
"checkpointStyle": {
"color": "#c1232b",
"borderColor": "#c23531"
},
"label": {
"normal": {
"textStyle": {
"color": "#293c55"
}
},
"emphasis": {
"textStyle": {
"color": "#293c55"
}
}
}
},
"visualMap": {
"color": [
"#c1232b",
"#fcce10"
]
},
"dataZoom": {
"backgroundColor": "rgba(0,0,0,0)",
"dataBackgroundColor": "rgba(181,195,52,0.3)",
"fillerColor": "rgba(181,195,52,0.2)",
"handleColor": "#27727b",
"handleSize": "100%",
"textStyle": {
"color": "#999999"
}
},
"markPoint": {
"label": {
"color": "#eeeeee"
},
"emphasis": {
"label": {
"color": "#eeeeee"
}
}
}
}
/*初始化数据,这是原来的*/
/*zhyd.chartConfig = {
color: ["#26B99A", "#34495E", "#BDC3C7", "#3498DB", "#9B59B6", "#8abb6f", "#759c6a", "#bfd3b7"],
title: {
itemGap: 8,
......@@ -208,7 +651,7 @@ zhyd.chartConfig = {
textStyle: {
fontFamily: "Arial, Verdana, sans-serif"
}
};
};*/
zhyd.createChart = function (options) {
var op = $.extend({
id: '',
......@@ -312,4 +755,4 @@ function init_echarts() {
})
}
}
}
\ No newline at end of file
}
......@@ -25,7 +25,8 @@ Table.prototype = {
var $tablelist = $(options.tableBox);
$tablelist.bootstrapTable('destroy').bootstrapTable({
url: options.url,
method: 'post', //请求方式(*)
method: 'method' in options ? options.method : 'post', //请求方式(*)
formId: 'formId' in this.options ? this.options.formId : '#form1',
toolbar: options.showToolbar !== false ? options.toolbar ? options.toolbar : '#toolbar' : '', //工具按钮用哪个容器
striped: true, //是否显示行间隔色
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
......@@ -199,9 +200,16 @@ Table.prototype = {
this.bindEvent("click", selector, callback);
},
queryParams: function (params) {
params = $.extend({}, params);
params.keywords = params.searchText;
return params;
var formdata = decodeURIComponent($(this.formId).serialize());
var data = formdata.split('&');
var parameter = {};
for(var i=0;i<data.length;i++) {
data2 = data[i].split('=');
parameter[data2[0]] = data2[1];
}
return {
...parameter, ...params
};
},
refresh: function () {
var options = this.options;
......
......@@ -3,7 +3,7 @@
* 项目工具类
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2017-09-02
* @since 1.0
......@@ -538,4 +538,4 @@ Date.prototype.format = function (format) {
}
}
return format;
};
\ No newline at end of file
};
......@@ -18,7 +18,7 @@ $.extend({
toobarTemplate: '<div id="tree-table-toolbar" class="btn-group" role="group" aria-label="..."><button id="add-btn" type="button" class="btn btn-info" title="新增"><i class="fa fa-plus fa-fw"> </i> </button><button id="batch-delete-btn" type="button" class="btn btn-danger" title="批量删除"><i class="fa fa-trash-o fa-fw"> </i> </button></div>',
oprater: {
title: '操作',
width: '100px',
width: '130px',
align: "center",
formatter: function (value, row, index) {
var curId = row.id;
......@@ -168,4 +168,4 @@ $.extend({
}
}
});
\ No newline at end of file
});
......@@ -3,7 +3,7 @@
* 图片预览
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018-04-25
* @since 1.0
......@@ -80,4 +80,4 @@ jQuery.fn.extend({
}
})
}
});
\ No newline at end of file
});
......@@ -11,6 +11,20 @@
</ol>
</@breadcrumb>
<div class="x_panel">
<form class="form-inline" id="article1" onclick="return false;">
<div class="form-group">
<label class="control-label">名称和描述:</label>
<input class=" form-control" name="keywords" placeholder="请输入关键字查询" value="">
</div>
<div class="form-group">
<label class="control-label">名称:</label>
<input class="form-control" name="title" placeholder="请输入名称关键字查询" value="">
</div>
<div class="form-group">
<button id="search-button" class="btn btn-primary"><i class="fa fa-search"></i>查询</button>
</div>
</form>
<div class="x_content">
<div class="<#--table-responsive-->">
<div class="btn-group hidden-xs" id="toolbar">
......@@ -68,6 +82,7 @@
$(function () {
var options = {
modalName: "文章",
formId: "#article1",
url: "/article/list",
getInfoUrl: "/article/get/{id}",
removeUrl: "/article/remove",
......@@ -95,7 +110,7 @@
align: 'center',
editable: false,
formatter: function (code, row, index) {
return code ? '<a href="' + code + '" class="showImage" title="' + row.title + '" rel="external nofollow"><img src="' + code + '" alt="' + row.title + '" class="img-rounded" style="width: 30px;height: auto;"></a>' : '-';
return code ? '<a href="' + code + '" class="showImage" title="' + row.title + '" rel="external nofollow"><img src="' + code + '" alt="' + row.title + '" onerror="this.src=\'/assets/images/favicon.ico\'" class="img-rounded" style="width: 30px;height: auto;"></a>' : '-';
}
}, {
field: 'comment',
......@@ -148,6 +163,14 @@
formatter: function (code) {
return code ? code : '-';
}
}, {
field: 'private',
title: '私密',
width: '50px',
align: 'center',
formatter: function (code) {
return code ? '<span class="label label-danger"><i class="fa fa-lock fa-fw"></i>私密</span>' : '<span class="label label-success"><i class="fa fa-unlock fa-fw"></i>公开</span>';
}
}, {
field: 'createTime',
title: '发布时间',
......@@ -272,5 +295,11 @@
}, 5000);
}
});
// 搜索查询按钮触发事件
$(function() {
$("#search-button").click(function () {
$('#tablelist').bootstrapTable(('refresh')); // 很重要的一步,刷新url!
})
})
</script>
</@footer>
\ No newline at end of file
</@footer>
......@@ -66,7 +66,7 @@
</div>
</div>
</div>
<@publishmodal></@publishmodal>
<@publishModal></@publishModal>
</form>
</div>
<@chooseImgModal></@chooseImgModal>
......
......@@ -53,7 +53,7 @@
</div>
</div>
</div>
<@publishmodal></@publishmodal>
<@publishModal></@publishModal>
</form>
<@chooseImgModal></@chooseImgModal>
<@footer>
......
......@@ -152,7 +152,7 @@
width: '50px',
align: 'center',
formatter: function (code) {
return code ? '<span class="label label-success">可用</span>' : '<span class="label label-danger">不可用</span>';
return code ? '<span class="label label-success">可用</span>' : '<span class="label label-danger">用</span>';
}
}, {
field: 'icon',
......@@ -188,4 +188,4 @@
});
});
</script>
</@footer>
\ No newline at end of file
</@footer>
......@@ -165,7 +165,7 @@
var $parent = row.parent;
var parent = $parent ? '<div style="background-color: #f1f1f1;padding: 5px;margin: 5px;border-radius: 4px;"><div style="padding-left: 10px;"><i class="fa fa-quote-left fa-fw"></i><strong>原评:</strong>' + filterXSS($parent.content) + '</div></div>' : '';
return '<div style="border-bottom: 1px solid #dcddde;margin-bottom: 10px;">评论自:'+source+'</div>' +
'<div class="col-md-12">' + content + parent + '</div>';
'<div class="col-md-12" style="word-break: break-all;">' + content + parent + '</div>';
}
}, {
field: 'support',
......@@ -296,4 +296,4 @@
});
});
</script>
</@footer>
\ No newline at end of file
</@footer>
......@@ -89,19 +89,17 @@
<#-- 面包屑导航内容 + 系统通知 -->
<#macro breadcrumb>
<div class="row">
<div class="col col-md-8">
<nav class="breadcrumb">
<div class="notify"><i class="fa fa-bullhorn fa-fw"></i></div>
<div id="scrolldiv">
<div class="scrolltext">
<ul class="list-unstyled" id="notice-box">
<li class="scrolltext-title">
<a href="javascript:void(0)" rel="bookmark">其实我们可以将所有的问题归结为两种:一种是没饭吃饿出来的;一种是吃饱了撑出来的。</a>
</li>
</ul>
</div>
<div class="col col-md-8 col-xs-12">
<div class="notify"><i class="fa fa-bullhorn fa-fw"></i></div>
<div id="scrolldiv">
<div class="scrolltext">
<ul class="list-unstyled" id="notice-box">
<li class="scrolltext-title">
其实我们可以将所有的问题归结为两种:一种是没饭吃饿出来的;一种是吃饱了撑出来的。
</li>
</ul>
</div>
</nav>
</div>
</div>
<div class="col col-md-4 text-right">
<#nested>
......@@ -110,7 +108,7 @@
</#macro>
<#-- 发布文章填写文章详情的弹窗模板 -->
<#macro publishmodal>
<#macro publishModal>
<div class="modal fade" id="publishModal" tabindex="-1" role="dialog" aria-labelledby="publishLabel" data-backdrop="static">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
......@@ -179,6 +177,12 @@
<input type="checkbox" class="square" name="comment" id="comment">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-2 col-sm-2 col-xs-12" for="comment">私密文章 </label>
<div class="col-md-10 col-sm-10 col-xs-12 fixed-radio-checkbox">
<input type="text" class="square form-control" name="password" placeholder="请输入文章密码">
</div>
</div>
</div>
</div>
</div>
......@@ -279,8 +283,8 @@
<div class="col col-lg-4 col-sm-4 col-md-4 col-xs-4">
<fieldset>
<legend>关注公众号</legend>
<a href="https://gitee.com/yadong.zhang/static/raw/master/wx/wechat_account_500x500.jpg" class="showImage" title="关注公众号:码一码" rel="external nofollow" style="display: block;text-align: center">
<img src="https://gitee.com/yadong.zhang/static/raw/master/wx/wechat_account_500x500.jpg" class="img-rounded" alt="关注公众号:码一码" width="300">
<a href="/assets/images/wechat_account_500x500.jpg" class="showImage" title="关注公众号:码一码" rel="external nofollow" style="display: block;text-align: center">
<img src="/assets/images/wechat_account_500x500.jpg" class="img-rounded" alt="关注公众号:码一码" width="300">
</a>
</fieldset>
</div>
......@@ -292,7 +296,7 @@
<ul>
<li>开源项目地址①:<a href="https://gitee.com/yadong.zhang/DBlog" target="_blank">https://gitee.com/yadong.zhang/DBlog</a></li>
<li>开源项目地址②:<a href="https://github.com/zhangyd-c/OneBlog" target="_blank">https://github.com/zhangyd-c/OneBlog</a></li>
<li>博主网站首页:<a href="https://www.zhyd.me" target="_blank">https://www.zhyd.me</a></li>
<li>博主网站首页:<a href="https://docs.zhyd.me" target="_blank">https://docs.zhyd.me</a></li>
</ul>
<h2>Demo演示</h2>
<ul>
......@@ -301,9 +305,9 @@
</ul>
<h2>获取帮助</h2>
<ul>
<li>相关Wiki:<a href="https://gitee.com/yadong.zhang/DBlog/wikis" target="_blank">https://gitee.com/yadong.zhang/DBlog/wikis</a></li>
<li>相关Wiki:<a href="https://docs.zhyd.me" target="_blank">https://docs.zhyd.me</a></li>
<li>提issue:<a href="https://gitee.com/yadong.zhang/DBlog/issues" target="_blank">https://gitee.com/yadong.zhang/DBlog/issues</a></li>
<li>留言:<a href="https://www.zhyd.me/guestbook" target="_blank">https://www.zhyd.me/guestbook</a></li>
<li>留言:<a href="https://docs.zhyd.me/guestbook" target="_blank">https://docs.zhyd.me/guestbook</a></li>
<li>加QQ群:<a href="http://shang.qq.com/wpa/qunwpa?idkey=9f986e9b33b1de953e1ef9a96cdeec990affd0ac7855e00ff103514de2027b60" target="_blank">190886500</a></li>
</ul>
<h2>其他开源作品</h2>
......@@ -325,7 +329,7 @@
<li><span><span><strong>评论系统</strong>:自研的评论系统,支持显示用户地址、浏览器和os信息,后台可审核评论、开启匿名评论、回复和邮件通知评论</span></span></li>
<li><span><span><strong>权限管理</strong>:后台配备完善的权限管理</span></span></li>
<li><span><span><strong>SEO</strong>:自带robots、sitemap等seo模板,实现自动生成robots和sitemap</span></span></li>
<li><span><span><strong>实时通讯</strong>:管理员可向在线的用户发送实时消息(需用户授权 - 基于websocket实现,具体参考<a href="https://www.zhyd.me/article/111">DBlog建站之Websocket的使用</a></span></span></li>
<li><span><span><strong>实时通讯</strong>:管理员可向在线的用户发送实时消息(需用户授权 - 基于websocket实现,具体参考<a href="https://docs.zhyd.me/article/111">DBlog建站之Websocket的使用</a></span></span></li>
<li><span><span><strong>系统配置支持快速配置</strong>:可通过后台手动修改诸如域名信息、SEO优化、赞赏码、七牛云以及更新维护通知等</span></span></li>
<li><span><span><strong><i class="fa fa-fire fa-fw red"></i>多种文件存储</strong>:集成七牛云、阿里云OSS,实现文件云存储,同时支持本地文件存储</span></span></li>
<li><span><span><strong><i class="fa fa-fire fa-fw red"></i>文件搬运工</strong>:集成<a href="https://gitee.com/yadong.zhang/blog-hunter">blog-hunter</a>实现“文章搬运工”功能,支持一键同步imooc、csdn、iteye或者cnblogs上的文章,可抓取列表和单个文章</span></span></li>
......@@ -337,9 +341,10 @@
</div>
<div class="modal-footer">
<span class="pull-left">tips: 如不想显示该弹窗,可在 <code>index.ftl</code> 中搜索 <code>aboutOneBlog</code> 后删掉相关代码</span>
<button type="button" class="btn btn-danger" data-dismiss="modal" id="neverShowNoticeModal"><i class="fa fa-close"> 不再显示</i></button>
<button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-close"> 关闭</i></button>
</div>
</div>
</div>
</div>
</#macro>
\ No newline at end of file
</#macro>
......@@ -68,50 +68,71 @@
}
</style>
</@header>
<#-- 网站首页的项目介绍内容 -->
<@aboutOneBlog></@aboutOneBlog>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12 top_tiles">
<#-- 文章 -->
<a href="/articles" class="statistics-panel">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 statistics-article" data-key="articleCount">
<div class="col-lg-2 col-md-2 col-sm-6 col-xs-12 statistics-article" data-key="articleCount">
<div class="tile-stats statistics-box">
<div class="icon"><i class="fa fa-envira"></i></div>
<div class="count"></div>
<div class="icon"><i style="color: #5470c6;" class="fa fa-envira"></i></div>
<div class="count" style="color: #9a60b4"></div>
<h4>文章</h4>
</div>
</div>
</a>
<#-- 标签 -->
<a href="/article/tags" class="statistics-panel">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 statistics-tag" data-key="tagCount">
<div class="col-lg-2 col-md-2 col-sm-6 col-xs-12 statistics-tag" data-key="tagCount">
<div class="tile-stats statistics-box">
<div class="icon"><i class="fa fa-tags"></i></div>
<div class="count"></div>
<div class="icon"><i style="color: #91cc75;" class="fa fa-tags"></i></div>
<div class="count" style="color: #ea7ccc"></div>
<h4>标签</h4>
</div>
</div>
</a>
<#-- 分类 -->
<a href="/article/types" class="statistics-panel">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 statistics-type" data-key="typeCount">
<div class="col-lg-2 col-md-2 col-sm-6 col-xs-12 statistics-type" data-key="typeCount">
<div class="tile-stats statistics-box">
<div class="icon"><i class="fa fa-th"></i></div>
<div class="count"></div>
<div class="icon"><i style="color: #fac858;" class="fa fa-th"></i></div>
<div class="count" style="color: #60c0dd"></div>
<h4>分类</h4>
</div>
</div>
</a>
<#-- 评论 -->
<a href="/comments" class="statistics-panel">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 statistics-comment" data-key="commentCount">
<div class="col-lg-2 col-md-2 col-sm-6 col-xs-12 statistics-comment" data-key="commentCount">
<div class="tile-stats statistics-box">
<div class="icon"><i class="fa fa-comments-o"></i></div>
<div class="count"></div>
<div class="icon"><i style="color: #ee6666;" class="fa fa-comments-o"></i></div>
<div class="count" style="color: #d7504b"></div>
<h4>留言数</h4>
</div>
</div>
</a>
<#--总访问 量-->
<a id="fangwen" href="#" class="statistics-panel">
<div class="col-lg-2 col-md-2 col-sm-6 col-xs-12 statistics-lookCount" data-key="lookCount">
<#--隐藏域,放进去值,方便运算-->
<input type="hidden" id="fangwen_inp" value="">
<div class="tile-stats statistics-box">
<div class="icon"><i style="color: #73c0de;" class="fa fa-bar-chart"></i></div>
<div class="count" id="l_count_mxx" style="color: #c6e579;"></div>
<h4>访问量</h4>
</div>
</div>
</a>
<#--总赞数-->
<a href="/articles" class="statistics-panel">
<div class="col-lg-2 col-md-2 col-sm-6 col-xs-12 statistics-zanCount" data-key="zanCount">
<div class="tile-stats statistics-box">
<div class="icon"><i style="color: #FF6666;" class="fa fa-thumbs-o-up"></i></div>
<div class="count"></div>
<h4>总赞量</h4>
</div>
</div>
</a>
</div>
</div>
<div class="row">
......@@ -250,56 +271,110 @@
</div>
</div>
</div>
<#-- 网站首页的项目介绍内容 -->
<@aboutOneBlog></@aboutOneBlog>
<@footer>
<script src="https://cdn.jsdelivr.net/npm/echarts@4.1.0/dist/echarts.min.js"></script>
<script src="/assets/js/zhyd.echarts.js"></script>
<script>
/* 顶部卡片统计 */
$.post("/statistics/siteInfo", function (json) {
$.alert.ajaxSuccess(json);
if(json.status == 200){
var jsonData = json.data;
<#-- 显示或者关闭首页的弹窗,当点击“不再显示后”,如果清缓存,这个弹窗仍然会再次显示 -->
<script type="text/javascript">
var neverShowNoticeModal = localStorage.getItem("neverShowNoticeModal");
if(!neverShowNoticeModal) {
$("#noticeModal").modal('show');
}
$("#neverShowNoticeModal").click(function (){
localStorage.setItem("neverShowNoticeModal", 1);
})
</script>
<script>
/* 顶部卡片统计 */
$.post("/statistics/siteInfo", function (json) {
$.alert.ajaxSuccess(json);
if (json.status == 200) {
//给隐藏域里面设置访问量,好让点击的时候能看到具体的数字,心理有个数
var $this = $(".statistics-lookCount");
var jsonData = json.data;
var jsonKey = $this.data("key");
$("#fangwen_inp").val(jsonData[jsonKey]);
//end
function setValue(dom, value) {
var $dom = dom;
$dom.find("div.tile-stats .count").text(value);
function setValue(dom, value) {
var $dom = dom;
$dom.find("div.tile-stats .count").text(value);
}
$(".statistics-tag, .statistics-type, .statistics-comment, .statistics-article, .statistics-lookCount, .statistics-zanCount").each(function () {
var $this = $(this);
var jsonKey = $this.data("key");
setValue($this, jsonData[jsonKey]);
});
}
//设置显示数字格式,k或者w
$(function () {
var num = $("#l_count_mxx").text();
// var num = 1209;
//点击显示访问量
$("#fangwen").click(function () {
layui.use('layer', function () {
var layer = layui.layer;
layer.msg("总访问量是:" + $("#fangwen_inp").val(), {
time: 2000 //20s后自动关闭
});
});
});
//转换数字格式,k或者w
if (num >= 10000) {
num = Math.round(num / 1000) / 10 + 'W';
} else if (num >= 1000) {
num = Math.round(num / 100) / 10 + 'K';
}
$("#l_count_mxx").text(num);
//点击显示详细的
$(".statistics-tag, .statistics-type, .statistics-comment, .statistics-article").each(function () {
var $this = $(this);
var jsonKey = $this.data("key");
setValue($this, jsonData[jsonKey]);
});
}
});
/* 分类文章数统计 */
$.post("/statistics/listType", function (json) {
$.alert.ajaxSuccess(json);
if(json.status == 200){
var jsonData = json.data;
zhyd.createChart({id:'echart_type', legendData: getNames(jsonData, 'name'), series:{name:'分类文章数统计', type: 'pie', seriesData: jsonData}});
}
});
/* 爬虫访问统计 */
$.post("/statistics/listSpider", function (json) {
$.alert.ajaxSuccess(json);
if(json.status == 200){
var jsonData = json.data || [{name: '暂无', value: 0}];
zhyd.createChart({id:'echart_spider', legendData: getNames(jsonData, 'name'), series:{name:'爬虫访问统计', type: 'pie', seriesData: jsonData}});
}
});
function getNames(arr, key) {
if(!arr){
return [];
}
var resultArr = [];
$.each(arr, function (i, v) {
resultArr.push(v[key]);
});
return resultArr;
}
init_echarts();
$("#noticeModal").modal('show');
</script>
</@footer>
\ No newline at end of file
/* 分类文章数统计 */
$.post("/statistics/listType", function (json) {
$.alert.ajaxSuccess(json);
if (json.status == 200) {
var jsonData = json.data;
zhyd.createChart({
id: 'echart_type',
legendData: getNames(jsonData, 'name'),
series: {name: '分类文章数统计', type: 'pie', seriesData: jsonData}
});
}
});
/* 爬虫访问统计 */
$.post("/statistics/listSpider", function (json) {
$.alert.ajaxSuccess(json);
if (json.status == 200) {
var jsonData = json.data || [{name: '暂无', value: 0}];
zhyd.createChart({id:'echart_spider', legendData: getNames(jsonData, 'name'), series:{name:'爬虫访问统计', type: 'pie', seriesData: jsonData}});
}
});
function getNames(arr, key) {
if(!arr){
return [];
}
var resultArr = [];
$.each(arr, function (i, v) {
resultArr.push(v[key]);
});
return resultArr;
}
init_echarts();
</script>
</@footer>
......@@ -98,10 +98,10 @@
<label class="control-label col-md-3 col-sm-3 col-xs-3"></label>
<div class="col-md-9 col-sm-9 col-xs-9 tips">
<i class="fa fa-exclamation-circle"></i> 获取方式:
<a href="javascript:;" data-toggle="modal" data-target="#helpModal" data-img="/assets/images/spider/uid/imooc.png" data-title="慕课网“用户ID”获取方式">慕课网</a> |
<a href="javascript:;" data-toggle="modal" data-target="#helpModal" data-img="/assets/images/spider/uid/csdn.png" data-title="CSDN“用户ID”获取方式">CSDN</a> |
<a href="javascript:;" data-toggle="modal" data-target="#helpModal" data-img="/assets/images/spider/uid/iteye.png" data-title="ITeye“用户ID”获取方式">ITeye</a> |
<a href="javascript:;" data-toggle="modal" data-target="#helpModal" data-img="/assets/images/spider/uid/cnblogs.png" data-title="博客园“用户ID”获取方式">博客园</a>
<a href="javascript:void(0);" data-toggle="modal" data-target="#helpModal" data-img="/assets/images/spider/uid/imooc.png" data-title="慕课网“用户ID”获取方式">慕课网</a> |
<a href="javascript:void(0);" data-toggle="modal" data-target="#helpModal" data-img="/assets/images/spider/uid/csdn.png" data-title="CSDN“用户ID”获取方式">CSDN</a> |
<a href="javascript:void(0);" data-toggle="modal" data-target="#helpModal" data-img="/assets/images/spider/uid/iteye.png" data-title="ITeye“用户ID”获取方式">ITeye</a> |
<a href="javascript:void(0);" data-toggle="modal" data-target="#helpModal" data-img="/assets/images/spider/uid/cnblogs.png" data-title="博客园“用户ID”获取方式">博客园</a>
</div>
</div>
<div class="item form-group">
......@@ -529,4 +529,4 @@
}
});
</script>
</@footer>
\ No newline at end of file
</@footer>
......@@ -27,6 +27,7 @@
<script src="https://cdn.jsdelivr.net/npm/switchery-npm@0.8.2/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/wangeditor@3.1.1/release/wangEditor.min.js" type="text/javascript"></script>
<script src="https://cdn.jsdelivr.net/npm/@adactive/bootstrap-tagsinput@0.8.2/dist/bootstrap-tagsinput.min.js"></script>
<script src="https://www.layuicdn.com/layui/layui.js"></script>
<#--
<script src="https://cdnjs.cloudflare.com/ajax/libs/pnotify/3.2.1/pnotify.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pnotify/3.2.1/pnotify.buttons.js"></script>
......
......@@ -114,7 +114,7 @@
}, {
field: '-',
title: '层级',
width: "60px",
width: "90px",
align: "center"
}, {
field: 'name',
......@@ -132,6 +132,7 @@
}, {
field: 'type',
title: '资源类型',
width: '100px',
formatter: function (code) {
return code == 'menu' ? '菜单' : '按钮';
}
......@@ -196,4 +197,4 @@
})
});
</script>
</@footer>
\ No newline at end of file
</@footer>
<#include "/include/macros.ftl">
<@header></@header>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<@breadcrumb>
<ol class="breadcrumb">
<li><a href="/">首页</a></li>
<li class="active">社会化登录配置管理</li>
</ol>
</@breadcrumb>
<div class="x_panel">
<div class="x_content">
<div class="<#--table-responsive-->">
<div class="btn-group hidden-xs" id="toolbar">
<@shiro.hasPermission name="link:add">
<button id="btn_add" type="button" class="btn btn-info" title="新增配置">
<i class="fa fa-plus fa-fw"></i>
</button>
</@shiro.hasPermission>
<@shiro.hasPermission name="link:batchDelete">
<button id="btn_delete_ids" type="button" class="btn btn-danger" title="批量删除">
<i class="fa fa-trash-o fa-fw"></i>
</button>
</@shiro.hasPermission>
</div>
<table id="tablelist">
</table>
</div>
</div>
</div>
</div>
</div>
<@addOrUpdateMOdal defaultTitle="添加社会化登录配置">
<input type="hidden" name="id">
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-3" for="platformName">平台名 <span class="required">*</span></label>
<div class="col-md-7 col-sm-7 col-xs-7">
<input type="text" class="form-control" id="platformName" name="platformName" required="required" placeholder="请输入平台名"/>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-3" for="platformName">平台标识 <span class="required">*</span></label>
<div class="col-md-7 col-sm-7 col-xs-7">
<select name="platform" id="platform" class="form-control" required="required">
<option value="">请选择</option>
<@zhydTag method="justAuthSources">
<#if justAuthSources?? && (justAuthSources?size > 0)>
<#list justAuthSources as item>
<option value="${item}">${item}</option>
</#list>
</#if>
</@zhydTag>
</select>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-3" for="clientId">clientId <span class="required">*</span></label>
<div class="col-md-7 col-sm-7 col-xs-7">
<input type="text" class="form-control" name="clientId" id="clientId" required="required" placeholder="请输入clientId"/>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-3" for="clientSecret">clientSecret <span class="required">*</span></label>
<div class="col-md-7 col-sm-7 col-xs-7">
<input type="text" class="form-control" name="clientSecret" id="clientSecret" required="required" placeholder="请输入clientSecret"/>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-3" for="redirectUri">redirectUri <i class="fa fa-question-circle" title="回调地址,选择平台标识后会自动填充,注意域名是否正确"></i><span class="required">*</span></label>
<div class="col-md-7 col-sm-7 col-xs-7">
<input type="text" class="form-control" id="redirectUri" name="redirectUri" placeholder="请输入redirectUri, 应为:${config.siteUrl}/oauth/social/{平台标识}" required="required"/>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-3" for="scope">授权范围(半角逗号分隔)<i class="fa fa-question-circle" title="如果不填,将使用默认值"></i></label>
<div class="col-md-7 col-sm-7 col-xs-7">
<input type="text" class="form-control" id="scope" name="scope" placeholder="请输入授权范围,使用半角逗号分隔"/>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-3" for="logo">平台 Logo <i class="fa fa-question-circle" title="回调地址,选择平台标识后会自动填充,参考 https://github.com/justauth/justauth-oauth-logo,请注意版本"></i></label>
<div class="col-md-7 col-sm-7 col-xs-7">
<input type="text" class="form-control" id="logo" name="logo" placeholder="请输入 logo,如:https://cdn.jsdelivr.net/gh/justauth/justauth-oauth-logo@1.10/github.png"/>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-3" for="alipayPublicKey">阿里云公钥 <i class="fa fa-question-circle" title="阿里云平台必填"></i></label>
<div class="col-md-7 col-sm-7 col-xs-7">
<input type="text" class="form-control" id="alipayPublicKey" name="alipayPublicKey" placeholder="请输入阿里云公钥"/>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-3" for="stackOverflowKey">Stack Overflow Key <i class="fa fa-question-circle" title="Stack Overflow 平台必填"></i></label>
<div class="col-md-7 col-sm-7 col-xs-7">
<input type="text" class="form-control" id="stackOverflowKey" name="stackOverflowKey" placeholder="请输入 Stack Overflow Key"/>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-3" for="agentId">agentId <i class="fa fa-question-circle" title="部分平台可用,比如当选择企业微信时,该值标识授权方的网页应用ID"></i></label>
<div class="col-md-7 col-sm-7 col-xs-7">
<input type="text" class="form-control" id="agentId" name="agentId" placeholder="请输入 agentId"/>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-3" for="status">是否需要申请unionid <i class="fa fa-question-circle" title="只针对 QQ 平台"></i></label>
<div class="col-md-7 col-sm-7 col-xs-7 fixed-radio-checkbox">
<ul class="list-unstyled list-inline">
<li>
<div class="radio">
<label>
<input type="radio" class="flat" name="unionId" value="1"> 是
</label>
</div>
</li>
<li>
<div class="radio">
<label>
<input type="radio" class="flat" name="unionId" value="0" checked> 否
</label>
</div>
</li>
</ul>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-3" for="status">状态 <i class="fa fa-question-circle" title="当禁用时,web 端将不再显示"></i></label>
<div class="col-md-7 col-sm-7 col-xs-7 fixed-radio-checkbox">
<ul class="list-unstyled list-inline">
<li>
<div class="radio">
<label>
<input type="radio" class="flat" name="available" value="1" checked> 启用
</label>
</div>
</li>
<li>
<div class="radio">
<label>
<input type="radio" class="flat" name="available" value="0"> 禁用
</label>
</div>
</li>
</ul>
</div>
</div>
</@addOrUpdateMOdal>
<@footer>
<script>
$("#platform").change(function (){
var $this = $(this);
var val = $this.val();
var webUrl = '${config.siteUrl}';
$("#redirectUri").val(webUrl + "/oauth/social/" + val);
$("#logo").val("https://cdn.jsdelivr.net/gh/justauth/justauth-oauth-logo@1.10/" + val.toLowerCase() + ".png");
})
function operateFormatter(code, row, index) {
var trId = row.id;
var operateBtn = [
'<@shiro.hasPermission name="link:edit"><a class="btn btn-sm btn-success btn-update" data-id="' + trId + '"title="编辑"><i class="fa fa-edit fa-fw"></i></a></@shiro.hasPermission>',
'<@shiro.hasPermission name="link:delete"><a class="btn btn-sm btn-danger btn-remove" data-id="' + trId + '"title="删除"><i class="fa fa-trash-o fa-fw"></i></a></@shiro.hasPermission>'
];
return operateBtn.join('');
}
$(function () {
var options = {
modalName: "社会化登录配置",
url: "/social/config/list",
getInfoUrl: "/social/config/get/{id}",
updateUrl: "/social/config/edit",
removeUrl: "/social/config/remove",
createUrl: "/social/config/add",
columns: [
{
checkbox: true
}, {
field: 'platformName',
title: '平台名',
width: '150px',
formatter: function (code) {
return code ? code : '-';
}
}, {
field: 'platform',
title: '平台标识',
width: '100px',
formatter: function (code) {
return code ? code : '-';
}
}, {
field: 'scope',
title: '授权范围',
width: '250px',
formatter: function (code) {
return code ? code : '-';
}
}, {
field: 'clientId',
title: 'clientId',
width: '100px',
formatter: function (code) {
return code ? code : '-';
}
}, {
field: 'logo',
title: 'logo',
width: '40px',
formatter: function (code) {
return !code ? '' : '<img src="'+code+'" width="20">';
}
}, {
field: 'available',
title: '状态',
width: '40px',
formatter: function (code, row, index) {
return code ? "启用" : "<strong style='color: red;'>禁用</strong>";
}
}, {
field: 'operate',
title: '操作',
align: "center",
width: '80px',
formatter: operateFormatter //自定义方法,添加操作按钮
}
],
rowStyle: function (row, index) {
var strclass = "";
if (!row.available) {
strclass = 'danger';
}
return { 'classes': strclass }
}
};
// 初始化table组件
var table = new Table(options);
table.init();
});
</script>
</@footer>
......@@ -12,7 +12,7 @@
<parent>
<groupId>com.zyd</groupId>
<artifactId>blog</artifactId>
<version>2.2.2</version>
<version>2.2.5</version>
</parent>
<dependencies>
......@@ -132,10 +132,6 @@
<artifactId>fastjson</artifactId>
<groupId>com.alibaba</groupId>
</exclusion>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
<exclusion>
<artifactId>shiro-core</artifactId>
<groupId>org.apache.shiro</groupId>
......@@ -202,24 +198,26 @@
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper-el</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.zyd</groupId>
<artifactId>blog-file</artifactId>
<version>${oneblog.version}</version>
<exclusions>
<exclusion>
<artifactId>okhttp</artifactId>
<groupId>com.squareup.okhttp3</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<artifactId>okhttp</artifactId>
<groupId>com.squareup.okhttp3</groupId>
<version>4.5.0</version>
</dependency>
<dependency>
......@@ -228,9 +226,9 @@
<version>${braum.version}</version>
</dependency>
<dependency>
<groupId>me.zhyd.oauth</groupId>
<artifactId>JustAuth</artifactId>
<version>${justauth.version}</version>
<groupId>com.fujieid</groupId>
<artifactId>jap-social</artifactId>
<version>${jap.version}</version>
</dependency>
</dependencies>
</project>
......@@ -11,7 +11,7 @@ import java.lang.annotation.Target;
* 日志记录、自定义注解
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
......@@ -8,7 +8,7 @@ import java.util.concurrent.TimeUnit;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/16 16:26
* @since 1.0
*/
......
......@@ -22,7 +22,7 @@ import java.lang.reflect.Method;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/16 16:26
* @since 1.0
*/
......
......@@ -18,7 +18,7 @@ import java.lang.reflect.Method;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/16 16:26
* @since 1.0
*/
......
......@@ -4,7 +4,7 @@ package com.zyd.blog.business.consts;
* 各api需要的url常量类
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
......@@ -5,7 +5,7 @@ package com.zyd.blog.business.consts;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/16 16:26
* @since 1.0
*/
......
......@@ -4,7 +4,7 @@ package com.zyd.blog.business.consts;
* 日期工具用到的常量
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
......@@ -4,7 +4,7 @@ package com.zyd.blog.business.consts;
* 文件常量类
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
......@@ -3,7 +3,7 @@ package com.zyd.blog.business.consts;
/**
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
......@@ -2,7 +2,7 @@ package com.zyd.blog.business.consts;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
......@@ -13,7 +13,7 @@ import java.util.Date;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/16 16:26
* @since 1.0
*/
......
......@@ -6,7 +6,7 @@ import lombok.Data;
* 系统通知详情,用于页面传输
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
......@@ -6,19 +6,21 @@ import com.zyd.blog.business.enums.ArticleStatusEnum;
import com.zyd.blog.persistence.beans.BizArticle;
import com.zyd.blog.persistence.beans.BizTags;
import com.zyd.blog.persistence.beans.BizType;
import org.springframework.util.StringUtils;
import java.util.Date;
import java.util.List;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @version 1.0
* @website https://docs.zhyd.me
* @date 2018/4/16 16:26
* @since 1.0
*/
public class Article {
private BizArticle bizArticle;
private final BizArticle bizArticle;
private Boolean isPrivate;
public Article() {
this.bizArticle = new BizArticle();
......@@ -26,6 +28,7 @@ public class Article {
public Article(BizArticle bizArticle) {
this.bizArticle = bizArticle;
this.setPrivate(!StringUtils.isEmpty(bizArticle.getPassword()));
}
@JsonIgnore
......@@ -75,7 +78,7 @@ public class Article {
public boolean getIsMarkdown() {
Boolean value = this.bizArticle.getIsMarkdown();
return null == value ? false : value;
return null != value && value;
}
public void setIsMarkdown(boolean isMarkdown) {
......@@ -130,7 +133,7 @@ public class Article {
public boolean getRecommended() {
Boolean value = this.bizArticle.getRecommended();
return value == null ? false : value;
return value != null && value;
}
public void setRecommended(Boolean value) {
......@@ -190,6 +193,24 @@ public class Article {
this.bizArticle.setComment(comment);
}
public Boolean getPrivate() {
return isPrivate;
}
public Article setPrivate(Boolean aPrivate) {
isPrivate = aPrivate;
return this;
}
public String getPassword() {
return this.bizArticle.getPassword();
}
public Article setPassword(String password) {
this.bizArticle.setPassword(password);
return this;
}
public List<BizTags> getTags() {
return this.bizArticle.getTags();
}
......@@ -198,17 +219,17 @@ public class Article {
return this.bizArticle.getBizType();
}
public int getLookCount(){
public int getLookCount() {
Integer lookCount = this.bizArticle.getLookCount();
return lookCount == null ? 0 : lookCount;
}
public int getCommentCount(){
public int getCommentCount() {
Integer commentCount = this.bizArticle.getCommentCount();
return commentCount == null ? 0 : commentCount;
}
public int getLoveCount(){
public int getLoveCount() {
Integer loveCount = this.bizArticle.getLoveCount();
return loveCount == null ? 0 : loveCount;
}
......
......@@ -7,7 +7,7 @@ import java.util.List;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
......@@ -7,7 +7,7 @@ import java.util.Date;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
......@@ -7,7 +7,7 @@ import java.util.Date;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
......@@ -7,7 +7,7 @@ import java.util.Date;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
package com.zyd.blog.business.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.zyd.blog.business.enums.CommentStatusEnum;
......@@ -15,13 +14,15 @@ import java.util.Date;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/16 16:26
* @since 1.0
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class Comment {
private BizComment bizComment;
private final BizComment bizComment;
private BizComment parent;
private BizArticle article;
public Comment() {
this.bizComment = new BizComment();
......@@ -29,6 +30,10 @@ public class Comment {
public Comment(BizComment bizComment) {
this.bizComment = bizComment;
if (null != bizComment) {
this.parent = bizComment.getParent();
this.article = bizComment.getArticle();
}
}
@JsonIgnore
......@@ -70,7 +75,7 @@ public class Comment {
}
public String getArticleTitle() {
BizArticle article = this.getArticle();
BizArticle article = this.article;
String title = null == article ? null : article.getTitle();
if (title == null) {
Long sid = getSid();
......@@ -277,18 +282,20 @@ public class Comment {
}
public BizComment getParent() {
return this.bizComment.getParent();
return this.parent;
}
public void setParent(BizComment parent) {
this.parent = parent;
this.bizComment.setParent(parent);
}
public BizArticle getArticle() {
return this.bizComment.getArticle();
return this.article;
}
public void getArticle(BizArticle article) {
this.article = article;
this.bizComment.setArticle(article);
}
......
......@@ -12,7 +12,7 @@ import java.util.Date;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
......@@ -8,7 +8,7 @@ import java.util.List;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
......@@ -8,7 +8,7 @@ import java.util.Date;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
......@@ -9,7 +9,7 @@ import java.util.List;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
......@@ -7,7 +7,7 @@ import java.util.Date;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
......@@ -7,7 +7,7 @@ import java.util.Date;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
package com.zyd.blog.business.entity;
import com.zyd.blog.persistence.beans.SysSocialConfig;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.Date;
/**
* @author yadong.zhang email:yadong.zhang(a)innodev.com.cn
* @version 1.0
* @date 2021/04/27 14:34
* @since 1.0
*/
public class SocialConfig {
private static final long serialVersionUID = 1L;
private SysSocialConfig sysSocialConfig;
public SocialConfig() {
this.sysSocialConfig = new SysSocialConfig();
}
public SocialConfig(SysSocialConfig sysSocialConfig) {
this.sysSocialConfig = sysSocialConfig;
}
public SysSocialConfig getSysSocialConfig(){
return this.sysSocialConfig;
}
public Long getId() {
return this.sysSocialConfig.getId();
}
public void setId(Long id) {
this.sysSocialConfig.setId(id);
}
public String getClientId() {
return this.sysSocialConfig.getClientId();
}
public void setClientId(String clientId) {
this.sysSocialConfig.setClientId(clientId);
}
public String getClientSecret() {
return this.sysSocialConfig.getClientSecret();
}
public void setClientSecret(String clientSecret) {
this.sysSocialConfig.setClientSecret(clientSecret);
}
public String getRedirectUri() {
return this.sysSocialConfig.getRedirectUri();
}
public void setRedirectUri(String redirectUri) {
this.sysSocialConfig.setRedirectUri(redirectUri);
}
public String getPlatformName() {
return this.sysSocialConfig.getPlatformName();
}
public void setPlatformName(String platformName) {
this.sysSocialConfig.setPlatformName(platformName);
}
public String getPlatform() {
return this.sysSocialConfig.getPlatform();
}
public void setPlatform(String platform) {
this.sysSocialConfig.setPlatform(platform);
}
public String getLogo() {
return this.sysSocialConfig.getLogo();
}
public void setLogo(String logo) {
this.sysSocialConfig.setLogo(logo);
}
public String getAlipayPublicKey() {
return this.sysSocialConfig.getAlipayPublicKey();
}
public void setAlipayPublicKey(String alipayPublicKey) {
this.sysSocialConfig.setAlipayPublicKey(alipayPublicKey);
}
public boolean isUnionId() {
Boolean value = this.sysSocialConfig.getUnionId();
return value != null ? value : false;
}
public void setUnionId(boolean unionId) {
this.sysSocialConfig.setUnionId(unionId);
}
public String getStackOverflowKey() {
return this.sysSocialConfig.getStackOverflowKey();
}
public void setStackOverflowKey(String stackOverflowKey) {
this.sysSocialConfig.setStackOverflowKey(stackOverflowKey);
}
public String getAgentId() {
return this.sysSocialConfig.getAgentId();
}
public void setAgentId(String agentId) {
this.sysSocialConfig.setAgentId(agentId);
}
public String getScope() {
return this.sysSocialConfig.getScope();
}
public void setScope(String scope) {
this.sysSocialConfig.setScope(scope);
}
public boolean isAvailable() {
Boolean value = this.sysSocialConfig.getAvailable();
return value != null ? value : false;
}
public void setAvailable(boolean available) {
this.sysSocialConfig.setAvailable(available);
}
public Date getCreateTime() {
return this.sysSocialConfig.getCreateTime();
}
public void setCreateTime(Date createTime) {
this.sysSocialConfig.setCreateTime(createTime);
}
public Date getUpdateTime() {
return this.sysSocialConfig.getUpdateTime();
}
public void setUpdateTime(Date updateTime) {
this.sysSocialConfig.setUpdateTime(updateTime);
}
}
......@@ -6,7 +6,7 @@ import com.zyd.blog.persistence.beans.BizStatistics;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/16 16:26
* @since 1.0
*/
......
......@@ -7,7 +7,7 @@ import java.util.Date;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
......@@ -7,7 +7,7 @@ import java.util.Date;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
......@@ -9,7 +9,7 @@ import java.util.List;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/4/16 16:26
* @since 1.0
*/
......
......@@ -10,7 +10,7 @@ import java.util.Date;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
......@@ -11,8 +11,8 @@ import java.util.Date;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @version 1.0
* @website https://docs.zhyd.me
* @date 2018/4/16 16:26
* @since 1.0
*/
......@@ -178,6 +178,10 @@ public class User extends AbstractBO {
return UserTypeEnum.getByType(this.sysUser.getUserType());
}
public Object getUserTypeDescEnum() {
return UserTypeEnum.getByTypeDesc(this.sysUser.getUserType());
}
public String getCompany() {
return this.sysUser.getCompany();
}
......
......@@ -9,7 +9,7 @@ import javax.validation.constraints.NotNull;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @date 2018/6/6 16:34
* @since 1.0
*/
......
......@@ -7,7 +7,7 @@ import java.util.Date;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
......@@ -2,7 +2,7 @@ package com.zyd.blog.business.enums;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.zhyd.me
* @website https://docs.zhyd.me
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册