近期记录

近期记录

彼方 39 2024-03-28

近期杂记

1. Jetbran插件激活码

LinuxDo上大佬开发的 Jetbran插件激活脚本,配合热佬脚本使用,我代理的地址:
https://jtb.bflome.com

油猴插件脚本地址:
https://greasyfork.org/zh-CN/scripts/480799-jetbra/feedback


使用教程:在热佬的config-jetbrains文件夹下找到power.conf文件,RESULT下添加下列内容:

EQUAL,552256481678533139637975642367886203758236695483472209227743107098274039115182632876163871002685432662302338668484423414183623828225303129495011678242692842492488816514989676246788248148342413267485195568231641482216898266877438354128287060766631859161479332205725666574464164020522537595703362075565234890263790811265628293553656776925959545054122892468596656349514684518208997243750044021837251938753278807502305685113970717218831835618638457758130244769634525644949374508517044601990948117620105271720428259518909031341417933211526168184737184239634893948475085109420481522243358927998080508613356123692889767778533191484116809048763806053864339307673413329622302838455339868310031694563895311196234390180465202269142275598079255373287732431039254464172062988256518444614496248243200781259934221113710095392103382136300966279867703201614910212881522237167155093128902262921185900884869382176544761664777559104752378158192377647794361684542114437145121112034418220761298224143523298442362011266447239773883726746341810632935875214148521014297762215812293965213101140233155347800537083565331646491142112103328400294630793407149764120146697310714474595556761774911418274155051344410984326483216333907679252415962391346653515408516718,65537,860106576952879101192782278876319243486072481962999610484027161162448933268423045647258145695082284265933019120714643752088997312766689988016808929265129401027490891810902278465065056686129972085119605237470899952751915070244375173428976413406363879128531449407795115913715863867259163957682164040613505040314747660800424242248055421184038777878268502955477482203711835548014501087778959157112423823275878824729132393281517778742463067583320091009916141454657614089600126948087954465055321987012989937065785013284988096504657892738536613208311013047138019418152103262155848541574327484510025594166239784429845180875774012229784878903603491426732347994359380330103328705981064044872334790365894924494923595382470094461546336020961505275530597716457288511366082299255537762891238136381924520749228412559219346777184174219999640906007205260040707839706131662149325151230558316068068139406816080119906833578907759960298749494098180107991752250725928647349597506532778539709852254478061194098069801549845163358315116260915270480057699929968468068015735162890213859113563672040630687357054902747438421559817252127187138838514773245413540030800888215961904267348727206110582505606182944023582459006406137831940959195566364811905585377246353->31872219281407242025505148642475109331663948030010491344733687844358944945421064967310388547820970408352359213697487269225694990179009814674781374751323403257628081559561462351695605167675284372388551941279783515209238245831229026662363729380633136520288327292047232179909791526492877475417113579821717193807584807644097527647305469671333646868883650312280989663788656507661713409911267085806708237966730821529702498972114194166091819277582149433578383639532136271637219758962252614390071122773223025154710411681628917523557526099053858210363406122853294409830276270946292893988830514538950951686480580886602618927728470029090747400687617046511462665469446846624685614084264191213318074804549715573780408305977947238915527798680393538207482620648181504876534152430149355791756374642327623133843473947861771150672096834149014464956451480803326284417202116346454345929350148770746553056995922154382822307758515805142704373984019252210715650875853634697920708113806880196144197384637328982263167395073688501517286678083973976140696077590122053014085412828620051470085033364773099146103525313018873319293728800442101520384088109603555959893639842091339193891977395427305674935962998394201154475636326880291448367598036283623703166979


然后在url.conf文件中复制下面内容:

[URL]
PREFIX,https://check-license.squaretest.com

PREFIX,https://account.jetbrains.com/lservice/rpc/validateKey.action

KEYWORD,116.62.33.138


然后就可以在https://plugins.jetbrains.com/里复制激活码使用了。

脚本代码[防丢]:

// ==UserScript==
// @name         JetBra
// @namespace    https://github.com/novice88/jetbra
// @version      3.4
// @license MIT
// @description  Add a button on the plugin homepage and click to get the plugin activation code
@author novice.li
@मैच hatps://plugins.jetbrain.com/*
// @grant        GM_setClipboard
// @grant        GM_addStyle
// @grant        GM_xmlhttpRequest
// @grant        window.onurlchange
// @connect noviceli.win
// @connect novitechie.com
// @connect self
// @connect localhost
// ==/UserScript==
 
 
async function findElementWithRetry(cssSelector) {
    const maxAttempts = 50;
    for (let attempts = 0; attempts < maxAttempts; attempts++) {
        const element = document.querySelector(cssSelector);
        if (element) {
            return element;
        }
        await new Promise(resolve => setTimeout(resolve, 100));
    }
    throw new Error(`Element with selector '${cssSelector}' not found after ${maxAttempts} attempts.`);
}
 
let addButton = async function () {
    console.log('JetBra is running');
    'use strict';
    GM_addStyle(`
    .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;
    }
`);
    const backendBaseUrl = 'https://jetbra.novitechie.com'
 
    let url = window.location.href
    if (!url.startsWith('https://plugins.jetbrains.com/plugin/')) {
        return;
    }
 
    let pluginId = url.split('/')[4].split('-')[0]
    console.log('pluginId: ' + pluginId);
 
    let pluginDetail = await fetch('https://plugins.jetbrains.com/api/plugins/' + pluginId).then(r => r.json());
 
    const parentElement = await findElementWithRetry('.plugin-header__controls-panel > div:first-child');
 
    if (parentElement.querySelector('.jetbra-button')) {
        return;
    }
    let newElement = document.createElement('div');
    newElement.classList.toggle('wt-col-inline');
    newElement.innerHTML = `<button class="jetbra-button" type="button">CLICK TO GENERATE ACTIVATION CODE</button>`;
    parentElement.appendChild(newElement)
 
    newElement.addEventListener('click', async () => {
        if (pluginDetail.purchaseInfo === undefined) {
            window.alert('This plugin is not a paid plugin in the market');
            return;
        }
        let data = {
            "licenseeName": "reborn",
            "assigneeName": "reborn",
            "assigneeEmail": "",
            "licenseRestriction": "",
            "checkConcurrentUse": false,
            "products": [{
                "code": pluginDetail.purchaseInfo.productCode,
                "fallbackDate": "2026-12-30",
                "paidUpTo": "2026-12-30",
                "extended": false
            }],
            "metadata": "0120230102PPAA013009",
            "hash": "41472961/0:1563609451",
            "gracePeriodDays": 7,
            "autoProlongated": true,
            "isAutoProlongated": true
        }
        GM_xmlhttpRequest({
            method: 'POST',
            url: backendBaseUrl + '/generateLicense',
            headers: {
                'Content-Type': 'application/json'
            },
            data: JSON.stringify(data),
            onload: function (response) {
                let license = JSON.parse(response.responseText).license
                GM_setClipboard(license, 'text');
                window.alert('The activation code has been copied to your clipboard');
            }
        });
    })
};
 
addButton();
if (window.onurlchange === null) {
    window.addEventListener('urlchange', (info) => {
        addButton();
    });

2. OpenVPN无法使用


公司的电脑突然无法使用OpenVPN了,一直连接失败,开始以为是开启了ClashX导致的,但是卸载了ClashX之后,依旧链接不上,修改了DNS也没啥用,后来翻了一下OpenVPN的错误日志,如下:

Transport Error: socket_protect error (UDP)
Client terminated, restarting in 2000 ms...

看起来应该是/var/run/agent_ovpnconnect.sock服务没有正常启动导致的,网上搜了一下,使用下面的方式解决了,在终端执行下列命令即可:

sudo launchctl load -w /Library/LaunchDaemons/org.openvpn.client.plist