Compare commits
2 Commits
2c08552986
...
9df2b7994b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9df2b7994b | ||
|
|
e1afc3a6c5 |
@ -7,15 +7,15 @@ import com.pengrad.telegrambot.model.Chat;
|
||||
import com.pengrad.telegrambot.model.Message;
|
||||
import com.pengrad.telegrambot.model.MessageEntity;
|
||||
import com.pengrad.telegrambot.response.SendResponse;
|
||||
import com.sun.tools.javac.Main;
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import org.springframework.aot.hint.annotation.RegisterReflectionForBinding;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import com.pengrad.telegrambot.model.User;
|
||||
|
||||
@Configuration
|
||||
@RegisterReflectionForBinding(classes = {CRC32Cache.class, CustomConfiguration.class,
|
||||
GalleryForQuery.class, Gallery.class, GalleryTask.class, MaskDomain.class,
|
||||
@RegisterReflectionForBinding(classes = {CustomConfiguration.class,
|
||||
GalleryForQuery.class, Gallery.class, GalleryTask.class, HikariConfig.class,
|
||||
PageNameCache.class, ShareFile.class, Tag.class, TagMark.class, User.class,
|
||||
SendResponse.class, Message.class, com.pengrad.telegrambot.model.User.class,
|
||||
Chat.class, MessageEntity.class,
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
package com.lion.lionwebsite.Configuration;
|
||||
|
||||
import com.lion.lionwebsite.Domain.MaskDomain;
|
||||
import com.lion.lionwebsite.Interceptor.HumanInterceptor;
|
||||
import com.lion.lionwebsite.Interceptor.PersonalInterceptor;
|
||||
import com.lion.lionwebsite.Interceptor.TaskHandlerInterceptor;
|
||||
import com.lion.lionwebsite.Util.CustomUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
@ -36,14 +33,4 @@ public class InterceptorConfiguration implements WebMvcConfigurer {
|
||||
public HandlerInterceptor getHumanInterceptor(){
|
||||
return new HumanInterceptor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CustomUtil getParameterUtil(){
|
||||
CustomUtil customUtil = new CustomUtil();
|
||||
MaskDomain[] maskDomains = new MaskDomain[2];
|
||||
maskDomains[0] = new MaskDomain("exhentai.org", "element-plus.org");
|
||||
maskDomains[1] = new MaskDomain("e-hentai.org", "element.org");
|
||||
customUtil.setMaskDomains(maskDomains);
|
||||
return customUtil;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
package com.lion.lionwebsite.Configuration;
|
||||
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@Configuration
|
||||
public class SqlConfiguration {
|
||||
@Bean(name = "datasource-main")
|
||||
@ConfigurationProperties(prefix = "spring.datasource-main")
|
||||
public DataSource dataSourceMain() {
|
||||
return DataSourceBuilder.create().build();
|
||||
}
|
||||
|
||||
@Bean(name = "datasource-cache")
|
||||
@ConfigurationProperties(prefix = "spring.datasource-cache")
|
||||
public DataSource dataSourceCache() {
|
||||
return DataSourceBuilder.create().build();
|
||||
}
|
||||
|
||||
@Bean(name = "sqlSessionFactory-main")
|
||||
public SqlSessionFactory sqlSessionFactoryMain(@Qualifier("datasource-main") DataSource dataSource) throws Exception {
|
||||
SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean();
|
||||
sessionFactoryBean.setDataSource(dataSource);
|
||||
return sessionFactoryBean.getObject();
|
||||
}
|
||||
|
||||
@Bean(name = "sqlSessionFactory-cache")
|
||||
public SqlSessionFactory sqlSessionFactoryCache(@Qualifier("datasource-cache") DataSource dataSource) throws Exception {
|
||||
SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean();
|
||||
sessionFactoryBean.setDataSource(dataSource);
|
||||
return sessionFactoryBean.getObject();
|
||||
}
|
||||
|
||||
@Bean(name = "sqlSessionTemplate-main")
|
||||
public SqlSessionTemplate sqlSessionTemplateMain(@Qualifier("sqlSessionFactory-main") SqlSessionFactory sqlSessionFactory) {
|
||||
return new SqlSessionTemplate(sqlSessionFactory);
|
||||
}
|
||||
|
||||
@Bean(name = "sqlSessionTemplate-cache")
|
||||
public SqlSessionTemplate sqlSessionTemplateCache(@Qualifier("sqlSessionFactory-cache") SqlSessionFactory sqlSessionFactory) {
|
||||
return new SqlSessionTemplate(sqlSessionFactory);
|
||||
}
|
||||
}
|
||||
@ -3,15 +3,12 @@ package com.lion.lionwebsite.Controller;
|
||||
import com.lion.lionwebsite.Service.CollectService;
|
||||
import com.lion.lionwebsite.Service.GalleryManageService;
|
||||
import com.lion.lionwebsite.Service.UserServiceImpl;
|
||||
import com.lion.lionwebsite.Util.CustomUtil;
|
||||
import com.lion.lionwebsite.Util.Response;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@ -22,14 +19,11 @@ public class GalleryManageController {
|
||||
|
||||
CollectService collectService;
|
||||
|
||||
CustomUtil customUtil;
|
||||
|
||||
UserServiceImpl userService;
|
||||
|
||||
public GalleryManageController(GalleryManageService galleryManageService, CollectService collectService, CustomUtil customUtil, UserServiceImpl userService) {
|
||||
public GalleryManageController(GalleryManageService galleryManageService, CollectService collectService, UserServiceImpl userService) {
|
||||
this.galleryManageService = galleryManageService;
|
||||
this.collectService = collectService;
|
||||
this.customUtil = customUtil;
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
@ -39,9 +33,6 @@ public class GalleryManageController {
|
||||
@RequestParam(value = "mode", defaultValue = "3", required = false)String mode){
|
||||
if(link == null || targetResolution == null)
|
||||
return Response._failure("参数不全");
|
||||
link = customUtil.restoreUrl(link);
|
||||
if(link == null)
|
||||
return Response._failure("链接错误");
|
||||
return galleryManageService.createTask(link, targetResolution, AuthCode, tags, Byte.parseByte(mode));
|
||||
}
|
||||
|
||||
@ -58,9 +49,6 @@ public class GalleryManageController {
|
||||
return Response._failure("参数不全");
|
||||
switch (type) {
|
||||
case "link" -> {
|
||||
param = customUtil.restoreUrl(param);
|
||||
if (param == null)
|
||||
return Response._failure("链接错误");
|
||||
return galleryManageService.selectTaskByLink(param);
|
||||
}
|
||||
case "gid" -> {
|
||||
@ -79,17 +67,17 @@ public class GalleryManageController {
|
||||
return galleryManageService.selectGalleryByDownloader(AuthCode);
|
||||
}
|
||||
default -> {
|
||||
return Response._default();
|
||||
return Response._failure("参数错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("")
|
||||
public String deleteTask(Integer gid, String AuthCode, @RequestParam(value = "mode", defaultValue = "3", required = false)String mode){
|
||||
public String deleteTask(Integer gid, String AuthCode){
|
||||
if(gid == null)
|
||||
return Response._failure("参数不全");
|
||||
|
||||
return galleryManageService.deleteGalleryByGid(gid, AuthCode, Byte.parseByte(mode));
|
||||
return galleryManageService.deleteGalleryByGid(gid, AuthCode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
package com.lion.lionwebsite.Dao;
|
||||
|
||||
import com.lion.lionwebsite.Domain.CRC32Cache;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
@Mapper
|
||||
public interface CRC32CacheMapper {
|
||||
@Insert("insert into CRC32Cache (path, lastModifyTime, crc32) values (#{path}, #{lastModifyTime}, #{crc32})")
|
||||
void insertCache(CRC32Cache crc32Cache);
|
||||
|
||||
@Select("select * from CRC32Cache where path=#{path}")
|
||||
CRC32Cache selectCache(String path);
|
||||
|
||||
@Select("select * from CRC32Cache where path like '%' || #{name} || '%'")
|
||||
CRC32Cache selectCacheByName(String name);
|
||||
|
||||
// @Update("update CRC32Cache set lastModifyTime=#{lastModifyTime}, crc32=#{crc32} where path=#{path}")
|
||||
// void updateCache(CRC32Cache crc32Cache);
|
||||
|
||||
@Delete("delete from CRC32Cache where path=#{path}")
|
||||
void deleteCacheByPath(String path);
|
||||
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.lion.lionwebsite.Dao;
|
||||
package com.lion.lionwebsite.Dao.cache;
|
||||
|
||||
import com.lion.lionwebsite.Domain.PageNameCache;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
@ -17,6 +17,6 @@ public interface PageNameCacheMapper {
|
||||
@Delete("delete from pageName where gid=#{gid}")
|
||||
void deletePageNameByGid(int gid);
|
||||
|
||||
@Delete("delete from pageName where gid=#{gid} and page=#{page}")
|
||||
void deletePageName(PageNameCache pageNameCache);
|
||||
// @Delete("delete from pageName where gid=#{gid} and page=#{page}")
|
||||
// void deletePageName(PageNameCache pageNameCache);
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.lion.lionwebsite.Dao;
|
||||
package com.lion.lionwebsite.Dao.normal;
|
||||
|
||||
import org.apache.ibatis.annotations.*;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.lion.lionwebsite.Dao;
|
||||
package com.lion.lionwebsite.Dao.normal;
|
||||
|
||||
import com.lion.lionwebsite.Domain.CustomConfiguration;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.lion.lionwebsite.Dao;
|
||||
package com.lion.lionwebsite.Dao.normal;
|
||||
|
||||
import com.lion.lionwebsite.Domain.Gallery;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
@ -9,8 +9,8 @@ public interface GalleryMapper {
|
||||
|
||||
|
||||
@Insert("insert into gallery" +
|
||||
" (gid, name, link, language, pages, status, fileSize, createTime, proceeding, resolution, displayFileSize, downloader, mode)\n" +
|
||||
" values (#{gid}, #{name}, #{link}, #{language}, #{pages}, #{status}, #{fileSize}, #{createTime}, #{proceeding}, #{resolution}, #{displayFileSize}, #{downloader}, #{mode})")
|
||||
" (gid, name, link, language, pages, status, fileSize, createTime, proceeding, resolution, displayFileSize, downloader, mode, thumb_link)\n" +
|
||||
" values (#{gid}, #{name}, #{link}, #{language}, #{pages}, #{status}, #{fileSize}, #{createTime}, #{proceeding}, #{resolution}, #{displayFileSize}, #{downloader}, #{mode}, #{thumb_link})")
|
||||
void insertGallery(Gallery gallery);
|
||||
|
||||
@Select("select * from gallery where link=#{link}")
|
||||
@ -1,4 +1,4 @@
|
||||
package com.lion.lionwebsite.Dao;
|
||||
package com.lion.lionwebsite.Dao.normal;
|
||||
|
||||
import com.lion.lionwebsite.Domain.ShareFile;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.lion.lionwebsite.Dao;
|
||||
package com.lion.lionwebsite.Dao.normal;
|
||||
|
||||
import com.lion.lionwebsite.Domain.SubBind;
|
||||
import com.lion.lionwebsite.Domain.SubUpdateRecord;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.lion.lionwebsite.Dao;
|
||||
package com.lion.lionwebsite.Dao.normal;
|
||||
|
||||
import com.lion.lionwebsite.Domain.Tag;
|
||||
import com.lion.lionwebsite.Domain.TagMark;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.lion.lionwebsite.Dao;
|
||||
package com.lion.lionwebsite.Dao.normal;
|
||||
|
||||
import com.lion.lionwebsite.Domain.User;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
@ -1,14 +0,0 @@
|
||||
package com.lion.lionwebsite.Domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CRC32Cache {
|
||||
String path;
|
||||
long lastModifyTime;
|
||||
String crc32;
|
||||
}
|
||||
@ -12,6 +12,11 @@ import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class Gallery {
|
||||
public static byte VIEW = 0;
|
||||
public static byte SOURCE = 1;
|
||||
public static byte PREVIEW = 2;
|
||||
public static byte ALL = 3;
|
||||
|
||||
@JsonProperty("name")
|
||||
private String name; //本子名字
|
||||
|
||||
@ -66,5 +71,9 @@ public class Gallery {
|
||||
|
||||
@JsonProperty("mode")
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private byte mode; //rd 可读可下载 r可读 d可下载
|
||||
private byte mode; //0 仅查看 1 仅下载源文件 2 仅存储预览图 3 全部
|
||||
|
||||
@JsonProperty("thumb_link")
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String thumb_link;
|
||||
}
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
package com.lion.lionwebsite.Domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class MaskDomain {
|
||||
String raw;
|
||||
String mask;
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
package com.lion.lionwebsite.Filter;
|
||||
|
||||
import com.lion.lionwebsite.Dao.UserMapper;
|
||||
import com.lion.lionwebsite.Dao.normal.UserMapper;
|
||||
import com.lion.lionwebsite.Util.CustomUtil;
|
||||
import jakarta.servlet.*;
|
||||
import jakarta.servlet.annotation.WebFilter;
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
package com.lion.lionwebsite.Interceptor;
|
||||
|
||||
import com.lion.lionwebsite.Dao.UserMapper;
|
||||
import com.lion.lionwebsite.Dao.normal.UserMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
@ -14,7 +15,7 @@ public class TaskHandlerInterceptor implements HandlerInterceptor {
|
||||
@Resource
|
||||
UserMapper userMapper;
|
||||
|
||||
String[] AuthCodes = null;
|
||||
String[] AuthCodes;
|
||||
|
||||
public TaskHandlerInterceptor(UserMapper userMapper) {
|
||||
this.userMapper = userMapper;
|
||||
@ -22,7 +23,7 @@ public class TaskHandlerInterceptor implements HandlerInterceptor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler){
|
||||
public boolean preHandle(HttpServletRequest request, @NotNull HttpServletResponse response, @NotNull Object handler){
|
||||
String auth = request.getParameter("AuthCode");
|
||||
|
||||
if(auth != null)
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.lion.lionwebsite;
|
||||
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.mybatis.spring.annotation.MapperScans;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||
@ -9,6 +11,10 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
@SpringBootApplication
|
||||
@EnableScheduling
|
||||
@ServletComponentScan(value = "com.lion.lionwebsite.Filter")
|
||||
@MapperScans({
|
||||
@MapperScan(basePackages = "com.lion.lionwebsite.Dao.normal", sqlSessionTemplateRef = "sqlSessionTemplate-main", sqlSessionFactoryRef = "sqlSessionFactory-main"),
|
||||
@MapperScan(basePackages = "com.lion.lionwebsite.Dao.cache", sqlSessionTemplateRef = "sqlSessionTemplate-cache", sqlSessionFactoryRef = "sqlSessionFactory-cache")
|
||||
})
|
||||
public class LionWebsiteApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@ -7,14 +7,5 @@ public class DeleteGalleryMessage extends AbstractMessage{
|
||||
{
|
||||
messageType = DELETE_GALLERY_MESSAGE;
|
||||
}
|
||||
|
||||
public static final byte DELETE_ALL = 3;
|
||||
public static final byte DELETE_PREVIEW = 2;
|
||||
public static final byte DELETE_SOURCE = 1;
|
||||
|
||||
|
||||
|
||||
byte deleteType;
|
||||
|
||||
String galleryName;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.lion.lionwebsite.Service;
|
||||
|
||||
import com.lion.lionwebsite.Dao.CollectMapper;
|
||||
import com.lion.lionwebsite.Dao.normal.CollectMapper;
|
||||
import com.lion.lionwebsite.Util.Response;
|
||||
import lombok.Data;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -2,7 +2,8 @@ package com.lion.lionwebsite.Service;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.lion.lionwebsite.Dao.*;
|
||||
import com.lion.lionwebsite.Dao.cache.PageNameCacheMapper;
|
||||
import com.lion.lionwebsite.Dao.normal.*;
|
||||
import com.lion.lionwebsite.Domain.*;
|
||||
import com.lion.lionwebsite.Exception.ResolutionNotMatchException;
|
||||
import com.lion.lionwebsite.Error.ErrorCode;
|
||||
@ -147,8 +148,7 @@ public class GalleryManageService {
|
||||
for (Integer tid : tidS)
|
||||
if (tagMapper.selectTagExistById(tid) > 0)
|
||||
tagMapper.markTag(gallery.getGid(), tid);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
response.failure("提交失败,未知原因");
|
||||
galleryMapper.deleteGalleryByGid(gallery.getGid());
|
||||
}
|
||||
@ -183,7 +183,7 @@ public class GalleryManageService {
|
||||
else
|
||||
response.failure("查询失败");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info(e.getMessage());
|
||||
response.failure("查询失败");
|
||||
}
|
||||
|
||||
@ -195,6 +195,7 @@ public class GalleryManageService {
|
||||
|
||||
/**
|
||||
* 通过gid查询本子
|
||||
*
|
||||
* @param gid gid
|
||||
* @return 查询结果
|
||||
*/
|
||||
@ -213,6 +214,7 @@ public class GalleryManageService {
|
||||
|
||||
/**
|
||||
* 查询所有本子
|
||||
*
|
||||
* @return 查询结果
|
||||
*/
|
||||
public String selectAllGallery(int userId) {
|
||||
@ -267,6 +269,7 @@ public class GalleryManageService {
|
||||
|
||||
/**
|
||||
* 查询未完成的本子
|
||||
*
|
||||
* @return 查询结果
|
||||
*/
|
||||
public String selectUnDoneGallery() {
|
||||
@ -283,6 +286,7 @@ public class GalleryManageService {
|
||||
|
||||
/**
|
||||
* 通过本子名查询本子
|
||||
*
|
||||
* @param name 名字
|
||||
* @return 查询结果
|
||||
*/
|
||||
@ -300,6 +304,7 @@ public class GalleryManageService {
|
||||
|
||||
/**
|
||||
* 查询用户下载的本子
|
||||
*
|
||||
* @param AuthCode 授权码(用于查询用户名)
|
||||
* @return 查询结果
|
||||
*/
|
||||
@ -365,13 +370,12 @@ public class GalleryManageService {
|
||||
|
||||
/**
|
||||
* 删除本子以及对应的文件(如果存在的话)
|
||||
*
|
||||
* @param gid gid
|
||||
* @return 删除结果
|
||||
*/
|
||||
public String deleteGalleryByGid(Integer gid, String AuthCode, byte mode) {
|
||||
public String deleteGalleryByGid(Integer gid, String AuthCode) {
|
||||
Response response = Response.generateResponse();
|
||||
String deleteType;
|
||||
|
||||
Gallery gallery = galleryMapper.selectGalleryByGid(gid);
|
||||
User user = userMapper.selectUserByAuthCode(AuthCode);
|
||||
if (gallery == null) {
|
||||
@ -383,17 +387,8 @@ public class GalleryManageService {
|
||||
if (!(collector.isEmpty() || collector.size() == 1 && collector.get(0).equals(user.getId()) //判断收藏
|
||||
&& gallery.getDownloader() == user.getId())) //判断下载
|
||||
response.failure("删除失败,该本子已被别人收藏或你不是下载人");
|
||||
|
||||
else {
|
||||
if((gallery.getMode() & mode) == 0) { //不能删除对应的,因为对应的没有
|
||||
if (mode == 1)
|
||||
response.failure("无法删除该本子的源文件,不存在");
|
||||
else if (mode == 2)
|
||||
response.failure("无法删除该本子的预览图,不存在");
|
||||
} else {
|
||||
log.info("删除本子{}, mode:{}, delete_mode:{}", gallery.getName(), gallery.getMode(), mode);
|
||||
gallery.setMode((byte) (gallery.getMode() ^ mode));
|
||||
if(gallery.getMode() == 0) { //删整个本子
|
||||
log.info("删除本子{}", gallery.getName());
|
||||
galleryMapper.deleteGalleryByGid(gallery.getGid()); //删除本子记录
|
||||
ArrayList<Integer> tidS = tagMapper.selectTagByGid(gallery.getGid());
|
||||
for (Integer tid : tidS)
|
||||
@ -406,26 +401,14 @@ public class GalleryManageService {
|
||||
|
||||
if (new File(TargetPath + "/" + gallery.getName()).isDirectory()) //删除本地缓存
|
||||
FileUtil.del(TargetPath + "/" + gallery.getName());
|
||||
deleteType = "全部";
|
||||
}else{
|
||||
if(mode == 2 && new File(TargetPath + "/" + gallery.getName()).isDirectory()) { //删除预览缓存
|
||||
FileUtil.del(TargetPath + "/" + gallery.getName());
|
||||
gid2name_cache.remove(gallery.getGid()); //删除本子缓存
|
||||
page2pageNameCache.remove(gallery.getName()); //移除页数缓存
|
||||
}
|
||||
|
||||
galleryMapper.updateGallery(gallery);
|
||||
deleteType = (mode == 1? "源文件": "预览图"); //用于提示
|
||||
}
|
||||
switch (remoteService.deleteGallery(gallery, mode)){
|
||||
case ErrorCode.IO_ERROR -> response.failure("本子:" + gallery.getName() + deleteType + "删除失败,IO错误");
|
||||
case ErrorCode.FILE_NOT_FOUND -> response.failure("本子:" + gallery.getName() + deleteType + "删除失败,文件不存在");
|
||||
switch (remoteService.deleteGallery(gallery)) {
|
||||
case ErrorCode.IO_ERROR -> response.failure("本子:" + gallery.getName() + "删除失败,IO错误");
|
||||
case ErrorCode.FILE_NOT_FOUND -> response.failure("本子:" + gallery.getName() + "删除失败,文件不存在");
|
||||
case 0 -> response.success();
|
||||
}
|
||||
if (response.get("result").equals("failure"))
|
||||
log.info(response.getResult());
|
||||
}
|
||||
}
|
||||
return response.toJSONString();
|
||||
}
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package com.lion.lionwebsite.Service;
|
||||
|
||||
import com.lion.lionwebsite.Dao.CustomConfigurationMapper;
|
||||
import com.lion.lionwebsite.Dao.GalleryMapper;
|
||||
import com.lion.lionwebsite.Dao.ShareFileMapper;
|
||||
import com.lion.lionwebsite.Dao.normal.CustomConfigurationMapper;
|
||||
import com.lion.lionwebsite.Dao.normal.GalleryMapper;
|
||||
import com.lion.lionwebsite.Dao.normal.ShareFileMapper;
|
||||
import com.lion.lionwebsite.Domain.CustomConfiguration;
|
||||
import com.lion.lionwebsite.Domain.ShareFile;
|
||||
import com.lion.lionwebsite.Util.CustomUtil;
|
||||
@ -29,8 +29,6 @@ import static java.nio.file.FileVisitResult.CONTINUE;
|
||||
@Service
|
||||
@Data
|
||||
public class LocalServiceImpl{
|
||||
String fires = "https://api.dler.io/sub?target=clash&new_name=true&url=https%3A%2F%2Ffast.losadhwselfff2332dasd.xyz%2Flink%2Fz0pfwyTvC5naXkbb%3Fclash%3D1&insert=false&config=https%3A%2F%2Fraw.githubusercontent.com%2FACL4SSR%2FACL4SSR%2Fmaster%2FClash%2Fconfig%2FACL4SSR_Online.ini";
|
||||
|
||||
String DouNaiClash = "https://aaaa.gay/link/X7zEqkIx5gtIGugO?client=clashmeta";
|
||||
|
||||
String DouNaiV2ray = "https://aaaa.gay/link/X7zEqkIx5gtIGugO?client=v2";
|
||||
@ -81,8 +79,6 @@ public class LocalServiceImpl{
|
||||
return false;
|
||||
}
|
||||
|
||||
File mixin = new File("sub/sub.txt");
|
||||
File firesFile = new File("sub/fires.txt");
|
||||
File DouNaiClashFile = new File("sub/DouNaiClash.txt");
|
||||
File DouNaiV2rayFile = new File("sub/DouNaiV2ray.txt");
|
||||
File directory = new File("sub");
|
||||
@ -90,31 +86,17 @@ public class LocalServiceImpl{
|
||||
if(!directory.isDirectory())
|
||||
Files.createDirectory(Paths.get("sub"));
|
||||
|
||||
List<String> fires_profile = null;
|
||||
List<String> DouNaiClash_profile = null;
|
||||
OutputStream outputStream;
|
||||
|
||||
//下载薯条订阅
|
||||
try(FileWriter writer = new FileWriter(firesFile)) {
|
||||
fires_profile = Get(fires);
|
||||
for (String i : fires_profile)
|
||||
writer.write(i + "\n");
|
||||
|
||||
System.out.println("load fires complete");
|
||||
}catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("load fires failure");
|
||||
}
|
||||
List<String> DouNaiClash_profile;
|
||||
|
||||
//下载豆奶v2ray订阅
|
||||
try(FileWriter writer = new FileWriter(DouNaiV2rayFile)) {
|
||||
String DouNaiV2rayRaw = Get(DouNaiV2ray).get(0);
|
||||
String DouNaiV2rayRaw = Get(DouNaiV2ray).getFirst();
|
||||
String[] v2rayPlain = new String(Base64.getDecoder().decode(DouNaiV2rayRaw)).split("\n");
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
//过滤高倍率节点
|
||||
for(String node: v2rayPlain){
|
||||
String name = URLDecoder.decode(node.split("#")[1], StandardCharsets.UTF_8);
|
||||
if(name.startsWith("①") && name.contains("流量")){
|
||||
if(name.startsWith("⛅") && name.contains("流量")){
|
||||
float ratio = Float.parseFloat(name.substring(name.indexOf("(") + 1, name.indexOf(")")).replace("倍流量", ""));
|
||||
if(ratio <= 1)
|
||||
stringBuilder.append(node).append("\n");
|
||||
@ -163,44 +145,6 @@ public class LocalServiceImpl{
|
||||
System.out.println("load DouNai clash failure");
|
||||
}
|
||||
|
||||
//处理合并
|
||||
assert DouNaiClash_profile != null;
|
||||
int side_start = DouNaiClash_profile.indexOf("proxies:");
|
||||
int side_end = DouNaiClash_profile.indexOf("proxy-groups:");
|
||||
|
||||
List<String> side_proxy = new ArrayList<>();
|
||||
List<String> side_name = new ArrayList<>();
|
||||
for (int i = side_start + 1; i < side_end; i++) {
|
||||
side_proxy.add(DouNaiClash_profile.get(i));
|
||||
if (DouNaiClash_profile.get(i).contains("name"))
|
||||
side_name.add(DouNaiClash_profile.get(i).replace("name:", ""));
|
||||
}
|
||||
|
||||
List<String> final_profile = new ArrayList<>();
|
||||
assert fires_profile != null;
|
||||
for (String i : fires_profile) {
|
||||
if (i.equals("proxy-groups:"))
|
||||
final_profile.addAll(side_proxy);
|
||||
|
||||
final_profile.add(i);
|
||||
if (i.equals("proxy-groups:")) {
|
||||
final_profile.add(" -");
|
||||
final_profile.add(" name: e站流量");
|
||||
final_profile.add(" type: select");
|
||||
final_profile.add(" proxies:");
|
||||
for (String x : side_name)
|
||||
final_profile.add(" " + x);
|
||||
|
||||
}
|
||||
if (i.equals("rules:"))
|
||||
final_profile.add(" - DOMAIN-KEYWORD,hentai,e站流量");
|
||||
}
|
||||
|
||||
outputStream = Files.newOutputStream(mixin.toPath());
|
||||
for(String i: final_profile)
|
||||
outputStream.write((i + "\n").getBytes(StandardCharsets.UTF_8));
|
||||
outputStream.close();
|
||||
|
||||
configurationMapper.updateConfiguration(CustomConfiguration.LAST_UPDATE_SUB_TIME, dateTimeFormatter.format(LocalDateTime.now()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3,9 +3,9 @@ package com.lion.lionwebsite.Service;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.lion.lionwebsite.Dao.CustomConfigurationMapper;
|
||||
import com.lion.lionwebsite.Dao.ShareFileMapper;
|
||||
import com.lion.lionwebsite.Dao.UserMapper;
|
||||
import com.lion.lionwebsite.Dao.normal.CustomConfigurationMapper;
|
||||
import com.lion.lionwebsite.Dao.normal.ShareFileMapper;
|
||||
import com.lion.lionwebsite.Dao.normal.UserMapper;
|
||||
import com.lion.lionwebsite.Domain.CustomConfiguration;
|
||||
import com.lion.lionwebsite.Domain.ShareFile;
|
||||
import com.lion.lionwebsite.Interceptor.TaskHandlerInterceptor;
|
||||
@ -22,7 +22,6 @@ import org.apache.commons.compress.archivers.ArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
|
||||
import org.apache.tomcat.util.http.fileupload.IOUtils;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package com.lion.lionwebsite.Service;
|
||||
|
||||
import com.lion.lionwebsite.Dao.CustomConfigurationMapper;
|
||||
import com.lion.lionwebsite.Dao.normal.CustomConfigurationMapper;
|
||||
|
||||
import com.lion.lionwebsite.Dao.ShareFileMapper;
|
||||
import com.lion.lionwebsite.Dao.UserMapper;
|
||||
import com.lion.lionwebsite.Dao.normal.ShareFileMapper;
|
||||
import com.lion.lionwebsite.Dao.normal.UserMapper;
|
||||
import com.lion.lionwebsite.Domain.CustomConfiguration;
|
||||
import com.lion.lionwebsite.Domain.ShareFile;
|
||||
import com.lion.lionwebsite.Domain.User;
|
||||
@ -23,6 +23,8 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Calendar;
|
||||
@ -129,7 +131,7 @@ public class PublicServiceImpl {
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
outputStream.write(imageBytes);
|
||||
outputStream.close();
|
||||
}catch (IOException e){
|
||||
}catch (IOException | URISyntaxException e){
|
||||
e.printStackTrace();
|
||||
try {
|
||||
response.sendError(503);
|
||||
@ -139,8 +141,8 @@ public class PublicServiceImpl {
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] getImageBytesFromUrl(String imageUrl) throws IOException {
|
||||
URL url = new URL(imageUrl);
|
||||
public static byte[] getImageBytesFromUrl(String imageUrl) throws IOException, URISyntaxException {
|
||||
URL url = new URI(imageUrl).toURL();
|
||||
InputStream inputStream = null;
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
|
||||
|
||||
@ -109,6 +109,8 @@ public class QueryService {
|
||||
else{ // transfer image and save it as cache
|
||||
log.info("miss cache:{}", imageName);
|
||||
try {
|
||||
if(!path.startsWith("/t"))
|
||||
path = "/t" + path;
|
||||
requests("https://s.exhentai.org" + path, true, response, new FileOutputStream(image));
|
||||
}catch (IOException e){
|
||||
e.printStackTrace();
|
||||
@ -119,8 +121,8 @@ public class QueryService {
|
||||
public String requests(String url, boolean isDirect, HttpServletResponse response, OutputStream local) throws IOException {
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
CloseableHttpResponse httpResponse;
|
||||
HashMap<String, String> headers = new HashMap<>();
|
||||
|
||||
HashMap<String, String> headers = new HashMap<>();
|
||||
headers.put("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36");
|
||||
headers.put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
|
||||
headers.put("Upgrade-Insecure-Requests", "1");
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.lion.lionwebsite.Service;
|
||||
|
||||
import com.lion.lionwebsite.Dao.GalleryMapper;
|
||||
import com.lion.lionwebsite.Dao.normal.GalleryMapper;
|
||||
import com.lion.lionwebsite.Domain.Gallery;
|
||||
import com.lion.lionwebsite.Domain.GalleryTask;
|
||||
import com.lion.lionwebsite.Message.*;
|
||||
@ -130,10 +130,9 @@ public class RemoteService {
|
||||
}
|
||||
}
|
||||
|
||||
public byte deleteGallery(Gallery gallery, byte type){
|
||||
public byte deleteGallery(Gallery gallery){
|
||||
DeleteGalleryMessage dgm = new DeleteGalleryMessage();
|
||||
dgm.setGalleryName(gallery.getName());
|
||||
dgm.setDeleteType(type);
|
||||
dgm.messageId = atomicInteger.getAndIncrement();
|
||||
|
||||
channel.writeAndFlush(dgm);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.lion.lionwebsite.Service;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.lion.lionwebsite.Dao.SubMapper;
|
||||
import com.lion.lionwebsite.Dao.normal.SubMapper;
|
||||
import com.lion.lionwebsite.Domain.SubBind;
|
||||
import com.lion.lionwebsite.Domain.SubUpdateRecord;
|
||||
import com.lion.lionwebsite.Util.CustomUtil;
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
package com.lion.lionwebsite.Service;
|
||||
|
||||
import com.lion.lionwebsite.Dao.GalleryMapper;
|
||||
import com.lion.lionwebsite.Dao.TagMapper;
|
||||
import com.lion.lionwebsite.Dao.normal.GalleryMapper;
|
||||
import com.lion.lionwebsite.Dao.normal.TagMapper;
|
||||
import com.lion.lionwebsite.Domain.Gallery;
|
||||
import com.lion.lionwebsite.Domain.Tag;
|
||||
import com.lion.lionwebsite.Util.Response;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package com.lion.lionwebsite.Service;
|
||||
|
||||
import com.lion.lionwebsite.Dao.CollectMapper;
|
||||
import com.lion.lionwebsite.Dao.GalleryMapper;
|
||||
import com.lion.lionwebsite.Dao.UserMapper;
|
||||
import com.lion.lionwebsite.Dao.normal.CollectMapper;
|
||||
import com.lion.lionwebsite.Dao.normal.GalleryMapper;
|
||||
import com.lion.lionwebsite.Dao.normal.UserMapper;
|
||||
import com.lion.lionwebsite.Domain.User;
|
||||
import com.lion.lionwebsite.Interceptor.TaskHandlerInterceptor;
|
||||
import com.lion.lionwebsite.Util.CustomUtil;
|
||||
|
||||
@ -1,14 +1,11 @@
|
||||
package com.lion.lionwebsite.Util;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.lion.lionwebsite.Domain.MaskDomain;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.URL;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.regex.Matcher;
|
||||
@ -28,27 +25,6 @@ public class CustomUtil {
|
||||
|
||||
public static ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
private MaskDomain[] maskDomains;
|
||||
public String restoreUrl(String link){
|
||||
URL url;
|
||||
|
||||
try {
|
||||
url = new URL(link);
|
||||
}catch (MalformedURLException e){
|
||||
return null;
|
||||
}
|
||||
|
||||
for(MaskDomain maskDomain: maskDomains){
|
||||
if(url.getHost().equals(maskDomain.getMask())){
|
||||
return link.replace(maskDomain.getMask(), maskDomain.getRaw());
|
||||
}
|
||||
else if(url.getHost().equals(maskDomain.getRaw())){
|
||||
return link;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String fileSizeToString(long fileSize){
|
||||
if (fileSize < ONE_KB) {
|
||||
return fileSize + "B";
|
||||
|
||||
@ -3,10 +3,11 @@ package com.lion.lionwebsite.Util;
|
||||
import com.lion.lionwebsite.Domain.Gallery;
|
||||
import com.lion.lionwebsite.Exception.ResolutionNotMatchException;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.client.entity.EntityBuilder;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.jsoup.Jsoup;
|
||||
@ -21,9 +22,6 @@ import java.util.*;
|
||||
|
||||
public class GalleryUtil {
|
||||
|
||||
static String EX_HENTAI = "https://exhentai.org";
|
||||
static String E_HENTAI = "https://e-hentai.org";
|
||||
|
||||
static String POST = "post";
|
||||
static String GET = "get";
|
||||
|
||||
@ -58,7 +56,7 @@ public class GalleryUtil {
|
||||
gallery.setProceeding(0);
|
||||
|
||||
//访问本子页面
|
||||
String galleryPage = requests(url, null, GET, null);
|
||||
String galleryPage = requests(url, GET, null, null);
|
||||
Document galleryDoc = Jsoup.parse(galleryPage);
|
||||
|
||||
//收集本子基本信息
|
||||
@ -76,7 +74,7 @@ public class GalleryUtil {
|
||||
|
||||
|
||||
//访问下载页面,获取分辨率
|
||||
String downloadPage = requests(download_link, extraProperties, GET, null);
|
||||
String downloadPage = requests(download_link, GET, extraProperties, null);
|
||||
Document downloadDoc = Jsoup.parse(downloadPage);
|
||||
Elements resolutions = downloadDoc.select("#db > div > table > tbody > tr > td");
|
||||
download_link = downloadDoc.select("#hathdl_form").attr("action");
|
||||
@ -123,7 +121,9 @@ public class GalleryUtil {
|
||||
gallery.setDisplayFileSize(CustomUtil.fileSizeToString(gallery.getFileSize()));
|
||||
|
||||
//提交下载请求
|
||||
downloadPage = requests(download_link, extraProperties, POST, targetResolution);
|
||||
HashMap<String, String> body = new HashMap<>();
|
||||
body.put("hathdl_xres", targetResolution.replace("x", "").replace("Original", "org"));
|
||||
downloadPage = requests(download_link, POST, extraProperties, body);
|
||||
downloadDoc = Jsoup.parse(downloadPage);
|
||||
|
||||
//判断下载请求是否提交成功
|
||||
@ -139,12 +139,12 @@ public class GalleryUtil {
|
||||
|
||||
|
||||
public static String queryUpdateLink(String link) throws IOException{
|
||||
String page = requests(link, null, GET, null);
|
||||
String page = requests(link, GET, null, null);
|
||||
Document document = Jsoup.parse(page);
|
||||
|
||||
Elements select = document.select("#gnd");
|
||||
if(select.size() > 0)
|
||||
return select.select("a").get(0).attributes().get("href");
|
||||
if(!select.isEmpty())
|
||||
return select.select("a").getFirst().attributes().get("href");
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -161,40 +161,30 @@ public class GalleryUtil {
|
||||
if(url.length() < 40)
|
||||
return null;
|
||||
|
||||
if(!url.contains("/g/") || !url.contains("hentai"))
|
||||
if(!url.contains("/g/") || !url.contains("exhentai"))
|
||||
return null;
|
||||
else if (url.contains(EX_HENTAI))
|
||||
return EX_HENTAI;
|
||||
else if (url.contains(E_HENTAI))
|
||||
return E_HENTAI;
|
||||
else{
|
||||
System.out.println(url);
|
||||
return null;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 自用request
|
||||
* @param url 链接
|
||||
* @param extraProperties 额外参数
|
||||
* @param headers 额外参数
|
||||
* @param method 请求方法
|
||||
* @param targetResolution 目标分辨率
|
||||
* @return 请求页面
|
||||
* @throws IOException 可能会抛出IO错误
|
||||
*/
|
||||
public static String requests(String url, HashMap<String, String> extraProperties, String method, String targetResolution) throws IOException {
|
||||
public static String requests(String url, String method, HashMap<String, String> headers, HashMap<String, String> body) throws IOException {
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
CloseableHttpResponse httpResponse;
|
||||
HashMap<String, String> headers = new HashMap<>();
|
||||
if(headers == null)
|
||||
headers = new HashMap<>();
|
||||
|
||||
headers.put("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36");
|
||||
headers.put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0");
|
||||
headers.put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
|
||||
headers.put("Upgrade-Insecure-Requests", "1");
|
||||
headers.put("Cookie", "ipb_member_id=5774855; ipb_pass_hash=4b061c3abe25289568b5a8e0123fb3b9; igneous=cea2e08fb; sk=oye107wk02gtomb56x65dmv4qzbn; nw=1");
|
||||
|
||||
if(extraProperties != null)
|
||||
headers.putAll(extraProperties);
|
||||
|
||||
if(method.equals(GET)){
|
||||
HttpGet httpGet = new HttpGet(url);
|
||||
for (Map.Entry<String, String> header: headers.entrySet()){
|
||||
@ -208,11 +198,12 @@ public class GalleryUtil {
|
||||
httpPost.addHeader(header.getKey(), header.getValue());
|
||||
}
|
||||
|
||||
MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
|
||||
multipartEntityBuilder.addTextBody("hathdl_xres",
|
||||
targetResolution.replace("x", "").replace("Original", "org"));
|
||||
|
||||
httpPost.setEntity(multipartEntityBuilder.build());
|
||||
if(body != null) {
|
||||
EntityBuilder entityBuilder = EntityBuilder.create();
|
||||
entityBuilder.setContentType(ContentType.APPLICATION_JSON);
|
||||
entityBuilder.setText(CustomUtil.objectMapper.writeValueAsString(body));
|
||||
httpPost.setEntity(entityBuilder.build());
|
||||
}
|
||||
httpResponse = httpClient.execute(httpPost);
|
||||
}
|
||||
HttpEntity responseEntity = httpResponse.getEntity();
|
||||
|
||||
@ -50,9 +50,10 @@ public class Response {
|
||||
setResult("failure");
|
||||
}
|
||||
|
||||
public void failure(String result){
|
||||
public Response failure(String result){
|
||||
failure();
|
||||
setData(result);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getResult(){
|
||||
@ -82,13 +83,6 @@ public class Response {
|
||||
return response.toJSONString();
|
||||
}
|
||||
|
||||
public static String _default(){
|
||||
Response response = Response.generateResponse();
|
||||
response.failure("参数错误");
|
||||
|
||||
return response.toJSONString();
|
||||
}
|
||||
|
||||
public String toJSONString(){
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
Binary file not shown.
@ -6,9 +6,12 @@ server:
|
||||
enabled: true
|
||||
|
||||
spring:
|
||||
datasource:
|
||||
datasource-main:
|
||||
driver-class-name: org.sqlite.JDBC
|
||||
url: jdbc:sqlite:/root/LionWebsite/LionWebsite.db
|
||||
jdbc-url: jdbc:sqlite:/root/LionWebsite/LionWebsite.db
|
||||
datasource-cache:
|
||||
driver-class-name: org.sqlite.JDBC
|
||||
jdbc-url: jdbc:sqlite:/root/LionWebsite/cache.db
|
||||
mvc:
|
||||
view:
|
||||
prefix: /resources/templates/
|
||||
@ -21,8 +24,6 @@ spring:
|
||||
max-request-size: 10000MB
|
||||
enabled: true
|
||||
|
||||
mybatis:
|
||||
type-aliases-package: com.lion.lionwebsite.Dao
|
||||
|
||||
personal-service:
|
||||
StoragePath: /storage/
|
||||
@ -35,7 +36,6 @@ remote-service:
|
||||
ip: 5.255.110.45
|
||||
|
||||
local-service:
|
||||
fires: https://api.dler.io/sub?target=clash&new_name=true&url=https%3A%2F%2Ffast.losadhwselfff2332dasd.xyz%2Flink%2Fz0pfwyTvC5naXkbb%3Fclash%3D1&insert=false&config=https%3A%2F%2Fraw.githubusercontent.com%2FACL4SSR%2FACL4SSR%2Fmaster%2FClash%2Fconfig%2FACL4SSR_Online.ini
|
||||
DouNaiClash: https://aaaa.gay/link/X7zEqkIx5gtIGugO?client=clashmeta
|
||||
DouNaiV2ray: https://aaaa.gay/link/X7zEqkIx5gtIGugO?client=v2
|
||||
|
||||
|
||||
BIN
src/main/resources/cache.db
Normal file
BIN
src/main/resources/cache.db
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user