From 771097d0370c298d08466e5276eaa47af4921346 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Mon, 19 Aug 2024 15:16:01 +0200 Subject: [PATCH] refactor: :truck: Begin rebranding to Versia Server --- .devcontainer/devcontainer.json | 2 +- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/config.workflow.toml | 16 +- .github/workflows/tests.yml | 8 +- .vscode/launch.json | 14 - CHANGELOG.md | 11 +- CONTRIBUTING.md | 22 +- Dockerfile | 6 +- README.md | 36 +- SECURITY.md | 6 +- bun.lockb | Bin 278228 -> 278228 bytes classes/functions/like.ts | 2 +- classes/functions/user.ts | 12 +- cli/commands/start.ts | 2 +- config/config.example.toml | 40 +- config/config.schema.json | 16 +- docker-compose.yml | 28 +- docs/api/emojis.md | 2 +- docs/api/federation.md | 2 +- docs/api/frontend.md | 10 +- docs/api/index.md | 4 +- docs/api/mastodon.md | 12 +- docs/api/moderation.md | 6 +- docs/cli.md | 8 +- docs/database.md | 4 +- docs/glitch-soc.md | 8 +- docs/installation.md | 8 +- .../migrations/0032_ambiguous_sue_storm.sql | 14 + drizzle/migrations/meta/0032_snapshot.json | 2126 +++++++++++++++++ drizzle/migrations/meta/_journal.json | 7 + drizzle/schema.ts | 10 +- flake.nix | 2 +- package.json | 4 +- packages/config-manager/config.type.ts | 16 +- packages/database-interface/attachment.ts | 4 +- packages/database-interface/emoji.ts | 6 +- packages/database-interface/instance.ts | 10 +- packages/database-interface/note.ts | 26 +- packages/database-interface/user.ts | 36 +- packages/glitch-server/main.ts | 8 +- packages/plugin-kit/package.json | 4 +- packages/plugin-kit/plugin.ts | 4 +- server/api/api/v1/custom_emojis/index.test.ts | 6 +- server/api/api/v1/emojis/:id/index.test.ts | 2 +- server/api/api/v1/emojis/index.test.ts | 4 +- .../v1/instance/extended_description.test.ts | 3 +- .../api/v1/instance/extended_description.ts | 2 +- server/api/api/v1/instance/index.ts | 4 +- server/api/api/v1/sso/index.ts | 2 +- server/api/api/v2/instance/index.ts | 2 +- server/api/oauth/sso/index.ts | 2 +- server/api/objects/:id/index.ts | 6 +- server/api/users/:uuid/inbox/index.ts | 2 +- server/api/users/:uuid/index.ts | 6 +- server/api/users/:uuid/outbox/index.ts | 2 +- server/api/well-known/lysand.ts | 4 +- server/api/well-known/nodeinfo/2.0/index.ts | 4 +- setup.ts | 4 +- 58 files changed, 2377 insertions(+), 242 deletions(-) delete mode 100644 .vscode/launch.json create mode 100644 drizzle/migrations/0032_ambiguous_sue_storm.sql create mode 100644 drizzle/migrations/meta/0032_snapshot.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 38501580..c4a2af66 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,5 @@ { - "name": "Lysand Dev Container", + "name": "versia Dev Container", "dockerFile": "Dockerfile", "runArgs": [ "-v", diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 333ead40..3a1cdb21 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -32,7 +32,7 @@ Please upload logs onto a service like [Pastebin](https://pastebin.com/) or [Has - OS: [e.g. Fedora 39] - Bun version - Postgres version -- Lysand commit ID or version +- versia Server commit ID or version ## Additional context diff --git a/.github/config.workflow.toml b/.github/config.workflow.toml index 01323099..052ada98 100644 --- a/.github/config.workflow.toml +++ b/.github/config.workflow.toml @@ -1,9 +1,9 @@ [database] host = "localhost" port = 5432 -username = "lysand" -password = "lysand" -database = "lysand" +username = "versia" +password = "versia" +database = "versia" [redis.queue] host = "localhost" @@ -38,7 +38,7 @@ rules = [ ] [oidc] -# Run Lysand with this value missing to generate a new key +# Run Versia with this value missing to generate a new key jwt_key = "MC4CAQAwBQYDK2VwBCIEID+H5n9PY3zVKZQcq4jrnE1IiRd2EWWr8ApuHUXmuOzl;MCowBQYDK2VwAyEAzenliNkgpXYsh3gXTnAoUWzlCPjIOppmAVx2DBlLsC8=" [http] @@ -79,7 +79,7 @@ convert_to = "webp" # access_key = "" # secret_access_key = "" # region = "us-west-2" -# bucket_name = "lysand" +# bucket_name = "versia" # public_url = "https://cdn.example.com" [validation] @@ -185,7 +185,7 @@ allowed_mime_types = [ [validation.challenges] # "Challenges" (aka captchas) are a way to verify that a user is human -# Lysand's challenges use no external services, and are Proof of Work based +# Versia Server's challenges use no external services, and are Proof of Work based # This means that they do not require any user interaction, instead # they require the user's computer to do a small amount of work enabled = true @@ -240,8 +240,8 @@ remove_media = [] # NOT IMPLEMENTED authorized_fetch = false [instance] -name = "Lysand" -description = "A test instance of Lysand" +name = "Versia" +description = "A test instance of Versia Server" # URL to your instance logo (jpg files should be renamed to jpeg) # logo = "" # URL to your instance banner (jpg files should be renamed to jpeg) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5031fbf5..9b6df4bf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,11 +16,11 @@ jobs: ports: - 5432:5432 env: - POSTGRES_DB: lysand - POSTGRES_USER: lysand - POSTGRES_PASSWORD: lysand + POSTGRES_DB: versia + POSTGRES_USER: versia + POSTGRES_PASSWORD: versia volumes: - - lysand-data:/var/lib/postgresql/data + - versia-data:/var/lib/postgresql/data options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 71c69319..00000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "configurations": [ - { - "type": "node", - "name": "vscode-jest-tests.v2.lysand", - "request": "launch", - "args": ["test", "${jest.testFile}"], - "cwd": "/home/jessew/Dev/lysand", - "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen", - "program": "/home/jessew/.bun/bin/bun" - } - ] -} diff --git a/CHANGELOG.md b/CHANGELOG.md index e183d58b..18e3f72b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,11 @@ -# `0.7.0` +# `0.7.0` (unreleased) + +> [!WARNING] +> This release marks the rename of the project from `Lysand` to `Versia`. ## Backwards Compatibility -Lysand Server `0.7.0` is backwards compatible with `0.6.0`. However, some new features may not be available to older clients. Notably, `lysand-fe` has had major improvements and will not work with `0.6.0`. +Versia Server `0.7.0` is backwards compatible with `0.6.0`. However, some new features may not be available to older clients. Notably, `versia-fe` has had major improvements and will not work with `0.6.0`. ## Features @@ -16,7 +19,7 @@ Lysand Server `0.7.0` is backwards compatible with `0.6.0`. However, some new fe - Added [**Roles API**](docs/api/roles.md). - Added [**Permissions API**](docs/api/roles.md) and enabled it for every route. - Added [**TOS and Privacy Policy**](docs/api/mastodon.md) endpoints. -- Added [**Challenge API**](docs/api/challenges.md). (basically CAPTCHAS). This can be enabled/disabled by administrators. No `lysand-fe` support yet. +- Added [**Challenge API**](docs/api/challenges.md). (basically CAPTCHAS). This can be enabled/disabled by administrators. No `versia-fe` support yet. - Added ability to refetch user data from remote instances. - Added ability to change the `username` of a user. ([Mastodon API extension](docs/api/mastodon.md)). - Added an endpoint to get a user by its username. @@ -24,7 +27,7 @@ Lysand Server `0.7.0` is backwards compatible with `0.6.0`. However, some new fe - Add option to never convert vector images to a raster format. - Refactor logging system to be more robust and easier to use. Logfiles are now automatically rotated. - Add support for HTTP proxies. -- Add support for serving Lysand over a Tor hidden service. +- Add support for serving Versia over a Tor hidden service. - Add global server error handler, to properly return 500 error messages to clients. - Sign all federation HTTP requests. - Add JSON schema for configuration file. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 77da428d..15b4afcc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,13 +1,13 @@ -# Contributing to Lysand +# Contributing to Versia > [!NOTE] > This document was authored by [@CPlusPatch](https://github.com/CPlusPatch). -Thank you for your interest in contributing to Lysand! We welcome contributions from everyone, regardless of their level of experience or expertise. +Thank you for your interest in contributing to Versia Server! We welcome contributions from everyone, regardless of their level of experience or expertise. # Tech Stack -Lysand is built using the following technologies: +Versia Server is built using the following technologies: - [Bun](https://bun.sh) - A JavaScript runtime similar to Node.js, but faster and with more features - [PostgreSQL](https://www.postgresql.org/) - A relational database @@ -51,19 +51,19 @@ To develop with HTTPS, you need to generate a self-signed certificate. We will u mkcert -install # You can change the domain to whatever you want, but it must resolve via /etc/hosts # *.localhost domains are automatically aliased to localhost by DNS -mkcert -key-file config/lysand.localhost-key.pem -cert-file config/lysand.localhost.pem lysand.localhost +mkcert -key-file config/versia.localhost-key.pem -cert-file config/versia.localhost.pem versia.localhost ``` 3. Edit the config: ```toml [http] -base_url = "https://lysand.localhost:9900" -bind = "lysand.localhost" +base_url = "https://versia.localhost:9900" +bind = "versia.localhost" bind_port = 9900 # Change the port to whatever you want [http.tls] enabled = true -key = "config/lysand.localhost-key.pem" -cert = "config/lysand.localhost.pem" +key = "config/versia.localhost-key.pem" +cert = "config/versia.localhost.pem" passphrase = "" ca = "" ``` @@ -134,7 +134,7 @@ To add tests for a route, create a `route_file_name.test.ts` file in the same di ### Writing documentation -Documentation for the Lysand protocol is available on [lysand.org](https://lysand.org/). If you are thinking of modifying the protocol, please make sure to send a pull request over there to get it approved and merged before you send your pull request here. +Documentation for the Versia protocol is available on [lysand.org](https://lysand.org/). If you are thinking of modifying the protocol, please make sure to send a pull request over there to get it approved and merged before you send your pull request here. This project should not need much documentation, but if you think that something needs to be documented, please add it to the README, docs or contribution guide. @@ -145,11 +145,11 @@ If you find a bug, please open an issue on GitHub. Please make sure to include t - The steps to reproduce the bug - The expected behavior - The actual behavior -- The version of Lysand you are using +- The version of Versia Server you are using - The version of Bun you are using - The version of PostgreSQL you are using - Your operating system and version # License -Lysand is licensed under the [AGPLv3 or later](https://www.gnu.org/licenses/agpl-3.0.en.html) license. By contributing to Lysand, you agree to license your contributions under the same license. \ No newline at end of file +Versia Server is licensed under the [AGPLv3 or later](https://www.gnu.org/licenses/agpl-3.0.en.html) license. By contributing to Versia, you agree to license your contributions under the same license. \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 92a08377..a8808dd6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,10 +37,10 @@ COPY entrypoint.sh /app LABEL org.opencontainers.image.authors="Gaspard Wierzbinski (https://cpluspatch.dev)" LABEL org.opencontainers.image.source="https://github.com/lysand-org/lysand" -LABEL org.opencontainers.image.vendor="Lysand Org" +LABEL org.opencontainers.image.vendor="Versia Pub" LABEL org.opencontainers.image.licenses="AGPL-3.0-or-later" -LABEL org.opencontainers.image.title="Lysand Server" -LABEL org.opencontainers.image.description="Lysand Server docker image" +LABEL org.opencontainers.image.title="Versia Server" +LABEL org.opencontainers.image.description="Versia Server Docker image" # Set current Git commit hash as an environment variable ARG GIT_COMMIT diff --git a/README.md b/README.md index 13146f91..161b61c7 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,30 @@

- Lysand Logo + Versia Logo

![Postgres](https://img.shields.io/badge/postgres-%23316192.svg?style=for-the-badge&logo=postgresql&logoColor=white) ![Bun](https://img.shields.io/badge/Bun-%23000000.svg?style=for-the-badge&logo=bun&logoColor=white) ![VS Code Insiders](https://img.shields.io/badge/VS%20Code%20Insiders-35b393.svg?style=for-the-badge&logo=visual-studio-code&logoColor=white) ![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge&logo=typescript&logoColor=white) ![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black) ![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa?style=for-the-badge)](code_of_conduct.md) ## What is this? -**Lysand Server** is a federated social network server based on the [Lysand](https://lysand.org) protocol. It is currently in beta phase, with basic federation and almost complete Mastodon API support. +**Versia Server** (formerly Lysand Server) is a federated social network server based on the [Versia](https://lysand.org) protocol. It is currently in beta phase, with basic federation and almost complete Mastodon API support. ### Goals -- **Privacy**: Lysand is designed to be as private as possible. Unnecessary data is not stored, and data that is stored is done so securely. -- **Configurability**: High configurability is a key feature of Lysand. Almost every aspect of the server can be configured to suit your needs. If you feel like something is missing, please open an issue. -- **Security**: Lysand is designed with security in mind. It is built with modern security practices and technologies, and is constantly updated to ensure the highest level of security. -- **Performance**: Efficiency and speed are a key focus of Lysand. The design is non-monolithic, and is built to be as fast as possible. -- **Mastodon API compatibility**: Lysand is designed to be compatible with the Mastodon API, with [`glitch-soc`](https://github.com/glitch-soc/mastodon) extensions. +- **Privacy**: Versia Server is designed to be as private as possible. Unnecessary data is not stored, and data that is stored is done so securely. +- **Configurability**: High configurability is a key feature of Versia Server. Almost every aspect of the server can be configured to suit your needs. If you feel like something is missing, please open an issue. +- **Security**: Versia Server is designed with security in mind. It is built with modern security practices and technologies, and is constantly updated to ensure the highest level of security. +- **Performance**: Efficiency and speed are a key focus of Versia Server. The design is non-monolithic, and is built to be as fast as possible. +- **Mastodon API compatibility**: Versia Server is designed to be compatible with the Mastodon API, with [`glitch-soc`](https://github.com/glitch-soc/mastodon) extensions. ### Anti-Goals - **Monolithic design**: Modularity and scaling is important to this project. This means that it is not a single, monolithic application, but rather a collection of smaller, more focused applications. (API layer, queue, database, frontend, etc.) -- **Complexity**: Both in code and in function, Lysand should be as simple as possible. This does not mean adding no features or functionality, but rather that the features and functionality that are added should be well-written and easy to understand. -- **Bloat**: Lysand should not be bloated with unnecessary features, packages, dependencies or code. It should be as lightweight as possible, while still being feature-rich. +- **Complexity**: Both in code and in function, Versia Server should be as simple as possible. This does not mean adding no features or functionality, but rather that the features and functionality that are added should be well-written and easy to understand. +- **Bloat**: Versia Server should not be bloated with unnecessary features, packages, dependencies or code. It should be as lightweight as possible, while still being feature-rich. ## Features -- [x] Fully compliant Lysand 3.0 federation (partial) +- [x] Versia 3.0 federation (partial) - [x] Hyper fast (thousands of HTTP requests per second) - [x] S3 or local media storage - [x] Deduplication of uploaded files @@ -56,11 +56,11 @@ ## Screenshots -You can visit [social.lysand.org](https://social.lysand.org) to see a live instance of Lysand with Lysand-FE. +You can visit [social.lysand.org](https://social.lysand.org) to see a live instance of Versia Server with Versia-FE. ## How do I run it? -Please see the [installation guide](docs/installation.md) for more information on how to install Lysand. +Please see the [installation guide](docs/installation.md) for more information on how to install Versia. ## Contributing @@ -69,13 +69,13 @@ Contributions are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) fil ## Federation The following extensions are currently supported or being worked on: -- `org.lysand:custom_emojis`: Custom emojis -- `org.lysand:polls`: Polls -- `org.lysand:microblogging`: Microblogging +- `pub.versia:custom_emojis`: Custom emojis +- `pub.versia:polls`: Polls +- `pub.versia:share`: Share ## API -Lysand implements the Mastodon API (as well as `glitch-soc` extensions). The API is currently almost fully complete, with some fringe functionality still being worked on. +Versia Server implements the Mastodon API (as well as `glitch-soc` extensions). The API is currently almost fully complete, with some fringe functionality still being worked on. Working endpoints are: @@ -206,9 +206,9 @@ Working endpoints are: - [ ] Reports - [ ] Admin API -## Lysand API +## Versia Server API -For Lysand's own custom API, please see the [API documentation](docs/api/index.md). +For Versia Server's own custom API, please see the [API documentation](docs/api/index.md). ## License diff --git a/SECURITY.md b/SECURITY.md index 852741a7..05c6b38f 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,7 +2,7 @@ ## Supported Versions -For now, only the released latest version of Lysand is supported for security updates. This will change as Lysand exits alpha status. +For now, only the released latest version of Veraia Server is supported for security updates. This will change as Versia Server exits alpha status. ## Reporting a Vulnerability @@ -15,8 +15,8 @@ Please do not report vulnerabilities publicly until they have been patched. If y ## Vulnerability Disclosure Policy -Lysand is an open-source project, and as such, we welcome security researchers to audit our code and report vulnerabilities. We will do our best to patch vulnerabilities as quickly as possible, and will credit researchers for their discoveries if they wish to be credited. +Versia Server is an open-source project, and as such, we welcome security researchers to audit our code and report vulnerabilities. We will do our best to patch vulnerabilities as quickly as possible, and will credit researchers for their discoveries if they wish to be credited. For security reasons, we ask that you do not publicly disclose vulnerabilities until they have been patched. We will do our best to patch vulnerabilities as quickly as possible, and will credit researchers for their discoveries if they wish to be credited. -Thank you for helping to keep Lysand secure! :3 \ No newline at end of file +Thank you for helping to keep Versia Server secure! :3 \ No newline at end of file diff --git a/bun.lockb b/bun.lockb index 8fc138740f1932455f9dc830776e6354a0d6ac4d..07970ec5579d8ea80f30a355b796bd089034659f 100755 GIT binary patch delta 124 zcmcceSK!KDfeCsFM;*T8hGnqqY^kmMqMR4@^>~_;$~<+^IX{*hJ{o#aXTe6lA}tPI z_7azxv#I}@PiVED&|=(vLW^m}EV$_QjH66CGug^gi;6Q7x6g`Wwz~(HoBqItWd)qK KeS$5E3nKt0T{m9< delta 124 zcmcceSK!KDfeCsFD{mfWFc#w2wdMQXC1;y|tK8}^Ub?jZaasOB`)SeJ3u-s|6=`wI z*qX7b$z}fc<`Y`&C$t#1pU`5OF$*rbJ>w{o&P=wP%HqVll; /** * Represents a Like entity in the database. */ -export const likeToLysand = (like: LikeType): Like => { +export const likeToVersia = (like: LikeType): Like => { return { id: like.id, // biome-ignore lint/suspicious/noExplicitAny: to be rewritten diff --git a/classes/functions/user.ts b/classes/functions/user.ts index c22429b4..271301f7 100644 --- a/classes/functions/user.ts +++ b/classes/functions/user.ts @@ -114,14 +114,14 @@ export const getFromHeader = async (value: string): Promise => { export const sendFollowAccept = async (follower: User, followee: User) => { await follower.federateToUser( - followAcceptToLysand(follower, followee), + followAcceptToVersia(follower, followee), followee, ); }; export const sendFollowReject = async (follower: User, followee: User) => { await follower.federateToUser( - followRejectToLysand(follower, followee), + followRejectToVersia(follower, followee), followee, ); }; @@ -258,7 +258,7 @@ export const retrieveToken = async ( ); }; -export const followRequestToLysand = ( +export const followRequestToVersia = ( follower: User, followee: User, ): Follow => { @@ -286,7 +286,7 @@ export const followRequestToLysand = ( }; }; -export const followAcceptToLysand = ( +export const followAcceptToVersia = ( follower: User, followee: User, ): FollowAccept => { @@ -314,12 +314,12 @@ export const followAcceptToLysand = ( }; }; -export const followRejectToLysand = ( +export const followRejectToVersia = ( follower: User, followee: User, ): FollowReject => { return { - ...followAcceptToLysand(follower, followee), + ...followAcceptToVersia(follower, followee), type: "FollowReject", }; }; diff --git a/cli/commands/start.ts b/cli/commands/start.ts index 1149ea15..0f6124ae 100644 --- a/cli/commands/start.ts +++ b/cli/commands/start.ts @@ -5,7 +5,7 @@ import { BaseCommand } from "~/cli/base"; export default class Start extends BaseCommand { static override args = {}; - static override description = "Starts Lysand"; + static override description = "Starts Versia Server"; static override examples = [ "<%= config.bin %> <%= command.id %> --threads 4", diff --git a/config/config.example.toml b/config/config.example.toml index 1235a4d1..910752bd 100644 --- a/config/config.example.toml +++ b/config/config.example.toml @@ -1,4 +1,4 @@ -# This schema always follows the latest dev version of Lysand, which may not be what you want +# This schema always follows the latest dev version of Versia Server, which may not be what you want # Change the URL to the commit/tag you are using #:schema https://raw.githubusercontent.com/lysand-org/lysand/main/config/config.schema.json @@ -6,9 +6,9 @@ # Main PostgreSQL database connection host = "localhost" port = 5432 -username = "lysand" +username = "versia" password = "mycoolpassword" -database = "lysand" +database = "versia" [redis.queue] # Redis instance for storing the federation queue @@ -46,10 +46,10 @@ rules = [ ] [oidc] -# Run Lysand with this value missing to generate a new key +# Run Versia Server with this value missing to generate a new key jwt_key = "" -# If enabled, Lysand will require users to log in with an OAuth provider +# If enabled, Versia Server will require users to log in with an OAuth provider forced = false # Allow registration with OAuth providers @@ -67,16 +67,16 @@ allow_registration = true # name = "CPlusPatch ID" # id = "cpluspatch-id" # This MUST match the provider's issuer URI, including the trailing slash (or lack thereof) -# url = "https://id.cpluspatch.com/application/o/lysand-testing/" +# url = "https://id.cpluspatch.com/application/o/versia-testing/" # client_id = "XXXX" # client_secret = "XXXXX" # icon = "https://cpluspatch.com/images/icons/logo.svg" [http] -# The full URL Lysand will be reachable by (paths are not supported) -base_url = "https://lysand.localhost:9900" +# The full URL Versia Server will be reachable by (paths are not supported) +base_url = "https://versia.localhost:9900" # Address to bind to (0.0.0.0 is suggested for proxies) -bind = "lysand.localhost" +bind = "versia.localhost" bind_port = 9900 # Bans IPv4 or IPv6 IPs (wildcards, networks and ranges are supported) @@ -94,7 +94,7 @@ enabled = false address = "http://localhost:8118" [http.tls] -# If these values are set, Lysand will use these files for TLS +# If these values are set, Versia Server will use these files for TLS enabled = false key = "" cert = "" @@ -104,7 +104,7 @@ ca = "" [http.bait] # Enable the bait feature (sends fake data to those who are flagged) enabled = false -# Path to file of bait data (if not provided, Lysand will send the entire Bee Movie script) +# Path to file of bait data (if not provided, Versia Server will send the entire Bee Movie script) send_file = "" # IPs to send bait data to (wildcards, networks and ranges are supported) bait_ips = ["127.0.0.1", "::1"] @@ -112,15 +112,15 @@ bait_ips = ["127.0.0.1", "::1"] bait_user_agents = ["curl", "wget"] [frontend] -# Enable custom frontends (warning: not enabling this or Glitch will make Lysand only accessible via the Mastodon API) +# Enable custom frontends (warning: not enabling this or Glitch will make Versia Server only accessible via the Mastodon API) # Frontends also control the OAuth flow, so if you disable this, you will need to use the Mastodon frontend enabled = true # The URL to reach the frontend at (should be on a local network) url = "http://localhost:3000" [frontend.routes] -# Special routes for your frontend, below are the defaults for Lysand-FE -# Can be set to a route already used by Lysand, as long as it is on a different HTTP method +# Special routes for your frontend, below are the defaults for Versia-FE +# Can be set to a route already used by Versia Server, as long as it is on a different HTTP method # e.g. /oauth/authorize is a POST-only route, so you can serve a GET route at /oauth/authorize # home = "/" # login = "/oauth/authorize" @@ -179,7 +179,7 @@ convert_vector = false # access_key = "XXXXX" # secret_access_key = "XXX" # region = "" -# bucket_name = "lysand" +# bucket_name = "versia" # public_url = "https://cdn.example.com" [validation] @@ -263,7 +263,7 @@ enforce_mime_types = false [validation.challenges] # "Challenges" (aka captchas) are a way to verify that a user is human -# Lysand's challenges use no external services, and are Proof of Work based +# Versia Server's challenges use no external services, and are Proof of Work based # This means that they do not require any user interaction, instead # they require the user's computer to do a small amount of work enabled = false @@ -312,7 +312,7 @@ banners = [] avatars = [] # For bridge software, such as lysand-org/activitypub -# Bridges must be hosted separately from the main Lysand process +# Bridges must be hosted separately from the main Versia Server process [federation.bridge] enabled = false # Only lysand-ap exists for now @@ -323,11 +323,11 @@ allowed_ips = ["192.168.1.0/24"] # Token for the bridge software # Bridge must have the same token! token = "mycooltoken" -url = "https://ap.lysand.org" +url = "https://ap.versia.social" [instance] -name = "Lysand" -description = "A Lysand instance" +name = "Versia" +description = "A Versia Server instance" # Path to a file containing a longer description of your instance # This will be parsed as Markdown # extended_description_path = "config/extended_description.md" diff --git a/config/config.schema.json b/config/config.schema.json index b2c8649d..ffafadef 100644 --- a/config/config.schema.json +++ b/config/config.schema.json @@ -26,7 +26,7 @@ "database": { "type": "string", "minLength": 1, - "default": "lysand" + "default": "versia" } }, "required": ["username"], @@ -228,7 +228,7 @@ "base_url": { "type": "string", "minLength": 1, - "default": "http://lysand.social" + "default": "http://versia.social" }, "bind": { "type": "string", @@ -548,7 +548,7 @@ }, "bucket_name": { "type": "string", - "default": "lysand" + "default": "versia" }, "public_url": { "$ref": "#/properties/http/properties/proxy/properties/address/anyOf/0" @@ -565,7 +565,7 @@ "endpoint": "", "access_key": "", "secret_access_key": "", - "bucket_name": "lysand", + "bucket_name": "versia", "public_url": "https://cdn.example.com" } }, @@ -3375,12 +3375,12 @@ "name": { "type": "string", "minLength": 1, - "default": "Lysand" + "default": "Versia" }, "description": { "type": "string", "minLength": 1, - "default": "A Lysand instance" + "default": "A Versia instance" }, "extended_description_path": { "type": "string" @@ -3437,8 +3437,8 @@ }, "additionalProperties": false, "default": { - "name": "Lysand", - "description": "A Lysand instance", + "name": "Versia", + "description": "A Versia instance", "keys": { "public": "", "private": "" diff --git a/docker-compose.yml b/docker-compose.yml index eaeba5dc..de629888 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,5 @@ services: - lysand: + versia: image: ghcr.io/lysand-org/lysand:latest volumes: - ./logs:/app/dist/logs @@ -7,10 +7,10 @@ services: - ./uploads:/app/dist/uploads - ./glitch:/app/dist/glitch restart: unless-stopped - container_name: lysand + container_name: versia command: "cli start --all-threads" networks: - - lysand-net + - versia-net depends_on: - db - redis @@ -19,44 +19,44 @@ services: fe: image: ghcr.io/lysand-org/lysand-fe:main - container_name: lysand-fe + container_name: versia-fe restart: unless-stopped networks: - - lysand-net + - versia-net environment: NUXT_PUBLIC_API_HOST: https://yourserver.com db: image: ghcr.io/lysand-org/postgres:main - container_name: lysand-db + container_name: versia-db restart: unless-stopped environment: - POSTGRES_DB: lysand - POSTGRES_USER: lysand + POSTGRES_DB: versia + POSTGRES_USER: versia POSTGRES_PASSWORD: _______________ networks: - - lysand-net + - versia-net volumes: - ./db-data:/var/lib/postgresql/data redis: image: redis:alpine - container_name: lysand-redis + container_name: versia-redis volumes: - ./redis-data:/data restart: unless-stopped networks: - - lysand-net + - versia-net sonic: volumes: - ./config.cfg:/etc/sonic.cfg - ./store/:/var/lib/sonic/store/ image: valeriansaliou/sonic:v1.4.9 - container_name: lysand-sonic + container_name: versia-sonic restart: unless-stopped networks: - - lysand-net + - versia-net networks: - lysand-net: \ No newline at end of file + versia-net: \ No newline at end of file diff --git a/docs/api/emojis.md b/docs/api/emojis.md index 1261cdfa..4374eaec 100644 --- a/docs/api/emojis.md +++ b/docs/api/emojis.md @@ -1,6 +1,6 @@ # Emoji API -An Emoji API is made available to users to manage custom emoji on the instance. We recommend using Lysand's CLI to manage emoji, but this API is available for those who prefer to use it (both admin and non-admin users). +An Emoji API is made available to users to manage custom emoji on the instance. We recommend using Versia Server's CLI to manage emoji, but this API is available for those who prefer to use it (both admin and non-admin users). ## Create Emoji diff --git a/docs/api/federation.md b/docs/api/federation.md index eef6b6d9..9e54cdf7 100644 --- a/docs/api/federation.md +++ b/docs/api/federation.md @@ -1,6 +1,6 @@ # Federation API -The Federation API contains a variety of endpoints for interacting with the Lysand remote network. +The Federation API contains a variety of endpoints for interacting with the Versia Server remote network. ## Refetch User diff --git a/docs/api/frontend.md b/docs/api/frontend.md index d704c212..e272ce9e 100644 --- a/docs/api/frontend.md +++ b/docs/api/frontend.md @@ -1,10 +1,10 @@ # Frontend API -The frontend API contains endpoints that are useful for frontend developers. These endpoints are not part of the Mastodon API, but are specific to Lysand. +The frontend API contains endpoints that are useful for frontend developers. These endpoints are not part of the Mastodon API, but are specific to Versia Server. ## Routes that the Frontend must implement -These routes can be set to a different URL in the Lysand configuration, at `frontend.routes`. The frontend must implement these routes for the instance to function correctly. +These routes can be set to a different URL in the Versia Server configuration, at `frontend.routes`. The frontend must implement these routes for the instance to function correctly. - `GET /oauth/authorize`: (NOT `POST`): Identifier/password login form, submits to [`POST /api/auth/login`](#sign-in) or OpenID Connect flow. - `GET /oauth/consent`: Consent form, submits to [`POST /api/auth/redirect`](#consent) @@ -15,7 +15,7 @@ These routes can be set to a different URL in the Lysand configuration, at `fron GET /api/v1/frontend/config ``` -Retrieves the frontend configuration for the instance. This returns whatever the `frontend.settings` object is set to in the Lysand configuration. +Retrieves the frontend configuration for the instance. This returns whatever the `frontend.settings` object is set to in the Versia Server configuration. This behaves like the `/api/v1/preferences` endpoint in the Mastodon API, but is specific to the frontend. These values are arbitrary and can be used for anything. @@ -23,8 +23,8 @@ For example, the frontend configuration could contain the following: ```json { - "org.lysand.fe:theme": "dark", - "org.lysand.fe:custom_css": "body { background-color: black; }", + "pub.versia.fe:theme": "dark", + "pub.versia.fe:custom_css": "body { background-color: black; }", // Googly is an imaginary frontend that uses the `net.googly.frontend` namespace "net.googly.frontend:spoiler_image": "https://example.com/spoiler.png" } diff --git a/docs/api/index.md b/docs/api/index.md index e8f653f2..f24c5c40 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -1,6 +1,6 @@ -# Lysand API Documentation +# Versia Server API Documentation -The Lysand API strictly follows the latest available Mastodon API version (Glitch-Soc version). This means that the Lysand API is a superset of the Mastodon API, with additional endpoints and features. +The Versia Server API strictly follows the latest available Mastodon API version (Glitch-Soc version). This means that the Versia Server API is a superset of the Mastodon API, with additional endpoints and features. Some more information about the Mastodon API can be found in the [Mastodon API documentation](https://docs.joinmastodon.org/api/). diff --git a/docs/api/mastodon.md b/docs/api/mastodon.md index 9e633a1e..5dbc0799 100644 --- a/docs/api/mastodon.md +++ b/docs/api/mastodon.md @@ -10,7 +10,7 @@ Three extra attributes have been added to the `/api/v1/instance` endpoint: { // ... banner: string | null; - lysand_version: string; + versia_version: string; sso: { forced: boolean; providers: { @@ -26,9 +26,9 @@ Three extra attributes have been added to the `/api/v1/instance` endpoint: The URL of the instance's banner image. `null` if there is no banner set. -### `lysand_version` +### `versia_version` -The version of the Lysand instance. +The version of the Versia Server instance. The normal `version` field is always set to `"4.3.0+glitch"` or similar, to not confuse clients that expect a Mastodon instance. @@ -55,18 +55,18 @@ Two extra attributes has been adding to all returned account objects: ```ts { // ... - roles: LysandRoles[]; + roles: VersiaRoles[]; uri: string; } ``` ### `roles` -An array of roles from [Lysand Roles](./roles.md). +An array of roles from [Versia Server Roles](./roles.md). ### `uri` -The URI of the account's Lysand object (for federation). Similar to Mastodon's `uri` field on notes. +The URI of the account's Versia object (for federation). Similar to Mastodon's `uri` field on notes. ## `/api/v1/accounts/update_credentials` diff --git a/docs/api/moderation.md b/docs/api/moderation.md index 7b8edebb..e4603b5b 100644 --- a/docs/api/moderation.md +++ b/docs/api/moderation.md @@ -3,11 +3,11 @@ > [!WARNING] > **NOT IMPLEMENTED** -The Lysand project uses the Mastodon API to interact with clients. However, the moderation API is custom-made for Lysand Server, as it allows for more fine-grained control over the server's behavior. +The Versia Server project uses the Mastodon API to interact with clients. However, the moderation API is custom-made for Versia Server Server, as it allows for more fine-grained control over the server's behavior. ## Flags, ModTags and ModNotes -Flags are used by Lysand Server to automatically attribute tags to a status or account based on rules. ModTags and ModNotes are used by moderators to manually tag and take notes on statuses and accounts. +Flags are used by Versia Server Server to automatically attribute tags to a status or account based on rules. ModTags and ModNotes are used by moderators to manually tag and take notes on statuses and accounts. The difference between flags and modtags is that flags are automatically attributed by the server, while modtags are manually attributed by moderators. @@ -22,7 +22,7 @@ The difference between flags and modtags is that flags are automatically attribu ### ModTag Types -ModTag do not have set types and can be anything. Lysand Server autosuggest previously used tags when a moderator is adding a new tag to avoid duplicates. +ModTag do not have set types and can be anything. Versia Server Server autosuggest previously used tags when a moderator is adding a new tag to avoid duplicates. ### Data Format diff --git a/docs/cli.md b/docs/cli.md index 7675c15e..332ae782 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -1,10 +1,10 @@ -# Lysand CLI +# Versia Server CLI -Lysand includes a built-in, scripting-compatible CLI that can be used to manage the server. This CLI can be used to create and delete users, manage the database and more. It can also output data in JSON or CSV format, making it easy to use in scripts. +Versia Server includes a built-in, scripting-compatible CLI that can be used to manage the server. This CLI can be used to create and delete users, manage the database and more. It can also output data in JSON or CSV format, making it easy to use in scripts. ## Using the CLI -Lysand includes a built-in CLI for managing the server. To use it, simply run the following command: +Versia Server includes a built-in CLI for managing the server. To use it, simply run the following command: ```bash # Development @@ -12,7 +12,7 @@ bun cli help # Source installs bun run dist/cli.js help # Docker -docker compose exec -it lysand /bin/sh /app/entrypoint.sh cli help +docker compose exec -it versia /bin/sh /app/entrypoint.sh cli help ``` You can use the `help` command to see a list of available commands. These include creating users, deleting users and more. Each command also has a `--help,-h` flag that you can use to see more information about the command. diff --git a/docs/database.md b/docs/database.md index 47bb84cc..b3ef671a 100644 --- a/docs/database.md +++ b/docs/database.md @@ -1,7 +1,7 @@ # Installing the database -Lysand uses a special PostgreSQL extension called `pg_uuidv7` to generate UUIDs. This extension is required for Lysand to work properly. To install it, you can either use the pre-made Docker image or install it manually. +Versia Server uses a special PostgreSQL extension called `pg_uuidv7` to generate UUIDs. This extension is required for Versia Server to work properly. To install it, you can either use the pre-made Docker image or install it manually. ## Using the Docker image -Lysand offers a pre-made Docker image for PostgreSQL with the extension already installed. Use `ghcr.io/lysand-org/postgres:main` as your Docker image name to use it. \ No newline at end of file +Versia Server offers a pre-made Docker image for PostgreSQL with the extension already installed. Use `ghcr.io/lysand-org/postgres:main` as your Docker image name to use it. \ No newline at end of file diff --git a/docs/glitch-soc.md b/docs/glitch-soc.md index 29f0995a..06ec2135 100644 --- a/docs/glitch-soc.md +++ b/docs/glitch-soc.md @@ -1,8 +1,8 @@ # Enabling Glitch-Soc -Lysand supports the use of the Glitch-Soc fork of Mastodon's frontend. Here's how to do it: +Versia Server supports the use of the Glitch-Soc fork of Mastodon's frontend. Here's how to do it: -1. Download the latest Glitch FE package from [the releases page](https://github.com/lysand-org/lysand/releases) (it should be named `glitch.tar.gz` and be inside the assets of a normal Lysand release). +1. Download the latest Glitch FE package from [the releases page](https://github.com/lysand-org/lysand/releases) (it should be named `glitch.tar.gz` and be inside the assets of a normal Versia Server release). 2. Extract the contents of the package into a folder, which you can name `glitch` for simplicity. (if using Docker, now is the time to mount that folder into the container, for example with `-v /path/to/glitch:/app/dist/glitch`) 3. Change the config to enable Glitch-FE: ```toml @@ -22,7 +22,7 @@ Lysand supports the use of the Glitch-Soc fork of Mastodon's frontend. Here's ho server = ["https://tech.lgbt"] ``` The `server` option can be left as-is, unless you have downloaded your own `index.html` file from a different Glitch instance. -4. Start Lysand and navigate to `/` to see the Glitch frontend in action. +4. Start Versia Server and navigate to `/` to see the Glitch frontend in action. ## How is this package created? @@ -32,6 +32,6 @@ The package static files were taken from a build of Glitch-Soc, while the index. Then, the paths in the `index.html` file were replaced with the correct paths for the static files (as they have different hashes in their names from the ones in the Glitch-Soc build). -At runtime, Lysand dynamically edits the index.html file to replace the content with correct data, as well as disabling `integrity` checks on the script/link tags. +At runtime, Versia Server dynamically edits the index.html file to replace the content with correct data, as well as disabling `integrity` checks on the script/link tags. In the future, I'll find a way to make this less hacky and more user-friendly, but for now, this is the best I can do. \ No newline at end of file diff --git a/docs/installation.md b/docs/installation.md index b6a1d366..0130639d 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -3,19 +3,19 @@ ## Requirements - The [Bun Runtime](https://bun.sh), version 1.1.24 or later (usage of the latest version is recommended) - - Lysand will work on lower versions than 1.1.24, but only the latest version is supported + - Versia Server will work on lower versions than 1.1.24, but only the latest version is supported - 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] -> Lysand has not been tested on Windows or macOS. It is recommended to use a Linux-based operating system to run Lysand. +> Versia Server has not been tested on Windows or macOS. It is recommended to use a Linux-based operating system to run LysVersia Serverand. > -> 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 Lysand. +> 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 -Docker is the recommended way to run Lysand (Podman also works). To run Lysand with Docker, follow these steps: +Docker is the recommended way to run Versia Server (Podman also works). To run Versia Server with Docker, follow these steps: 1. Download the `docker-compose.yml` file from the repository diff --git a/drizzle/migrations/0032_ambiguous_sue_storm.sql b/drizzle/migrations/0032_ambiguous_sue_storm.sql new file mode 100644 index 00000000..aa852948 --- /dev/null +++ b/drizzle/migrations/0032_ambiguous_sue_storm.sql @@ -0,0 +1,14 @@ +ALTER TABLE "LysandObject" RENAME TO "VersiaObject";--> statement-breakpoint +ALTER TABLE "VersiaObject" DROP CONSTRAINT "LysandObject_authorId_LysandObject_id_fk"; +--> statement-breakpoint +DROP INDEX IF EXISTS "LysandObject_remote_id_index";--> statement-breakpoint +DROP INDEX IF EXISTS "LysandObject_uri_index";--> statement-breakpoint +ALTER TABLE "Instances" ALTER COLUMN "protocol" SET DEFAULT 'versia';--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "VersiaObject" ADD CONSTRAINT "VersiaObject_authorId_VersiaObject_id_fk" FOREIGN KEY ("authorId") REFERENCES "public"."VersiaObject"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "VersiaObject_remote_id_index" ON "VersiaObject" USING btree ("remote_id");--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "VersiaObject_uri_index" ON "VersiaObject" USING btree ("uri"); \ No newline at end of file diff --git a/drizzle/migrations/meta/0032_snapshot.json b/drizzle/migrations/meta/0032_snapshot.json new file mode 100644 index 00000000..d7850c90 --- /dev/null +++ b/drizzle/migrations/meta/0032_snapshot.json @@ -0,0 +1,2126 @@ +{ + "id": "0066d399-ea8e-481c-86d8-7f44b81ed808", + "prevId": "93c2cedf-461e-4534-96ec-570c8f6af4fd", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.Applications": { + "name": "Applications", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "website": { + "name": "website", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vapid_key": { + "name": "vapid_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret": { + "name": "secret", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scopes": { + "name": "scopes", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "redirect_uri": { + "name": "redirect_uri", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "Applications_client_id_index": { + "name": "Applications_client_id_index", + "columns": [ + { + "expression": "client_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.Attachments": { + "name": "Attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remote_url": { + "name": "remote_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "thumbnail_url": { + "name": "thumbnail_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "blurhash": { + "name": "blurhash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "fps": { + "name": "fps", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "duration": { + "name": "duration", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "width": { + "name": "width", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "height": { + "name": "height", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "noteId": { + "name": "noteId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Attachments_noteId_Notes_id_fk": { + "name": "Attachments_noteId_Notes_id_fk", + "tableFrom": "Attachments", + "tableTo": "Notes", + "columnsFrom": ["noteId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.Challenges": { + "name": "Challenges", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "challenge": { + "name": "challenge", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "NOW() + INTERVAL '5 minutes'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.EmojiToNote": { + "name": "EmojiToNote", + "schema": "", + "columns": { + "emojiId": { + "name": "emojiId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "noteId": { + "name": "noteId", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "EmojiToNote_emojiId_noteId_index": { + "name": "EmojiToNote_emojiId_noteId_index", + "columns": [ + { + "expression": "emojiId", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "noteId", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "EmojiToNote_noteId_index": { + "name": "EmojiToNote_noteId_index", + "columns": [ + { + "expression": "noteId", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "EmojiToNote_emojiId_Emojis_id_fk": { + "name": "EmojiToNote_emojiId_Emojis_id_fk", + "tableFrom": "EmojiToNote", + "tableTo": "Emojis", + "columnsFrom": ["emojiId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "EmojiToNote_noteId_Notes_id_fk": { + "name": "EmojiToNote_noteId_Notes_id_fk", + "tableFrom": "EmojiToNote", + "tableTo": "Notes", + "columnsFrom": ["noteId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.EmojiToUser": { + "name": "EmojiToUser", + "schema": "", + "columns": { + "emojiId": { + "name": "emojiId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "EmojiToUser_emojiId_userId_index": { + "name": "EmojiToUser_emojiId_userId_index", + "columns": [ + { + "expression": "emojiId", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "userId", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "EmojiToUser_userId_index": { + "name": "EmojiToUser_userId_index", + "columns": [ + { + "expression": "userId", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "EmojiToUser_emojiId_Emojis_id_fk": { + "name": "EmojiToUser_emojiId_Emojis_id_fk", + "tableFrom": "EmojiToUser", + "tableTo": "Emojis", + "columnsFrom": ["emojiId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "EmojiToUser_userId_Users_id_fk": { + "name": "EmojiToUser_userId_Users_id_fk", + "tableFrom": "EmojiToUser", + "tableTo": "Users", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.Emojis": { + "name": "Emojis", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "shortcode": { + "name": "shortcode", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "visible_in_picker": { + "name": "visible_in_picker", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "alt": { + "name": "alt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "instanceId": { + "name": "instanceId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "ownerId": { + "name": "ownerId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "category": { + "name": "category", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Emojis_instanceId_Instances_id_fk": { + "name": "Emojis_instanceId_Instances_id_fk", + "tableFrom": "Emojis", + "tableTo": "Instances", + "columnsFrom": ["instanceId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Emojis_ownerId_Users_id_fk": { + "name": "Emojis_ownerId_Users_id_fk", + "tableFrom": "Emojis", + "tableTo": "Users", + "columnsFrom": ["ownerId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.FilterKeywords": { + "name": "FilterKeywords", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "filterId": { + "name": "filterId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "keyword": { + "name": "keyword", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "whole_word": { + "name": "whole_word", + "type": "boolean", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "FilterKeywords_filterId_Filters_id_fk": { + "name": "FilterKeywords_filterId_Filters_id_fk", + "tableFrom": "FilterKeywords", + "tableTo": "Filters", + "columnsFrom": ["filterId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.Filters": { + "name": "Filters", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "context": { + "name": "context", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "filter_action": { + "name": "filter_action", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "Filters_userId_Users_id_fk": { + "name": "Filters_userId_Users_id_fk", + "tableFrom": "Filters", + "tableTo": "Users", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.Flags": { + "name": "Flags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "flag_type": { + "name": "flag_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'other'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "noteId": { + "name": "noteId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Flags_noteId_Notes_id_fk": { + "name": "Flags_noteId_Notes_id_fk", + "tableFrom": "Flags", + "tableTo": "Notes", + "columnsFrom": ["noteId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Flags_userId_Users_id_fk": { + "name": "Flags_userId_Users_id_fk", + "tableFrom": "Flags", + "tableTo": "Users", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.Instances": { + "name": "Instances", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "base_url": { + "name": "base_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "logo": { + "name": "logo", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "disable_automoderation": { + "name": "disable_automoderation", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "protocol": { + "name": "protocol", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'versia'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.Likes": { + "name": "Likes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "likerId": { + "name": "likerId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "likedId": { + "name": "likedId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "Likes_likerId_Users_id_fk": { + "name": "Likes_likerId_Users_id_fk", + "tableFrom": "Likes", + "tableTo": "Users", + "columnsFrom": ["likerId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Likes_likedId_Notes_id_fk": { + "name": "Likes_likedId_Notes_id_fk", + "tableFrom": "Likes", + "tableTo": "Notes", + "columnsFrom": ["likedId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.Markers": { + "name": "Markers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "noteId": { + "name": "noteId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "notificationId": { + "name": "notificationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "timeline": { + "name": "timeline", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "Markers_noteId_Notes_id_fk": { + "name": "Markers_noteId_Notes_id_fk", + "tableFrom": "Markers", + "tableTo": "Notes", + "columnsFrom": ["noteId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Markers_notificationId_Notifications_id_fk": { + "name": "Markers_notificationId_Notifications_id_fk", + "tableFrom": "Markers", + "tableTo": "Notifications", + "columnsFrom": ["notificationId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Markers_userId_Users_id_fk": { + "name": "Markers_userId_Users_id_fk", + "tableFrom": "Markers", + "tableTo": "Users", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.ModNotes": { + "name": "ModNotes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "noteId": { + "name": "noteId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "modId": { + "name": "modId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ModNotes_noteId_Notes_id_fk": { + "name": "ModNotes_noteId_Notes_id_fk", + "tableFrom": "ModNotes", + "tableTo": "Notes", + "columnsFrom": ["noteId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModNotes_userId_Users_id_fk": { + "name": "ModNotes_userId_Users_id_fk", + "tableFrom": "ModNotes", + "tableTo": "Users", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModNotes_modId_Users_id_fk": { + "name": "ModNotes_modId_Users_id_fk", + "tableFrom": "ModNotes", + "tableTo": "Users", + "columnsFrom": ["modId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.ModTags": { + "name": "ModTags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "noteId": { + "name": "noteId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "modId": { + "name": "modId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "tag": { + "name": "tag", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ModTags_noteId_Notes_id_fk": { + "name": "ModTags_noteId_Notes_id_fk", + "tableFrom": "ModTags", + "tableTo": "Notes", + "columnsFrom": ["noteId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModTags_userId_Users_id_fk": { + "name": "ModTags_userId_Users_id_fk", + "tableFrom": "ModTags", + "tableTo": "Users", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModTags_modId_Users_id_fk": { + "name": "ModTags_modId_Users_id_fk", + "tableFrom": "ModTags", + "tableTo": "Users", + "columnsFrom": ["modId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.NoteToMentions": { + "name": "NoteToMentions", + "schema": "", + "columns": { + "noteId": { + "name": "noteId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "NoteToMentions_noteId_userId_index": { + "name": "NoteToMentions_noteId_userId_index", + "columns": [ + { + "expression": "noteId", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "userId", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "NoteToMentions_userId_index": { + "name": "NoteToMentions_userId_index", + "columns": [ + { + "expression": "userId", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "NoteToMentions_noteId_Notes_id_fk": { + "name": "NoteToMentions_noteId_Notes_id_fk", + "tableFrom": "NoteToMentions", + "tableTo": "Notes", + "columnsFrom": ["noteId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "NoteToMentions_userId_Users_id_fk": { + "name": "NoteToMentions_userId_Users_id_fk", + "tableFrom": "NoteToMentions", + "tableTo": "Users", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.Notes": { + "name": "Notes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "authorId": { + "name": "authorId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "reblogId": { + "name": "reblogId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'text/plain'" + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "replyId": { + "name": "replyId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "quoteId": { + "name": "quoteId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "sensitive": { + "name": "sensitive", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "spoiler_text": { + "name": "spoiler_text", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "content_source": { + "name": "content_source", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + } + }, + "indexes": {}, + "foreignKeys": { + "Notes_authorId_Users_id_fk": { + "name": "Notes_authorId_Users_id_fk", + "tableFrom": "Notes", + "tableTo": "Users", + "columnsFrom": ["authorId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Notes_reblogId_Notes_id_fk": { + "name": "Notes_reblogId_Notes_id_fk", + "tableFrom": "Notes", + "tableTo": "Notes", + "columnsFrom": ["reblogId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Notes_replyId_Notes_id_fk": { + "name": "Notes_replyId_Notes_id_fk", + "tableFrom": "Notes", + "tableTo": "Notes", + "columnsFrom": ["replyId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Notes_quoteId_Notes_id_fk": { + "name": "Notes_quoteId_Notes_id_fk", + "tableFrom": "Notes", + "tableTo": "Notes", + "columnsFrom": ["quoteId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Notes_applicationId_Applications_id_fk": { + "name": "Notes_applicationId_Applications_id_fk", + "tableFrom": "Notes", + "tableTo": "Applications", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "Notes_uri_unique": { + "name": "Notes_uri_unique", + "nullsNotDistinct": false, + "columns": ["uri"] + } + } + }, + "public.Notifications": { + "name": "Notifications", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "notifiedId": { + "name": "notifiedId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "accountId": { + "name": "accountId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "noteId": { + "name": "noteId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "dismissed": { + "name": "dismissed", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "Notifications_notifiedId_Users_id_fk": { + "name": "Notifications_notifiedId_Users_id_fk", + "tableFrom": "Notifications", + "tableTo": "Users", + "columnsFrom": ["notifiedId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Notifications_accountId_Users_id_fk": { + "name": "Notifications_accountId_Users_id_fk", + "tableFrom": "Notifications", + "tableTo": "Users", + "columnsFrom": ["accountId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Notifications_noteId_Notes_id_fk": { + "name": "Notifications_noteId_Notes_id_fk", + "tableFrom": "Notifications", + "tableTo": "Notes", + "columnsFrom": ["noteId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.OpenIdAccounts": { + "name": "OpenIdAccounts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "issuer_id": { + "name": "issuer_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "OpenIdAccounts_userId_Users_id_fk": { + "name": "OpenIdAccounts_userId_Users_id_fk", + "tableFrom": "OpenIdAccounts", + "tableTo": "Users", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.OpenIdLoginFlows": { + "name": "OpenIdLoginFlows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "code_verifier": { + "name": "code_verifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "issuer_id": { + "name": "issuer_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "OpenIdLoginFlows_applicationId_Applications_id_fk": { + "name": "OpenIdLoginFlows_applicationId_Applications_id_fk", + "tableFrom": "OpenIdLoginFlows", + "tableTo": "Applications", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.Relationships": { + "name": "Relationships", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "ownerId": { + "name": "ownerId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "subjectId": { + "name": "subjectId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "following": { + "name": "following", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "showing_reblogs": { + "name": "showing_reblogs", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "notifying": { + "name": "notifying", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "blocking": { + "name": "blocking", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "muting": { + "name": "muting", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "muting_notifications": { + "name": "muting_notifications", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "requested": { + "name": "requested", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "domain_blocking": { + "name": "domain_blocking", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "endorsed": { + "name": "endorsed", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "languages": { + "name": "languages", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "Relationships_ownerId_Users_id_fk": { + "name": "Relationships_ownerId_Users_id_fk", + "tableFrom": "Relationships", + "tableTo": "Users", + "columnsFrom": ["ownerId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Relationships_subjectId_Users_id_fk": { + "name": "Relationships_subjectId_Users_id_fk", + "tableFrom": "Relationships", + "tableTo": "Users", + "columnsFrom": ["subjectId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.RoleToUsers": { + "name": "RoleToUsers", + "schema": "", + "columns": { + "roleId": { + "name": "roleId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "RoleToUsers_roleId_Roles_id_fk": { + "name": "RoleToUsers_roleId_Roles_id_fk", + "tableFrom": "RoleToUsers", + "tableTo": "Roles", + "columnsFrom": ["roleId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "RoleToUsers_userId_Users_id_fk": { + "name": "RoleToUsers_userId_Users_id_fk", + "tableFrom": "RoleToUsers", + "tableTo": "Users", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.Roles": { + "name": "Roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permissions": { + "name": "permissions", + "type": "text[]", + "primaryKey": false, + "notNull": true + }, + "priority": { + "name": "priority", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "visible": { + "name": "visible", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.Tokens": { + "name": "Tokens", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "token_type": { + "name": "token_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "redirect_uri": { + "name": "redirect_uri", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Tokens_userId_Users_id_fk": { + "name": "Tokens_userId_Users_id_fk", + "tableFrom": "Tokens", + "tableTo": "Users", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Tokens_applicationId_Applications_id_fk": { + "name": "Tokens_applicationId_Applications_id_fk", + "tableFrom": "Tokens", + "tableTo": "Applications", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.UserToPinnedNotes": { + "name": "UserToPinnedNotes", + "schema": "", + "columns": { + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "noteId": { + "name": "noteId", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "UserToPinnedNotes_userId_noteId_index": { + "name": "UserToPinnedNotes_userId_noteId_index", + "columns": [ + { + "expression": "userId", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "noteId", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "UserToPinnedNotes_noteId_index": { + "name": "UserToPinnedNotes_noteId_index", + "columns": [ + { + "expression": "noteId", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "UserToPinnedNotes_userId_Users_id_fk": { + "name": "UserToPinnedNotes_userId_Users_id_fk", + "tableFrom": "UserToPinnedNotes", + "tableTo": "Users", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "UserToPinnedNotes_noteId_Notes_id_fk": { + "name": "UserToPinnedNotes_noteId_Notes_id_fk", + "tableFrom": "UserToPinnedNotes", + "tableTo": "Notes", + "columnsFrom": ["noteId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.Users": { + "name": "Users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "is_admin": { + "name": "is_admin", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "email_verification_token": { + "name": "email_verification_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "password_reset_token": { + "name": "password_reset_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "fields": { + "name": "fields", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'" + }, + "endpoints": { + "name": "endpoints", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "avatar": { + "name": "avatar", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "header": { + "name": "header", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_bot": { + "name": "is_bot", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_locked": { + "name": "is_locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_discoverable": { + "name": "is_discoverable", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "sanctions": { + "name": "sanctions", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "public_key": { + "name": "public_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "private_key": { + "name": "private_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "instanceId": { + "name": "instanceId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "disable_automoderation": { + "name": "disable_automoderation", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "Users_uri_index": { + "name": "Users_uri_index", + "columns": [ + { + "expression": "uri", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "Users_username_index": { + "name": "Users_username_index", + "columns": [ + { + "expression": "username", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "Users_email_index": { + "name": "Users_email_index", + "columns": [ + { + "expression": "email", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "Users_instanceId_Instances_id_fk": { + "name": "Users_instanceId_Instances_id_fk", + "tableFrom": "Users", + "tableTo": "Instances", + "columnsFrom": ["instanceId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.VersiaObject": { + "name": "VersiaObject", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "remote_id": { + "name": "remote_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "authorId": { + "name": "authorId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "extra_data": { + "name": "extra_data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "extensions": { + "name": "extensions", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "VersiaObject_remote_id_index": { + "name": "VersiaObject_remote_id_index", + "columns": [ + { + "expression": "remote_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "VersiaObject_uri_index": { + "name": "VersiaObject_uri_index", + "columns": [ + { + "expression": "uri", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "VersiaObject_authorId_VersiaObject_id_fk": { + "name": "VersiaObject_authorId_VersiaObject_id_fk", + "tableFrom": "VersiaObject", + "tableTo": "VersiaObject", + "columnsFrom": ["authorId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/drizzle/migrations/meta/_journal.json b/drizzle/migrations/meta/_journal.json index 88857b8f..17236b20 100644 --- a/drizzle/migrations/meta/_journal.json +++ b/drizzle/migrations/meta/_journal.json @@ -225,6 +225,13 @@ "when": 1722100203904, "tag": "0031_mature_demogoblin", "breakpoints": true + }, + { + "idx": 32, + "version": "7", + "when": 1724073118382, + "tag": "0032_ambiguous_sue_storm", + "breakpoints": true } ] } diff --git a/drizzle/schema.ts b/drizzle/schema.ts index 6d1af586..0d47e19c 100644 --- a/drizzle/schema.ts +++ b/drizzle/schema.ts @@ -136,8 +136,8 @@ export const Likes = pgTable("Likes", { .notNull(), }); -export const LysandObjects = pgTable( - "LysandObject", +export const VersiaObjects = pgTable( + "VersiaObject", { id: uuid("id").default(sql`uuid_generate_v7()`).primaryKey().notNull(), remoteId: text("remote_id").notNull(), @@ -154,7 +154,7 @@ export const LysandObjects = pgTable( return { remoteIdKey: uniqueIndex().on(table.remoteId), uriKey: uniqueIndex().on(table.uri), - lysandObjectAuthorIdFkey: foreignKey({ + versiaObjectAuthorIdFkey: foreignKey({ columns: [table.authorId], foreignColumns: [table.id], }) @@ -347,8 +347,8 @@ export const Instances = pgTable("Instances", { .notNull(), protocol: text("protocol") .notNull() - .$type<"lysand" | "activitypub">() - .default("lysand"), + .$type<"versia" | "activitypub">() + .default("versia"), }); export const OpenIdAccounts = pgTable("OpenIdAccounts", { diff --git a/flake.nix b/flake.nix index fadc8cba..464f8804 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "Lysand Server"; + description = "Versia Server"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; diff --git a/package.json b/package.json index 4ec1a8c3..aeaef0b8 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "lysand", + "name": "versia-server", "module": "index.ts", "type": "module", "version": "0.7.0", @@ -64,7 +64,7 @@ "additionalHelpFlags": ["-h"], "additionalVersionFlags": ["-v"], "plugins": [], - "description": "CLI to interface with the Lysand project", + "description": "CLI to interface with the Versia project", "topicSeparator": " ", "topics": { "user": { diff --git a/packages/config-manager/config.type.ts b/packages/config-manager/config.type.ts index 1c640900..e1c9cd00 100644 --- a/packages/config-manager/config.type.ts +++ b/packages/config-manager/config.type.ts @@ -32,7 +32,7 @@ export const configValidator = z.object({ .default(5432), username: z.string().min(1), password: z.string().default(""), - database: z.string().min(1).default("lysand"), + database: z.string().min(1).default("versia"), }), redis: z.object({ queue: z @@ -109,7 +109,7 @@ export const configValidator = z.object({ jwt_key: z.string().min(3).includes(";").default("").or(z.literal("")), }), http: z.object({ - base_url: z.string().min(1).default("http://lysand.social"), + base_url: z.string().min(1).default("http://versia.social"), bind: z.string().min(1).default("0.0.0.0"), bind_port: z .number() @@ -260,7 +260,7 @@ export const configValidator = z.object({ access_key: z.string(), secret_access_key: z.string(), region: z.string().optional(), - bucket_name: z.string().default("lysand"), + bucket_name: z.string().default("versia"), public_url: zUrl, }) .default({ @@ -268,7 +268,7 @@ export const configValidator = z.object({ access_key: "", secret_access_key: "", region: undefined, - bucket_name: "lysand", + bucket_name: "versia", public_url: "https://cdn.example.com", }), validation: z @@ -507,8 +507,8 @@ export const configValidator = z.object({ }), instance: z .object({ - name: z.string().min(1).default("Lysand"), - description: z.string().min(1).default("A Lysand instance"), + name: z.string().min(1).default("Versia"), + description: z.string().min(1).default("A Versia instance"), extended_description_path: z.string().optional(), tos_path: z.string().optional(), privacy_policy_path: z.string().optional(), @@ -525,8 +525,8 @@ export const configValidator = z.object({ }), }) .default({ - name: "Lysand", - description: "A Lysand instance", + name: "Versia", + description: "A Versia instance", extended_description_path: undefined, tos_path: undefined, privacy_policy_path: undefined, diff --git a/packages/database-interface/attachment.ts b/packages/database-interface/attachment.ts index e1a48289..e91c8259 100644 --- a/packages/database-interface/attachment.ts +++ b/packages/database-interface/attachment.ts @@ -197,7 +197,7 @@ export class Attachment extends BaseInterface { }; } - public toLysand(): ContentFormat { + public toVersia(): ContentFormat { return { [this.data.mimeType]: { content: this.data.url, @@ -217,7 +217,7 @@ export class Attachment extends BaseInterface { }; } - public static fromLysand( + public static fromVersia( attachmentToConvert: ContentFormat, ): Promise { const key = Object.keys(attachmentToConvert)[0]; diff --git a/packages/database-interface/emoji.ts b/packages/database-interface/emoji.ts index 4d040e62..55309bbd 100644 --- a/packages/database-interface/emoji.ts +++ b/packages/database-interface/emoji.ts @@ -150,7 +150,7 @@ export class Emoji extends BaseInterface { const foundInstance = host ? await Instance.resolve(host) : null; - return await Emoji.fromLysand(emojiToFetch, foundInstance?.id ?? null); + return await Emoji.fromVersia(emojiToFetch, foundInstance?.id ?? null); } get id() { @@ -189,7 +189,7 @@ export class Emoji extends BaseInterface { }; } - public toLysand(): CustomEmojiExtension["emojis"][0] { + public toVersia(): CustomEmojiExtension["emojis"][0] { return { name: this.data.shortcode, url: { @@ -201,7 +201,7 @@ export class Emoji extends BaseInterface { }; } - public static fromLysand( + public static fromVersia( emoji: CustomEmojiExtension["emojis"][0], instanceId: string | null, ): Promise { diff --git a/packages/database-interface/instance.ts b/packages/database-interface/instance.ts index 14a6f44c..2ff0319b 100644 --- a/packages/database-interface/instance.ts +++ b/packages/database-interface/instance.ts @@ -133,10 +133,10 @@ export class Instance extends BaseInterface { static async fetchMetadata(url: string): Promise<{ metadata: ServerMetadata; - protocol: "lysand" | "activitypub"; + protocol: "versia" | "activitypub"; } | null> { const origin = new URL(url).origin; - const wellKnownUrl = new URL("/.well-known/lysand", origin); + const wellKnownUrl = new URL("/.well-known/versia", origin); const logger = getLogger("federation"); const requester = await User.getServerActor().getFederationRequester(); @@ -152,7 +152,7 @@ export class Instance extends BaseInterface { })); if (!(ok && raw.headers.get("content-type")?.includes("json"))) { - // If the server doesn't have a Lysand well-known endpoint, it's not a Lysand instance + // If the server doesn't have a Versia well-known endpoint, it's not a Versia instance // Try to resolve ActivityPub metadata instead const data = await Instance.fetchActivityPubMetadata(url); @@ -171,7 +171,7 @@ export class Instance extends BaseInterface { data, ); - return { metadata, protocol: "lysand" }; + return { metadata, protocol: "versia" }; } catch (error) { logger.error`Instance ${chalk.bold( origin, @@ -179,7 +179,7 @@ export class Instance extends BaseInterface { return null; } } catch (error) { - logger.error`Failed to fetch Lysand metadata for instance ${chalk.bold( + logger.error`Failed to fetch Versia metadata for instance ${chalk.bold( origin, )} - Error! ${error}`; return null; diff --git a/packages/database-interface/note.ts b/packages/database-interface/note.ts index a90afeb6..707f320f 100644 --- a/packages/database-interface/note.ts +++ b/packages/database-interface/note.ts @@ -11,7 +11,7 @@ import type { import { EntityValidator } from "@lysand-org/federation"; import type { ContentFormat, - Note as LysandNote, + Note as VersiaNote, } from "@lysand-org/federation/types"; import { type InferInsertModel, @@ -193,7 +193,7 @@ export class Note extends BaseInterface { const users = await this.getUsersToFederateTo(); for (const user of users) { - await this.author.federateToUser(this.toLysand(), user); + await this.author.federateToUser(this.toVersia(), user); } } @@ -594,7 +594,7 @@ export class Note extends BaseInterface { * @returns The saved note, or null if the note could not be fetched */ static async saveFromRemote(uri: string): Promise { - let note: LysandNote | null = null; + let note: VersiaNote | null = null; if (uri) { if (!URL.canParse(uri)) { @@ -622,16 +622,16 @@ export class Note extends BaseInterface { throw new Error("Invalid object author"); } - return await Note.fromLysand(note, author); + return await Note.fromVersia(note, author); } /** - * Turns a Lysand Note into a database note (saved) - * @param note Lysand Note + * Turns a Versia Note into a database note (saved) + * @param note Versia Note * @param author Author of the note * @returns The saved note */ - static async fromLysand(note: LysandNote, author: User): Promise { + static async fromVersia(note: VersiaNote, author: User): Promise { const emojis: Emoji[] = []; const logger = getLogger("federation"); @@ -653,7 +653,7 @@ export class Note extends BaseInterface { const attachments: Attachment[] = []; for (const attachment of note.attachments ?? []) { - const resolvedAttachment = await Attachment.fromLysand( + const resolvedAttachment = await Attachment.fromVersia( attachment, ).catch((e) => { logger.error`${e}`; @@ -886,10 +886,10 @@ export class Note extends BaseInterface { } /** - * Convert a note to the Lysand format - * @returns The note in the Lysand format + * Convert a note to the Versia format + * @returns The note in the Versia format */ - toLysand(): LysandNote { + toVersia(): VersiaNote { const status = this.data; return { type: "Note", @@ -906,7 +906,7 @@ export class Note extends BaseInterface { }, }, attachments: (status.attachments ?? []).map((attachment) => - new Attachment(attachment).toLysand(), + new Attachment(attachment).toVersia(), ), is_sensitive: status.sensitive, mentions: status.mentions.map((mention) => @@ -925,7 +925,7 @@ export class Note extends BaseInterface { extensions: { "org.lysand:custom_emojis": { emojis: status.emojis.map((emoji) => - new Emoji(emoji).toLysand(), + new Emoji(emoji).toVersia(), ), }, // TODO: Add polls and reactions diff --git a/packages/database-interface/user.ts b/packages/database-interface/user.ts index b164f8e9..0122891c 100644 --- a/packages/database-interface/user.ts +++ b/packages/database-interface/user.ts @@ -14,7 +14,7 @@ import { type HttpVerb, SignatureConstructor, } from "@lysand-org/federation"; -import type { Entity, User as LysandUser } from "@lysand-org/federation/types"; +import type { Entity, User as VersiaUser } from "@lysand-org/federation/types"; import chalk from "chalk"; import { type InferInsertModel, @@ -34,7 +34,7 @@ import { htmlToText } from "html-to-text"; import { type UserWithRelations, findManyUsers, - followRequestToLysand, + followRequestToVersia, } from "~/classes/functions/user"; import { searchManager } from "~/classes/search/search-manager"; import { db } from "~/drizzle/db"; @@ -232,7 +232,7 @@ export class User extends BaseInterface { if (otherUser.isRemote()) { const { ok } = await this.federateToUser( - followRequestToLysand(this, otherUser), + followRequestToVersia(this, otherUser), otherUser, ); @@ -412,8 +412,8 @@ export class User extends BaseInterface { const instance = await Instance.resolve(uri); - if (instance.data.protocol === "lysand") { - return await User.saveFromLysand(uri, instance); + if (instance.data.protocol === "versia") { + return await User.saveFromVersia(uri, instance); } if (instance.data.protocol === "activitypub") { @@ -428,18 +428,18 @@ export class User extends BaseInterface { config.federation.bridge.url, ); - return await User.saveFromLysand(bridgeUri.toString(), instance); + return await User.saveFromVersia(bridgeUri.toString(), instance); } throw new Error(`Unsupported protocol: ${instance.data.protocol}`); } - private static async saveFromLysand( + private static async saveFromVersia( uri: string, instance: Instance, ): Promise { const requester = await User.getServerActor().getFederationRequester(); - const { data: json } = await requester.get>(uri, { + const { data: json } = await requester.get>(uri, { // @ts-expect-error Bun extension proxy: config.http.proxy.address, }); @@ -447,12 +447,12 @@ export class User extends BaseInterface { const validator = new EntityValidator(); const data = await validator.User(json); - const user = await User.fromLysand(data, instance); + const user = await User.fromVersia(data, instance); const userEmojis = data.extensions?.["org.lysand:custom_emojis"]?.emojis ?? []; const emojis = await Promise.all( - userEmojis.map((emoji) => Emoji.fromLysand(emoji, instance.id)), + userEmojis.map((emoji) => Emoji.fromVersia(emoji, instance.id)), ); if (emojis.length > 0) { @@ -475,8 +475,8 @@ export class User extends BaseInterface { return finalUser; } - static async fromLysand( - user: LysandUser, + static async fromVersia( + user: VersiaUser, instance: Instance, ): Promise { const data = { @@ -707,14 +707,14 @@ export class User extends BaseInterface { newUser.endpoints || newUser.isDiscoverable) ) { - await this.federateToFollowers(this.toLysand()); + await this.federateToFollowers(this.toVersia()); } return updated.data; } /** - * Signs a Lysand entity with that user's private key + * Signs a Versia entity with that user's private key * * @param entity Entity to sign * @param signatureUrl URL to embed in signature (must be the same URI of queries made with this signature) @@ -754,7 +754,7 @@ export class User extends BaseInterface { } /** - * Helper to get the appropriate Lysand SDK requester with this user's private key + * Helper to get the appropriate Versia SDK requester with this user's private key * * @returns The requester */ @@ -894,9 +894,9 @@ export class User extends BaseInterface { }; } - toLysand(): LysandUser { + toVersia(): VersiaUser { if (this.isRemote()) { - throw new Error("Cannot convert remote user to Lysand format"); + throw new Error("Cannot convert remote user to Versia format"); } const user = this.data; @@ -958,7 +958,7 @@ export class User extends BaseInterface { extensions: { "org.lysand:custom_emojis": { emojis: user.emojis.map((emoji) => - new Emoji(emoji).toLysand(), + new Emoji(emoji).toVersia(), ), }, }, diff --git a/packages/glitch-server/main.ts b/packages/glitch-server/main.ts index 76620cbe..9742ca4b 100644 --- a/packages/glitch-server/main.ts +++ b/packages/glitch-server/main.ts @@ -216,17 +216,17 @@ const brandingTransforms = ( newFileContents = newFileContents.replaceAll( "Glitch-soc is free open source software forked from Mastodon.", - "Lysand is free and open-source software using the Glitch-Soc frontend.", + "Versia Server is free and open-source software using the Glitch-Soc frontend.", ); - newFileContents = newFileContents.replaceAll("Mastodon", "Lysand"); + newFileContents = newFileContents.replaceAll("Mastodon", "Versia Server"); newFileContents = newFileContents.replaceAll( - "Lysand is free, open-source software, and a trademark of Lysand gGmbH.", + "Versia is free, open-source software, and a trademark of Versia gGmbH.", "This is not a Mastodon instance.", ); newFileContents = newFileContents.replaceAll( "joinmastodon.org", - "lysand.org", + "versia.pub", ); return newFileContents; diff --git a/packages/plugin-kit/package.json b/packages/plugin-kit/package.json index ff5554bd..52948db6 100644 --- a/packages/plugin-kit/package.json +++ b/packages/plugin-kit/package.json @@ -1,9 +1,9 @@ { - "name": "@lysand-org/kit", + "name": "@versia-org/kit", "module": "index.ts", "type": "module", "version": "0.0.0", - "description": "Framework for building Lysand Server plugins", + "description": "Framework for building Versia Server plugins", "author": { "email": "contact@cpluspatch.com", "name": "CPlusPatch", diff --git a/packages/plugin-kit/plugin.ts b/packages/plugin-kit/plugin.ts index c40c17a9..96987c19 100644 --- a/packages/plugin-kit/plugin.ts +++ b/packages/plugin-kit/plugin.ts @@ -18,7 +18,7 @@ export class Plugin { } /** - * Loads the plugin's configuration from the Lysand Server configuration file. + * Loads the plugin's configuration from the Versia Server configuration file. * This will be called when the plugin is loaded. * @param config Values the user has set in the configuration file. */ @@ -65,7 +65,7 @@ export class PluginConfigManager { } /** - * Loads the configuration from the Lysand Server configuration file. + * Loads the configuration from the Versia Server configuration file. * This will be called when the plugin is loaded. * @param config Values the user has set in the configuration file. */ diff --git a/server/api/api/v1/custom_emojis/index.test.ts b/server/api/api/v1/custom_emojis/index.test.ts index 2e6c0454..53a0ab86 100644 --- a/server/api/api/v1/custom_emojis/index.test.ts +++ b/server/api/api/v1/custom_emojis/index.test.ts @@ -22,7 +22,7 @@ beforeAll(async () => { method: "POST", body: JSON.stringify({ shortcode: "test1", - element: "https://cdn.lysand.org/logo.webp", + element: "https://cdn.versia.social/logo.webp", global: true, }), }), @@ -39,7 +39,7 @@ beforeAll(async () => { method: "POST", body: JSON.stringify({ shortcode: "test2", - element: "https://cdn.lysand.org/logo.webp", + element: "https://cdn.versia.social/logo.webp", }), }), ); @@ -53,7 +53,7 @@ beforeAll(async () => { method: "POST", body: JSON.stringify({ shortcode: "test3", - element: "https://cdn.lysand.org/logo.webp", + element: "https://cdn.versia.social/logo.webp", }), }), ); diff --git a/server/api/api/v1/emojis/:id/index.test.ts b/server/api/api/v1/emojis/:id/index.test.ts index e8af582e..f199a1fe 100644 --- a/server/api/api/v1/emojis/:id/index.test.ts +++ b/server/api/api/v1/emojis/:id/index.test.ts @@ -23,7 +23,7 @@ beforeAll(async () => { method: "POST", body: JSON.stringify({ shortcode: "test", - element: "https://cdn.lysand.org/logo.webp", + element: "https://cdn.versia.social/logo.webp", global: true, }), }), diff --git a/server/api/api/v1/emojis/index.test.ts b/server/api/api/v1/emojis/index.test.ts index 0f245ca0..bf5547c2 100644 --- a/server/api/api/v1/emojis/index.test.ts +++ b/server/api/api/v1/emojis/index.test.ts @@ -49,7 +49,7 @@ describe(meta.route, () => { }, body: JSON.stringify({ shortcode: "test", - element: "https://cdn.lysand.org/logo.webp", + element: "https://cdn.versia.social/logo.webp", }), }), ); @@ -108,7 +108,7 @@ describe(meta.route, () => { }, body: JSON.stringify({ shortcode: "test3", - element: "https://cdn.lysand.org/logo.webp", + element: "https://cdn.versia.social/logo.webp", }), }), ); diff --git a/server/api/api/v1/instance/extended_description.test.ts b/server/api/api/v1/instance/extended_description.test.ts index 8a230f13..4458eeac 100644 --- a/server/api/api/v1/instance/extended_description.test.ts +++ b/server/api/api/v1/instance/extended_description.test.ts @@ -15,9 +15,8 @@ describe(meta.route, () => { const json = await response.json(); expect(json).toEqual({ updated_at: new Date(1970, 0, 0).toISOString(), - // This is a [Lysand](https://lysand.org) server with the default extended description. content: - '

This is a Lysand server with the default extended description.

\n', + '

This is a Versia server with the default extended description.

\n', }); }); }); diff --git a/server/api/api/v1/instance/extended_description.ts b/server/api/api/v1/instance/extended_description.ts index a7b26ed7..f77a07d8 100644 --- a/server/api/api/v1/instance/extended_description.ts +++ b/server/api/api/v1/instance/extended_description.ts @@ -24,7 +24,7 @@ export default (app: Hono) => async () => { const { content, lastModified } = await renderMarkdownInPath( config.instance.extended_description_path ?? "", - "This is a [Lysand](https://lysand.org) server with the default extended description.", + "This is a [Versia](https://versia.pub) server with the default extended description.", ); return jsonResponse({ diff --git a/server/api/api/v1/instance/index.ts b/server/api/api/v1/instance/index.ts index 1f976857..252a3f70 100644 --- a/server/api/api/v1/instance/index.ts +++ b/server/api/api/v1/instance/index.ts @@ -80,7 +80,7 @@ export default (app: Hono) => streaming_api: "", }, version: "4.3.0-alpha.3+glitch", - lysand_version: version, + versia_version: version, sso: { forced: false, providers: config.oidc.providers.map((p) => ({ @@ -92,7 +92,7 @@ export default (app: Hono) => contact_account: contactAccount?.toApi() || undefined, } satisfies Record & { banner: string | null; - lysand_version: string; + versia_version: string; sso: { forced: boolean; providers: { diff --git a/server/api/api/v1/sso/index.ts b/server/api/api/v1/sso/index.ts index c797f63f..fd9a8ee7 100644 --- a/server/api/api/v1/sso/index.ts +++ b/server/api/api/v1/sso/index.ts @@ -135,7 +135,7 @@ export default (app: Hono) => .insert(Applications) .values({ clientId: user.id + randomString(32, "base64"), - name: "Lysand", + name: "Versia", redirectUri: `${oauthRedirectUri(issuerId)}`, scopes: "openid profile email", secret: "", diff --git a/server/api/api/v2/instance/index.ts b/server/api/api/v2/instance/index.ts index c8f78e39..3aec4bd7 100644 --- a/server/api/api/v2/instance/index.ts +++ b/server/api/api/v2/instance/index.ts @@ -38,7 +38,7 @@ export default (app: Hono) => domain: new URL(config.http.base_url).hostname, title: config.instance.name, version: "4.3.0-alpha.3+glitch", - lysand_version: version, + versia_version: version, source_url: "https://github.com/lysand-org/lysand", description: config.instance.description, usage: { diff --git a/server/api/oauth/sso/index.ts b/server/api/oauth/sso/index.ts index 0e02b839..d1f8a7f7 100644 --- a/server/api/oauth/sso/index.ts +++ b/server/api/oauth/sso/index.ts @@ -60,7 +60,7 @@ export default (app: Hono) => meta.route, zValidator("query", schemas.query, handleZodError), async (context) => { - // This is the Lysand client's client_id, not the external OAuth provider's client_id + // This is the Versia client's client_id, not the external OAuth provider's client_id const { issuer: issuerId, client_id } = context.req.valid("query"); const body = await context.req.query(); diff --git a/server/api/objects/:id/index.ts b/server/api/objects/:id/index.ts index 33b6e73a..c575f3bf 100644 --- a/server/api/objects/:id/index.ts +++ b/server/api/objects/:id/index.ts @@ -5,7 +5,7 @@ import { zValidator } from "@hono/zod-validator"; import type { Entity } from "@lysand-org/federation/types"; import { and, eq, inArray, sql } from "drizzle-orm"; import { z } from "zod"; -import { type LikeType, likeToLysand } from "~/classes/functions/like"; +import { type LikeType, likeToVersia } from "~/classes/functions/like"; import { db } from "~/drizzle/db"; import { Notes } from "~/drizzle/schema"; import { config } from "~/packages/config-manager"; @@ -56,7 +56,7 @@ export default (app: Hono) => inArray(Notes.visibility, ["public", "unlisted"]), ), ); - apiObject = foundObject ? foundObject.toLysand() : null; + apiObject = foundObject ? foundObject.toVersia() : null; foundAuthor = foundObject ? foundObject.author : null; if (foundObject) { @@ -72,7 +72,7 @@ export default (app: Hono) => sql`EXISTS (SELECT 1 FROM "Notes" WHERE "Notes"."id" = ${like.likedId} AND "Notes"."visibility" IN ('public', 'unlisted'))`, ), })) ?? null; - apiObject = foundObject ? likeToLysand(foundObject) : null; + apiObject = foundObject ? likeToVersia(foundObject) : null; foundAuthor = foundObject ? await User.fromId(foundObject.likerId) : null; diff --git a/server/api/users/:uuid/inbox/index.ts b/server/api/users/:uuid/inbox/index.ts index 68e0c0b3..0148898f 100644 --- a/server/api/users/:uuid/inbox/index.ts +++ b/server/api/users/:uuid/inbox/index.ts @@ -203,7 +203,7 @@ export default (app: Hono) => return errorResponse("Author not found", 404); } - const newStatus = await Note.fromLysand( + const newStatus = await Note.fromVersia( note, account, ).catch((e) => { diff --git a/server/api/users/:uuid/index.ts b/server/api/users/:uuid/index.ts index 8ef12745..25045d16 100644 --- a/server/api/users/:uuid/index.ts +++ b/server/api/users/:uuid/index.ts @@ -57,7 +57,7 @@ export default (app: Hono) => } if (debug) { - return response(JSON.stringify(user.toLysand(), null, 4), 200, { + return response(JSON.stringify(user.toVersia(), null, 4), 200, { "Content-Type": "application/json", }); } @@ -70,7 +70,7 @@ export default (app: Hono) => return redirect(user.toApi().url); } - const userString = JSON.stringify(user.toLysand()); + const userString = JSON.stringify(user.toVersia()); // If base_url uses https and request uses http, rewrite request to use https // This fixes reverse proxy errors @@ -82,7 +82,7 @@ export default (app: Hono) => reqUrl.protocol = "https:"; } - const { headers } = await user.sign(user.toLysand(), reqUrl, "GET"); + const { headers } = await user.sign(user.toVersia(), reqUrl, "GET"); return response(userString, 200, { "Content-Type": "application/json", diff --git a/server/api/users/:uuid/outbox/index.ts b/server/api/users/:uuid/outbox/index.ts index c057e7d6..b6e467d0 100644 --- a/server/api/users/:uuid/outbox/index.ts +++ b/server/api/users/:uuid/outbox/index.ts @@ -109,7 +109,7 @@ export default (app: Hono) => config.http.base_url, ).toString() : undefined, - items: notes.map((note) => note.toLysand()), + items: notes.map((note) => note.toVersia()), }); }, ); diff --git a/server/api/well-known/lysand.ts b/server/api/well-known/lysand.ts index cd783620..e07dfd4a 100644 --- a/server/api/well-known/lysand.ts +++ b/server/api/well-known/lysand.ts @@ -15,7 +15,7 @@ export const meta = applyConfig({ duration: 60, max: 60, }, - route: "/.well-known/lysand", + route: "/.well-known/versia", }); export default (app: Hono) => @@ -28,6 +28,6 @@ export default (app: Hono) => logo: urlToContentFormat(config.instance.logo) ?? undefined, banner: urlToContentFormat(config.instance.banner) ?? undefined, supported_extensions: ["org.lysand:custom_emojis"], - website: "https://lysand.org", + website: "https://versia.pub", } satisfies ServerMetadata); }); diff --git a/server/api/well-known/nodeinfo/2.0/index.ts b/server/api/well-known/nodeinfo/2.0/index.ts index b539f79f..fe52d913 100644 --- a/server/api/well-known/nodeinfo/2.0/index.ts +++ b/server/api/well-known/nodeinfo/2.0/index.ts @@ -19,8 +19,8 @@ export default (app: Hono) => app.on(meta.allowedMethods, meta.route, () => { return jsonResponse({ version: "2.0", - software: { name: "lysand", version: manifest.version }, - protocols: ["lysand"], + software: { name: "versia-server", version: manifest.version }, + protocols: ["versia"], services: { outbound: [], inbound: [] }, usage: { users: { total: 0, activeMonth: 0, activeHalfyear: 0 }, diff --git a/setup.ts b/setup.ts index bdb43243..a7792800 100644 --- a/setup.ts +++ b/setup.ts @@ -12,7 +12,7 @@ await configureLoggers(); const serverLogger = getLogger("server"); -serverLogger.info`Starting Lysand...`; +serverLogger.info`Starting Versia Server...`; await setupDatabase(); @@ -29,7 +29,7 @@ const postCount = await Note.getCount(); await checkConfig(config); -serverLogger.info`Lysand started at ${config.http.bind}:${config.http.bind_port} in ${(performance.now() - timeAtStart).toFixed(0)}ms`; +serverLogger.info`Versia Server started at ${config.http.bind}:${config.http.bind_port} in ${(performance.now() - timeAtStart).toFixed(0)}ms`; serverLogger.info`Database is online, now serving ${postCount} posts`;