Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
891c287a3a
|
||
|
|
d959162b43
|
||
|
|
4adbfdf712
|
||
|
|
3d1720e020
|
||
|
|
e0490adb1a
|
@@ -17,6 +17,7 @@ jobs:
|
|||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: 1.95
|
toolchain: 1.95
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
- run: |
|
- run: |
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key
|
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key
|
||||||
@@ -36,6 +37,7 @@ jobs:
|
|||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: 1.95
|
toolchain: 1.95
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
- run: |
|
- run: |
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key
|
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key
|
||||||
@@ -55,6 +57,7 @@ jobs:
|
|||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: 1.95
|
toolchain: 1.95
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
- run: rustup component add rustfmt
|
- run: rustup component add rustfmt
|
||||||
- run: |
|
- run: |
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
@@ -75,6 +78,7 @@ jobs:
|
|||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: 1.95
|
toolchain: 1.95
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
- run: rustup component add clippy
|
- run: rustup component add clippy
|
||||||
- run: |
|
- run: |
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
@@ -95,6 +99,7 @@ jobs:
|
|||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: 1.95
|
toolchain: 1.95
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
- run: |
|
- run: |
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key
|
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key
|
||||||
@@ -105,4 +110,3 @@ jobs:
|
|||||||
ssh-add -v ~/.ssh/textsender-models_deploy_key
|
ssh-add -v ~/.ssh/textsender-models_deploy_key
|
||||||
|
|
||||||
cargo build
|
cargo build
|
||||||
|
|
||||||
|
|||||||
Generated
+2
-3
@@ -1658,13 +1658,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "textsender_models"
|
name = "textsender_models"
|
||||||
version = "0.2.5"
|
version = "0.3.0"
|
||||||
source = "git+ssh://git@git.kundeng.us/phoenix/textsender-models.git?tag=v0.2.5-v0.3.0-migrate-38dbcb09f7-111#38dbcb09f7c2c572f429ec382c01e14b72b1d615"
|
source = "git+ssh://git@git.kundeng.us/phoenix/textsender-models.git?tag=v0.3.0#d504108745b7b97a02eac24e16763cdb5e731f2b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"const_format",
|
"const_format",
|
||||||
"dotenvy",
|
"dotenvy",
|
||||||
"josekit",
|
"josekit",
|
||||||
"rand 0.10.1",
|
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"time",
|
"time",
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ uuid = { version = "1.23.1", features = ["v4", "serde"] }
|
|||||||
base64-ng = { version = "1.0.6" }
|
base64-ng = { version = "1.0.6" }
|
||||||
const_format = { version = "0.2.36" }
|
const_format = { version = "0.2.36" }
|
||||||
josekit = { version = "0.10.3" }
|
josekit = { version = "0.10.3" }
|
||||||
textsender_models = { git = "ssh://git@git.kundeng.us/phoenix/textsender-models.git", tag = "v0.2.5-v0.3.0-migrate-38dbcb09f7-111" }
|
textsender_models = { git = "ssh://git@git.kundeng.us/phoenix/textsender-models.git", tag = "v0.3.0" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempfile = { version = "3.27.0" }
|
tempfile = { version = "3.27.0" }
|
||||||
|
|||||||
+4
-15
@@ -32,17 +32,11 @@ pub async fn send_mssage(
|
|||||||
|
|
||||||
let mut params = std::collections::HashMap::new();
|
let mut params = std::collections::HashMap::new();
|
||||||
params.insert("To", contact.phone_number.as_str());
|
params.insert("To", contact.phone_number.as_str());
|
||||||
// params.insert("StatusCallback", "http://OjQozHznkhNTTR.vpnrM1zdXFuiQ");
|
|
||||||
// params.insert("MaxPrice", "1");
|
|
||||||
params.insert("ProvideFeedback", "true");
|
params.insert("ProvideFeedback", "true");
|
||||||
// params.insert("Attempt", "5");
|
|
||||||
// params.insert("ValidityPeriod", "1537");
|
|
||||||
params.insert("ForceDelivery", "false");
|
params.insert("ForceDelivery", "false");
|
||||||
params.insert("ContentRetention", "retain");
|
params.insert("ContentRetention", "retain");
|
||||||
params.insert("AddressRetention", "obfuscate");
|
params.insert("AddressRetention", "obfuscate");
|
||||||
params.insert("SmartEncoded", "true");
|
params.insert("SmartEncoded", "true");
|
||||||
// params.insert("PersistentAction", "string");
|
|
||||||
// params.insert("PersistentAction", "string");
|
|
||||||
params.insert("ShortenUrls", "true");
|
params.insert("ShortenUrls", "true");
|
||||||
let date = match param.schedule_at {
|
let date = match param.schedule_at {
|
||||||
Some(date_value) => date_value.to_string(),
|
Some(date_value) => date_value.to_string(),
|
||||||
@@ -66,7 +60,7 @@ pub async fn send_mssage(
|
|||||||
let request = client.post(url).headers(headers).form(¶ms);
|
let request = client.post(url).headers(headers).form(¶ms);
|
||||||
match request.send().await {
|
match request.send().await {
|
||||||
Ok(response) => match response.status() {
|
Ok(response) => match response.status() {
|
||||||
reqwest::StatusCode::OK => Ok(response),
|
reqwest::StatusCode::CREATED => Ok(response),
|
||||||
status => Err(std::io::Error::other(format!(
|
status => Err(std::io::Error::other(format!(
|
||||||
"Unaccounted status: {status:?}"
|
"Unaccounted status: {status:?}"
|
||||||
))),
|
))),
|
||||||
@@ -104,15 +98,10 @@ fn generate_auth(
|
|||||||
params.insert("ShortenUrls", "true");
|
params.insert("ShortenUrls", "true");
|
||||||
params.insert("SendAsMms", "true");
|
params.insert("SendAsMms", "true");
|
||||||
params.insert("RiskCheck", "enable");
|
params.insert("RiskCheck", "enable");
|
||||||
|
|
||||||
let response = request.send().await?;
|
|
||||||
let body = response.text().await?;
|
|
||||||
println!("{}", body);
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const DEFAULT_SCHEDULING_SECONDS: i64 = 300;
|
||||||
|
|
||||||
fn is_scheduleable(
|
fn is_scheduleable(
|
||||||
now: &Option<time::OffsetDateTime>,
|
now: &Option<time::OffsetDateTime>,
|
||||||
scheduled: &Option<time::OffsetDateTime>,
|
scheduled: &Option<time::OffsetDateTime>,
|
||||||
@@ -121,7 +110,7 @@ fn is_scheduleable(
|
|||||||
Some(schedule_at) => {
|
Some(schedule_at) => {
|
||||||
let early = now
|
let early = now
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.checked_add(time::Duration::seconds(300))
|
.checked_add(time::Duration::seconds(DEFAULT_SCHEDULING_SECONDS))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
*schedule_at > early
|
*schedule_at > early
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user