progress. but sync
All checks were successful
Rebuild signaller for deprived.dev to rebuild site / test_service (push) Successful in 15s

This commit is contained in:
BOTAlex 2025-10-06 15:31:30 +02:00
parent 5702ea1ea7
commit db11d96328
2 changed files with 18 additions and 10 deletions

View file

@ -19,7 +19,6 @@
text = ''
set -euo pipefail
export npm_config_cache="$PWD/.npm-cache"
[ -f .env ] && set -a && . ./.env && set +a
if [ -f package-lock.json ]; then cmd=ci; else cmd=install; fi
echo " npm $cmd (nix run)"
${node}/bin/npm "$cmd"

View file

@ -1,21 +1,30 @@
import PocketBase from "pocketbase";
import { parseProfile, type Profile } from "./Profile";
const PUBLIC_POCKET_URL = "https://pocket.deprived.dev/";
let pb = new PocketBase(PUBLIC_POCKET_URL);
class Redactor {
async TryGetUnredacter(): Promise<Profile> {
const url =
'https://pocket.deprived.dev/api/collections/redacted_content/records?page=1&perPage=1&filter=plain_id="redacted_json"&skipTotal=1';
const key = localStorage.getItem("key");
if (!key) throw new Error("Missing key");
const hashResJson = await (
await fetch("http://api.deprived.dev/unredact", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ key: "balls" }),
})
).json();
const unredactHash = hashResJson.response;
console.log('Trying unredact hash: "' + unredactHash + '"');
const url = `https://pocket.deprived.dev/api/files/redacted_content/${unredactHash}/redacted_cv_info_ha08bbn520.json`;
const res = await fetch(url, {
body: localStorage.getItem("key"),
method: "GET",
headers: { Accept: "application/json" },
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(res);
const data = await res.json();
console.log(data);
const item = data?.items?.[0];
const raw = JSON.parse(item.file);
return parseProfile(raw);