Forwarded from zrj766的频道 (Close AI)
Allen Hua 的网络博客
[可能是]最好的压缩图片程序,使用 squoosh-cli 批量压缩图片
[可能是]最好的压缩图片程序,使用 squoosh-cli 批量压缩图片
Forwarded from Deleted Account
阿里和cloudflare 我都写过
const http = require("http")
const Mail = require("/home/ddns/mail")
const Core = require('@alicloud/pop-core');
var KeyId ='xxxxxxxxxx'
var KeySecret=""
var Domain
var Server_ip_port
class Ddns{
constructor(options) {
this.option= {
config: {
accessKeyId: KeyId,
accessKeySecret: KeySecret,
endpoint: 'https://alidns.aliyuncs.com',
apiVersion: '2015-01-09'
},
domain: "apitest",
ip: "1.1.1.1"
}
this.option={...this.option,...options}
this.domain_name = options.domain
this.ip = options.ip
this.type=options.type
console.log( "console.log(this.type)------------",this.type)
this.params = {
"DomainName": Domain,
"RR": this.domain_name,
"Type": options.ipv6 ? "AAAA" : "A",
"Value": options.ipv6 ? options.ipv6 : this.ip,
"Line":"default",
}
console.log("this.params------",this.params)
this.requestOption = {
method: 'POST'
}
this.client = new Core(this.option.config)
}
check(){
return new Promise((resolve, reject)=>{
this.client.request('DescribeDomainRecords', this.params, this.requestOption).then((result) => {
for (let i of result.DomainRecords.Record){
if(i.RR.includes(this.domain_name)){
this.params = {
"RecordId": i.RecordId,
"RR": this.domain_name,
"Type": "A",
"Value": this.ip
}
console.log(this.params)
if(i.Value===this.ip){
resolve("not")
return;
}
resolve(true)
return
}
};
resolve(false)
}, (ex) => {
console.log(ex);
})
})
}
run_api(command){
this.client.request(command, this.params, this.requestOption).then((result) => {
console.log(JSON.stringify(result));
}, (ex) => {
console.log(ex);
})
}
run_ddns(){
this.check().then(data=>{
if(data==="not"){
console.log("have a same ip")
return false
}
if(data){
console.log("modify")
this.run_api("UpdateDomainRecord")
return true
}else{
console.log("add")
this.run_api("AddDomainRecord")
return true
}
})
}
}
http.createServer((req,res)=>{
let url = new URL(Server_ip_port+req.url)
let prarment = url.searchParams
let ddnsData = {}
try {Forwarded from Deleted Account
ddnsData.domain = prarment.get("domain")
ddnsData.IP = res.connection.remoteAddress.split("f:")[1]
ddnsData.passwd = prarment.get("passwd")
//update ipv6
ddnsData.type = prarment.get("type")
ddnsData.IPv6=prarment.get("ipv6")
if(ddnsData.IPv6)ddnsData.IPv6=ddnsData.IPv6.split("/")[0]
console.log("type ------",ddnsData.type)
console.log("typeIPV6 ------",ddnsData.IPv6)
console.log(ddnsData)
if (ddnsData.passwd === "xxxxxx") {
console.log(`Ths user ${ddnsData.passwd} logined`)
console.log(`DNS will change IP is ${ddnsData.IP}, domain is ${ddnsData.domain}`)
let ddns = new Ddns({
domain: ddnsData.domain,
ip: ddnsData.IP,
type:ddnsData.type,
ipv6:ddnsData.IPv6
})
if(ddnsData.type==="AAAA"&&!ddnsData.IPv6)return
ddns.run_ddns()
let mail = new Mail("DDNS Server", JSON.stringify(ddnsData))
mail.send()
res.end('ok')
} else {
res.end("not")
}
}
catch (e){
console.log(e)
}
}).listen(12345)
有需要的拿去Forwarded from 汤不热精选Ace
Media is too big
VIEW IN TELEGRAM
Forwarded from 汤不热精选Ace
This media is not supported in your browser
VIEW IN TELEGRAM
Forwarded from 汤不热精选Ace
This media is not supported in your browser
VIEW IN TELEGRAM
Forwarded from 汤不热精选Ace
This media is not supported in your browser
VIEW IN TELEGRAM
Forwarded from 汤不热精选Ace
This media is not supported in your browser
VIEW IN TELEGRAM
Forwarded from 汤不热svip
Media is too big
VIEW IN TELEGRAM
Forwarded from 汤不热svip
This media is not supported in your browser
VIEW IN TELEGRAM
Forwarded from 汤不热svip
This media is not supported in your browser
VIEW IN TELEGRAM
Forwarded from 汤不热svip
This media is not supported in your browser
VIEW IN TELEGRAM
Forwarded from 汤不热精选Ace
This media is not supported in your browser
VIEW IN TELEGRAM