Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sms-gateway
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Huss
sms-gateway
Commits
923b576d
Commit
923b576d
authored
2 years ago
by
David Huss
Browse files
Options
Downloads
Patches
Plain Diff
Check if white/blacklist is empty
parent
415ddbd4
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Cargo.lock
+1
-1
1 addition, 1 deletion
Cargo.lock
Cargo.toml
+1
-1
1 addition, 1 deletion
Cargo.toml
src/sms.rs
+24
-20
24 additions, 20 deletions
src/sms.rs
with
26 additions
and
22 deletions
Cargo.lock
+
1
−
1
View file @
923b576d
...
@@ -1376,7 +1376,7 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
...
@@ -1376,7 +1376,7 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
[[package]]
[[package]]
name = "sms-gateway"
name = "sms-gateway"
version = "0.
2
.0"
version = "0.
3
.0"
dependencies = [
dependencies = [
"actix-rt",
"actix-rt",
"actix-web",
"actix-web",
...
...
This diff is collapsed.
Click to expand it.
Cargo.toml
+
1
−
1
View file @
923b576d
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
name
=
"sms-gateway"
name
=
"sms-gateway"
description
=
"A http frontend for SMS Server Tools 3"
description
=
"A http frontend for SMS Server Tools 3"
authors
=
[
"David Huss <david.huss@hfbk-hamburg.de>"
]
authors
=
[
"David Huss <david.huss@hfbk-hamburg.de>"
]
version
=
"0.
2
.0"
version
=
"0.
3
.0"
edition
=
"2021"
edition
=
"2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
...
...
This diff is collapsed.
Click to expand it.
src/sms.rs
+
24
−
20
View file @
923b576d
...
@@ -93,18 +93,21 @@ impl Sms {
...
@@ -93,18 +93,21 @@ impl Sms {
let
mut
path
=
CONFIG
.sms.paths
.as_ref
()
.unwrap
()
.outgoing
.clone
();
let
mut
path
=
CONFIG
.sms.paths
.as_ref
()
.unwrap
()
.outgoing
.clone
();
path
.push
(
filename
);
path
.push
(
filename
);
if
CONFIG
.filters.whitelist
.len
()
>
0
{
// Check if the number matches any of the numbers in the whitelist
// Check if the number matches any of the numbers in the whitelist
let
in_whitelist
=
CONFIG
.filters.whitelist
.iter
()
let
in_whitelist
=
CONFIG
.filters.whitelist
.iter
()
.any
(|
re
|{
.any
(|
re
|{
re
.is_match
(
&
self
.number
)
re
.is_match
(
&
self
.number
)
});
});
// Return an Error if not
// Return an Error if not
on the whitelist
if
!
in_whitelist
{
if
!
in_whitelist
{
warn!
(
"Refused to send SMS to
\"
{}
\"
as it was not on the whitelist"
,
self
.number
);
warn!
(
"Refused to send SMS to
\"
{}
\"
as it was not on the whitelist"
,
self
.number
);
return
Err
(
SmsError
::
NotInWhiteList
(
self
.number
.clone
()));
return
Err
(
SmsError
::
NotInWhiteList
(
self
.number
.clone
()));
}
}
}
if
CONFIG
.filters.blacklist
.len
()
>
0
{
// Check if the number matches any of the numbers on the blacklist
// Check if the number matches any of the numbers on the blacklist
let
in_blacklist
=
CONFIG
.filters.whitelist
.iter
()
let
in_blacklist
=
CONFIG
.filters.whitelist
.iter
()
.any
(|
re
|{
.any
(|
re
|{
...
@@ -116,6 +119,7 @@ impl Sms {
...
@@ -116,6 +119,7 @@ impl Sms {
warn!
(
"Refused to send SMS to
\"
{}
\"
as it was blacklisted"
,
self
.number
);
warn!
(
"Refused to send SMS to
\"
{}
\"
as it was blacklisted"
,
self
.number
);
return
Err
(
SmsError
::
InBlackList
(
self
.number
.clone
()));
return
Err
(
SmsError
::
InBlackList
(
self
.number
.clone
()));
}
}
}
// Create an file handle for the outgoing SMS, return an Error if this fails
// Create an file handle for the outgoing SMS, return an Error if this fails
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment