fix: eh regexp
This commit is contained in:
parent
bf5acd966d
commit
b7e1b4e989
|
@ -5,6 +5,9 @@ on:
|
|||
tags:
|
||||
- 'v*'
|
||||
|
||||
env:
|
||||
CARGO_NET_GIT_FETCH_WITH_CLI: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: 'Build'
|
||||
|
@ -30,14 +33,13 @@ jobs:
|
|||
registry: ghcr.io
|
||||
username: qini7-sese
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Generate App Version
|
||||
run: echo VERSIONED_TAG=`git describe --tags --always` >> $GITHUB_ENV
|
||||
- name: Build docker image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: |
|
||||
ghcr.io/qini7-sese/ehbot:amd64
|
||||
${{ steps.prep.outputs.tags }}
|
||||
- name: Docker manifest push
|
||||
run: |
|
||||
docker manifest create ghcr.io/qini7-sese/ehbot:latest ghcr.io/qini7-sese/ehbot:amd64
|
||||
docker manifest push ghcr.io/qini7-sese/ehbot:latest
|
||||
ghcr.io/qini7-sese/ehbot:latest
|
||||
ghcr.io/qini7-sese/ehbot:${{ env.VERSIONED_TAG }}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
edition = "2021"
|
||||
name = "bot"
|
||||
version = "0.1.10"
|
||||
version = "0.1.11"
|
||||
|
||||
[dependencies]
|
||||
eh2telegraph = {path = "../eh2telegraph"}
|
||||
|
@ -16,7 +16,7 @@ reqwest = {version = "0.11", default-features = false, features = ["json", "mult
|
|||
serde = {version = "1", features = ["derive"]}
|
||||
singleflight-async = {version = "0.1", features = ["hardware-lock-elision"]}
|
||||
teloxide = {version = "0.11", features = ["macros", "ctrlc_handler", "auto-send"]}
|
||||
time = {version = "0.3", features = ["local-offset", "std", "macros"]}
|
||||
time = {version = "=0.3.17", features = ["local-offset", "std", "macros"]}
|
||||
tokio = {version = "1", default-features = false, features = ["rt-multi-thread", "macros", "net", "sync", "time", "parking_lot"]}
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = {version = "0.3", features = ["local-time", "parking_lot", "time"]}
|
||||
|
|
|
@ -124,7 +124,7 @@ where
|
|||
.send_message(msg.chat.id, escape("Usage: /sync url"))
|
||||
.reply_to_message_id(msg.id)
|
||||
.await;
|
||||
return ControlFlow::BREAK;
|
||||
return ControlFlow::Break(());
|
||||
}
|
||||
|
||||
info!(
|
||||
|
@ -144,7 +144,7 @@ where
|
|||
}
|
||||
};
|
||||
|
||||
ControlFlow::BREAK
|
||||
ControlFlow::Break(())
|
||||
}
|
||||
|
||||
pub async fn respond_admin_cmd(
|
||||
|
@ -162,7 +162,7 @@ where
|
|||
.reply_to_message_id(msg.id)
|
||||
.await;
|
||||
});
|
||||
ControlFlow::BREAK
|
||||
ControlFlow::Break(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -210,11 +210,11 @@ where
|
|||
.edit_message_text(msg.chat.id, msg.id, self.sync_response(&url).await)
|
||||
.await;
|
||||
});
|
||||
return ControlFlow::BREAK;
|
||||
return ControlFlow::Break(());
|
||||
}
|
||||
|
||||
// fallback to the next branch
|
||||
ControlFlow::CONTINUE
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
|
||||
pub async fn respond_caption(
|
||||
|
@ -232,7 +232,6 @@ where
|
|||
.expect("Url MessageEntry found but caption is None");
|
||||
let encoded: Vec<_> = raw
|
||||
.encode_utf16()
|
||||
.into_iter()
|
||||
.skip(entry.offset)
|
||||
.take(entry.length)
|
||||
.collect();
|
||||
|
@ -270,9 +269,9 @@ where
|
|||
.edit_message_text(msg.chat.id, msg.id, self.sync_response(&url).await)
|
||||
.await;
|
||||
});
|
||||
ControlFlow::BREAK
|
||||
ControlFlow::Break(())
|
||||
}
|
||||
None => ControlFlow::CONTINUE,
|
||||
None => ControlFlow::Continue(()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,7 +283,7 @@ where
|
|||
let first_photo = match msg.photo().and_then(|x| x.first()) {
|
||||
Some(p) => p,
|
||||
None => {
|
||||
return ControlFlow::CONTINUE;
|
||||
return ControlFlow::Continue(());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -324,7 +323,7 @@ where
|
|||
Some(u) => u,
|
||||
None => {
|
||||
trace!("[photo handler] image not found");
|
||||
return ControlFlow::CONTINUE;
|
||||
return ControlFlow::Continue(());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -345,7 +344,7 @@ where
|
|||
});
|
||||
}
|
||||
|
||||
ControlFlow::BREAK
|
||||
ControlFlow::Break(())
|
||||
}
|
||||
|
||||
pub async fn respond_default(
|
||||
|
@ -362,7 +361,7 @@ where
|
|||
}
|
||||
#[cfg(debug_assertions)]
|
||||
tracing::warn!("{:?}", msg);
|
||||
ControlFlow::BREAK
|
||||
ControlFlow::Break(())
|
||||
}
|
||||
|
||||
async fn sync_response(&self, url: &str) -> String {
|
||||
|
|
|
@ -60,7 +60,7 @@ macro_rules! ok_or_break {
|
|||
match $e {
|
||||
Ok(r) => r,
|
||||
Err(_) => {
|
||||
return ControlFlow::BREAK;
|
||||
return ControlFlow::Break(());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@ reqwest = {version = "0.11", default-features = false, features = ["json", "mult
|
|||
rustls = {version = "0.20", features = ["dangerous_configuration"]}
|
||||
serde = {version = "1", features = ["derive"]}
|
||||
serde_with = {version = "1", features = ["macros", "json"]}
|
||||
serde_yaml = "0.8"
|
||||
serde_yaml = "0.9"
|
||||
thiserror = "1"
|
||||
tokio = {version = "1", default-features = false, features = ["rt-multi-thread", "macros", "net", "sync", "time", "parking_lot"]}
|
||||
tracing = "0.1"
|
||||
|
|
|
@ -21,8 +21,7 @@ use super::{AlbumMeta, Collector, ImageData, ImageMeta};
|
|||
|
||||
lazy_static::lazy_static! {
|
||||
static ref TITLE_RE: Regex = Regex::new(r#"<span class="pretty">(.*?)</span>"#).unwrap();
|
||||
// static ref PAGE_RE: Regex = Regex::new(r#"<noscript><img src="(https://t\d?\.nhentai\.net/galleries/\d+/\d+t\.\w+)"#).unwrap();
|
||||
static ref PAGE_RE: Regex = Regex::new(r#"<noscript><img src="(https://cdn.nhentai.xxx/g/\d+/\d+t\.\w+)"#).unwrap();
|
||||
static ref PAGE_RE: Regex = Regex::new(r#"<noscript><img src="(https://cdn\.(?:nhentai\.xxx|hentaibomb\.com)/g/\d+/\d+t\.\w+)"#).unwrap();
|
||||
|
||||
static ref RETRY_POLICY: RetryPolicy = RetryPolicy::fixed(Duration::from_millis(200))
|
||||
.with_max_retries(5)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#![feature(type_alias_impl_trait)]
|
||||
#![feature(impl_trait_in_assoc_type)]
|
||||
|
||||
pub mod buffer;
|
||||
pub mod collector;
|
||||
|
|
Loading…
Reference in New Issue