This article is synchronized and updated to xLog by Mix Space
For the best browsing experience, it is recommended to visit the original link
https://www.do1e.cn/posts/code/two-docker-images
To facilitate my own deployment, I uploaded two small tools I previously wrote to DockerHub and made them open source. Those in need can take them. This blog will briefly introduce them.
Captcha Recognition and Auto-fill#
At first, I found it too troublesome to enter the general captcha every time I logged into Nanjing University's unified identity authentication. At that time, I didn't have AI to help me generate code and wasn't very good at JavaScript, so I asked a friend for help to write one, while I implemented the backend recognition code using sml2h3/ddddocr. In short, it's a very simple tool that automatically fills in the captcha every time you refresh, and you just need to click login.
After packaging it into a Docker image, it became easier to deploy, but it requires the use of HTTPS. You can self-sign a certificate if you don't have one issued by an organization, but you need to install the certificate on each client.
In theory, it also supports other websites, and you can modify the JavaScript code yourself. I log into Nanjing University's unified identity authentication quite frequently, so I only implemented this one.
Cross-Origin IP Address API#
I wrote this because in another blog of mine, Nanjing University IPv4 Address Range, I wanted to implement the parsing of the user's IP address and determine whether the visiting user is within the Nanjing University campus network. However, the APIs I found either did not support cross-origin requests or required a VPN.
So I decided to write one myself, and also use the IP geolocation parsing I applied for.
After finishing it, I packaged it into a Docker image for easier deployment; you can check the README on GitHub for details.
Return Example
IPv4
{
"ip": "114.xxx.xxx.xxx",
"region": "China–Jiangsu–Nanjing Education Network/Nanjing University",
"error": null
}
IPv6
{
"ip": "2001:xxxx:xxxx:xxxx::xxxx",
"region": "China Education Network",
"error": null
}
Although it supports IPv6, I disabled IPv6 resolution during deployment, as my blog is about Nanjing UniversityIPv4 Address Range.