linyu-im
linyu-mini-server:springboot + vue + mysql。一款非常漂亮的linyu-im,它的mini版本,仅使用了mysql数据库
1、数据库有sqlite和mysql,这里修改为mysql
2、User类的badge徽章字段中使用了JacksonTypeHandler转为字符串为List<String>
3、一共4张表: user(用户表)、chat_list(聊天会话表)、message(消息表)、group(群组表)
4、SecurityUtil 实现了rsa非对称公钥加密,私钥解密,aes对称加密解密
5、DataBaseInitializer 在bean创建好后,读取sql文件,使用jdbcTemplate执行sql语句,创建表(如果不存在的话)。包括sqlite和mysql。
6、引入这个依赖,处理敏感词
<dependency>
<groupId>com.github.houbb</groupId>
<artifactId>sensitive-word</artifactId>
<version>0.24.0</version>
</dependency>
在 SensitiveWordConfig 定义 SensitiveWordBs 这个bean,并在 MessageServiceImpl 中使用这个bean的replace方法作替换
7、在 UserInfoArgumentResolver 中解析controller的 @Userid 和 @UserIp 这2个注解,其中userid从request的属性的userinfo中获取userid,而userIp则使用 IpUtil 获取
8、使用 FilterRegistrationBean 定义 CorsFilter,解决跨域问题
9、在 CacheUtil 中使用 Caffeine 缓存,缓存用户id和token
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
</dependency>
10、AuthenticationTokenFilter 过滤器使用 JwtUtil 解析用户x-token
11、UrlLimitAspect 切面识别 @UrlLimit 注解(用户id或请求ip、请求次数),结合Caffeine缓存作限流
12、ExpiredClearTask 清理了7天之前的 message 和 user
13、引入sshd的依赖
<dependency>
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-core</artifactId>
<version>2.14.0</version>
</dependency>
在 SshServerService 中创建了1个 SshServer,并且端口是 2222,并且提供了密码认证器。
这时,比如在windows启动了linyu应用,然后在windows的cmd中输入 ssh -p 2222 linyu@127.0.0.1,就会进入到ssh的终端
(或者在linux上面输入 ssh -p 2222 linyu@192.168.134.5)