mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-08-29 16:02:10 +00:00
rename regex
field to request
, increase db field size to 1024 bytes
This commit is contained in:
parent
4c305f967f
commit
1302a89c44
@ -48,7 +48,7 @@ impl Proxy {
|
|||||||
for r in rules {
|
for r in rules {
|
||||||
b.push(Rule {
|
b.push(Rule {
|
||||||
is_enabled: r.is_enabled,
|
is_enabled: r.is_enabled,
|
||||||
regex: r.regex,
|
request: r.request,
|
||||||
url: r.url,
|
url: r.url,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ impl Proxy {
|
|||||||
pub fn matches(&self, request: &Uri) -> Option<ProxyResolver> {
|
pub fn matches(&self, request: &Uri) -> Option<ProxyResolver> {
|
||||||
for rule in self.rule.borrow().iter().filter(|r| r.is_enabled) {
|
for rule in self.rule.borrow().iter().filter(|r| r.is_enabled) {
|
||||||
if gtk::glib::Regex::match_simple(
|
if gtk::glib::Regex::match_simple(
|
||||||
&rule.regex,
|
&rule.request,
|
||||||
request.to_str(),
|
request.to_str(),
|
||||||
gtk::glib::RegexCompileFlags::DEFAULT,
|
gtk::glib::RegexCompileFlags::DEFAULT,
|
||||||
gtk::glib::RegexMatchFlags::DEFAULT,
|
gtk::glib::RegexMatchFlags::DEFAULT,
|
||||||
|
@ -64,11 +64,11 @@ pub fn init(tx: &Transaction) -> Result<usize> {
|
|||||||
`time` INTEGER NOT NULL,
|
`time` INTEGER NOT NULL,
|
||||||
`is_enabled` INTEGER NOT NULL,
|
`is_enabled` INTEGER NOT NULL,
|
||||||
`priority` INTEGER NOT NULL,
|
`priority` INTEGER NOT NULL,
|
||||||
`regex` VARCHAR(255) NOT NULL,
|
`request` VARCHAR(1024) NOT NULL,
|
||||||
`url` VARCHAR(255) NOT NULL,
|
`url` VARCHAR(255) NOT NULL,
|
||||||
|
|
||||||
FOREIGN KEY (`profile_id`) REFERENCES `profile` (`id`),
|
FOREIGN KEY (`profile_id`) REFERENCES `profile` (`id`),
|
||||||
UNIQUE (`regex`)
|
UNIQUE (`request`)
|
||||||
)",
|
)",
|
||||||
[],
|
[],
|
||||||
)?;
|
)?;
|
||||||
@ -115,7 +115,7 @@ pub fn rules(tx: &Transaction, profile_id: i64) -> Result<Vec<Rule>> {
|
|||||||
`time`,
|
`time`,
|
||||||
`is_enabled`,
|
`is_enabled`,
|
||||||
`priority`,
|
`priority`,
|
||||||
`regex`,
|
`request`,
|
||||||
`url`
|
`url`
|
||||||
|
|
||||||
FROM `profile_proxy_rule`
|
FROM `profile_proxy_rule`
|
||||||
@ -130,7 +130,7 @@ pub fn rules(tx: &Transaction, profile_id: i64) -> Result<Vec<Rule>> {
|
|||||||
//time: DateTime::from_unix_local(row.get(2)?).unwrap(),
|
//time: DateTime::from_unix_local(row.get(2)?).unwrap(),
|
||||||
is_enabled: row.get(3)?,
|
is_enabled: row.get(3)?,
|
||||||
//priority: row.get(4)?,
|
//priority: row.get(4)?,
|
||||||
regex: row.get(5)?,
|
request: row.get(5)?,
|
||||||
url: row.get(6)?,
|
url: row.get(6)?,
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
pub struct Rule {
|
pub struct Rule {
|
||||||
pub is_enabled: bool,
|
pub is_enabled: bool,
|
||||||
pub regex: String,
|
pub request: String,
|
||||||
pub url: String,
|
pub url: String,
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
pub struct Rule {
|
pub struct Rule {
|
||||||
pub is_enabled: bool,
|
pub is_enabled: bool,
|
||||||
pub regex: String,
|
pub request: String,
|
||||||
pub url: String,
|
pub url: String,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user