mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
refactor(api): ♻️ Replace old client library with new version (@versia/client)
This commit is contained in:
parent
7708bff31f
commit
fbe86043b7
|
|
@ -1,4 +1,4 @@
|
|||
import type { Application as APIApplication } from "@lysand-org/client/types";
|
||||
import type { Application as APIApplication } from "@versia/client/types";
|
||||
import type { InferSelectModel } from "drizzle-orm";
|
||||
import { db } from "~/drizzle/db";
|
||||
import type { Applications } from "~/drizzle/schema";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Notification as ApiNotification } from "@lysand-org/client/types";
|
||||
import type { Notification as ApiNotification } from "@versia/client/types";
|
||||
import type { InferSelectModel } from "drizzle-orm";
|
||||
import { db } from "~/drizzle/db";
|
||||
import type { Notifications } from "~/drizzle/schema";
|
||||
|
|
|
|||
|
|
@ -323,8 +323,8 @@ avatars = []
|
|||
# Bridges must be hosted separately from the main Versia Server process
|
||||
[federation.bridge]
|
||||
enabled = false
|
||||
# Only lysand-ap exists for now
|
||||
software = "lysand-ap"
|
||||
# Only versia-ap exists for now
|
||||
software = "versia-ap"
|
||||
# If this is empty, any bridge with the correct token
|
||||
# will be able to send data to your instance
|
||||
allowed_ips = ["192.168.1.0/24"]
|
||||
|
|
|
|||
|
|
@ -3346,7 +3346,7 @@
|
|||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": ["lysand-ap"]
|
||||
"enum": ["versia-ap"]
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
|
|
@ -3372,7 +3372,7 @@
|
|||
"additionalProperties": false,
|
||||
"default": {
|
||||
"enabled": false,
|
||||
"software": "lysand-ap",
|
||||
"software": "versia-ap",
|
||||
"allowed_ips": [],
|
||||
"token": ""
|
||||
}
|
||||
|
|
@ -3396,7 +3396,7 @@
|
|||
},
|
||||
"bridge": {
|
||||
"enabled": false,
|
||||
"software": "lysand-ap",
|
||||
"software": "versia-ap",
|
||||
"allowed_ips": [],
|
||||
"token": ""
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ Versia Server supports the use of the Glitch-Soc fork of Mastodon's frontend. He
|
|||
3. Change the config to enable Glitch-FE:
|
||||
```toml
|
||||
[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)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Source as ApiSource } from "@lysand-org/client/types";
|
||||
import type { Source as ApiSource } from "@versia/client/types";
|
||||
import type { ContentFormat } from "@versia/federation/types";
|
||||
import type { Challenge } from "altcha-lib/types";
|
||||
import { relations, sql } from "drizzle-orm";
|
||||
|
|
|
|||
|
|
@ -105,10 +105,10 @@
|
|||
"@inquirer/input": "^2.2.9",
|
||||
"@json2csv/plainjs": "^7.0.6",
|
||||
"@logtape/logtape": "npm:@jsr/logtape__logtape@0.4.2",
|
||||
"@lysand-org/client": "^0.2.5",
|
||||
"@oclif/core": "^4.0.19",
|
||||
"@sentry/bun": "^8.26.0",
|
||||
"@tufjs/canonical-json": "^2.0.0",
|
||||
"@versia/client": "^0.1.0-rc.0",
|
||||
"@versia/federation": "^0.1.0-rc.1",
|
||||
"altcha-lib": "^0.5.1",
|
||||
"blurhash": "^2.0.5",
|
||||
|
|
|
|||
|
|
@ -484,14 +484,14 @@ export const configValidator = z.object({
|
|||
bridge: z
|
||||
.object({
|
||||
enabled: z.boolean().default(false),
|
||||
software: z.enum(["lysand-ap"]).or(z.string()),
|
||||
software: z.enum(["versia-ap"]).or(z.string()),
|
||||
allowed_ips: z.array(z.string().trim()).default([]),
|
||||
token: z.string().default(""),
|
||||
url: zUrl.optional(),
|
||||
})
|
||||
.default({
|
||||
enabled: false,
|
||||
software: "lysand-ap",
|
||||
software: "versia-ap",
|
||||
allowed_ips: [],
|
||||
token: "",
|
||||
})
|
||||
|
|
@ -516,7 +516,7 @@ export const configValidator = z.object({
|
|||
},
|
||||
bridge: {
|
||||
enabled: false,
|
||||
software: "lysand-ap",
|
||||
software: "versia-ap",
|
||||
allowed_ips: [],
|
||||
token: "",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { proxyUrl } from "@/response";
|
|||
import type {
|
||||
AsyncAttachment as ApiAsyncAttachment,
|
||||
Attachment as ApiAttachment,
|
||||
} from "@lysand-org/client/types";
|
||||
} from "@versia/client/types";
|
||||
import type { ContentFormat } from "@versia/federation/types";
|
||||
import {
|
||||
type InferInsertModel,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { emojiValidatorWithColons, emojiValidatorWithIdentifiers } from "@/api";
|
||||
import { proxyUrl } from "@/response";
|
||||
import type { Emoji as ApiEmoji } from "@lysand-org/client/types";
|
||||
import type { Emoji as ApiEmoji } from "@versia/client/types";
|
||||
import type { CustomEmojiExtension } from "@versia/federation/types";
|
||||
import {
|
||||
type InferInsertModel,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { getLogger } from "@logtape/logtape";
|
|||
import type {
|
||||
Attachment as ApiAttachment,
|
||||
Status as ApiStatus,
|
||||
} from "@lysand-org/client/types";
|
||||
} from "@versia/client/types";
|
||||
import { EntityValidator } from "@versia/federation";
|
||||
import type {
|
||||
ContentFormat,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Relationship as APIRelationship } from "@lysand-org/client/types";
|
||||
import type { Relationship as APIRelationship } from "@versia/client/types";
|
||||
import {
|
||||
type InferInsertModel,
|
||||
type InferSelectModel,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { proxyUrl } from "@/response";
|
||||
import type { RolePermission } from "@lysand-org/client/types";
|
||||
import type { RolePermission } from "@versia/client/types";
|
||||
import {
|
||||
type InferInsertModel,
|
||||
type InferSelectModel,
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@ import { getLogger } from "@logtape/logtape";
|
|||
import type {
|
||||
Account as ApiAccount,
|
||||
Mention as ApiMention,
|
||||
} from "@lysand-org/client/types";
|
||||
} from "@versia/client/types";
|
||||
import {
|
||||
EntityValidator,
|
||||
FederationRequester,
|
||||
type HttpVerb,
|
||||
SignatureConstructor,
|
||||
} from "@versia/federation";
|
||||
import type { User as VersiaUser } from "@versia/federation/types";
|
||||
import type { Collection, User as VersiaUser } from "@versia/federation/types";
|
||||
import chalk from "chalk";
|
||||
import {
|
||||
type InferInsertModel,
|
||||
|
|
@ -668,7 +668,7 @@ export class User extends BaseInterface<typeof Users, UserWithRelations> {
|
|||
* @returns The signed string and headers to send with the request
|
||||
*/
|
||||
async sign(
|
||||
entity: KnownEntity,
|
||||
entity: KnownEntity | Collection,
|
||||
signatureUrl: string | URL,
|
||||
signatureMethod: HttpVerb = "POST",
|
||||
): Promise<{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import type { Relationship as ApiRelationship } from "@lysand-org/client/types";
|
||||
import type { Relationship as ApiRelationship } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./block";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import type { Relationship as ApiRelationship } from "@lysand-org/client/types";
|
||||
import type { Relationship as ApiRelationship } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./follow";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Account as ApiAccount } from "@lysand-org/client/types";
|
||||
import type { Account as ApiAccount } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./followers";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Account as ApiAccount } from "@lysand-org/client/types";
|
||||
import type { Account as ApiAccount } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./following";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Account as ApiAccount } from "@lysand-org/client/types";
|
||||
import type { Account as ApiAccount } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestStatuses, getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import type { Relationship as ApiRelationship } from "@lysand-org/client/types";
|
||||
import type { Relationship as ApiRelationship } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./mute";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Status as ApiStatus } from "@lysand-org/client/types";
|
||||
import type { Status as ApiStatus } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestStatuses, getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./statuses";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Relationship as ApiRelationship } from "@lysand-org/client/types";
|
||||
import type { Relationship as ApiRelationship } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./unmute";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import type { Account as ApiAccount } from "@lysand-org/client/types";
|
||||
import type { Account as ApiAccount } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import type { Account as ApiAccount } from "@lysand-org/client/types";
|
||||
import type { Account as ApiAccount } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import type { Account as ApiAccount } from "@lysand-org/client/types";
|
||||
import type { Account as ApiAccount } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import {
|
|||
idValidator,
|
||||
} from "@/api";
|
||||
import { zValidator } from "@hono/zod-validator";
|
||||
import type { Marker as ApiMarker } from "@lysand-org/client/types";
|
||||
import type { Marker as ApiMarker } from "@versia/client/types";
|
||||
import { and, count, eq } from "drizzle-orm";
|
||||
import { z } from "zod";
|
||||
import { db } from "~/drizzle/db";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Notification as ApiNotification } from "@lysand-org/client/types";
|
||||
import type { Notification as ApiNotification } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./dismiss";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Notification as ApiNotification } from "@lysand-org/client/types";
|
||||
import type { Notification as ApiNotification } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Notification as ApiNotification } from "@lysand-org/client/types";
|
||||
import type { Notification as ApiNotification } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Notification as ApiNotification } from "@lysand-org/client/types";
|
||||
import type { Notification as ApiNotification } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestStatuses, getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Notification as ApiNotification } from "@lysand-org/client/types";
|
||||
import type { Notification as ApiNotification } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestStatuses, getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import type { Status as ApiStatus } from "@lysand-org/client/types";
|
||||
import type { Status as ApiStatus } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestStatuses, getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./favourite";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Account as ApiAccount } from "@lysand-org/client/types";
|
||||
import type { Account as ApiAccount } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestStatuses, getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./favourited_by";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Account as ApiAccount } from "@lysand-org/client/types";
|
||||
import type { Account as ApiAccount } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestStatuses, getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./reblogged_by";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||
import { zValidator } from "@hono/zod-validator";
|
||||
import type { StatusSource as ApiStatusSource } from "@lysand-org/client/types";
|
||||
import type { StatusSource as ApiStatusSource } from "@versia/client/types";
|
||||
import { z } from "zod";
|
||||
import { RolePermissions } from "~/drizzle/schema";
|
||||
import { Note } from "~/packages/database-interface/note";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Status as ApiStatus } from "@lysand-org/client/types";
|
||||
import type { Status as ApiStatus } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestStatuses, getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./unfavourite";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Status as ApiStatus } from "@lysand-org/client/types";
|
||||
import type { Status as ApiStatus } from "@versia/client/types";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { db } from "~/drizzle/db";
|
||||
import { Emojis } from "~/drizzle/schema";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import type { Status as ApiStatus } from "@lysand-org/client/types";
|
||||
import type { Status as ApiStatus } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestStatuses, getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./home";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import type { Status as ApiStatus } from "@lysand-org/client/types";
|
||||
import type { Status as ApiStatus } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestStatuses, getTestUsers, sendTestRequest } from "~/tests/utils";
|
||||
import { meta } from "./public";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { apiRoute, applyConfig } from "@/api";
|
||||
import { proxyUrl } from "@/response";
|
||||
import type { Instance as ApiInstance } from "@lysand-org/client/types";
|
||||
import type { Instance as ApiInstance } from "@versia/client/types";
|
||||
import { and, eq, isNull } from "drizzle-orm";
|
||||
import { Users } from "~/drizzle/schema";
|
||||
import manifest from "~/package.json";
|
||||
|
|
@ -37,7 +37,6 @@ export default apiRoute((app) =>
|
|||
domain: new URL(config.http.base_url).hostname,
|
||||
title: config.instance.name,
|
||||
version: "4.3.0-alpha.3+glitch",
|
||||
// @ts-expect-error Temporary until package also gets the rebranding
|
||||
versia_version: version,
|
||||
source_url: "https://github.com/lysand-org/server",
|
||||
description: config.instance.description,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { afterAll, describe, expect, test } from "bun:test";
|
|||
import type {
|
||||
Account as ApiAccount,
|
||||
Relationship as ApiRelationship,
|
||||
} from "@lysand-org/client/types";
|
||||
} from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestUsers, sendTestRequest, wrapRelativeUrl } from "~/tests/utils";
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import type {
|
|||
AsyncAttachment as ApiAsyncAttachment,
|
||||
Context as ApiContext,
|
||||
Status as ApiStatus,
|
||||
} from "@lysand-org/client/types";
|
||||
} from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { getTestUsers, sendTestRequest, wrapRelativeUrl } from "~/tests/utils";
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { afterAll, describe, expect, test } from "bun:test";
|
|||
import type {
|
||||
Application as ApiApplication,
|
||||
Token as ApiToken,
|
||||
} from "@lysand-org/client/types";
|
||||
} from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager";
|
||||
import { getTestUsers, sendTestRequest, wrapRelativeUrl } from "./utils";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import type { Hono } from "@hono/hono";
|
||||
import type { RouterRoute } from "@hono/hono/types";
|
||||
import type {
|
||||
Collection,
|
||||
Delete,
|
||||
Follow,
|
||||
FollowAccept,
|
||||
|
|
@ -62,5 +61,4 @@ export type KnownEntity =
|
|||
| FollowReject
|
||||
| Unfollow
|
||||
| Delete
|
||||
| LikeExtension
|
||||
| Collection;
|
||||
| LikeExtension;
|
||||
|
|
|
|||
Loading…
Reference in a new issue