自用——加密私信
//openpgpjs github上的文档居然落后于自己的版本了。。。真是蛋疼
fetch("https://cdnjs.cloudflare.com/ajax/libs/openpgp/4.10.10/openpgp.min.js")
.then(response => response.text())
.then(data => {
eval(data)
})
var _username
if (window.location.toString().match("target")!=null){
//https://2047.name/editor?target=username/????
const splitAt = 4
_username=window.location.toString().split("/")[splitAt]}
else{
//https://2047.name/m/ABCDEF123456
//和 ??? 之间的私信对话
_username=document.getElementsByClassName("header_title")[0].innerText.slice(2).split(" ")[0]
}
var _pubKey
fetch("https://2047.name/public_key/"+_username)
.then(response => response.text())
.then(data => {
_pubKey=data
})
const _encryptButton=document.createElement("button")
_encryptButton.innerText="加密"
const _previewButton=document.getElementById("editor_btnpreview")
_previewButton.insertAdjacentElement("afterend",_encryptButton)
const _textArea=document.getElementById("editor_text")
_encryptButton.onclick= async () =>{
if (_pubKey[1]=="<"){throw "No PubKey!" }
const _textContent=_textArea.value
const _encryptedMessage = await openpgp.encrypt({
message: openpgp.message.fromText(_textContent),
publicKeys: (await openpgp.key.readArmored(_pubKey)).keys,
});
_textArea.value=_encryptedMessage.data
}
inferior ttttttttttttttttttttttttttttttttttttttttt
inferior 始终不敢把PGP私钥存在自己日常用的电脑上,也不敢放到云端,这样登陆的时候要搞很多步骤,非常麻烦。
计划写个脚本用隐写术把私钥放到图片中,同时自动帮忙签名。随便一张图片应该不会引起怀疑。用不到其它功能电脑上也不用装PGP的软件了,风险更小。
这周末必须把坑填了。
inferior 搞了块x86的板子专门用来在几个“友站”键政,靠iptables把除了前置代理的网络连接都禁用了,应该比较靠谱了吧。。
一开始图便宜买的arm板子,买回来发现好多软件没有对应架构的软件包 蛋疼啊。。
inferior function _delAllPost() { var postList = [] Array.from(document.getElementsByClassName("date")).forEach((item) => { postList.push(item.href.split("p/")[1]) }) postList.forEach( async (item) => { if (!(isNaN(item))) { await api({ action: 'mark_delete', target: "post/" + item.toString(), }) } }) }thphd2047前站长 题外话,是不是应该有什么浏览器插件之类的可以hold住private key,不然解密就得弄到命令行去做。
inferior function _deluserPost(name) { var postList = [] Array.from(document.getElementsByClassName("details")).forEach((item) => { postList.push({ post: item.children[4].dataset.id.split("/")[1], username: item.children[0].innerText}) }) postList.forEach(async (item) => { if (item[username] == name) { await api({ action: 'mark_delete', target: "post/" + item[post].toString(), }) } }) }