Skip to content

Commit 1302a89

Browse files
author
yggverse
committed
rename regex field to request, increase db field size to 1024 bytes
1 parent 4c305f9 commit 1302a89

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/profile/proxy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl Proxy {
4848
for r in rules {
4949
b.push(Rule {
5050
is_enabled: r.is_enabled,
51-
regex: r.regex,
51+
request: r.request,
5252
url: r.url,
5353
});
5454
}
@@ -62,7 +62,7 @@ impl Proxy {
6262
pub fn matches(&self, request: &Uri) -> Option<ProxyResolver> {
6363
for rule in self.rule.borrow().iter().filter(|r| r.is_enabled) {
6464
if gtk::glib::Regex::match_simple(
65-
&rule.regex,
65+
&rule.request,
6666
request.to_str(),
6767
gtk::glib::RegexCompileFlags::DEFAULT,
6868
gtk::glib::RegexMatchFlags::DEFAULT,

src/profile/proxy/database.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ pub fn init(tx: &Transaction) -> Result<usize> {
6464
`time` INTEGER NOT NULL,
6565
`is_enabled` INTEGER NOT NULL,
6666
`priority` INTEGER NOT NULL,
67-
`regex` VARCHAR(255) NOT NULL,
67+
`request` VARCHAR(1024) NOT NULL,
6868
`url` VARCHAR(255) NOT NULL,
6969
7070
FOREIGN KEY (`profile_id`) REFERENCES `profile` (`id`),
71-
UNIQUE (`regex`)
71+
UNIQUE (`request`)
7272
)",
7373
[],
7474
)?;
@@ -115,7 +115,7 @@ pub fn rules(tx: &Transaction, profile_id: i64) -> Result<Vec<Rule>> {
115115
`time`,
116116
`is_enabled`,
117117
`priority`,
118-
`regex`,
118+
`request`,
119119
`url`
120120
121121
FROM `profile_proxy_rule`
@@ -130,7 +130,7 @@ pub fn rules(tx: &Transaction, profile_id: i64) -> Result<Vec<Rule>> {
130130
//time: DateTime::from_unix_local(row.get(2)?).unwrap(),
131131
is_enabled: row.get(3)?,
132132
//priority: row.get(4)?,
133-
regex: row.get(5)?,
133+
request: row.get(5)?,
134134
url: row.get(6)?,
135135
})
136136
})?;

src/profile/proxy/database/rule.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pub struct Rule {
22
pub is_enabled: bool,
3-
pub regex: String,
3+
pub request: String,
44
pub url: String,
55
}

src/profile/proxy/rule.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pub struct Rule {
22
pub is_enabled: bool,
3-
pub regex: String,
3+
pub request: String,
44
pub url: String,
55
}

0 commit comments

Comments
 (0)