diff --git a/Dockerfile b/Dockerfile index 6ca4da4..26e3a4c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,24 @@ -FROM oven/bun:alpine +FROM oven/bun:alpine as base + +# Install dependencies into temp directory +# This will cache them and speed up future builds +FROM base AS install +RUN mkdir -p /temp/dev +COPY package.json bun.lockb /temp/dev/ +RUN cd /temp/dev && bun install --frozen-lockfile + +# Install with --production (exclude devDependencies) +RUN mkdir -p /temp/prod +COPY package.json bun.lockb /temp/prod/ +RUN cd /temp/prod && bun install --frozen-lockfile --production + +FROM base AS builder COPY . /app +RUN cd /app && bun install +RUN cd /app && bun docs:build -RUN cd ./app && bun install -RUN cd ./app && bun docs:build - -FROM oven/bun:alpine +FROM base AS final COPY --from=builder /app/.vitepress/dist/ /app @@ -14,4 +27,7 @@ LABEL org.opencontainers.image.source "https://github.com/lysand-org/docs" LABEL org.opencontainers.image.vendor "Lysand.org" LABEL org.opencontainers.image.licenses "MIT" LABEL org.opencontainers.image.title "Lysand Docs" -LABEL org.opencontainers.image.description "Documentation for Lysand" \ No newline at end of file +LABEL org.opencontainers.image.description "Documentation for Lysand" + +WORKDIR /app +CMD ["bun", "docs:serve"] \ No newline at end of file diff --git a/docs/objects.md b/docs/objects.md index d7b2cf5..5dcb26b 100644 --- a/docs/objects.md +++ b/docs/objects.md @@ -51,11 +51,17 @@ This document uses TypeScript to define the types of the entities in a clear and ```typescript interface Entity { - id: string; - created_at: string; - uri: string; - type: string; -}; + id: string; + created_at: string; + uri: string; + type: string; + extensions?: { + "org.lysand:custom_emojis"?: { + emojis: Emoji[]; + }; + [key: string]: object | undefined; + }; +} ``` The `Entity` type is the base type for all entities in the Lysand protocol. It includes the `id`, `created_at`, `uri`, and `type` attributes. diff --git a/docs/objects/actions.md b/docs/objects/actions.md index 673dbbf..733a72d 100644 --- a/docs/objects/actions.md +++ b/docs/objects/actions.md @@ -40,4 +40,13 @@ This approach helps prevent potential misuse of the protocol to determine if a u | :----- | :----- | :------- | | author | String | Yes | -URI of the [Actor](./actors) who initiated the action. \ No newline at end of file +URI of the [Actor](./actors) who initiated the action. + +## Types + +```typescript +interface Action extends Entity { + type: "Like" | "Dislike" | "Follow" | "FollowAccept" | "FollowReject" | "Announce" | "Undo"; + author: string +} +``` \ No newline at end of file diff --git a/docs/objects/announce.md b/docs/objects/announce.md index 3d7da0a..668056f 100644 --- a/docs/objects/announce.md +++ b/docs/objects/announce.md @@ -36,9 +36,8 @@ URI of the object being announced. Must be of type [Note](./note) ## Types ```typescript -interface Announce extends Entity { +interface Announce extends Action { type: "Announce"; - author: string; object: string; } ``` \ No newline at end of file diff --git a/docs/objects/dislike.md b/docs/objects/dislike.md index dd773b1..8b7002c 100644 --- a/docs/objects/dislike.md +++ b/docs/objects/dislike.md @@ -35,9 +35,8 @@ URI of the object being disliked. Must be of type [Note](./note) ## Types ```typescript -interface Dislike extends Entity { +interface Dislike extends Action { type: "Dislike"; - author: string; object: string; } ``` \ No newline at end of file diff --git a/docs/objects/follow-accept.md b/docs/objects/follow-accept.md index 48b7c2c..d595c28 100644 --- a/docs/objects/follow-accept.md +++ b/docs/objects/follow-accept.md @@ -35,9 +35,8 @@ URI of the [User](./user) who tried to follow the author ## Types ```typescript -interface FollowAccept extends Entity { +interface FollowAccept extends Action { type: "FollowAccept"; - author: string; follower: string; } ``` \ No newline at end of file diff --git a/docs/objects/follow-reject.md b/docs/objects/follow-reject.md index 6b64bf0..aed6449 100644 --- a/docs/objects/follow-reject.md +++ b/docs/objects/follow-reject.md @@ -35,9 +35,8 @@ URI of the [User](./user) who tried to follow the author. ## Types ```typescript -interface FollowReject extends Entity { +interface FollowReject extends Action { type: "FollowReject"; - author: string; follower: string; } ``` diff --git a/docs/objects/follow.md b/docs/objects/follow.md index 64ebc5f..7d907bd 100644 --- a/docs/objects/follow.md +++ b/docs/objects/follow.md @@ -35,9 +35,8 @@ URI of the [User](./user) who is being follow requested. ## Types ```typescript -interface Follow extends Entity { +interface Follow extends Action { type: "Follow"; - author: string; followee: string; } ``` diff --git a/docs/objects/like.md b/docs/objects/like.md index bdd555c..b80ebba 100644 --- a/docs/objects/like.md +++ b/docs/objects/like.md @@ -35,9 +35,8 @@ URI of the object being liked. Must be of type [Note](./note) ## Types ```typescript -interface Like extends Entity { +interface Like extends Action { type: "Like"; - author: string; object: string; } ``` diff --git a/docs/objects/publications.md b/docs/objects/publications.md index 8566527..7e2242c 100644 --- a/docs/objects/publications.md +++ b/docs/objects/publications.md @@ -212,7 +212,7 @@ Servers **MUST** respect the visibility of the publication and **MUST NOT** show ## Types ```typescript -interface Publication { +interface Publication extends Entity { type: "Note" | "Patch"; author: string; content?: ContentFormat; @@ -223,6 +223,19 @@ interface Publication { subject?: string; is_sensitive?: boolean; visibility: Visibility; + extensions?: Entity["extensions"] & { + "org.lysand:reactions"?: { + reactions: string; + }; + "org.lysand:polls"?: { + poll: { + options: ContentFormat[]; + votes: number[]; + multiple_choice?: boolean; + expires_at: string; + }; + }; + }; } ``` diff --git a/docs/objects/server-metadata.md b/docs/objects/server-metadata.md index 235a3f1..376069d 100644 --- a/docs/objects/server-metadata.md +++ b/docs/objects/server-metadata.md @@ -151,4 +151,24 @@ Clients should display the most modern format that they support, such as WebP, A | :------------------- | :-------------- | :----------------------------- | | supported_extensions | Array of String | Yes, can be empty array (`[]`) | -List of extension names that the server supports, in namespaced format (`"org.lysand:reactions"`). \ No newline at end of file +List of extension names that the server supports, in namespaced format (`"org.lysand:reactions"`). + +## Types + +```typescript +interface ServerMetadata { + type: "ServerMetadata"; + name: string; + version: string; + description?: string; + website?: string; + moderators?: string[]; + admins?: string[]; + logo?: ContentFormat; + banner?: ContentFormat; + supported_extensions: string[]; + extensions?: { + [key: string]: object | undefined; + }; +} +``` \ No newline at end of file diff --git a/docs/objects/undo.md b/docs/objects/undo.md index 057ed17..0643fb0 100644 --- a/docs/objects/undo.md +++ b/docs/objects/undo.md @@ -40,4 +40,14 @@ URI of the [Actor](./actors) who initiated the action. | :----- | :----- | :------- | | object | String | Yes | -URI of the object being undone. The object **MUST** be an [Action](./actions) or a [Note](./note). To undo [Patch](./patch) objects, use a subsequent [Patch](./patch) or delete the original [Note](./note). \ No newline at end of file +URI of the object being undone. The object **MUST** be an [Action](./actions) or a [Note](./note). To undo [Patch](./patch) objects, use a subsequent [Patch](./patch) or delete the original [Note](./note). + +## Types + +```typescript +interface Undo extends Entity { + type: "Undo"; + author: string; + object: string; +} +``` \ No newline at end of file diff --git a/docs/objects/user.md b/docs/objects/user.md index 10707f9..a78bc3c 100644 --- a/docs/objects/user.md +++ b/docs/objects/user.md @@ -332,6 +332,9 @@ interface User extends Entity { dislikes: string; inbox: string; outbox: string; + extensions?: Entity["extensions"] & { + "org.lysand:vanity"?: VanityExtension; + }; } ```