增加cookie检测,失效时发送消息
This commit is contained in:
parent
2df627eab4
commit
c1ff2938bf
@ -6,6 +6,7 @@ import com.lion.lionwebsite.Dao.normal.ShareFileMapper;
|
|||||||
import com.lion.lionwebsite.Domain.CustomConfiguration;
|
import com.lion.lionwebsite.Domain.CustomConfiguration;
|
||||||
import com.lion.lionwebsite.Domain.ShareFile;
|
import com.lion.lionwebsite.Domain.ShareFile;
|
||||||
import com.lion.lionwebsite.Util.CustomUtil;
|
import com.lion.lionwebsite.Util.CustomUtil;
|
||||||
|
import com.lion.lionwebsite.Util.GalleryUtil;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.apache.http.HttpEntity;
|
import org.apache.http.HttpEntity;
|
||||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
@ -41,10 +42,13 @@ public class LocalServiceImpl{
|
|||||||
|
|
||||||
GalleryMapper galleryMapper;
|
GalleryMapper galleryMapper;
|
||||||
|
|
||||||
public LocalServiceImpl(CustomConfigurationMapper configurationMapper, ShareFileMapper shareFileMapper, GalleryMapper galleryMapper){
|
PushService pushService;
|
||||||
|
|
||||||
|
public LocalServiceImpl(CustomConfigurationMapper configurationMapper, ShareFileMapper shareFileMapper, GalleryMapper galleryMapper, PushService pushService) {
|
||||||
this.shareFileMapper = shareFileMapper;
|
this.shareFileMapper = shareFileMapper;
|
||||||
this.configurationMapper = configurationMapper;
|
this.configurationMapper = configurationMapper;
|
||||||
this.galleryMapper = galleryMapper;
|
this.galleryMapper = galleryMapper;
|
||||||
|
this.pushService = pushService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,6 +60,20 @@ public class LocalServiceImpl{
|
|||||||
configurationMapper.updateConfiguration(CustomConfiguration.LAST_RESET_AMOUNT_TIME, CustomUtil.now());
|
configurationMapper.updateConfiguration(CustomConfiguration.LAST_RESET_AMOUNT_TIME, CustomUtil.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每天凌晨测试e-hentai cookie是否过期
|
||||||
|
*/
|
||||||
|
@Scheduled(cron = "0 0 0 * * *")
|
||||||
|
public void verifyCookie(){
|
||||||
|
try {
|
||||||
|
String content = GalleryUtil.requests("https://exhentai.org", "GET", null, null);
|
||||||
|
if(content.trim().isEmpty())
|
||||||
|
pushService.sendToMe("cookie过期");
|
||||||
|
} catch (IOException e) {
|
||||||
|
pushService.sendToMe("检测cookie异常:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时更新订阅
|
* 定时更新订阅
|
||||||
* @throws IOException 下载以及保存异常
|
* @throws IOException 下载以及保存异常
|
||||||
|
|||||||
@ -271,7 +271,7 @@ public class GalleryUtil {
|
|||||||
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("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("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
|
||||||
if(url.contains("hentai")) {
|
if(url.contains("hentai")) {
|
||||||
headers.put("Cookie", "ipb_session_id=1b6cb1beb8948f5421e6f747e43feb82; ipb_member_id=5774855; ipb_pass_hash=4b061c3abe25289568b5a8e0123fb3b9; sk=oye107wk02gtomb56x65dmv4qzbn; nw=1");
|
headers.put("Cookie", "ipb_session_id=af2b2b1a795b39550711134d7bdcbf7f; ipb_member_id=5774855; ipb_pass_hash=4b061c3abe25289568b5a8e0123fb3b9; sk=oye107wk02gtomb56x65dmv4qzbn; nw=1");
|
||||||
headers.put("Upgrade-Insecure-Requests", "1");
|
headers.put("Upgrade-Insecure-Requests", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user