-
-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #409 from GyulyVGC/copy-ip
Copy IP addresses to clipboard and add IP address in search parameters inside Inspect page
- Loading branch information
Showing
13 changed files
with
147 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub mod message; | ||
pub mod runtime_data; | ||
pub mod sniffer; | ||
pub mod timing_events; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use std::time::Duration; | ||
|
||
pub struct TimingEvents { | ||
/// Timestamp of last window focus | ||
pub focus: std::time::Instant, | ||
/// Timestamp of the last press on Copy IP button, with the related IP address | ||
pub copy_ip: (std::time::Instant, String), | ||
} | ||
|
||
impl TimingEvents { | ||
const TIMEOUT_FOCUS: u64 = 200; | ||
const TIMEOUT_COPY_IP: u64 = 1500; | ||
|
||
pub fn focus_now(&mut self) { | ||
self.focus = std::time::Instant::now(); | ||
} | ||
|
||
pub fn was_just_focus(&self) -> bool { | ||
self.focus.elapsed() < Duration::from_millis(TimingEvents::TIMEOUT_FOCUS) | ||
} | ||
|
||
pub fn copy_ip_now(&mut self, ip: String) { | ||
self.copy_ip = (std::time::Instant::now(), ip); | ||
} | ||
|
||
pub fn was_just_copy_ip(&self, ip: &String) -> bool { | ||
self.copy_ip.0.elapsed() < Duration::from_millis(TimingEvents::TIMEOUT_COPY_IP) | ||
&& self.copy_ip.1.eq(ip) | ||
} | ||
} | ||
|
||
impl Default for TimingEvents { | ||
fn default() -> Self { | ||
Self { | ||
focus: std::time::Instant::now(), | ||
copy_ip: (std::time::Instant::now(), String::new()), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters