encrypted queryraw

This commit is contained in:
Rizky 2024-04-18 13:49:25 +07:00
parent 6a133b8f8e
commit 72038b9f68
4 changed files with 54 additions and 41 deletions

File diff suppressed because one or more lines are too long

View File

@ -67,6 +67,7 @@
"tinycolor2": "^1.6.0", "tinycolor2": "^1.6.0",
"ua-parser-js": "^1.0.37", "ua-parser-js": "^1.0.37",
"uuid": "9.0.1", "uuid": "9.0.1",
"pako": "^2.1.0",
"wasm-gzip": "^2.0.3", "wasm-gzip": "^2.0.3",
"web-utils": "workspace:*", "web-utils": "workspace:*",
"y-pojo": "^0.0.8", "y-pojo": "^0.0.8",
@ -74,6 +75,7 @@
"yjs-types": "^0.0.1" "yjs-types": "^0.0.1"
}, },
"devDependencies": { "devDependencies": {
"@types/pako": "^2.0.3",
"@types/lodash.concat": "^4.5.8", "@types/lodash.concat": "^4.5.8",
"@types/lodash.find": "^4.6.8", "@types/lodash.find": "^4.6.8",
"@types/lodash.findindex": "^4.6.8", "@types/lodash.findindex": "^4.6.8",

View File

@ -1,5 +1,6 @@
import hash_sum from "hash-sum"; import hash_sum from "hash-sum";
import { fetchViaProxy } from "../proxy"; import { fetchViaProxy } from "../proxy";
import pako from "pako";
export const dbProxy = (dburl: string) => { export const dbProxy = (dburl: string) => {
const name = ""; const name = "";
@ -63,12 +64,19 @@ export const dbProxy = (dburl: string) => {
if (table.startsWith("$")) { if (table.startsWith("$")) {
return (...params: any[]) => { return (...params: any[]) => {
const bytes = pako.gzip(JSON.stringify(params));
return fetchSendDb( return fetchSendDb(
{ {
name, name,
action: "query", action: "query",
table, table,
params, params: btoa(
bytes.reduce(
(acc, current) => acc + String.fromCharCode(current),
""
)
),
}, },
dburl dburl
); );

BIN
bun.lockb

Binary file not shown.