Skip to content

Instantly share code, notes, and snippets.

@csuwildcat
Created August 22, 2024 17:51
Show Gist options
  • Save csuwildcat/6b4cef830b9fcdb59a673e376d8ac115 to your computer and use it in GitHub Desktop.
Save csuwildcat/6b4cef830b9fcdb59a673e376d8ac115 to your computer and use it in GitHub Desktop.
{
published: true,
protocol: 'https://areweweb5yet.com/protocols/blog',
types: {
follow: {
schema: "https://areweweb5yet.com/protocols/follow",
dataFormats: ["application/json"]
},
post: {
schema: "https://areweweb5yet.com/protocols/post",
dataFormats: ["application/json"]
},
comment: {
schema: "https://areweweb5yet.com/protocols/comment",
dataFormats: ["application/json"]
},
media: {
dataFormats: ["image/gif", "image/png", "image/jpeg", "video/mp4"]
},
invite: {
schema: "https://areweweb5yet.com/protocols/invite",
dataFormats: ["application/json"]
},
moderator: {
schema: "https://areweweb5yet.com/protocols/moderator",
dataFormats: ["application/json"]
},
admin: {
schema: "https://areweweb5yet.com/protocols/admin",
dataFormats: ["application/json"]
},
block: {
schema: "https://areweweb5yet.com/protocols/block",
dataFormats: ["application/json"]
},
},
structure: {
// A global role assigned to other people the user follows
follow: {
$role: true
},
// A global admin role given to others to allow them ability
// to manage posts, comments, and add moderators to posts.
admin: {
$role: true
},
invite: {
$actions: [
{
// Allow anyone to send me invites
who: 'anyone',
can: ['create', 'delete']
}
],
$expiry: {
// Invites expire after 1 day
ttl: 86_400
},
$gate: {
// You need to put in the work to send me an invite, honey
pow: true
}
},
block: {
$actions: [
{
// Admins can also delete and prune
// comments authored by anyone on any post.
role: 'admin',
can: ['co-delete', 'co-prune']
}
]
},
post: {
// A post cannot be greater than 5k bytes.
$size: {
max: 5_000
},
$tags: {
// An array of the tags that are REQUIRED with a post.
// Only language is required.
$requiredTags: ['language'],
// Can optionally attach an array of category strings to each post
categories: {
type: 'array',
items: {
type: 'string'
}
},
// Can optionally specify whether or not a post should be highlighted
highlighted: {
type: 'boolean'
},
// A required tag to specify what langauge the post is written in.
// Must be one of the provided values.
language: {
type: 'string',
enum: ['en-US', 'es-ES', 'zh-CN', 'de-DE', 'hi-IN', 'bn-IN']
}
},
moderator: {
$role: true,
$actions: [
{
// Admins can add and delete moderator roles.
// Also able to delete moderator roles that someone else authored.
role: 'admin',
can: ['create', 'delete', 'co-delete']
}
],
},
media: {
$actions: [
{
// The author of the post can create, update and delete
// media that are associated with it their post.
who: 'author',
of: 'post',
can: ['create', 'update', 'delete']
}
],
$size: {
// Media cannot be more than 1MB in size
max: 1_000_000
}
},
comment: {
$actions: [
{
// Anyone can create comments.
// The author of the comment can also update, delete or prune.
// Pruning would delete the media as well as the comment.
who: 'anyone',
can: ['create', 'update', 'delete', 'prune'],
excluding: [ // What would it look like to exclude people via block list?
{
who: 'recipient',
of: 'block'
}
]
},
{
// The author of the post can delete and prune
// comments authored by others on their own post.
who: 'author',
of: 'post',
can: ['co-delete', 'co-prune']
},
{
// A post's moderator can also delete and prune
// comments authored by anyone on this specific post.
role: 'post/moderator',
can: ['co-delete', 'co-prune']
},
{
// Admins can also delete and prune
// comments authored by anyone on any post.
role: 'admin',
can: ['co-delete', 'co-prune']
}
],
media: {
$actions: [
{
// The author of a comment can add, update or delete
// media attached to their comment.
who: 'author',
of: 'post/comment',
can: ['create', 'update', 'delete']
},
{
// The author of the post can delete media authored by anyone.
who: 'author',
of: 'post',
can: ['co-delete']
},
{
// The post's moderator can delete media authored by anyone.
role: 'post/moderator',
can: ['co-delete']
},
{
// The global admin can delete media authored by anyone
role: 'admin',
can: ['co-delete']
}
]
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment