progress. but sync
All checks were successful
Rebuild signaller for deprived.dev to rebuild site / test_service (push) Successful in 15s
All checks were successful
Rebuild signaller for deprived.dev to rebuild site / test_service (push) Successful in 15s
This commit is contained in:
parent
5702ea1ea7
commit
db11d96328
2 changed files with 18 additions and 10 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue