mirror of
https://github.com/v0l/route96.git
synced 2025-06-17 20:23:56 +00:00
feat: bud-04 (mirror)
feat: migrate void.cat
This commit is contained in:
@ -50,6 +50,18 @@ export class Blossom {
|
||||
}
|
||||
}
|
||||
|
||||
async mirror(url: string) {
|
||||
const rsp = await this.#req("mirror", "PUT", "mirror", JSON.stringify({ url }), undefined, {
|
||||
"content-type": "application/json"
|
||||
});
|
||||
if (rsp.ok) {
|
||||
return (await rsp.json()) as BlobDescriptor;
|
||||
} else {
|
||||
const text = await rsp.text();
|
||||
throw new Error(text);
|
||||
}
|
||||
}
|
||||
|
||||
async list(pk: string) {
|
||||
const rsp = await this.#req(`list/${pk}`, "GET", "list");
|
||||
if (rsp.ok) {
|
||||
@ -76,6 +88,7 @@ export class Blossom {
|
||||
term: string,
|
||||
body?: BodyInit,
|
||||
tags?: Array<Array<string>>,
|
||||
headers?: Record<string, string>,
|
||||
) {
|
||||
throwIfOffline();
|
||||
|
||||
@ -100,6 +113,7 @@ export class Blossom {
|
||||
method,
|
||||
body,
|
||||
headers: {
|
||||
...headers,
|
||||
accept: "application/json",
|
||||
authorization: await auth(url, method),
|
||||
},
|
||||
|
Reference in New Issue
Block a user