From 4bf613ef684fc0c01c1c4b6d69fd8d77a30a258f Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 17 Dec 2024 11:06:07 +0100 Subject: [PATCH] fix upload urls --- src/http.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/http.ts b/src/http.ts index f2e2ef1..529b58f 100644 --- a/src/http.ts +++ b/src/http.ts @@ -176,7 +176,6 @@ type RequestOptions = Pick; export class LemmyHttp { #apiUrl: string; #headers: { [key: string]: string } = {}; - #pictrsUrl: string; #fetchFunction: typeof fetch = fetch.bind(globalThis); /** @@ -192,7 +191,6 @@ export class LemmyHttp { }, ) { this.#apiUrl = `${baseUrl.replace(/\/+$/, "")}/api/${VERSION}`; - this.#pictrsUrl = `${baseUrl}/pictrs/image`; if (options?.headers) { this.#headers = options.headers; @@ -1881,7 +1879,7 @@ export class LemmyHttp { ): Promise { const formData = createFormData(image); - const response = await this.#fetchFunction(this.#pictrsUrl, { + const response = await this.#fetchFunction("/api/v4/image", { ...options, method: HttpType.Post, body: formData as unknown as BodyInit, @@ -1901,7 +1899,7 @@ export class LemmyHttp { ): Promise { const formData = createFormData(image); - const response = await this.#fetchFunction(this.#pictrsUrl, { + const response = await this.#fetchFunction("/api/v4/account/avatar", { ...options, method: HttpType.Post, body: formData as unknown as BodyInit,