Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,19 @@
background-color: #f5f5f5;
}

.certificate {
position: relative;
display: inline-block;
border: none;
cursor: pointer;
padding-right: 0.5rem;
}

.certificate a {
color: #333;
text-decoration: none;
}

.traffic-table {
width: 100%;
table-layout: fixed;
Expand Down Expand Up @@ -321,6 +334,9 @@
<a data-kind="res-body">Copy Response Body</a>
</div>
</div>
<div class="certificate">
<a href="/__proxyfor__/certificate/" target="_blank" title="Install CA certificate for HTTPS Proxy">Certificate</a>
</div>
</div>
</div>
<div class="main-view"></div>
Expand Down
16 changes: 8 additions & 8 deletions assets/install-certificate.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h1 id="install-proxyfors-certificate-authority">Install proxyfor’s
<h2 id="windows">Windows</h2>
</summary>
<p><a
href="http://proxyfor.local/proxyfor-ca-cert.cer">proxyfor-ca-cert.cer</a></p>
href="./proxyfor-ca-cert.cer">proxyfor-ca-cert.cer</a></p>
<h3 id="manual-installation">Manual Installation</h3>
<ol type="1">
<li>Double-click the CER file to start the import wizard.</li>
Expand All @@ -38,8 +38,8 @@ <h3 id="manual-installation">Manual Installation</h3>
machine. Click Next.</li>
<li>Click Next again.</li>
<li>Leave Password blank and click Next.</li>
<li><strong>Select Place all certificates in the following
store</strong>, then click Browse, and select Trusted Root Certification
<li>Select Place all certificates in the following
store, then click Browse, and select Trusted Root Certification
Authorities.<br />
Click OK and Next.</li>
<li>Click Finish.</li>
Expand All @@ -57,7 +57,7 @@ <h3 id="automated-installation">Automated Installation</h3>
<h2 id="linux">Linux</h2>
</summary>
<p><a
href="http://proxyfor.local/proxyfor-ca-cert.pem">proxyfor-ca-cert.pem</a></p>
href="./proxyfor-ca-cert.pem">proxyfor-ca-cert.pem</a></p>
<h3 id="ubuntudebian">Ubuntu/Debian</h3>
<ol type="1">
<li><code>mv proxyfor-ca-cert.pem /usr/local/share/ca-certificates/proxyfor.crt</code></li>
Expand All @@ -74,7 +74,7 @@ <h3 id="fedora">Fedora</h3>
<h2 id="macos">macOS</h2>
</summary>
<p><a
href="http://proxyfor.local/proxyfor-ca-cert.pem">proxyfor-ca-cert.pem</a></p>
href="./proxyfor-ca-cert.pem">proxyfor-ca-cert.pem</a></p>
<h3 id="manual-installation-1">Manual Installation</h3>
<ol type="1">
<li>Double-click the PEM file to open the Keychain Access
Expand All @@ -94,7 +94,7 @@ <h3 id="automated-installation-1">Automated Installation</h3>
<h2 id="ios">iOS</h2>
</summary>
<p><a
href="http://proxyfor.local/proxyfor-ca-cert.pem">proxyfor-ca-cert.pem</a></p>
href="./proxyfor-ca-cert.pem">proxyfor-ca-cert.pem</a></p>
<h3 id="ios-13">iOS 13+</h3>
<ol type="1">
<li>Use Safari to download the certificate. Other browsers may not open
Expand All @@ -110,7 +110,7 @@ <h3 id="ios-13">iOS 13+</h3>
<h2 id="android">Android</h2>
</summary>
<p><a
href="http://proxyfor.local/proxyfor-ca-cert.cer">proxyfor-ca-cert.cer</a></p>
href="./proxyfor-ca-cert.cer">proxyfor-ca-cert.cer</a></p>
<h3 id="android-10">Android 10+</h3>
<ol type="1">
<li>Open the downloaded CER file.</li>
Expand Down Expand Up @@ -139,7 +139,7 @@ <h3 id="android-10">Android 10+</h3>
<h2 id="firefox">Firefox</h2>
</summary>
<p><a
href="http://proxyfor.local/proxyfor-ca-cert.pem">proxyfor-ca-cert.pem</a></p>
href="./proxyfor-ca-cert.pem">proxyfor-ca-cert.pem</a></p>
<h3 id="firefox-1">Firefox</h3>
<ol type="1">
<li>Open Options -&gt; Privacy &amp; Security and click View
Expand Down
2 changes: 2 additions & 0 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ impl Server {
} else if let Some(id) = path.strip_prefix("/traffic/") {
let query = req.uri().query().unwrap_or_default();
self.handle_get_traffic(&mut res, id, query).await
} else if let Some(path) = path.strip_prefix("/certificate/") {
self.handle_cert_index(&mut res, path).await
} else {
*res.status_mut() = StatusCode::NOT_FOUND;
return Ok(res);
Expand Down
18 changes: 9 additions & 9 deletions tests/snapshots/cert__cert_page.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
source: tests/cert.rs
expression: text
expression: res.text().await?
---
<h1 id="install-proxyfors-certificate-authority">Install proxyfor’s
Certificate Authority</h1>
Expand Down Expand Up @@ -33,7 +33,7 @@ summary:before {
<h2 id="windows">Windows</h2>
</summary>
<p><a
href="http://proxyfor.local/proxyfor-ca-cert.cer">proxyfor-ca-cert.cer</a></p>
href="./proxyfor-ca-cert.cer">proxyfor-ca-cert.cer</a></p>
<h3 id="manual-installation">Manual Installation</h3>
<ol type="1">
<li>Double-click the CER file to start the import wizard.</li>
Expand All @@ -42,8 +42,8 @@ the certificate – only the current Windows user or everyone on the
machine. Click Next.</li>
<li>Click Next again.</li>
<li>Leave Password blank and click Next.</li>
<li><strong>Select Place all certificates in the following
store</strong>, then click Browse, and select Trusted Root Certification
<li>Select Place all certificates in the following
store, then click Browse, and select Trusted Root Certification
Authorities.<br />
Click OK and Next.</li>
<li>Click Finish.</li>
Expand All @@ -61,7 +61,7 @@ href="https://technet.microsoft.com/en-us/library/cc732443.aspx">details</a>).</
<h2 id="linux">Linux</h2>
</summary>
<p><a
href="http://proxyfor.local/proxyfor-ca-cert.pem">proxyfor-ca-cert.pem</a></p>
href="./proxyfor-ca-cert.pem">proxyfor-ca-cert.pem</a></p>
<h3 id="ubuntudebian">Ubuntu/Debian</h3>
<ol type="1">
<li><code>mv proxyfor-ca-cert.pem /usr/local/share/ca-certificates/proxyfor.crt</code></li>
Expand All @@ -78,7 +78,7 @@ href="http://proxyfor.local/proxyfor-ca-cert.pem">proxyfor-ca-cert.pem</a></p>
<h2 id="macos">macOS</h2>
</summary>
<p><a
href="http://proxyfor.local/proxyfor-ca-cert.pem">proxyfor-ca-cert.pem</a></p>
href="./proxyfor-ca-cert.pem">proxyfor-ca-cert.pem</a></p>
<h3 id="manual-installation-1">Manual Installation</h3>
<ol type="1">
<li>Double-click the PEM file to open the Keychain Access
Expand All @@ -98,7 +98,7 @@ it.</li>
<h2 id="ios">iOS</h2>
</summary>
<p><a
href="http://proxyfor.local/proxyfor-ca-cert.pem">proxyfor-ca-cert.pem</a></p>
href="./proxyfor-ca-cert.pem">proxyfor-ca-cert.pem</a></p>
<h3 id="ios-13">iOS 13+</h3>
<ol type="1">
<li>Use Safari to download the certificate. Other browsers may not open
Expand All @@ -114,7 +114,7 @@ Certificate Trust Settings.</strong> Toggle proxyfor to ON.</li>
<h2 id="android">Android</h2>
</summary>
<p><a
href="http://proxyfor.local/proxyfor-ca-cert.cer">proxyfor-ca-cert.cer</a></p>
href="./proxyfor-ca-cert.cer">proxyfor-ca-cert.cer</a></p>
<h3 id="android-10">Android 10+</h3>
<ol type="1">
<li>Open the downloaded CER file.</li>
Expand Down Expand Up @@ -143,7 +143,7 @@ via the Magisk Manager app.</p>
<h2 id="firefox">Firefox</h2>
</summary>
<p><a
href="http://proxyfor.local/proxyfor-ca-cert.pem">proxyfor-ca-cert.pem</a></p>
href="./proxyfor-ca-cert.pem">proxyfor-ca-cert.pem</a></p>
<h3 id="firefox-1">Firefox</h3>
<ol type="1">
<li>Open Options -&gt; Privacy &amp; Security and click View
Expand Down