mirror of
https://github.com/Hello-hao/Tbed.git
synced 2024-04-21 12:32:10 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f61e672e54 | ||
|
|
4a5147b862 | ||
|
|
f9374cbc0e | ||
|
|
10b919be95 | ||
|
|
8d96a3d636 | ||
|
|
a086e708b4 | ||
|
|
903cd6c74a | ||
|
|
7c5524c1ee | ||
|
|
444f16dc2c | ||
|
|
d96096965f | ||
|
|
3d4ff813fe | ||
|
|
9ac31c22ca | ||
|
|
5041d65612 | ||
|
|
196bbf8026 | ||
|
|
d1942a5295 | ||
|
|
9293c0d295 | ||
|
|
1de06c6352 | ||
|
|
b9d020f7a6 | ||
|
|
dcf753b2b3 |
@@ -10,12 +10,12 @@
|
||||
|
||||
### 引导
|
||||
|
||||
[官网](https://tbed.hellohao.cn) | [宣传视频](https://www.bilibili.com/video/BV11r4y1y7mH/) | [文档](https://doc.hellohao.cn) | [演示站](https://pic.hellohao.cn) | [前端源码](https://github.com/Hello-hao/tbed-web)
|
||||
[官网](https://tbed.hellohao.cn) | [宣传视频](https://www.bilibili.com/video/BV11r4y1y7mH/) | [文档](https://doc.hellohao.cn) | [演示站](https://pic.hellohao.cn) | [前端源码](https://github.com/Hello-hao/tbed-web) | [客户端程序](https://tbed.hellohao.cn/app)
|
||||
|
||||
|
||||
### 前言
|
||||
|
||||
**Hellohao图像托管程序**(图床)这是一个由JAVA语言编写SpringBoot框架开发的开源图像托管程序。具备多对象存储源对接,采用`前后端分离`式设计的一款专门托管图像的程序,支持多种格式的图像 多功能的图床系统。
|
||||
**Hellohao图像托管程序**(图床)这是一个由JAVA语言编写SpringBoot框架开发的开源图像托管程序。具备多对象存储源对接,采用`前后端分离`式设计的一款专门托管图像的程序,支持多种格式的图像 多功能的图床系统。该程序支持除了`web端`之外,同时支持`客户端(win/mac)`,`移动端(小程序)`等常用全平台支持。
|
||||
|
||||
程序主要使用领域:`个人照片存储`,`团队共享图像`,`博客/商城等网站图片托管`,`图像批量云分享`等。具备优秀的多用户图像上传功能和完善的图像查询管理逻辑,同时支持对接多家对象存储。
|
||||
|
||||
@@ -23,16 +23,16 @@
|
||||
|
||||
开源版:`本地`,`阿里OSS`,`又拍USS`,`七牛KODO`,`腾讯COS`,`网易NOS`,~~`U-File`~~,`FTP`
|
||||
|
||||
Core版:`本地`,`阿里OSS`,`又拍USS`,`七牛KODO`,`腾讯COS`,`网易NOS`,~~`U-File`~~,`FTP`,`Backblaze(B2)`,`百度云BOS`,`青云Qingstor`,`Ucloud US3`,`Minio`,`AWS S3`
|
||||
Core版:`本地`,`阿里OSS`,`又拍USS`,`七牛KODO`,`腾讯COS`,`网易NOS`,~~`U-File`~~,`FTP`,`Backblaze(B2)`,`百度云BOS`,`青云Qingstor`,`Ucloud US3`,`Minio`,`AWS S3`等通用S3协议
|
||||
|
||||
|
||||
### 更新日志 `20220506`
|
||||
|
||||
- [x] 新增个人相册复制链接功能可选链接格式
|
||||
- [x] 修复了系统已知安全隐患
|
||||
- [x] 优化重写删除图像功能,修复部分场景下图像删除失败的问题(支持进度展示)
|
||||
- [x] 优化多个页面细节
|
||||
### 更新日志 `20220901`
|
||||
|
||||
- `增加`图片名称显示/编辑功能(为后续图像精准搜索打基础)
|
||||
- `增加`数据库命名检测(数据库名称必须为:tbed)
|
||||
- `调整`站点设置表单的部分字段字符数限制
|
||||
- `调整`页面部分表单的文字显示
|
||||
|
||||
|
||||
[^_^]:程序宣传视频:[自制宣传视频](https://www.bilibili.com/video/BV11r4y1y7mH/)
|
||||
|
||||
@@ -60,6 +60,8 @@ Core版:`本地`,`阿里OSS`,`又拍USS`,`七牛KODO`,`腾讯COS`,`网易NOS`,
|
||||
|
||||
### 主要功能
|
||||
|
||||
- [x] 全端支持,不限于(`web端`/`桌面端Windows/Mac`/`移动端小程序`)
|
||||
|
||||
- [x] 前后端分离式架构设计,部署更方便
|
||||
|
||||
- [x] 个人相册浏览,图像详细资料展示卡片
|
||||
@@ -76,7 +78,9 @@ Core版:`本地`,`阿里OSS`,`又拍USS`,`七牛KODO`,`腾讯COS`,`网易NOS`,
|
||||
|
||||
- [x] 图片定期暂存
|
||||
|
||||
- [x] 支持多种图像格式如:`jfif`,`webp`,`ico`,`svg`等
|
||||
- [x] 图片名称记录/修改
|
||||
|
||||
- [x] 支持常见多种图像格式如:`webp`,`ico`,`svg`等等
|
||||
|
||||
- [x] 支持画廊批量分享模式
|
||||
|
||||
@@ -157,6 +161,11 @@ Core版:`本地`,`阿里OSS`,`又拍USS`,`七牛KODO`,`腾讯COS`,`网易NOS`,
|
||||
初始邮箱:`admin`
|
||||
初始密码:`admin`
|
||||
|
||||
### 客户端(win64/mac)
|
||||
> 目前正在开发过程中,预计将于近期上线。
|
||||

|
||||
|
||||
|
||||
### 微信小程序
|
||||
> 目前已有测试版,更多功能开发中,开发进度的快慢要根据作者的工作压力、心情状况等自身情况进行评估。
|
||||
> 暂时无法给出具体发布小程序的时间。大家期待吧。
|
||||
|
||||
+72
-51
@@ -1,17 +1,17 @@
|
||||
/*
|
||||
Navicat Premium Data Transfer
|
||||
|
||||
Source Server : localhost
|
||||
Source Server : locMysql
|
||||
Source Server Type : MySQL
|
||||
Source Server Version : 50720
|
||||
Source Server Version : 80028
|
||||
Source Host : localhost:3306
|
||||
Source Schema : tbed
|
||||
|
||||
Target Server Type : MySQL
|
||||
Target Server Version : 50720
|
||||
Target Server Version : 80028
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 29/10/2021 14:42:28
|
||||
Date: 01/09/2022 00:28:28
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
@@ -26,23 +26,42 @@ CREATE TABLE `album` (
|
||||
`albumtitle` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`createdate` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`userid` int(10) NULL DEFAULT NULL
|
||||
`userid` int(0) NULL DEFAULT NULL
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of album
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for appclient
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `appclient`;
|
||||
CREATE TABLE `appclient` (
|
||||
`id` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
`isuse` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
`winpackurl` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`macpackurl` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`appname` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`applogo` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`appupdate` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of appclient
|
||||
-- ----------------------------
|
||||
INSERT INTO `appclient` VALUES ('app', 'on', '', '', 'Hellohao图像托管', 'https://hellohao.nos-eastchina1.126.net/TbedClient/app.png', '1.0.1');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for code
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `code`;
|
||||
CREATE TABLE `code` (
|
||||
`id` int(255) NOT NULL AUTO_INCREMENT,
|
||||
`id` int(0) NOT NULL AUTO_INCREMENT,
|
||||
`value` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`code` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of code
|
||||
@@ -53,24 +72,24 @@ CREATE TABLE `code` (
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `config`;
|
||||
CREATE TABLE `config` (
|
||||
`id` int(4) NOT NULL AUTO_INCREMENT,
|
||||
`sourcekey` int(4) NULL DEFAULT NULL,
|
||||
`emails` int(4) NULL DEFAULT NULL COMMENT '邮箱配置',
|
||||
`id` int(0) NOT NULL AUTO_INCREMENT,
|
||||
`sourcekey` int(0) NULL DEFAULT NULL,
|
||||
`emails` int(0) NULL DEFAULT NULL COMMENT '邮箱配置',
|
||||
`webname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '网站名',
|
||||
`explain` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`explain` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
|
||||
`video` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`backtype` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '背景类型',
|
||||
`links` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`notice` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`baidu` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`links` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
|
||||
`notice` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
|
||||
`baidu` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
|
||||
`domain` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`background1` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`background2` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`sett` int(2) NOT NULL COMMENT '首页样式',
|
||||
`sett` int(0) NOT NULL COMMENT '首页样式',
|
||||
`webms` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`webkeywords` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`webfavicons` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`theme` int(4) NULL DEFAULT 1 COMMENT '主题',
|
||||
`theme` int(0) NULL DEFAULT 1 COMMENT '主题',
|
||||
`websubtitle` mediumtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
|
||||
`logo` mediumtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
|
||||
`aboutinfo` mediumtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
|
||||
@@ -87,13 +106,13 @@ INSERT INTO `config` VALUES (1, 7, 1, 'Hellohao图床', 'Hellohao图像托管,
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `emailconfig`;
|
||||
CREATE TABLE `emailconfig` (
|
||||
`id` int(2) NOT NULL AUTO_INCREMENT,
|
||||
`id` int(0) NOT NULL AUTO_INCREMENT,
|
||||
`emails` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱',
|
||||
`emailkey` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '授权码',
|
||||
`emailurl` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '服务器',
|
||||
`port` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '端口',
|
||||
`emailname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名',
|
||||
`using` int(4) NULL DEFAULT NULL COMMENT '1为可用,其他为不使用',
|
||||
`using` int(0) NULL DEFAULT NULL COMMENT '1为可用,其他为不使用',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
@@ -107,11 +126,11 @@ INSERT INTO `emailconfig` VALUES (1, '', '', '', '465', 'Hellohao图床', 0);
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `group`;
|
||||
CREATE TABLE `group` (
|
||||
`id` int(255) NOT NULL AUTO_INCREMENT,
|
||||
`id` int(0) NOT NULL AUTO_INCREMENT,
|
||||
`groupname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '组名称',
|
||||
`keyid` int(255) NULL DEFAULT NULL,
|
||||
`usertype` int(4) NULL DEFAULT NULL,
|
||||
`compress` int(4) NULL DEFAULT NULL,
|
||||
`keyid` int(0) NULL DEFAULT NULL,
|
||||
`usertype` int(0) NULL DEFAULT NULL,
|
||||
`compress` int(0) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
@@ -140,24 +159,25 @@ INSERT INTO `imgandalbum` VALUES ('http://img.wwery.com/ccx51/5GBv93Ks.jpg', 'TO
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `imgdata`;
|
||||
CREATE TABLE `imgdata` (
|
||||
`id` int(255) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`imgname` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片名',
|
||||
`imgurl` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片链接',
|
||||
`userid` int(10) NULL DEFAULT NULL COMMENT '用户名',
|
||||
`userid` int(0) NULL DEFAULT NULL COMMENT '用户名',
|
||||
`updatetime` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '上传时间',
|
||||
`sizes` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`abnormal` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`source` int(2) NULL DEFAULT NULL COMMENT '存储源',
|
||||
`imgtype` int(2) NULL DEFAULT NULL,
|
||||
`source` int(0) NULL DEFAULT NULL COMMENT '存储源',
|
||||
`imgtype` int(0) NULL DEFAULT NULL,
|
||||
`explains` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`md5key` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`imguid` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`format` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`about` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
|
||||
`violation` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`idname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '未命名图像',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `index_md5key_url`(`md5key`(255), `imgurl`(255)) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compressed;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compressed;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of imgdata
|
||||
@@ -168,12 +188,12 @@ CREATE TABLE `imgdata` (
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `imgreview`;
|
||||
CREATE TABLE `imgreview` (
|
||||
`id` int(4) NOT NULL AUTO_INCREMENT,
|
||||
`id` int(0) NOT NULL AUTO_INCREMENT,
|
||||
`app_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`api_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`secret_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`Using` int(4) NULL DEFAULT NULL,
|
||||
`count` int(255) NULL DEFAULT NULL COMMENT '拦截数量',
|
||||
`Using` int(0) NULL DEFAULT NULL,
|
||||
`count` int(0) NULL DEFAULT NULL COMMENT '拦截数量',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
@@ -187,7 +207,7 @@ INSERT INTO `imgreview` VALUES (1, '', '', '', 0, 0);
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `imgtemp`;
|
||||
CREATE TABLE `imgtemp` (
|
||||
`id` int(255) NOT NULL AUTO_INCREMENT,
|
||||
`id` int(0) NOT NULL AUTO_INCREMENT,
|
||||
`imguid` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`deltime` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
@@ -202,13 +222,13 @@ CREATE TABLE `imgtemp` (
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `keys`;
|
||||
CREATE TABLE `keys` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`id` int(0) NOT NULL AUTO_INCREMENT,
|
||||
`AccessKey` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`AccessSecret` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`Endpoint` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`Bucketname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`RequestAddress` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`storageType` int(11) NULL DEFAULT NULL,
|
||||
`storageType` int(0) NULL DEFAULT NULL,
|
||||
`keyname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '未定义策略名称' COMMENT '策略名称',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
@@ -230,8 +250,8 @@ INSERT INTO `keys` VALUES (13, '', '', '', '0', '', 7, 'ftp');
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sysconfig`;
|
||||
CREATE TABLE `sysconfig` (
|
||||
`id` int(2) NOT NULL AUTO_INCREMENT,
|
||||
`register` int(2) NOT NULL COMMENT '是否可以注册',
|
||||
`id` int(0) NOT NULL AUTO_INCREMENT,
|
||||
`register` int(0) NOT NULL COMMENT '是否可以注册',
|
||||
`checkduplicate` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
@@ -246,19 +266,19 @@ INSERT INTO `sysconfig` VALUES (1, 1, '0');
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `uploadconfig`;
|
||||
CREATE TABLE `uploadconfig` (
|
||||
`id` int(2) NOT NULL AUTO_INCREMENT,
|
||||
`id` int(0) NOT NULL AUTO_INCREMENT,
|
||||
`filesizetourists` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`filesizeuser` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`imgcounttourists` int(10) NULL DEFAULT NULL COMMENT '游客文件总数量, 超出则不允许加入队列',
|
||||
`imgcountuser` int(10) NULL DEFAULT NULL COMMENT '用户文件总数量, 超出则不允许加入队列',
|
||||
`imgcounttourists` int(0) NULL DEFAULT NULL COMMENT '游客文件总数量, 超出则不允许加入队列',
|
||||
`imgcountuser` int(0) NULL DEFAULT NULL COMMENT '用户文件总数量, 超出则不允许加入队列',
|
||||
`suffix` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '支持后缀',
|
||||
`urltype` int(2) NULL DEFAULT NULL COMMENT 'url类型',
|
||||
`isupdate` int(2) NULL DEFAULT NULL COMMENT '禁止游客上传',
|
||||
`api` int(2) NOT NULL COMMENT '开启api',
|
||||
`urltype` int(0) NULL DEFAULT NULL COMMENT 'url类型',
|
||||
`isupdate` int(0) NULL DEFAULT NULL COMMENT '禁止游客上传',
|
||||
`api` int(0) NOT NULL COMMENT '开启api',
|
||||
`visitormemory` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`usermemory` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`blacklist` varchar(4000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`userclose` int(4) NULL DEFAULT 0 COMMENT '用户上传开关',
|
||||
`userclose` int(0) NULL DEFAULT 0 COMMENT '用户上传开关',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
@@ -272,34 +292,35 @@ INSERT INTO `uploadconfig` VALUES (1, '10485760', '20971520', 5, 10, 'gif,jpg,jp
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `user`;
|
||||
CREATE TABLE `user` (
|
||||
`id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`username` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
|
||||
`password` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',
|
||||
`email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`birthder` date NULL DEFAULT NULL COMMENT '注册时间',
|
||||
`level` int(10) NULL DEFAULT NULL COMMENT '等级',
|
||||
`level` int(0) NULL DEFAULT NULL COMMENT '等级',
|
||||
`uid` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户唯一标识',
|
||||
`isok` int(2) NOT NULL,
|
||||
`isok` int(0) NOT NULL,
|
||||
`memory` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`groupid` int(255) NULL DEFAULT NULL,
|
||||
`groupid` int(0) NULL DEFAULT NULL,
|
||||
`token` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of user
|
||||
-- ----------------------------
|
||||
INSERT INTO `user` VALUES (1, 'admin', 'YWRtaW4=', 'admin', '2019-01-10', 2, 'e95c0571bfe04ec680c249fb15cc22e9', 1, '2147483648', 1);
|
||||
INSERT INTO `user` VALUES (1, 'admin', 'YWRtaW4=', 'admin', '2019-01-10', 2, '9b76655b2706483780bf54988ca12531', 1, '2147483648', 1, '');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for usergroup
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `usergroup`;
|
||||
CREATE TABLE `usergroup` (
|
||||
`id` int(255) NOT NULL AUTO_INCREMENT,
|
||||
`userid` int(255) NULL DEFAULT NULL,
|
||||
`groupid` int(255) NULL DEFAULT NULL,
|
||||
`id` int(0) NOT NULL AUTO_INCREMENT,
|
||||
`userid` int(0) NULL DEFAULT NULL,
|
||||
`groupid` int(0) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of usergroup
|
||||
|
||||
@@ -25,7 +25,6 @@ public class SubjectFilter extends BasicHttpAuthenticationFilter {
|
||||
|
||||
public static String WEBHOST = null;
|
||||
private String CODE ="000";
|
||||
|
||||
protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
|
||||
UserServiceImpl userService = SpringContextHolder.getBean(UserServiceImpl.class);
|
||||
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
|
||||
@@ -34,8 +33,8 @@ public class SubjectFilter extends BasicHttpAuthenticationFilter {
|
||||
String Users_Origin = httpServletRequest.getHeader("usersOrigin");
|
||||
String token = httpServletRequest.getHeader("Authorization");
|
||||
//验证前端域名
|
||||
if(httpServletRequest.getMethod().equals("POST") && !serviceName.contains("/api")
|
||||
&& !serviceName.contains("/verifyCode") && !serviceName.contains("/client")){
|
||||
if(httpServletRequest.getMethod().equals("POST") && !serviceName.contains("/api") && !serviceName.contains("/verifyCode")
|
||||
&& !serviceName.contains("/getClientVersion") && !serviceName.contains("/client")){
|
||||
try{
|
||||
if(Users_Origin.compareTo(SecureUtil.md5(WEBHOST))!=0){
|
||||
System.out.println("前端域名校验未通过");
|
||||
@@ -73,15 +72,12 @@ public class SubjectFilter extends BasicHttpAuthenticationFilter {
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
UsernamePasswordToken tokenOBJ = new UsernamePasswordToken(userData.getEmail(),userData.getPassword());
|
||||
tokenOBJ.setRememberMe(true);
|
||||
//执行登录方法,如果没有异常,说明登录成功
|
||||
subject.login(tokenOBJ);
|
||||
SecurityUtils.getSubject().getSession().setTimeout(3600000);
|
||||
User loginUser = (User) SecurityUtils.getSubject().getPrincipal();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// String token = httpServletRequest.getHeader("Authorization");
|
||||
JSONObject jsonObject = JWTUtil.checkToken(token);
|
||||
if(!jsonObject.getBoolean("check")){
|
||||
if(!serviceName.contains("admin") || serviceName.contains("admin/client")){
|
||||
@@ -100,7 +96,6 @@ public class SubjectFilter extends BasicHttpAuthenticationFilter {
|
||||
subject.login(tokenOBJ);
|
||||
SecurityUtils.getSubject().getSession().setTimeout(3600000);//一小时
|
||||
} catch (Exception e) {
|
||||
// System.err.println("拦截器,登录失败,false");
|
||||
this.CODE = "403";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ public class XssFilter implements Filter {
|
||||
//由于我的@WebFilter注解配置的是urlPatterns="/*"(过滤所有请求),所以这里对不需要过滤的静态资源url,作忽略处理(大家可以依照具体需求配置)
|
||||
String[] exclusionsUrls = {".js",".gif",".jpg",".png",".bmp",".css",".ico"};//,"/","/index","/admin/root/"
|
||||
for (String str : exclusionsUrls) {
|
||||
//System.out.println(path.contains(str));
|
||||
if (path.contains(str)) {
|
||||
filterChain.doFilter(servletRequest,servletResponse);
|
||||
return;
|
||||
|
||||
@@ -89,8 +89,6 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
||||
String line = "";
|
||||
StringBuilder body = new StringBuilder();
|
||||
int counter = 0;
|
||||
|
||||
// 读取POST提交的数据内容
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(stream, Charset.forName("UTF-8")));
|
||||
try {
|
||||
while ((line = reader.readLine()) != null) {
|
||||
|
||||
@@ -51,7 +51,6 @@ public class UserRealm extends AuthorizingRealm {
|
||||
if(u==null){
|
||||
return null;
|
||||
}
|
||||
//密码认证(防止泄露,不需要我们做)
|
||||
return new SimpleAuthenticationInfo(u,u.getPassword(),"");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,6 +150,25 @@ public class AdminController {
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(value={"/setImgFileName","/client/setImgFileName"})
|
||||
@ResponseBody
|
||||
public Msg setImgFileName(@RequestParam(value = "data", defaultValue = "") String data) {
|
||||
Msg msg = new Msg();
|
||||
try {
|
||||
JSONObject jsonObject = JSONObject.parseObject(data);
|
||||
String name = jsonObject.getString("name");
|
||||
String imgname = jsonObject.getString("imgname");
|
||||
Images images = new Images();
|
||||
images.setIdname(name.replaceAll(" ", ""));
|
||||
images.setImgname(imgname);
|
||||
imgService.setImg(images);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
msg.setCode("500");
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
@PostMapping("/getRecently")
|
||||
@ResponseBody
|
||||
public Msg getRecently() {
|
||||
@@ -324,7 +343,6 @@ public class AdminController {
|
||||
img.setSelecttype(selecttype);
|
||||
}
|
||||
}else{
|
||||
//普通用户
|
||||
img.setUserid(user.getId());
|
||||
}
|
||||
List<Images> images = imgService.selectimg(img);
|
||||
@@ -491,7 +509,6 @@ public class AdminController {
|
||||
return msg;
|
||||
}
|
||||
|
||||
//工具函数
|
||||
private static String getChinaes(int v){
|
||||
String ch = "";
|
||||
switch(v){
|
||||
|
||||
@@ -313,9 +313,6 @@ public class AdminRootController {
|
||||
if (!appClient.getIsuse().equals("on")) {
|
||||
appClient.setIsuse("off");
|
||||
}
|
||||
if (!appClient.getAppupdate().equals("on")) {
|
||||
appClient.setAppupdate("off");
|
||||
}
|
||||
appClientService.editAppClientData(appClient);
|
||||
msg.setInfo("配置保存成功");
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -97,8 +97,7 @@ public class AlbumController {
|
||||
|
||||
}
|
||||
|
||||
//后台列表要修改时的查询表单
|
||||
@PostMapping("/admin/getAlbumListForKey")
|
||||
@PostMapping("/admin/getAlbumListForKey")
|
||||
@ResponseBody
|
||||
public Msg getAlbumListForKey(@RequestParam(value = "data", defaultValue = "") String data){
|
||||
Msg msg = new Msg();
|
||||
@@ -214,8 +213,6 @@ public class AlbumController {
|
||||
String password = jsonObject.getString("password");
|
||||
JSONArray jsonArray = JSONArray.parseArray(jsonObject.getString("albumlist"));
|
||||
if(null!=password){
|
||||
// String regex = "^[a-z0-9A-Z\u4e00-\u9fa5]+$";
|
||||
// return str.matches(regex);
|
||||
password = password.replace(" ", "");
|
||||
if(password.replace(" ", "").equals("") || password.length()<3){
|
||||
msg.setCode("110403");
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
package cn.hellohao.controller;
|
||||
|
||||
import cn.hellohao.auth.token.JWTUtil;
|
||||
import cn.hellohao.pojo.AppClient;
|
||||
import cn.hellohao.pojo.Msg;
|
||||
import cn.hellohao.pojo.UploadConfig;
|
||||
import cn.hellohao.pojo.User;
|
||||
import cn.hellohao.service.AppClientService;
|
||||
import cn.hellohao.service.ImgService;
|
||||
import cn.hellohao.service.UploadConfigService;
|
||||
import cn.hellohao.service.impl.UploadServicel;
|
||||
import cn.hellohao.service.impl.UserServiceImpl;
|
||||
import cn.hellohao.utils.Base64ToMultipartFile;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @author Hellohao
|
||||
@@ -31,14 +35,16 @@ public class ClientAppController {
|
||||
private UserServiceImpl userService;
|
||||
@Autowired
|
||||
private UploadConfigService uploadConfigService;
|
||||
@Autowired
|
||||
private UploadServicel uploadServicel;
|
||||
|
||||
@PostMapping("/loginByToken")
|
||||
@ResponseBody
|
||||
public Msg loginByToken(@RequestParam(value = "data", defaultValue = "") String data) {
|
||||
Msg msg = new Msg();
|
||||
JSONObject jsonObj = JSONObject.parseObject(data);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
try{
|
||||
JSONObject jsonObj = JSONObject.parseObject(data);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
User newUser = new User();
|
||||
String userToken = jsonObj.getString("userToken");
|
||||
newUser.setToken(userToken);
|
||||
@@ -79,22 +85,21 @@ public class ClientAppController {
|
||||
return msg;
|
||||
}
|
||||
|
||||
@PostMapping("/getVersion")
|
||||
@ResponseBody
|
||||
public Msg getVersion() {
|
||||
@PostMapping("/imgUploading")
|
||||
public Msg imgUploading(@RequestParam(required = true, value = "data") String data, HttpServletRequest request) {
|
||||
Msg msg = new Msg();
|
||||
try {
|
||||
AppClient app = appClientService.getAppClientData("app");
|
||||
if(app.getAppupdate().equals("on")){
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("winpackurl",app.getWinpackurl());
|
||||
jsonObject.put("macpackurl",app.getMacpackurl());
|
||||
msg.setData(jsonObject);
|
||||
}else{
|
||||
msg.setCode("000");
|
||||
try{
|
||||
JSONObject jsonObj = JSONObject.parseObject(data);
|
||||
String imgstr = jsonObj.getString("imgstr");
|
||||
Integer days = jsonObj.getInteger("days");
|
||||
// String imgclass = jsonObj.getString("imgclass");
|
||||
if (null != imgstr && !imgstr.isEmpty()) {
|
||||
MultipartFile multipartFile = Base64ToMultipartFile.base64Convert(imgstr);
|
||||
msg = uploadServicel.uploadForLoc(request, multipartFile, days, null);
|
||||
}
|
||||
}catch (Exception e){
|
||||
msg.setCode("000");
|
||||
e.printStackTrace();
|
||||
msg.setCode("500");
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ public class ClientController {
|
||||
@Autowired
|
||||
private ClientService clientService;
|
||||
|
||||
|
||||
@PostMapping(value = "/uploadbymail")
|
||||
@ResponseBody
|
||||
public Msg uploadbymail(HttpServletRequest request, @RequestParam("file") MultipartFile file, String mail, String pass) {
|
||||
|
||||
@@ -24,7 +24,6 @@ public class ExceptionHandling {
|
||||
ModelAndView modelAndView = new ModelAndView("index");
|
||||
Print.Normal("异常拦截成功:"+ ssie.getMessage());
|
||||
modelAndView.addObject("error",ssie.getMessage());
|
||||
//返回错误信息,并显示给用户
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ImageReviewController {
|
||||
private ImgreviewService imgreviewService;
|
||||
|
||||
|
||||
@PostMapping("/updateimgReviewConfig") //new
|
||||
@PostMapping("/updateimgReviewConfig")
|
||||
@ResponseBody
|
||||
public Msg updateimgReviewConfig(@RequestParam(value = "data", defaultValue = "") String data ) {
|
||||
final Msg msg = new Msg();
|
||||
|
||||
@@ -6,6 +6,7 @@ import cn.hellohao.service.*;
|
||||
import cn.hellohao.service.impl.AlbumServiceImpl;
|
||||
import cn.hellohao.service.impl.UploadServicel;
|
||||
import cn.hellohao.service.impl.deleImages;
|
||||
import cn.hellohao.utils.MyVersion;
|
||||
import cn.hellohao.utils.verifyCode.IVerifyCodeGen;
|
||||
import cn.hellohao.utils.verifyCode.SimpleCharVerifyCodeGenImpl;
|
||||
import cn.hutool.captcha.CaptchaUtil;
|
||||
@@ -13,6 +14,7 @@ import cn.hutool.captcha.ShearCaptcha;
|
||||
import cn.hutool.captcha.generator.MathGenerator;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
@@ -71,7 +73,6 @@ public class IndexController {
|
||||
jsonObject.put("api",updateConfig.getApi());
|
||||
jsonObject.put("register",sysConfig.getRegister());
|
||||
jsonObject.put("isuse",appClient.getIsuse());
|
||||
// jsonObject.put("packurl",appClient.getPackurl());
|
||||
jsonObject.put("clientname",appClient.getAppname());
|
||||
jsonObject.put("clientlogo",appClient.getApplogo());
|
||||
jsonObject.put("appupdate",appClient.getAppupdate());
|
||||
@@ -79,13 +80,13 @@ public class IndexController {
|
||||
return msg;
|
||||
}
|
||||
|
||||
@PostMapping(value = {"/upload","/client/upload"})// new
|
||||
@PostMapping(value = {"/upload","/client/upload"})
|
||||
@ResponseBody
|
||||
public Msg upimg(HttpServletRequest request, @RequestParam(value = "file", required = false) MultipartFile multipartFile,Integer day) {
|
||||
return uploadServicel.uploadForLoc(request,multipartFile,day,null);
|
||||
}
|
||||
|
||||
@PostMapping(value = {"/uploadForUrl","/client/uploadForUrl"}) //new
|
||||
@PostMapping(value = {"/uploadForUrl","/client/uploadForUrl"})
|
||||
@ResponseBody
|
||||
public Msg upurlimg(HttpServletRequest request,@RequestParam(value = "data", defaultValue = "") String data) {
|
||||
JSONObject jsonObj = JSONObject.parseObject(data);
|
||||
@@ -128,7 +129,7 @@ public class IndexController {
|
||||
return retMsg;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/getUploadInfo")//new
|
||||
@RequestMapping(value = "/getUploadInfo")
|
||||
@ResponseBody
|
||||
public Msg getUploadInfo() {
|
||||
Msg msg = new Msg();
|
||||
@@ -269,7 +270,7 @@ public class IndexController {
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/deleImagesByUid","/client/deleImagesByUid"}) //new
|
||||
@PostMapping({"/deleImagesByUid","/client/deleImagesByUid"})
|
||||
@ResponseBody
|
||||
public Msg deleImagesByUid(@RequestParam(value = "data", defaultValue = "") String data) {
|
||||
Msg msg = new Msg();
|
||||
@@ -280,12 +281,9 @@ public class IndexController {
|
||||
msg.setInfo("图像已不存在,删除成功");
|
||||
return msg;
|
||||
}
|
||||
//判断是不是自己的图片 因为这里的删除功能只能是首页上传后才会调用的接口 能删除的图片只能是自己的
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
User user = (User) subject.getPrincipal();
|
||||
if(null!=user){
|
||||
//由于integer类型的==比较方式适用于-128~127之间,所以超过这个范围就会不对
|
||||
// if(user.getId()!=image.getUserid()){
|
||||
if(!user.getId().equals(image.getUserid())){
|
||||
msg.setInfo("删除失败,该图片不允许你执行操作");
|
||||
msg.setCode("100403");
|
||||
@@ -304,6 +302,32 @@ public class IndexController {
|
||||
return msg;
|
||||
}
|
||||
|
||||
@PostMapping("/getClientVersion")
|
||||
@ResponseBody
|
||||
public Msg getClientVersion(@RequestParam(value = "data", defaultValue = "") String data) {
|
||||
Msg msg = new Msg();
|
||||
msg.setCode("000");
|
||||
try {
|
||||
JSONObject jsonObj = JSONObject.parseObject(data);
|
||||
String appv = jsonObj.getString("version");
|
||||
AppClient app = appClientService.getAppClientData("app");
|
||||
if(!StringUtils.isBlank(app.getAppupdate())){
|
||||
String version = app.getAppupdate().replaceAll("\\.","");
|
||||
if(MyVersion.compareVersion(app.getAppupdate(),appv)==1){
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("winpackurl",app.getWinpackurl());
|
||||
jsonObject.put("macpackurl",app.getMacpackurl());
|
||||
msg.setCode("200");
|
||||
msg.setData(jsonObject);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
msg.setCode("000");
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/authError")
|
||||
@ResponseBody
|
||||
public Msg authError(HttpServletRequest request){
|
||||
|
||||
@@ -97,7 +97,7 @@ public class UserController {
|
||||
}
|
||||
String uid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
|
||||
String birthder = df.format(new Date());// new Date()为获取当前系统时间
|
||||
String birthder = df.format(new Date());
|
||||
user.setLevel(1);
|
||||
user.setUid(uid);
|
||||
user.setBirthder(birthder);
|
||||
@@ -124,12 +124,12 @@ public class UserController {
|
||||
userService.register(user);
|
||||
}else{
|
||||
msg.setCode("110408");
|
||||
msg.setInfo("验证码不正确");//失效也要处理。
|
||||
msg.setInfo("验证码不正确");
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
@PostMapping("/login")//new
|
||||
@PostMapping("/login")
|
||||
@ResponseBody
|
||||
public Msg login(HttpServletRequest request,HttpSession httpSession,@RequestParam(value = "data", defaultValue = "") String data) {
|
||||
Msg msg = new Msg();
|
||||
@@ -176,7 +176,6 @@ public class UserController {
|
||||
msg.setData(jsonObject);
|
||||
return msg;
|
||||
} catch (UnknownAccountException e) {
|
||||
//此异常说明用户名不存在
|
||||
msg.setCode("4000");
|
||||
msg.setInfo("登录邮箱不存在");
|
||||
System.err.println("邮箱不存在");
|
||||
@@ -225,7 +224,7 @@ public class UserController {
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(value = "/logout")//new
|
||||
@PostMapping(value = "/logout")
|
||||
@ResponseBody
|
||||
public Msg exit(Model model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
|
||||
Msg msg = new Msg();
|
||||
@@ -236,7 +235,7 @@ public class UserController {
|
||||
return msg;
|
||||
}
|
||||
|
||||
@PostMapping("/retrievePass") //new
|
||||
@PostMapping("/retrievePass")
|
||||
@ResponseBody
|
||||
public Msg retrievePass(HttpServletRequest request,HttpSession httpSession, @RequestParam(value = "data", defaultValue = "") String data) {
|
||||
Msg msg = new Msg();
|
||||
@@ -296,7 +295,7 @@ public class UserController {
|
||||
return msg;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/retrieve", method = RequestMethod.GET) //new
|
||||
@RequestMapping(value = "/retrieve", method = RequestMethod.GET)
|
||||
public String retrieve(Model model, String activation,String cip) {
|
||||
Integer ret = 0;
|
||||
try {
|
||||
|
||||
@@ -10,6 +10,7 @@ public class AppClient {
|
||||
private String applogo;
|
||||
private String appupdate;
|
||||
|
||||
|
||||
public AppClient(){}
|
||||
|
||||
public AppClient(String id, String isuse, String winpackurl, String macpackurl, String appname, String applogo, String appupdate) {
|
||||
|
||||
@@ -36,6 +36,8 @@ public class Images {
|
||||
private String[] classifuidlist; //类别uid集合
|
||||
private String classificationuid; //类别uid集合
|
||||
|
||||
private String idname;
|
||||
|
||||
public Images() {
|
||||
super();
|
||||
}
|
||||
@@ -54,7 +56,7 @@ public class Images {
|
||||
Integer imgtype, String updatetime, String username, Integer storageType, String starttime, String stoptime,
|
||||
String explains, String md5key, String notes, String useridlist, String imguid, String albumtitle,
|
||||
String password, Integer selecttype,Long countNum,Integer monthNum,String yyyy,
|
||||
String format,String about,Integer great,String[] classifuidlist,String classificationuid,String violation) {
|
||||
String format,String about,Integer great,String[] classifuidlist,String classificationuid,String violation,String idname) {
|
||||
this.id = id;
|
||||
this.imgname = imgname;
|
||||
this.imgurl = imgurl;
|
||||
@@ -85,6 +87,7 @@ public class Images {
|
||||
this.classifuidlist = classifuidlist;
|
||||
this.classificationuid = classificationuid;
|
||||
this.violation = violation;
|
||||
this.idname = idname;
|
||||
|
||||
}
|
||||
|
||||
@@ -328,6 +331,14 @@ public class Images {
|
||||
public void setViolation(String violation) {
|
||||
this.violation = violation;
|
||||
}
|
||||
|
||||
public String getIdname() {
|
||||
return idname;
|
||||
}
|
||||
|
||||
public void setIdname(String idname) {
|
||||
this.idname = idname;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ public class UploadServicel {
|
||||
MultipartFile multipartFile, Integer setday, String imgUrl) {
|
||||
Msg msg = new Msg();
|
||||
try{
|
||||
String imageFileName = "未命名图像";
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
UploadConfig uploadConfig = uploadConfigMapper.getUpdateConfig();
|
||||
String userip = GetIPS.getIpAddr(request);
|
||||
@@ -65,6 +66,7 @@ public class UploadServicel {
|
||||
FileInputStream fis = null;
|
||||
File file =null;
|
||||
if(imgUrl==null){
|
||||
imageFileName = multipartFile.getOriginalFilename();
|
||||
file = SetFiles.changeFile_new(multipartFile);
|
||||
}else{
|
||||
Msg imgData = uploadForURL(request, imgUrl);
|
||||
@@ -172,6 +174,7 @@ public class UploadServicel {
|
||||
img.setMd5key(md5key);
|
||||
img.setImguid(imguid);
|
||||
img.setFormat(fileMiME.getData().toString());
|
||||
img.setIdname(imageFileName);
|
||||
userMapper.insertimg(img);
|
||||
long etime = System.currentTimeMillis();
|
||||
Print.Normal("上传图片所用总时长:" + String.valueOf(etime - stime) + "ms");
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
package cn.hellohao.utils;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import sun.misc.BASE64Decoder;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* base64转为multipartFile工具类
|
||||
* base64Convert
|
||||
*/
|
||||
|
||||
public class Base64ToMultipartFile implements MultipartFile {
|
||||
private final byte[] imgContent;
|
||||
private final String header;
|
||||
|
||||
|
||||
|
||||
public Base64ToMultipartFile (byte[] imgContent, String header) {
|
||||
this.imgContent = imgContent;
|
||||
this.header = header.split(";")[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return System.currentTimeMillis() + Math.random() + "." + header.split("/")[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOriginalFilename() {
|
||||
return System.currentTimeMillis() + (int) Math.random() * 10000 + "." + header.split("/")[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
return header.split(":")[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return imgContent == null || imgContent.length == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSize() {
|
||||
return imgContent.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getBytes() throws IOException {
|
||||
return imgContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(imgContent);
|
||||
// 关闭流,不然文件会一直占用资源,无法对其操作
|
||||
byteArrayInputStream.close();
|
||||
return byteArrayInputStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transferTo(File dest) throws IOException, IllegalStateException {
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(dest);
|
||||
fileOutputStream.write(imgContent);
|
||||
// 关闭流,不然文件会一直占用资源,无法对其操作
|
||||
fileOutputStream.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* base64转multipartFile
|
||||
*
|
||||
* @param base64
|
||||
* @return
|
||||
*/
|
||||
public static MultipartFile base64Convert(String base64) {
|
||||
String[] baseStrs = base64.split(",");
|
||||
|
||||
BASE64Decoder decoder = new BASE64Decoder();
|
||||
byte[] b = new byte[0];
|
||||
try {
|
||||
b = decoder.decodeBuffer(baseStrs[1]);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
for (int i = 0; i < b.length; ++i) {
|
||||
if (b[i] < 0) {
|
||||
b[i] += 256;
|
||||
}
|
||||
}
|
||||
return new Base64ToMultipartFile (b, baseStrs[0]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -32,6 +32,13 @@ public class FirstRun implements InitializingBean {
|
||||
RunSqlScript.USERNAME = jdbcusername;
|
||||
RunSqlScript.PASSWORD = jdbcpass;
|
||||
RunSqlScript.DBURL = jdbcurl;
|
||||
|
||||
Integer dataBaseName = RunSqlScript.RunSelectCount("SELECT count(*) FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = 'tbed'");
|
||||
if(dataBaseName<1){
|
||||
Print.Normal("无法找到指定数据库,请先创建'tbed'数据库,并导入表结构后再试。");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
Print.Normal("正在校验数据库参数...");
|
||||
RunSqlScript.RunInsert(dynamic);
|
||||
RunSqlScript.RunInsert(compressed);
|
||||
@@ -91,15 +98,14 @@ public class FirstRun implements InitializingBean {
|
||||
RunSqlScript.RunInsert(instartAppclient);
|
||||
Print.Normal("Add table.appclient");
|
||||
}
|
||||
// Integer ret6 = RunSqlScript.RunSelectCount(judgeTable+" 'imgdata' and column_name = 'idname'");
|
||||
// if(ret6==0){
|
||||
// RunSqlScript.RunInsert(sql11);
|
||||
// Print.Normal("Add imgdata.idname");
|
||||
// }
|
||||
Integer ret7 = RunSqlScript.RunSelectCount(judgeTable+" 'imgdata' and column_name = 'idname'");
|
||||
if(ret7==0){
|
||||
RunSqlScript.RunInsert(sql11);
|
||||
Print.Normal("Add imgdata.idname");
|
||||
}
|
||||
|
||||
RunSqlScript.RunInsert(sql10);
|
||||
RunSqlScript.RunInsert("alter table `config` modify column `explain` text,modify column `links` text,modify column `notice` text,modify column `baidu` text");
|
||||
|
||||
//RunSqlScript.RunInsert("alter table imgdata drop index index_md5key_url");
|
||||
RunSqlScript.RunInsert(inddx_md5key);
|
||||
RunSqlScript.RunInsert("UPDATE `keys` SET `Endpoint` = '0' WHERE `id` = 8");
|
||||
Print.Normal("Stage success");
|
||||
@@ -107,7 +113,6 @@ public class FirstRun implements InitializingBean {
|
||||
clears();
|
||||
}
|
||||
|
||||
//检查表是否存在,后边加'imgdata' and column_name = 'explains' 检查字段是否存在
|
||||
private String isTableName = "SELECT count(table_name) FROM information_schema.TABLES WHERE TABLE_SCHEMA='tbed' and table_name =";
|
||||
private String judgeTable = "select count(*) from information_schema.columns where TABLE_SCHEMA='tbed' and table_name = ";
|
||||
//创建blacklist 2019-11-29
|
||||
@@ -117,25 +122,14 @@ public class FirstRun implements InitializingBean {
|
||||
private String sql3 ="CREATE TABLE `imgandalbum` (`imgname` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,`albumkey` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic";
|
||||
private String sql4 ="CREATE TABLE `album` (`albumkey` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,`albumtitle` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,`createdate` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `password` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic";
|
||||
private String sql6 = "alter table imgdata add explains varchar(5000)";
|
||||
//添加album表字段userid
|
||||
private String sql7 = "alter table album add userid int(10)";
|
||||
//添加imgdata表字段md5key
|
||||
private String sql8 = "alter table imgdata add md5key varchar(5000)";
|
||||
private String sql9 = "ALTER TABLE config ADD theme int(4) DEFAULT '1' COMMENT '主题' ";
|
||||
//修改字段长度
|
||||
private String sql10 = "alter table config modify column `explain` varchar(1000),modify column links varchar(1000),modify column notice varchar(1000),modify column baidu varchar(1000)";
|
||||
// 图片标识名字段
|
||||
private String sql11 = "alter table `imgdata` add idname varchar(255) DEFAULT '未命名' ;";
|
||||
|
||||
private String sql11 = "alter table `imgdata` add idname varchar(255) DEFAULT '未命名图像' ;";
|
||||
private String sql12 = "alter table tbed.user add `token` varchar(255)";
|
||||
//创建客户端程序相关表
|
||||
private String createAppclient = "CREATE TABLE `appclient` (`id` varchar(10) NOT NULL,`isuse` varchar(10) NOT NULL,`winpackurl` varchar(255) NULL DEFAULT NULL,`macpackurl` varchar(255) NULL DEFAULT NULL,`appname` varchar(20) NULL,`applogo` varchar(255) NULL,`appupdate` varchar(10) NOT NULL) ";
|
||||
private String instartAppclient = "INSERT INTO `appclient` VALUES ('app', 'on', NULL, NULL, 'Hellohao图像托管', 'https://hellohao.nos-eastchina1.126.net/TbedClient/app.png', 'off');";
|
||||
|
||||
|
||||
private String instartAppclient = "INSERT INTO `appclient` VALUES ('app', 'on', NULL, NULL, 'Hellohao图像托管', 'https://hellohao.nos-eastchina1.126.net/TbedClient/app.png', '1.0.1');";
|
||||
private String inddx_md5key = "ALTER TABLE imgdata ADD INDEX index_md5key_url ( md5key,imgurl)";
|
||||
// create index yarn_app_result_i4 on yarn_app_result (flow_exec_id(100), another_column(50));
|
||||
|
||||
private String dynamic = "alter table imgdata row_format=dynamic";
|
||||
private String compressed = "alter table imgdata row_format=compressed";
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package cn.hellohao.utils;
|
||||
|
||||
/**
|
||||
* @author Hellohao
|
||||
* @version 1.0
|
||||
* @date 2022/7/18 9:49
|
||||
*/
|
||||
public class MyVersion {
|
||||
/**
|
||||
* 版本号比较
|
||||
*
|
||||
* @param v1
|
||||
* @param v2
|
||||
* @return 0代表相等,1代表左边大,-1代表右边大
|
||||
* Utils.compareVersion("1.0.358_20180820090554","1.0.358_20180820090553")=1
|
||||
*/
|
||||
public static int compareVersion(String v1, String v2) {
|
||||
if (v1.equals(v2)) {
|
||||
return 0;
|
||||
}
|
||||
String[] version1Array = v1.split("[._]");
|
||||
String[] version2Array = v2.split("[._]");
|
||||
int index = 0;
|
||||
int minLen = Math.min(version1Array.length, version2Array.length);
|
||||
long diff = 0;
|
||||
|
||||
while (index < minLen
|
||||
&& (diff = Long.parseLong(version1Array[index])
|
||||
- Long.parseLong(version2Array[index])) == 0) {
|
||||
index++;
|
||||
}
|
||||
if (diff == 0) {
|
||||
for (int i = index; i < version1Array.length; i++) {
|
||||
if (Long.parseLong(version1Array[i]) > 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = index; i < version2Array.length; i++) {
|
||||
if (Long.parseLong(version2Array[i]) > 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
return diff > 0 ? 1 : -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,7 +19,8 @@
|
||||
a.imguid,
|
||||
a.format,
|
||||
a.about,
|
||||
a.violation
|
||||
a.violation,
|
||||
a.idname
|
||||
FROM
|
||||
imgdata a
|
||||
LEFT JOIN user b ON a.userid = b.id
|
||||
@@ -66,7 +67,9 @@
|
||||
and
|
||||
a.imguid = #{imguid}
|
||||
</if>
|
||||
|
||||
<if test="idname != null and idname !=''">
|
||||
and idname LIKE '%${idname}%'
|
||||
</if>
|
||||
order by a.id desc
|
||||
</select>
|
||||
<!-- 此用户下总数 -->
|
||||
@@ -104,6 +107,9 @@
|
||||
<if test="explains!=null">
|
||||
explains=#{explains}
|
||||
</if>
|
||||
<if test="idname!=null and idname!=''">
|
||||
idname=#{idname}
|
||||
</if>
|
||||
</set>
|
||||
where imgname=#{imgname}
|
||||
</update>
|
||||
|
||||
@@ -117,8 +117,8 @@
|
||||
|
||||
<!-- 插入图片信息 -->
|
||||
<insert id="insertimg" parameterType="cn.hellohao.pojo.Images">
|
||||
INSERT INTO imgdata (id, imgname, imgurl, userid, updatetime,sizes,abnormal,source,imgtype,md5key,imguid,format,about,violation)
|
||||
VALUES (NULL, #{imgname}, #{imgurl}, #{userid}, #{updatetime},#{sizes},#{abnormal},#{source},#{imgtype},#{md5key},#{imguid},#{format},#{about},null)
|
||||
INSERT INTO imgdata (id, imgname, imgurl, userid, updatetime,sizes,abnormal,source,imgtype,md5key,imguid,format,about,violation,idname)
|
||||
VALUES (NULL, #{imgname}, #{imgurl}, #{userid}, #{updatetime},#{sizes},#{abnormal},#{source},#{imgtype},#{md5key},#{imguid},#{format},#{about},null,#{idname})
|
||||
</insert>
|
||||
|
||||
<!-- 修改资料 -->
|
||||
|
||||
Reference in New Issue
Block a user