Skip to content

Commit 7589afd

Browse files
committed
docs: 📝 Write article about Versia 0.5
1 parent d97efab commit 7589afd

File tree

16 files changed

+291
-50
lines changed

16 files changed

+291
-50
lines changed

bun.lockb

8.84 KB
Binary file not shown.

components/article/content.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
<template>
2-
<!-- <article
3-
class="$style.content mx-auto max-w-3xl prose prose-invert mt-10 prose-code:before:content-none prose-code:after:content-none prose-a:text-orange-500 prose-a:underline"
4-
v-html="body"></article> -->
52
<article :class="[$style.content, 'prose prose-invert prose-code:before:content-none prose-code:after:content-none']" v-html="body"></article>
63
</template>
74

@@ -29,8 +26,12 @@ defineProps<{
2926
@apply h-6 w-6 flex-none rounded-full bg-gray-800;
3027
}
3128
29+
.content :global :has(.header-anchor):hover .header-anchor {
30+
@apply opacity-100;
31+
}
32+
3233
.content :global .header-anchor {
33-
@apply no-underline absolute w-16 md:w-auto text-right left-[calc(100%-3.75rem)] md:-left-10 text-gray-200
34+
@apply no-underline absolute size-6 md:w-auto text-right opacity-0 duration-75 left-[calc(100%-3.75rem)] md:-left-10 text-gray-200
3435
}
3536
3637
.content :global .header-anchor::before {

components/article/image.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
<template>
2-
<nuxt-img :src="image" :width="width" :height="height" format="webp" alt="" :preload="true"
3-
class="drop-shadow-2xl w-full rounded bg-zinc-900 ring-1 ring-white/10" />
2+
<figure class="space-y-3 w-full">
3+
<nuxt-img :src="image" :width="width" :height="height" format="webp" alt="" :preload="true"
4+
class="drop-shadow-2xl w-full rounded bg-zinc-900 ring-1 ring-white/10" />
5+
<figcaption v-if="caption" class="text-center text-sm text-gray-400">{{ caption }}</figcaption>
6+
</figure>
47
</template>
58

69
<script lang="ts" setup>
710
defineProps<{
811
image: string;
912
width?: number;
1013
height?: number;
14+
caption?: string;
1115
}>();
1216
</script>

components/article/title.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="mx-auto max-w-2xl text-center flex items-center justify-center gap-8 flex-col">
3-
<h1 v-if="title" class="text-4xl font-bold tracking-tight text-gray-50 sm:text-5xl">
3+
<h1 v-if="title" class="text-4xl font-bold tracking-tight text-gray-50 sm:text-5xl font-title">
44
{{ title }}
55
</h1>
66
<div>
@@ -18,7 +18,7 @@ defineProps<{
1818
}>();
1919
2020
const formatDate = (date?: string) => {
21-
return new Intl.DateTimeFormat(undefined, {
21+
return new Intl.DateTimeFormat("en-GB", {
2222
year: "numeric",
2323
month: "long",
2424
day: "numeric",

components/navigation/navbar.vue

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<template>
2+
<header class="shadow bg-zinc-800">
3+
<div class="mx-auto max-w-7xl px-2 sm:px-4 lg:px-8">
4+
<div class="relative flex h-16 justify-between">
5+
<div class="relative z-10 flex px-2 lg:px-0">
6+
<div class="flex flex-shrink-0 items-center">
7+
<img class="h-8 w-auto" src="https://cdn.versia.pub/branding/icon.svg"
8+
alt="Pink rounded square with three white star icons in the center" />
9+
</div>
10+
</div>
11+
<div class="relative z-0 flex flex-1 items-center justify-center px-2">
12+
<div class="w-full max-w-xl">
13+
<label for="search" class="sr-only">Search</label>
14+
<div class="relative">
15+
<div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
16+
<Icon name="tabler:search" class="size-5 text-gray-300" aria-hidden="true" />
17+
</div>
18+
<input id="search" name="search"
19+
class="block w-full rounded-md border-0 bg-zinc-700 py-1.5 pl-10 pr-3 text-gray-200 ring-1 ring-inset ring-gray-700 placeholder:text-gray-300 focus:ring-2 focus:ring-inset focus:ring-pink-600 sm:text-sm sm:leading-6"
20+
placeholder="Search" type="search" />
21+
</div>
22+
</div>
23+
</div>
24+
</div>
25+
<nav class="hidden sm:flex sm:flex-row flex-col justify-evenly gap-x-8 gap-y-2 py-2" aria-label="Global">
26+
<a v-for="item in navigation" :key="item.name" :href="item.href"
27+
:class="['text-gray-100 hover:bg-zinc-700 hover:text-gray-50 inline-flex items-center justify-center rounded py-2 px-3 text-sm font-medium duration-200 w-full']">{{ item.name }}</a>
28+
</nav>
29+
</div>
30+
</header>
31+
</template>
32+
33+
<script lang="ts" setup>
34+
const navigation = [
35+
{ name: "Dashboard", href: "#", current: true },
36+
{ name: "Team", href: "#", current: false },
37+
{ name: "Projects", href: "#", current: false },
38+
{ name: "Calendar", href: "#", current: false },
39+
];
40+
</script>

composables/server/Post.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export const getPost = async (path: string): Promise<Post | null> => {
4646
height: header.image_height
4747
? Number(header.image_height)
4848
: undefined,
49+
credit: header.image_credit,
4950
},
5051
title: header.title,
5152
path,

content/2025/01/17/versia-05.md

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
---
2+
title: Versia 0.5 is here!
3+
created_at: 1737126070000
4+
description: The latest and greatest version of Versia is here! This release is all about small changes and tweaks to make exchanges more consistent.
5+
image: /images/vibrant-abstract-purple-pink.jpg
6+
image_credit: Steve Johnson, Pexels
7+
image_width: 1280
8+
image_height: 720
9+
author: CPlusPatch
10+
author_image: https://cpluspatch.com/images/avatars/jessew.png
11+
author_handle: @jessew
12+
---
13+
14+
Today, on January 17th 2025, I [merged](https://github.com/versia-pub/docs/pull/35) Versia 0.5 into the docs' `main` branch.
15+
16+
This release doesn't bring any major changes, being mostly renames and tweaks to make data exchanges more consistent. The most notable changes are:
17+
18+
- Signature headers have been renamed
19+
- The nonce in signatures has been replaced by a timestamp
20+
- Groups are better documented
21+
- (and moved to an extension :p)
22+
- [Versia Links](https://versia.pub/links) are a new feature
23+
- Some [`Collections`](https://versia.pub/structures/collection) have been swapped for the simpler [`URICollection`](https://versia.pub/structures/collection#uri-collection) format
24+
- A bunch of new extensions
25+
26+
You can find the full changelog [here](https://versia.pub/changelog).
27+
28+
Let's go over everything in more detail.
29+
30+
## Line endings
31+
32+
For the sake of consistency across OSes and editors, all text fields in Versia now use Unix line endings (`\n`). Most servers already use Unix line endings, but it's good to be explicit about it.
33+
34+
## Renamed headers
35+
36+
The following headers have been renamed:
37+
38+
- `X-Signature` --> `Versia-Signature`
39+
- `X-Signed-By` --> `Versia-Signed-By`
40+
41+
Why? Well, [RFC 6648](https://tools.ietf.org/html/rfc6648) happened (tldr: the `X-` prefix is deprecated).
42+
43+
## Nonce no more
44+
45+
The `X-Nonce` header in signatures has been replaced by a timestamp. Replay attacks are not really a big concern in the Versia security model, but verifying signature freshness is still a good idea.
46+
47+
### What does this prevent?
48+
49+
Here's an example: Alice accidentally posts her full social security number to a public Versia server. Obviously, she immediately deletes the post, but someone with a malicious instance could replay the note federation request to other servers, essentially bringing it back from the dead.
50+
51+
This is a very contrived example, but it's a good illustration of why we should verify the freshness of signatures.
52+
53+
## Rate limiting
54+
55+
Obeying IETF draft [polli-ratelimit-headers-02](https://www.ietf.org/archive/id/draft-polli-ratelimit-headers-02.html) is now mandatory for all Versia implementations. Implementations running on weaker hardware can sometimes struggle with the load of a large number of requests, so it's important to have a way to throttle federation!
56+
57+
As to the draft itself, it was chosen for its simplicity, so you shouldn't have too much trouble implementing it.
58+
59+
## Groups
60+
61+
Turns out, [`Groups`](https://versia.pub/extensions/groups) were missing a lot of significant information, like how to actually subscribe and receive updates from them. This has been fixed.
62+
63+
The new system introduces a very similar system to the one used for [`Follows`](https://versia.pub/entities/follow), with the following new entities:
64+
65+
- `pub.versia:groups/Subscribe`
66+
- `pub.versia:groups/Unsubscribe`
67+
- `pub.versia:groups/SubscribeAccept`
68+
- `pub.versia:groups/SubscribeReject`
69+
70+
As to federation, the [`Groups`](https://versia.pub/extensions/groups)'s home instance can now federate all notes posted to it while keeping the original author's signature, using the new `pub.versia:groups/Federate` entity. This avoids the need for forwardable signatures, which are a pain to implement.
71+
72+
To top that all off, `Groups` have [been moved to an extension](https://versia.pub/extensions/groups), because they were getting too big for the main spec.
73+
74+
## Versia Links
75+
76+
A common problem on ActivityPub is that you can easily link to a user or a note via its URI, but to interact with it, you need to have your implementation look up that URI in your favourite client. This is a pain. There should be a way to automatically open your favorite client when you click on a link, right?
77+
78+
Well, the issue comes from the fact that there's no way for a client to tell which URIs are Versia URIs (e.g., `https://versia.social/users/jessew`) and which are not (like `https://google.com`). This is where Versia Links come in.
79+
80+
They look like this:
81+
82+
```plaintext
83+
# Opens a user profile
84+
web+versia://users/bob.social/alice
85+
86+
# Opens a note
87+
web+versia://notes/jimbob.com/01902e09-0f8b-72de-8ee3-9afc0cf5eae1
88+
89+
# Opens the composer with a reply to a note
90+
web+versia://reply/bob.social/01902e09-0f8b-72de-8ee3-9afc0cf5eae1
91+
```
92+
93+
The `web+` prefix allows Web clients to register support for the `web+versia` scheme, which will open the link in the user's Versia client. This is a simple way to make Versia URIs stand out from the rest.
94+
95+
Versia Links are meant to be used in instances' web UIs, for logged-out users. This replaces the "type your instance's domain" popup that was previously used in [Mastodon](https://joinmastodon.org/), for example.
96+
97+
For more information, check out the [Versia Links spec](https://versia.pub/links).
98+
99+
## Timestamp change
100+
101+
All timestamps now use [RFC 3339](https://tools.ietf.org/html/rfc3339) instead of ISO 8601. [RFC 3339](https://tools.ietf.org/html/rfc3339) can be thought as a more restricted version of ISO 8601, which means that most implementations should already be compatible with it.
102+
103+
```plaintext
104+
# ISO 8601
105+
2025-01-17T12:00:00Z
106+
107+
# RFC 3339
108+
2025-01-17T12:00:00Z
109+
110+
# They're the same!
111+
# Except now you can't do this horrible thing anymore:
112+
2025-W03-5T17:04:29/PT2M
113+
```
114+
115+
[Here's a helpful visualization of the differences between the two](https://ijmacd.github.io/rfc3339-iso8601/).
116+
117+
### Unix timestamps?
118+
119+
Unix timestamps are great for machines, but they're not very human-readable. [RFC 3339](https://tools.ietf.org/html/rfc3339) is a good compromise between the two, being both human-readable and easily machine-readable.
120+
121+
## `$schema` in Entities
122+
123+
Entities can now optionally have a `$schema` field, which allows implementations to include a [JSON Schema](https://json-schema.org/) inside the entity.
124+
125+
This is meant for human use only, and not for either clients or servers to validate the entity. Including the implementation's JSON schema in the entity itself can be useful for debugging and documentation purposes.
126+
127+
## URICollection
128+
129+
Some `Collections` have been swapped for the simpler `URICollection` format. This is a simple list of URIs, which can be used for things like a list of followers, for example.
130+
131+
It is much easier to implement than the full `Collection` format, plus it's also more lightweight.
132+
133+
```json
134+
{
135+
"author": "https://versia.social/users/018ec082-0ae1-761c-b2c5-22275a611771",
136+
"first": "https://versia.social/users/018ec082-0ae1-761c-b2c5-22275a611771/followers?page=1",
137+
"last": "https://versia.social/users/018ec082-0ae1-761c-b2c5-22275a611771/followers?page=3",
138+
"total": 46,
139+
"next": "https://versia.social/users/018ec082-0ae1-761c-b2c5-22275a611771/followers?page=2",
140+
"previous": null,
141+
"items": [
142+
"https://versia.social/users/f8b0d4b4-d354-4798-bbc5-c2ba8acabfe3",
143+
"https://social.bob.com/u/2B27E62snga763"
144+
]
145+
}
146+
```
147+
148+
## Note collections
149+
150+
[Notes](https://versia.pub/entities/note) now have a `collections` field, which regroups `outbox`, `likes`, `replies`, etc.
151+
152+
```json
153+
{
154+
// ...
155+
"collections": {
156+
"replies": "https://versia.social/objects/01902e09-0f8b-72de-8ee3-9afc0cf5eae1/replies",
157+
"quotes": "https://versia.social/objects/01902e09-0f8b-72de-8ee3-9afc0cf5eae1/quotes",
158+
"pub.versia:likes/Likes": "https://versia.social/objects/01902e09-0f8b-72de-8ee3-9afc0cf5eae1/likes",
159+
"pub.versia:likes/Dislikes": "https://versia.social/objects/01902e09-0f8b-72de-8ee3-9afc0cf5eae1/dislikes",
160+
"pub.versia:reactions/Reactions": "https://versia.social/objects/01902e09-0f8b-72de-8ee3-9afc0cf5eae1/reactions"
161+
}
162+
}
163+
```
164+
165+
This is a simpler structure than in Versia 0.4, where everything was its own top-level field:
166+
167+
```json
168+
{
169+
// ...
170+
"replies": "https://versia.social/objects/01902e09-0f8b-72de-8ee3-9afc0cf5eae1/replies",
171+
"quotes": "https://versia.social/objects/01902e09-0f8b-72de-8ee3-9afc0cf5eae1/quotes",
172+
"extensions": {
173+
"pub.versia:likes": {
174+
"likes": "https://versia.social/objects/01902e09-0f8b-72de-8ee3-9afc0cf5eae1/likes",
175+
}
176+
}
177+
}
178+
```
179+
180+
## Interaction Controls
181+
182+
The new [Interaction Controls Extension](https://versia.pub/extensions/interaction-controls) allows users to control who can interact with their posts, just like on Bluesky or Twitter. This is great when you're often the target of spam or harassment.
183+
184+
The system has a lot of flexibility while still being simple enough to implement in a weekend or two.
185+
186+
## Smaller stuff
187+
188+
- Usernames can now have uppercase characters. Also, they're now case-insensitive, so `jessew` and `JesseW` are the same user.
189+
- The [Vanity Extension](https://versia.pub/extensions/vanity) now supports a `timezone` field.
190+
- Docs have been improved across the board, with [more examples](https://versia.pub/federation/example) and explanations.
191+
- [`Reports`](https://versia.pub/extensions/reports) are now transient, and the `reason` field was replaced by a `tags` field.
192+
193+
## Conclusion
194+
195+
Is this a large breaking change that will require a lot of work to implement? No, not really. Is it better than the previous version? Yes, definitely.
196+
197+
I hope you have a good time implementing this release. If you have any questions, feel free to contact me, Jesse, [on these socials](https://cpluspatch.com/contact). I'm always glad to help.
198+
199+
Happy hacking!

content/test/test-file.md

Lines changed: 0 additions & 32 deletions
This file was deleted.

layouts/app.vue

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1+
<script setup lang="ts">
2+
</script>
3+
14
<template>
2-
<main :class="[$style.content, 'w-full h-full min-h-screen bg-gradient-to-tr from-zinc-900 to-zinc-800']">
5+
<main :class="['size-full min-h-screen bg-zinc-900 font-sans']">
36
<slot />
47
</main>
5-
</template>
6-
7-
<style lang="css" module>
8-
.content {
9-
font-family: Inter, sans-serif;
10-
}
11-
</style>
8+
</template>

nuxt.config.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,23 @@ export default defineNuxtConfig({
9494
future: {
9595
compatibilityVersion: 4,
9696
},
97+
fonts: {
98+
defaults: {
99+
subsets: ["latin", "latin-ext"],
100+
},
101+
},
102+
security: {
103+
headers: {
104+
contentSecurityPolicy: {
105+
"img-src": [
106+
"'self'",
107+
"data:",
108+
"images.pexels.com",
109+
"cdn.versia.pub",
110+
],
111+
},
112+
},
113+
},
97114
image: {
98115
domains: ["images.pexels.com"],
99116
},

0 commit comments

Comments
 (0)