mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-10 04:32:35 +01:00
Use localhost:3001 as fallback when cdn endpoints are null rather than 3003
This commit is contained in:
parent
b82c6d672b
commit
08560d8655
@ -50,7 +50,7 @@ router.post(
|
|||||||
const path = `attachments/${channel_id}/${id}/${filename}`;
|
const path = `attachments/${channel_id}/${id}/${filename}`;
|
||||||
|
|
||||||
const endpoint =
|
const endpoint =
|
||||||
Config.get()?.cdn.endpointPublic || "http://localhost:3003";
|
Config.get()?.cdn.endpointPublic || "http://localhost:3001";
|
||||||
|
|
||||||
await storage.set(path, buffer);
|
await storage.set(path, buffer);
|
||||||
let width;
|
let width;
|
||||||
|
@ -63,7 +63,7 @@ router.post(
|
|||||||
|
|
||||||
const path = `avatars/${user_id}/${hash}`;
|
const path = `avatars/${user_id}/${hash}`;
|
||||||
const endpoint =
|
const endpoint =
|
||||||
Config.get().cdn.endpointPublic || "http://localhost:3003";
|
Config.get().cdn.endpointPublic || "http://localhost:3001";
|
||||||
|
|
||||||
await storage.set(path, buffer);
|
await storage.set(path, buffer);
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ router.post("/", multer.single("file"), async (req: Request, res: Response) => {
|
|||||||
if (ANIMATED_MIME_TYPES.includes(type.mime)) hash = `a_${hash}`; // animated icons have a_ infront of the hash
|
if (ANIMATED_MIME_TYPES.includes(type.mime)) hash = `a_${hash}`; // animated icons have a_ infront of the hash
|
||||||
|
|
||||||
const path = `guilds/${guild_id}/users/${user_id}/avatars/${hash}`;
|
const path = `guilds/${guild_id}/users/${user_id}/avatars/${hash}`;
|
||||||
const endpoint = Config.get().cdn.endpointPublic || "http://localhost:3003";
|
const endpoint = Config.get().cdn.endpointPublic || "http://localhost:3001";
|
||||||
|
|
||||||
await storage.set(path, buffer);
|
await storage.set(path, buffer);
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ router.post(
|
|||||||
|
|
||||||
const path = `role-icons/${role_id}/${hash}.png`;
|
const path = `role-icons/${role_id}/${hash}.png`;
|
||||||
const endpoint =
|
const endpoint =
|
||||||
Config.get().cdn.endpointPublic || "http://localhost:3003";
|
Config.get().cdn.endpointPublic || "http://localhost:3001";
|
||||||
|
|
||||||
await storage.set(path, buffer);
|
await storage.set(path, buffer);
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ export async function uploadFile(
|
|||||||
});
|
});
|
||||||
|
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${Config.get().cdn.endpointPrivate || "http://localhost:3003"}${path}`,
|
`${Config.get().cdn.endpointPrivate || "http://localhost:3001"}${path}`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
signature: Config.get().security.requestSignature,
|
signature: Config.get().security.requestSignature,
|
||||||
@ -75,7 +75,7 @@ export async function handleFile(
|
|||||||
|
|
||||||
export async function deleteFile(path: string) {
|
export async function deleteFile(path: string) {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${Config.get().cdn.endpointPrivate || "http://localhost:3003"}${path}`,
|
`${Config.get().cdn.endpointPrivate || "http://localhost:3001"}${path}`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
signature: Config.get().security.requestSignature,
|
signature: Config.get().security.requestSignature,
|
||||||
|
Loading…
Reference in New Issue
Block a user