support refill license info

This commit is contained in:
novice.li 2024-03-02 09:55:58 +08:00
parent a01643113e
commit 8ea2e0698f
2 changed files with 38 additions and 4 deletions

View File

@ -4,7 +4,26 @@
<meta charset="UTF-8"/> <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/> <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Get keys</title> <title>Generate License</title>
<style>
.jetbra-button {
background-color: #04AA6D;
border: none;
color: white;
padding: 8px 24px;
text-align: center;
text-decoration: none;
display: inline-block;
border-radius: 16px;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
transition-duration: 0.4s;
}
.jetbra-button:hover {
background-color: #057e47;
color: white;
}
</style>
<style> <style>
.form { .form {
background-color: #15172b; background-color: #15172b;
@ -776,6 +795,7 @@
</main> </main>
<footer class="flex items-center justify-between"> <footer class="flex items-center justify-between">
<div class="text-sm text-grey">Theme by QieTuZai</div> <div class="text-sm text-grey">Theme by QieTuZai</div>
<div class="text-sm text-grey"><button class="jetbra-button" onclick="showLicenseForm()">Refill licensee information</button></div>
<div class="text-sm text-grey">Copy from ja-netfilter</div> <div class="text-sm text-grey">Copy from ja-netfilter</div>
</footer> </footer>
<div id ="mask" style="position:fixed;top:0;left:0;z-index:998;width:100%;height:100%;display:none;background-color:#000;opacity:0.5;overflow:hidden;"></div> <div id ="mask" style="position:fixed;top:0;left:0;z-index:998;width:100%;height:100%;display:none;background-color:#000;opacity:0.5;overflow:hidden;"></div>
@ -794,7 +814,7 @@
<label for="assigneeName" class="placeholder">assigneeName</label> <label for="assigneeName" class="placeholder">assigneeName</label>
</div> </div>
<div class="input-container ic2"> <div class="input-container ic2">
<input id="expiryDate" class="input" type="text" placeholder="" value="2030-12-31"/> <input id="expiryDate" class="input" type="text" placeholder="" value="2026-12-31"/>
<div class="cut cut-short"></div> <div class="cut cut-short"></div>
<label for="expiryDate" class="placeholder">expiryDate</label> <label for="expiryDate" class="placeholder">expiryDate</label>
</div> </div>
@ -802,7 +822,6 @@
</div> </div>
</div> </div>
<script> <script>
if (localStorage.getItem('licenseInfo') === null) { if (localStorage.getItem('licenseInfo') === null) {
document.getElementById('mask').style.display = 'block' document.getElementById('mask').style.display = 'block'
@ -821,6 +840,21 @@
document.getElementById('mask').style.display = 'none' document.getElementById('mask').style.display = 'none'
document.getElementById('form').style.display = 'none' document.getElementById('form').style.display = 'none'
} }
window.showLicenseForm = function () {
let licenseInfo = localStorage.getItem('licenseInfo');
if (licenseInfo !== null) {
licenseInfo = JSON.parse(licenseInfo)
document.getElementById('licenseeName').value = licenseInfo.licenseeName
document.getElementById('assigneeName').value = licenseInfo.assigneeName
document.getElementById('expiryDate').value = licenseInfo.expiryDate
}else {
document.getElementById('licenseeName').value = 'Test only'
document.getElementById('assigneeName').value = 'Test only'
document.getElementById('expiryDate').value = '2026-12-31'
}
document.getElementById('mask').style.display = 'block'
document.getElementById('form').style.display = 'block'
}
</script> </script>
<script> <script>

View File

@ -65,7 +65,7 @@ async fn main() -> std::io::Result<()> {
.route("/images/icons.svg", web::get().to(|| async { HttpResponse::Ok().content_type(mime::IMAGE_SVG).body(ICONS) })) .route("/images/icons.svg", web::get().to(|| async { HttpResponse::Ok().content_type(mime::IMAGE_SVG).body(ICONS) }))
.route("/generateLicense", web::post().to(generate_license)) .route("/generateLicense", web::post().to(generate_license))
}) })
.bind(("127.0.0.1", 8080))? .bind("0.0.0.0:8080")?
.run() .run()
.await .await
} }