From c4339e64bd123e3b5caf598868e44dd1c1969f30 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Thu, 23 Jan 2025 15:28:16 +0100 Subject: [PATCH] chore: :arrow_up: Upgrade Bun to 1.2.0 --- .devcontainer/Dockerfile | 2 +- CHANGELOG.md | 2 +- Dockerfile | 2 +- Worker.Dockerfile | 2 +- classes/media/drivers/disk.test.ts | 3 +++ classes/media/drivers/disk.ts | 6 ++++++ docs/setup/installation.md | 8 ++++---- 7 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index afab3004..24027d88 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,5 @@ # Bun doesn't run well on Musl but this seems to work -FROM oven/bun:1.1.42-alpine as base +FROM oven/bun:1.2.0-alpine as base # Switch to Bash by editing /etc/passwd RUN apk add --no-cache libstdc++ git bash curl openssh cloc && \ diff --git a/CHANGELOG.md b/CHANGELOG.md index 61a2ecfe..4bb490e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ Versia Server `0.8.0` is fully backwards compatible with `0.7.0`. - Added an administration UI for managing the queue. - Media processing is now also handled by a queue system. - Added [Push Notifications](https://docs.joinmastodon.org/methods/push) support. -- Upgraded Bun to `1.1.42`. +- Upgraded Bun to `1.2.0`. - Implemented support for the [**Instance Messaging Extension**](https://versia.pub/extensions/instance-messaging) - Implement [**Shared Inboxes**](https://versia.pub/federation#inboxes) support. - Allowed `
` and `` tags in Markdown. diff --git a/Dockerfile b/Dockerfile index 13ab5cfd..7b6bec89 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,7 @@ RUN bun run build WORKDIR /temp/dist # Copy production dependencies and source code into final image -FROM oven/bun:1.1.42-alpine +FROM oven/bun:1.2.0-alpine # Install libstdc++ for Bun and create app directory RUN apk add --no-cache libstdc++ && \ diff --git a/Worker.Dockerfile b/Worker.Dockerfile index ca5b0d43..6202f333 100644 --- a/Worker.Dockerfile +++ b/Worker.Dockerfile @@ -26,7 +26,7 @@ RUN bun run build:worker WORKDIR /temp/dist # Copy production dependencies and source code into final image -FROM oven/bun:1.1.42-alpine +FROM oven/bun:1.2.0-alpine # Install libstdc++ for Bun and create app directory RUN apk add --no-cache libstdc++ && \ diff --git a/classes/media/drivers/disk.test.ts b/classes/media/drivers/disk.test.ts index c3aa4a63..60e15dab 100644 --- a/classes/media/drivers/disk.test.ts +++ b/classes/media/drivers/disk.test.ts @@ -29,6 +29,9 @@ describe("DiskMediaDriver", () => { media: { local_uploads_folder: "/test/uploads", }, + http: { + base_url: "http://localhost:3000", + }, } as Config; mockMediaHasher = mock(() => Promise.resolve("testhash")); diff --git a/classes/media/drivers/disk.ts b/classes/media/drivers/disk.ts index 4b8060b0..5e380ed1 100644 --- a/classes/media/drivers/disk.ts +++ b/classes/media/drivers/disk.ts @@ -80,6 +80,12 @@ export class DiskMediaDriver implements MediaDriver { */ public async deleteFileByUrl(url: string): Promise { const urlObj = new URL(url); + + // Check if URL is from the local uploads folder + if (urlObj.host !== new URL(this.config.http.base_url).host) { + return Promise.resolve(); + } + const hash = urlObj.pathname.split("/").at(-2); if (!hash) { throw new Error("Invalid URL"); diff --git a/docs/setup/installation.md b/docs/setup/installation.md index afd8ef95..509b8382 100644 --- a/docs/setup/installation.md +++ b/docs/setup/installation.md @@ -2,15 +2,15 @@ ## Requirements -- The [Bun Runtime](https://bun.sh), version 1.1.25 or later (usage of the latest version is recommended) - - Versia Server will not work on lower versions than 1.1.25. +- The [Bun Runtime](https://bun.sh), version 1.2.0 or later (usage of the latest version is recommended) + - Versia Server will not work on lower versions than 1.2.0. - A PostgreSQL database - (Optional but recommended) A Linux-based operating system - (Optional if you want search) A working [Sonic](https://github.com/valeriansaliou/sonic) instance > [!WARNING] > Versia Server has not been tested on Windows or macOS. It is recommended to use a Linux-based operating system to run Versia Server. -> +> > We will not be offering support to Windows or macOS users. If you are using one of these operating systems, please use a virtual machine or container to run Versia Server. ## With Docker/Podman @@ -92,4 +92,4 @@ Updating the server is as simple as pulling the latest changes from the reposito For Docker, you can run `docker-compose pull` to update the Docker images. -Sometimes, new configuration options are added to `config.example.toml`. If you see a new option in the example file, you should add it to your `config.toml` file. \ No newline at end of file +Sometimes, new configuration options are added to `config.example.toml`. If you see a new option in the example file, you should add it to your `config.toml` file.