feat: init pi-provider-qoder plugin with oauth, signature and WAF bypass

This commit is contained in:
Simon Shi
2026-06-16 13:38:48 +08:00
commit dd8c313984
17 changed files with 6093 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
const qoderCustomAlphabet = "_doRTgHZBKcGVjlvpC,@aFSx#DPuNJme&i*MzLOEn)sUrthbf%Y^w.(kIQyXqWA!";
const qoderStdAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
export function qoderEncodeBody(plaintext: string | Buffer): string {
const std = Buffer.isBuffer(plaintext) ? plaintext.toString("base64") : Buffer.from(plaintext).toString("base64");
const n = std.length;
const a = Math.floor(n / 3);
const rearranged = std.slice(n - a) + std.slice(a, n - a) + std.slice(0, a);
let out = "";
for (let i = 0; i < n; i++) {
const c = rearranged[i];
if (c === "=") {
out += "$";
} else {
const idx = qoderStdAlphabet.indexOf(c);
if (idx >= 0) {
out += qoderCustomAlphabet[idx];
} else {
out += c;
}
}
}
return out;
}