added APRS-IS Passcode

This commit is contained in:
Bigsk 2024-10-17 09:56:46 +08:00
parent 0b2a6c6967
commit 1d592b96c8
23 changed files with 413 additions and 18 deletions

BIN
.DS_Store vendored

Binary file not shown.

186
aprs_is_passcode/en.html Normal file
View File

@ -0,0 +1,186 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Get APRS-IS Passcode</title>
<!-- Bootstrap -->
<link href="https://cdn.gh.ink/assembly/bootstrap/4.6.1/css/bootstrap.min.css" rel="stylesheet">
<!-- Favicon -->
<link rel="icon" href="https://2-cdn.ianxia.com/images/avatar/common.png" type="image/png">
<script src="https://cdn.gh.ink/js/vue/2.6.14/vue.min.js"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="https://tools.ianxia.com"><b>Ian</b>Tools</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Language
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="zh.html"><b>简体中文</b></a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="https://www.ianxia.com">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://blog.ianxia.com">Blog (In Chinese)</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://demo.ianxia.com">DEMO</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://adsb.ianxia.com">ADS-B</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="../en.html">Tools</a>
</li>
</ul>
</div>
</nav>
<section>
<div class="jumbotron text-center mt-2">
<div class="container">
<div class="row">
<div class="col-12">
<h1>Get APRS-IS Passcode</h1>
</div>
</div>
</div>
</div>
</section>
<section>
<div class="container">
<div class="row" id="app">
<div class="col-md-1"></div>
<div class="col-md-5">
<form class="form-horizontal" role="form">
<div class="form-inline">
<label><b>Callsign: </b>&nbsp;</label>
<input type="text" class="form-control" v-model="callsign" style="width:120px">
&nbsp;&nbsp;
<button type="button" class="btn btn-primary" v-on:click="getPasscode(callsign)" type="button">Get</button>
</div>
</form>
</div>
<div class="col-md-6">
<label><b>APRS-IS Passcode Is</b></label>
<p>{{passcode}}</p>
</div>
</div>
<div class="text-center">
<hr>
<h5>Algorithm source: <a href="https://github.com/PU5KOD/APRS-Passcode-Generator">APRS-Passcode-Generator</a></h5>
</div>
</div>
</section>
<hr>
<script>
new Vue({
el: '#app',
data: {
callsign: "",
passcode: "Please Press Get"
},
methods: {
getPasscode(callsign) {
if((/^[a-zA-Z0-9-]+$/).test(callsign)){
callsign = callsign.toUpperCase();
let i = 0;
let tmp_code = 29666;
while(i < callsign.length){
// ^ = XOR Operation
tmp_code = tmp_code ^ callsign.charCodeAt(i) * 256;
tmp_code = tmp_code ^ callsign.charCodeAt(i+1);
i += 2;
}
tmp_code = tmp_code & 32767;
this.passcode = tmp_code;
}
else{
this.passcode = "Please Press Get";
alert("Wrong callsign! Please retry.");
}
}
}
})
let date = new Date();
</script>
<footer class="text-center">
<div class="container">
<div class="row">
<div class="col-12">
<p style="color: #516069"><strong>Copyright © Ian Xia <script>document.write(date.getFullYear().toString());</script> All rights reserved</strong></p>
</div>
</div>
</div>
</footer>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://cdn.gh.ink/js/jquery/jquery-3.6.0.min.js"></script>
<!-- Grey Filter Detector -->
<script>
$.ajax({
type: "GET",
url: "https://api.gh.ink/grey_filter",
dataType: "json",
success: function(data, textStatus){
for (let i=0;i<data["content"]["accurate_slot"].length;i++) {
// Accurate Slot
if (Date.now()/1000 >= data["content"]["accurate_slot"][i][0] && Date.now()/1000 <= data["content"]["accurate_slot"][i][1]) {
$("html").css({
'-webkit-filter': 'grayscale(100%)',
'-moz-filter': 'grayscale(100%)',
'-ms-filter': 'grayscale(100%)',
'-o-filter': 'grayscale(100%)',
'filter': 'progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)',
'_filter': 'none'
});
break;
}
}
for (let i=0;i<data["content"]["day_slot"].length;i++) {
// Day Slot
let begin = new Date(
date.getFullYear().toString() + "-" +
data["content"]["day_slot"][i][0][0].toString() + "-" +
data["content"]["day_slot"][i][0][1].toString() + " " +
data["content"]["day_slot"][i][0][2].toString() + ":" +
data["content"]["day_slot"][i][0][3].toString() + ":" +
data["content"]["day_slot"][i][0][4].toString()
)
let end = new Date(
date.getFullYear().toString() + "-" +
data["content"]["day_slot"][i][1][0].toString() + "-" +
data["content"]["day_slot"][i][1][1].toString() + " " +
data["content"]["day_slot"][i][1][2].toString() + ":" +
data["content"]["day_slot"][i][1][3].toString() + ":" +
data["content"]["day_slot"][i][1][4].toString()
)
if (Date.now() >= begin.getTime() && Date.now() <= end.getTime()) {
$("html").css({
'-webkit-filter': 'grayscale(100%)',
'-moz-filter': 'grayscale(100%)',
'-ms-filter': 'grayscale(100%)',
'-o-filter': 'grayscale(100%)',
'filter': 'progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)',
'_filter': 'none'
});
break;
}
}
}
});
</script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="https://cdn.gh.ink/js/popper/1.16.1/popper.min.js"></script>
<script src="https://cdn.gh.ink/assembly/bootstrap/4.6.1/js/bootstrap.min.js"></script>
</body>
</html>

View File

@ -0,0 +1,7 @@
<script>
if(navigator.language=="zh-CN"){
window.location.href="./zh.html";
}else{
window.location.href="./en.html";
}
</script>

188
aprs_is_passcode/zh.html Normal file
View File

@ -0,0 +1,188 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>获取APRS IS密码</title>
<!-- Bootstrap -->
<link href="https://cdn.gh.ink/assembly/bootstrap/4.6.1/css/bootstrap.min.css" rel="stylesheet">
<!-- Favicon -->
<link rel="icon" href="https://2-cdn.ianxia.com/images/avatar/common.png" type="image/png">
<script src="https://cdn.gh.ink/js/vue/2.6.14/vue.min.js"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="https://tools.ianxia.com"><b>Ian</b>Tools</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
语言
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="en.html"><b>English</b></a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="https://www.ianxia.com">首页</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://blog.ianxia.com">博客</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://demo.ianxia.com">DEMO</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://adsb.ianxia.com">ADS-B</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="../zh.html">小工具</a>
</li>
</ul>
</div>
</nav>
<section>
<div class="jumbotron text-center mt-2">
<div class="container">
<div class="row">
<div class="col-12">
<h1>
获取APRS IS密码
</h1>
</div>
</div>
</div>
</div>
</section>
<section>
<div class="container">
<div class="row" id="app">
<div class="col-md-1"></div>
<div class="col-md-5">
<form class="form-horizontal" role="form">
<div class="form-inline">
<label><b>呼号:</b>&nbsp;</label>
<input type="text" class="form-control" v-model="callsign" style="width:120px">
&nbsp;&nbsp;
<button type="button" class="btn btn-primary" v-on:click="getPasscode(callsign)" type="button">获取</button>
</div>
</form>
</div>
<div class="col-md-6">
<label><b>APRS IS密码为</b></label>
<p>{{passcode}}</p>
</div>
</div>
<div class="text-center">
<hr>
<h5>算法来源:<a href="https://github.com/PU5KOD/APRS-Passcode-Generator">APRS-Passcode-Generator</a></h5>
</div>
</div>
</section>
<hr>
<script>
new Vue({
el: '#app',
data: {
callsign: "",
passcode: "请按获取"
},
methods: {
getPasscode(callsign) {
if((/^[a-zA-Z0-9-]+$/).test(callsign)){
callsign = callsign.toUpperCase();
let i = 0;
let tmp_code = 29666;
while(i < callsign.length){
// ^ = XOR Operation
tmp_code = tmp_code ^ callsign.charCodeAt(i) * 256;
tmp_code = tmp_code ^ callsign.charCodeAt(i+1);
i += 2;
}
tmp_code = tmp_code & 32767;
this.passcode = tmp_code;
}
else{
this.passcode = "请按获取";
alert("错误的呼号!请重试。");
}
}
}
})
let date = new Date();
</script>
<footer class="text-center">
<div class="container">
<div class="row">
<div class="col-12">
<p style="color: #516069"><strong>版权所有 © Ian Xia <script>document.write(date.getFullYear().toString());</script> 保留所有权利</strong></p>
</div>
</div>
</div>
</footer>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://cdn.gh.ink/js/jquery/jquery-3.6.0.min.js"></script>
<!-- Grey Filter Detector -->
<script>
$.ajax({
type: "GET",
url: "https://api.gh.ink/grey_filter",
dataType: "json",
success: function(data, textStatus){
for (let i=0;i<data["content"]["accurate_slot"].length;i++) {
// Accurate Slot
if (Date.now()/1000 >= data["content"]["accurate_slot"][i][0] && Date.now()/1000 <= data["content"]["accurate_slot"][i][1]) {
$("html").css({
'-webkit-filter': 'grayscale(100%)',
'-moz-filter': 'grayscale(100%)',
'-ms-filter': 'grayscale(100%)',
'-o-filter': 'grayscale(100%)',
'filter': 'progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)',
'_filter': 'none'
});
break;
}
}
for (let i=0;i<data["content"]["day_slot"].length;i++) {
// Day Slot
let begin = new Date(
date.getFullYear().toString() + "-" +
data["content"]["day_slot"][i][0][0].toString() + "-" +
data["content"]["day_slot"][i][0][1].toString() + " " +
data["content"]["day_slot"][i][0][2].toString() + ":" +
data["content"]["day_slot"][i][0][3].toString() + ":" +
data["content"]["day_slot"][i][0][4].toString()
)
let end = new Date(
date.getFullYear().toString() + "-" +
data["content"]["day_slot"][i][1][0].toString() + "-" +
data["content"]["day_slot"][i][1][1].toString() + " " +
data["content"]["day_slot"][i][1][2].toString() + ":" +
data["content"]["day_slot"][i][1][3].toString() + ":" +
data["content"]["day_slot"][i][1][4].toString()
)
if (Date.now() >= begin.getTime() && Date.now() <= end.getTime()) {
$("html").css({
'-webkit-filter': 'grayscale(100%)',
'-moz-filter': 'grayscale(100%)',
'-ms-filter': 'grayscale(100%)',
'-o-filter': 'grayscale(100%)',
'filter': 'progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)',
'_filter': 'none'
});
break;
}
}
}
});
</script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="https://cdn.gh.ink/js/popper/1.16.1/popper.min.js"></script>
<script src="https://cdn.gh.ink/assembly/bootstrap/4.6.1/js/bootstrap.min.js"></script>
</body>
</html>

View File

@ -152,7 +152,7 @@
<script>
$.ajax({
type: "GET",
url: "https://open.geh.ink/grey_filter",
url: "https://api.gh.ink/grey_filter",
dataType: "json",
success: function(data, textStatus){
for (let i=0;i<data["content"]["accurate_slot"].length;i++) {

View File

@ -152,7 +152,7 @@
<script>
$.ajax({
type: "GET",
url: "https://open.geh.ink/grey_filter",
url: "https://api.gh.ink/grey_filter",
dataType: "json",
success: function(data, textStatus){
for (let i=0;i<data["content"]["accurate_slot"].length;i++) {

View File

@ -297,7 +297,7 @@
<script>
$.ajax({
type: "GET",
url: "https://open.geh.ink/grey_filter",
url: "https://api.gh.ink/grey_filter",
dataType: "json",
success: function(data, textStatus){
for (let i=0;i<data["content"]["accurate_slot"].length;i++) {

View File

@ -297,7 +297,7 @@
<script>
$.ajax({
type: "GET",
url: "https://open.geh.ink/grey_filter",
url: "https://api.gh.ink/grey_filter",
dataType: "json",
success: function(data, textStatus){
for (let i=0;i<data["content"]["accurate_slot"].length;i++) {

View File

@ -237,7 +237,7 @@
<script>
$.ajax({
type: "GET",
url: "https://open.geh.ink/grey_filter",
url: "https://api.gh.ink/grey_filter",
dataType: "json",
success: function(data, textStatus){
for (let i=0;i<data["content"]["accurate_slot"].length;i++) {

View File

@ -237,7 +237,7 @@
<script>
$.ajax({
type: "GET",
url: "https://open.geh.ink/grey_filter",
url: "https://api.gh.ink/grey_filter",
dataType: "json",
success: function(data, textStatus){
for (let i=0;i<data["content"]["accurate_slot"].length;i++) {

View File

@ -118,7 +118,7 @@
<script>
$.ajax({
type: "GET",
url: "https://open.geh.ink/grey_filter",
url: "https://api.gh.ink/grey_filter",
dataType: "json",
success: function(data, textStatus){
for (let i=0;i<data["content"]["accurate_slot"].length;i++) {

View File

@ -172,7 +172,7 @@
<script>
$.ajax({
type: "GET",
url: "https://open.geh.ink/grey_filter",
url: "https://api.gh.ink/grey_filter",
dataType: "json",
success: function(data, textStatus){
for (let i=0;i<data["content"]["accurate_slot"].length;i++) {

View File

@ -172,7 +172,7 @@
<script>
$.ajax({
type: "GET",
url: "https://open.geh.ink/grey_filter",
url: "https://api.gh.ink/grey_filter",
dataType: "json",
success: function(data, textStatus){
for (let i=0;i<data["content"]["accurate_slot"].length;i++) {

View File

@ -13,6 +13,20 @@
"en": "Amateur Radio"
},
"path": "commu_a_c"
},{
"name": {
"zh": "获取APRS IS密码",
"en": "Get APRS-IS Passcode"
},
"description": {
"zh": "在线获取APRS IS密码",
"en": "Get APRS-IS Passcode Online"
},
"category": {
"zh": "业余无线电",
"en": "Amateur Radio"
},
"path": "aprs_is_passcode"
},{
"name": {
"zh": "小环天线计算器",

View File

@ -182,7 +182,7 @@
<script>
$.ajax({
type: "GET",
url: "https://open.geh.ink/grey_filter",
url: "https://api.gh.ink/grey_filter",
dataType: "json",
success: function(data, textStatus){
for (let i=0;i<data["content"]["accurate_slot"].length;i++) {

View File

@ -182,7 +182,7 @@
<script>
$.ajax({
type: "GET",
url: "https://open.geh.ink/grey_filter",
url: "https://api.gh.ink/grey_filter",
dataType: "json",
success: function(data, textStatus){
for (let i=0;i<data["content"]["accurate_slot"].length;i++) {

View File

@ -182,7 +182,7 @@
<script>
$.ajax({
type: "GET",
url: "https://open.geh.ink/grey_filter",
url: "https://api.gh.ink/grey_filter",
dataType: "json",
success: function(data, textStatus){
for (let i=0;i<data["content"]["accurate_slot"].length;i++) {

View File

@ -182,7 +182,7 @@
<script>
$.ajax({
type: "GET",
url: "https://open.geh.ink/grey_filter",
url: "https://api.gh.ink/grey_filter",
dataType: "json",
success: function(data, textStatus){
for (let i=0;i<data["content"]["accurate_slot"].length;i++) {

View File

@ -119,7 +119,7 @@
<script>
$.ajax({
type: "GET",
url: "https://open.geh.ink/grey_filter",
url: "https://api.gh.ink/grey_filter",
dataType: "json",
success: function(data, textStatus){
for (let i=0;i<data["content"]["accurate_slot"].length;i++) {

View File

@ -119,7 +119,7 @@
<script>
$.ajax({
type: "GET",
url: "https://open.geh.ink/grey_filter",
url: "https://api.gh.ink/grey_filter",
dataType: "json",
success: function(data, textStatus){
for (let i=0;i<data["content"]["accurate_slot"].length;i++) {

View File

@ -177,7 +177,7 @@
<script>
$.ajax({
type: "GET",
url: "https://open.geh.ink/grey_filter",
url: "https://api.gh.ink/grey_filter",
dataType: "json",
success: function(data, textStatus){
for (let i=0;i<data["content"]["accurate_slot"].length;i++) {

View File

@ -177,7 +177,7 @@
<script>
$.ajax({
type: "GET",
url: "https://open.geh.ink/grey_filter",
url: "https://api.gh.ink/grey_filter",
dataType: "json",
success: function(data, textStatus){
for (let i=0;i<data["content"]["accurate_slot"].length;i++) {

View File

@ -118,7 +118,7 @@
<script>
$.ajax({
type: "GET",
url: "https://open.geh.ink/grey_filter",
url: "https://api.gh.ink/grey_filter",
dataType: "json",
success: function(data, textStatus){
for (let i=0;i<data["content"]["accurate_slot"].length;i++) {