mirror of
https://github.com/dev-claw/vripper-project.git
synced 2026-08-19 08:35:41 +02:00
Merge branch 'main' into feature/issue-303/create-host-specific-settings
This commit is contained in:
@@ -171,9 +171,9 @@ internal abstract class Host(
|
||||
fun <T> fetch(
|
||||
url: String,
|
||||
context: Context,
|
||||
referer: String = "https://vipergirls.to/",
|
||||
transformer: (ClassicHttpResponse) -> T
|
||||
): T {
|
||||
val referer = context.headers["Referer"] ?: "https://vipergirls.to/"
|
||||
val httpGet =
|
||||
HttpGet(url).also {
|
||||
it.addHeader("Referer", referer)
|
||||
|
||||
@@ -23,11 +23,18 @@ internal class ImageBamHost : Host("imagebam.com", 2) {
|
||||
val doc = try {
|
||||
log.debug(String.format("Looking for xpath expression %s in %s", CONTINUE_XPATH, context.imageEntity.url))
|
||||
if (XpathUtils.getAsNode(document, CONTINUE_XPATH) != null) {
|
||||
val sfwCookie = BasicClientCookie("sfw_inter", "1")
|
||||
sfwCookie.domain = "www.imagebam.com"
|
||||
sfwCookie.path = "/"
|
||||
sfwCookie.setExpiryDate(LocalDateTime.now().plusDays(3).atZone(ZoneId.systemDefault()).toInstant())
|
||||
val nsfwCookie = BasicClientCookie("nsfw_inter", "1").apply {
|
||||
domain = "www.imagebam.com"
|
||||
path = "/"
|
||||
setExpiryDate(LocalDateTime.now().plusDays(3).atZone(ZoneId.systemDefault()).toInstant())
|
||||
}
|
||||
val sfwCookie = BasicClientCookie("sfw_inter", "1").apply {
|
||||
domain = "www.imagebam.com"
|
||||
path = "/"
|
||||
setExpiryDate(LocalDateTime.now().plusDays(3).atZone(ZoneId.systemDefault()).toInstant())
|
||||
}
|
||||
|
||||
context.httpContext.cookieStore.addCookie(nsfwCookie)
|
||||
context.httpContext.cookieStore.addCookie(sfwCookie)
|
||||
fetch(context.imageEntity.url, context) {
|
||||
HtmlUtils.clean(it.entity.content)
|
||||
|
||||
@@ -35,6 +35,7 @@ internal class ViprImHost : Host("vipr.im", 15) {
|
||||
.map { obj: Node -> obj.textContent }
|
||||
.map { obj: String -> obj.trim() }.orElse(null)
|
||||
val imgUrl = imgNode.attributes.getNamedItem("src").textContent.trim()
|
||||
context.headers["Referer"] = "https://vipr.im/"
|
||||
Pair(imgTitle!!, imgUrl)
|
||||
} catch (e: Exception) {
|
||||
throw HostException("Unexpected error occurred", e)
|
||||
|
||||
@@ -49,6 +49,7 @@ internal class ImageDownloadRunnable(
|
||||
cookieStore = HTTPService.cookieStore
|
||||
}
|
||||
val requests = mutableListOf<HttpUriRequestBase>()
|
||||
val headers = mutableMapOf<String, String>()
|
||||
|
||||
init {
|
||||
ApplicationProperties.VRIPPER_DIR.listDirectoryEntries()
|
||||
|
||||
@@ -213,13 +213,15 @@ class GrpcServerAppEndpointService : EndpointServiceGrpcKt.EndpointServiceCorout
|
||||
enableClipboardMonitoring = request.systemSettings.enableClipboardMonitoring,
|
||||
clipboardPollingRate = request.systemSettings.clipboardPollingRate,
|
||||
maxEventLog = request.systemSettings.maxEventLog,
|
||||
), hostSettings = request.hostSettingsMap.entries.associate { hostSettings ->
|
||||
),
|
||||
hostSettings = request.hostSettingsMap.entries.associate { hostSettings ->
|
||||
HostName.valueOf(hostSettings.key) to hostSettings.value.settingsMap.entries.associate {
|
||||
HostSettingKey.valueOf(
|
||||
it.key
|
||||
) to it.value
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
)
|
||||
return EndpointServiceOuterClass.EmptyResponse.getDefaultInstance()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user