mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
Cleanup files and packages
This commit is contained in:
parent
bc296194b6
commit
fe0cfa547b
|
|
@ -1,22 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
extends: [
|
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/strict-type-checked",
|
|
||||||
"plugin:@typescript-eslint/stylistic",
|
|
||||||
"plugin:prettier/recommended",
|
|
||||||
],
|
|
||||||
parser: "@typescript-eslint/parser",
|
|
||||||
parserOptions: {
|
|
||||||
project: "./tsconfig.json",
|
|
||||||
},
|
|
||||||
ignorePatterns: ["node_modules/", "dist/", ".eslintrc.cjs"],
|
|
||||||
plugins: ["@typescript-eslint"],
|
|
||||||
root: true,
|
|
||||||
rules: {
|
|
||||||
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
||||||
"@typescript-eslint/no-unsafe-argument": "off",
|
|
||||||
"@typescript-eslint/no-explicit-any": "off",
|
|
||||||
"@typescript-eslint/consistent-type-exports": "error",
|
|
||||||
"@typescript-eslint/consistent-type-imports": "error",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"tabWidth": 4,
|
|
||||||
"useTabs": true,
|
|
||||||
"arrowParens": "avoid",
|
|
||||||
"bracketSameLine": true,
|
|
||||||
"bracketSpacing": true,
|
|
||||||
"jsxSingleQuote": false,
|
|
||||||
"trailingComma": "es5"
|
|
||||||
}
|
|
||||||
2
build.ts
2
build.ts
|
|
@ -40,7 +40,7 @@ await $`mkdir -p dist/node_modules/@img`;
|
||||||
await $`cp -r node_modules/@img/sharp-libvips-linux-* dist/node_modules/@img`;
|
await $`cp -r node_modules/@img/sharp-libvips-linux-* dist/node_modules/@img`;
|
||||||
await $`cp -r node_modules/@img/sharp-linux-* dist/node_modules/@img`;
|
await $`cp -r node_modules/@img/sharp-linux-* dist/node_modules/@img`;
|
||||||
|
|
||||||
// Copy Vite build output to dist
|
// Copy Nuxt build output to dist
|
||||||
await $`cp -r packages/frontend/.output dist/frontend`;
|
await $`cp -r packages/frontend/.output dist/frontend`;
|
||||||
|
|
||||||
// Copy the Bee Movie script from pages
|
// Copy the Bee Movie script from pages
|
||||||
|
|
|
||||||
36
package.json
36
package.json
|
|
@ -57,73 +57,47 @@
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "1.6.4",
|
"@biomejs/biome": "1.6.4",
|
||||||
"@img/sharp-wasm32": "^0.33.3",
|
|
||||||
"@julr/unocss-preset-forms": "^0.1.0",
|
|
||||||
"@nuxtjs/seo": "^2.0.0-rc.10",
|
|
||||||
"@nuxtjs/tailwindcss": "^6.11.4",
|
|
||||||
"@types/cli-table": "^0.3.4",
|
"@types/cli-table": "^0.3.4",
|
||||||
"@types/html-to-text": "^9.0.4",
|
"@types/html-to-text": "^9.0.4",
|
||||||
"@types/ioredis": "^5.0.0",
|
"@types/ioredis": "^5.0.0",
|
||||||
"@types/jsonld": "^1.5.13",
|
"@types/jsonld": "^1.5.13",
|
||||||
"@types/mime-types": "^2.1.4",
|
"@types/mime-types": "^2.1.4",
|
||||||
"@types/pg": "^8.11.5",
|
"@types/pg": "^8.11.5",
|
||||||
"@typescript-eslint/eslint-plugin": "latest",
|
|
||||||
"@unocss/cli": "latest",
|
|
||||||
"@unocss/transformer-directives": "^0.59.0",
|
|
||||||
"@vitejs/plugin-vue": "latest",
|
|
||||||
"@vueuse/head": "^2.0.0",
|
|
||||||
"activitypub-types": "^1.0.3",
|
|
||||||
"bun-types": "latest",
|
"bun-types": "latest",
|
||||||
"drizzle-kit": "^0.20.14",
|
"drizzle-kit": "^0.20.14",
|
||||||
"shiki": "^1.2.4",
|
"typescript": "latest"
|
||||||
"typescript": "latest",
|
|
||||||
"unocss": "latest",
|
|
||||||
"untyped": "^1.4.2",
|
|
||||||
"vite": "^5.2.8",
|
|
||||||
"vite-ssr": "^0.17.1",
|
|
||||||
"vue": "^3.3.9",
|
|
||||||
"vue-router": "^4.2.5",
|
|
||||||
"vue-tsc": "latest"
|
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": "^5.3.2"
|
"typescript": "^5.3.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.461.0",
|
|
||||||
"@iarna/toml": "^2.2.5",
|
|
||||||
"@json2csv/plainjs": "^7.0.6",
|
"@json2csv/plainjs": "^7.0.6",
|
||||||
"blurhash": "^2.0.5",
|
"blurhash": "^2.0.5",
|
||||||
"bullmq": "latest",
|
"bullmq": "^5.7.1",
|
||||||
"chalk": "^5.3.0",
|
"chalk": "^5.3.0",
|
||||||
"cli-parser": "workspace:*",
|
"cli-parser": "workspace:*",
|
||||||
"cli-table": "^0.3.11",
|
"cli-table": "^0.3.11",
|
||||||
"config-manager": "workspace:*",
|
"config-manager": "workspace:*",
|
||||||
"drizzle-orm": "^0.30.7",
|
"drizzle-orm": "^0.30.7",
|
||||||
"eventemitter3": "^5.0.1",
|
|
||||||
"extract-zip": "^2.0.1",
|
"extract-zip": "^2.0.1",
|
||||||
"html-to-text": "^9.0.5",
|
"html-to-text": "^9.0.5",
|
||||||
"ioredis": "^5.3.2",
|
"ioredis": "^5.3.2",
|
||||||
"ip-matching": "^2.1.2",
|
"ip-matching": "^2.1.2",
|
||||||
"iso-639-1": "^3.1.0",
|
"iso-639-1": "^3.1.0",
|
||||||
"isomorphic-dompurify": "latest",
|
"isomorphic-dompurify": "latest",
|
||||||
"jsonld": "^8.3.1",
|
|
||||||
"linkify-html": "^4.1.3",
|
"linkify-html": "^4.1.3",
|
||||||
"linkify-string": "^4.1.3",
|
"linkify-string": "^4.1.3",
|
||||||
"linkifyjs": "^4.1.3",
|
"linkifyjs": "^4.1.3",
|
||||||
"log-manager": "workspace:*",
|
"log-manager": "workspace:*",
|
||||||
"magic-regexp": "^0.8.0",
|
"magic-regexp": "^0.8.0",
|
||||||
"marked": "latest",
|
"marked": "^12.0.1",
|
||||||
"media-manager": "workspace:*",
|
"media-manager": "workspace:*",
|
||||||
"megalodon": "^10.0.0",
|
"megalodon": "^10.0.0",
|
||||||
"meilisearch": "latest",
|
"meilisearch": "^0.38.0",
|
||||||
"merge-deep-ts": "^1.2.6",
|
|
||||||
"mime-types": "^2.1.35",
|
"mime-types": "^2.1.35",
|
||||||
"next-route-matcher": "^1.0.1",
|
|
||||||
"oauth4webapi": "^2.4.0",
|
"oauth4webapi": "^2.4.0",
|
||||||
"pg": "^8.11.5",
|
"pg": "^8.11.5",
|
||||||
"request-parser": "workspace:*",
|
"request-parser": "workspace:*",
|
||||||
"semver": "^7.5.4",
|
"sharp": "^0.33.3"
|
||||||
"sharp": "^0.33.3",
|
|
||||||
"strip-ansi": "^7.1.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import chalk from "chalk";
|
import chalk from "chalk";
|
||||||
import strip from "strip-ansi";
|
|
||||||
import { type CliParameter, CliParameterType } from "./cli-builder.type";
|
import { type CliParameter, CliParameterType } from "./cli-builder.type";
|
||||||
|
|
||||||
export function startsWithArray(fullArray: string[], startArray: string[]) {
|
export function startsWithArray(fullArray: string[], startArray: string[]) {
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,13 @@
|
||||||
"c12": "^1.10.0",
|
"c12": "^1.10.0",
|
||||||
"nuxt": "^3.11.2",
|
"nuxt": "^3.11.2",
|
||||||
"vue": "^3.4.21",
|
"vue": "^3.4.21",
|
||||||
"vue-router": "^4.3.0"
|
"vue-router": "^4.3.0",
|
||||||
|
"shiki": "^1.2.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/forms": "^0.5.7",
|
"@tailwindcss/forms": "^0.5.7",
|
||||||
"@vue-email/nuxt": "^0.8.19"
|
"@vue-email/nuxt": "^0.8.19",
|
||||||
|
"@nuxtjs/seo": "^2.0.0-rc.10",
|
||||||
|
"@nuxtjs/tailwindcss": "^6.11.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
import type { Server } from "./types";
|
|
||||||
import { HookTypes } from "./types";
|
|
||||||
|
|
||||||
const registerPlugin = (server: Server) => {
|
|
||||||
server.on(HookTypes.OnPostCreate, (req, newPost, author) => {
|
|
||||||
console.log("New post created!");
|
|
||||||
console.log(`Post details: ${newPost.content} (${newPost.id})`);
|
|
||||||
console.log(`Made by ${author.username} (${author.id})`);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export default registerPlugin;
|
|
||||||
155
plugins/types.ts
155
plugins/types.ts
|
|
@ -1,155 +0,0 @@
|
||||||
import EventEmitter from "eventemitter3";
|
|
||||||
import type { StatusWithRelations } from "~database/entities/Status";
|
|
||||||
import type { UserWithRelations } from "~database/entities/User";
|
|
||||||
import type { LysandObjectType } from "~types/lysand/Object";
|
|
||||||
|
|
||||||
export enum HookTypes {
|
|
||||||
/**
|
|
||||||
* Called before the server starts listening
|
|
||||||
*/
|
|
||||||
PreServe = "preServe",
|
|
||||||
/**
|
|
||||||
* Called after the server stops listening
|
|
||||||
*/
|
|
||||||
PostServe = "postServe",
|
|
||||||
/**
|
|
||||||
* Called on every HTTP request (before anything else is done)
|
|
||||||
*/
|
|
||||||
OnRequestReceive = "onRequestReceive",
|
|
||||||
/**
|
|
||||||
* Called on every HTTP request (after it is processed)
|
|
||||||
*/
|
|
||||||
OnRequestProcessed = "onRequestProcessed",
|
|
||||||
/**
|
|
||||||
* Called on every object received (before it is parsed and added to the database)
|
|
||||||
*/
|
|
||||||
OnObjectReceive = "onObjectReceive",
|
|
||||||
/**
|
|
||||||
* Called on every object processed (after it is parsed and added to the database)
|
|
||||||
*/
|
|
||||||
OnObjectProcessed = "onObjectProcessed",
|
|
||||||
/**
|
|
||||||
* Called when signature verification fails on an object
|
|
||||||
*/
|
|
||||||
OnCryptoFail = "onCryptoFail",
|
|
||||||
/**
|
|
||||||
* Called when signature verification succeeds on an object
|
|
||||||
*/
|
|
||||||
OnCryptoSuccess = "onCryptoSuccess",
|
|
||||||
/**
|
|
||||||
* Called when a user is banned by another user
|
|
||||||
*/
|
|
||||||
OnBan = "onBan",
|
|
||||||
/**
|
|
||||||
* Called when a user is suspended by another user
|
|
||||||
*/
|
|
||||||
OnSuspend = "onSuspend",
|
|
||||||
/**
|
|
||||||
* Called when a user is blocked by another user
|
|
||||||
*/
|
|
||||||
OnUserBlock = "onUserBlock",
|
|
||||||
/**
|
|
||||||
* Called when a user is muted by another user
|
|
||||||
*/
|
|
||||||
OnUserMute = "onUserMute",
|
|
||||||
/**
|
|
||||||
* Called when a user is followed by another user
|
|
||||||
*/
|
|
||||||
OnUserFollow = "onUserFollow",
|
|
||||||
/**
|
|
||||||
* Called when a user registers (before completing email verification)
|
|
||||||
*/
|
|
||||||
OnRegister = "onRegister",
|
|
||||||
/**
|
|
||||||
* Called when a user finishes registering (after completing email verification)
|
|
||||||
*/
|
|
||||||
OnRegisterFinish = "onRegisterFinish",
|
|
||||||
/**
|
|
||||||
* Called when a user deletes their account
|
|
||||||
*/
|
|
||||||
OnDeleteAccount = "onDeleteAccount",
|
|
||||||
/**
|
|
||||||
* Called when a post is created
|
|
||||||
*/
|
|
||||||
OnPostCreate = "onPostCreate",
|
|
||||||
/**
|
|
||||||
* Called when a post is deleted
|
|
||||||
*/
|
|
||||||
OnPostDelete = "onPostDelete",
|
|
||||||
/**
|
|
||||||
* Called when a post is updated
|
|
||||||
*/
|
|
||||||
OnPostUpdate = "onPostUpdate",
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ServerStats {
|
|
||||||
postCount: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ServerEvents {
|
|
||||||
[HookTypes.PreServe]: () => void;
|
|
||||||
[HookTypes.PostServe]: (stats: ServerStats) => void;
|
|
||||||
[HookTypes.OnRequestReceive]: (req: Request) => void;
|
|
||||||
[HookTypes.OnRequestProcessed]: (req: Request) => void;
|
|
||||||
[HookTypes.OnObjectReceive]: (obj: LysandObjectType) => void;
|
|
||||||
[HookTypes.OnObjectProcessed]: (obj: LysandObjectType) => void;
|
|
||||||
[HookTypes.OnCryptoFail]: (
|
|
||||||
req: Request,
|
|
||||||
obj: LysandObjectType,
|
|
||||||
author: UserWithRelations,
|
|
||||||
publicKey: string,
|
|
||||||
) => void;
|
|
||||||
[HookTypes.OnCryptoSuccess]: (
|
|
||||||
req: Request,
|
|
||||||
obj: LysandObjectType,
|
|
||||||
author: UserWithRelations,
|
|
||||||
publicKey: string,
|
|
||||||
) => void;
|
|
||||||
[HookTypes.OnBan]: (
|
|
||||||
req: Request,
|
|
||||||
bannedUser: UserWithRelations,
|
|
||||||
banner: UserWithRelations,
|
|
||||||
) => void;
|
|
||||||
[HookTypes.OnSuspend]: (
|
|
||||||
req: Request,
|
|
||||||
suspendedUser: UserWithRelations,
|
|
||||||
suspender: UserWithRelations,
|
|
||||||
) => void;
|
|
||||||
[HookTypes.OnUserBlock]: (
|
|
||||||
req: Request,
|
|
||||||
blockedUser: UserWithRelations,
|
|
||||||
blocker: UserWithRelations,
|
|
||||||
) => void;
|
|
||||||
[HookTypes.OnUserMute]: (
|
|
||||||
req: Request,
|
|
||||||
mutedUser: UserWithRelations,
|
|
||||||
muter: UserWithRelations,
|
|
||||||
) => void;
|
|
||||||
[HookTypes.OnUserFollow]: (
|
|
||||||
req: Request,
|
|
||||||
followedUser: UserWithRelations,
|
|
||||||
follower: UserWithRelations,
|
|
||||||
) => void;
|
|
||||||
[HookTypes.OnRegister]: (req: Request, newUser: UserWithRelations) => void;
|
|
||||||
[HookTypes.OnDeleteAccount]: (
|
|
||||||
req: Request,
|
|
||||||
deletedUser: UserWithRelations,
|
|
||||||
) => void;
|
|
||||||
[HookTypes.OnPostCreate]: (
|
|
||||||
req: Request,
|
|
||||||
newPost: StatusWithRelations,
|
|
||||||
author: UserWithRelations,
|
|
||||||
) => void;
|
|
||||||
[HookTypes.OnPostDelete]: (
|
|
||||||
req: Request,
|
|
||||||
deletedPost: StatusWithRelations,
|
|
||||||
deleter: UserWithRelations,
|
|
||||||
) => void;
|
|
||||||
[HookTypes.OnPostUpdate]: (
|
|
||||||
req: Request,
|
|
||||||
updatedPost: StatusWithRelations,
|
|
||||||
updater: UserWithRelations,
|
|
||||||
) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Server extends EventEmitter<ServerEvents> {}
|
|
||||||
25
test.ts
25
test.ts
|
|
@ -1,25 +0,0 @@
|
||||||
import {
|
|
||||||
anyOf,
|
|
||||||
char,
|
|
||||||
charIn,
|
|
||||||
charNotIn,
|
|
||||||
createRegExp,
|
|
||||||
digit,
|
|
||||||
exactly,
|
|
||||||
global,
|
|
||||||
letter,
|
|
||||||
maybe,
|
|
||||||
not,
|
|
||||||
oneOrMore,
|
|
||||||
whitespace,
|
|
||||||
} from "magic-regexp/further-magic";
|
|
||||||
|
|
||||||
const regexp = createRegExp(
|
|
||||||
exactly("@jesse")
|
|
||||||
.notBefore(anyOf(letter, digit, charIn("@")))
|
|
||||||
.notAfter(anyOf(letter, digit, charIn("@"))),
|
|
||||||
[global],
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(regexp);
|
|
||||||
console.log("@jessew@game cheese @jesse2 @jesse s".match(regexp));
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
import { presetForms } from "@julr/unocss-preset-forms";
|
|
||||||
import transformerDirectives from "@unocss/transformer-directives";
|
|
||||||
|
|
||||||
import {
|
|
||||||
defineConfig,
|
|
||||||
presetTypography,
|
|
||||||
presetUno,
|
|
||||||
presetWebFonts,
|
|
||||||
} from "unocss";
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
presets: [
|
|
||||||
presetUno(),
|
|
||||||
presetTypography({
|
|
||||||
cssExtend: {
|
|
||||||
"h1,h2,h3,h4,h5.h6": {
|
|
||||||
"font-family": "'Poppins'",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
presetWebFonts(),
|
|
||||||
presetForms(),
|
|
||||||
],
|
|
||||||
transformers: [transformerDirectives()],
|
|
||||||
});
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
import type { APActivity, APObject } from "activitypub-types";
|
|
||||||
import type { NodeObject } from "jsonld";
|
|
||||||
|
|
||||||
export const response = (
|
export const response = (
|
||||||
data: BodyInit | null = null,
|
data: BodyInit | null = null,
|
||||||
status = 200,
|
status = 200,
|
||||||
|
|
@ -55,15 +52,6 @@ export const xmlResponse = (data: string, status = 200) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const jsonLdResponse = (
|
|
||||||
data: NodeObject | APActivity | APObject,
|
|
||||||
status = 200,
|
|
||||||
) => {
|
|
||||||
return response(JSON.stringify(data), status, {
|
|
||||||
"Content-Type": "application/activity+json",
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const errorResponse = (error: string, status = 500) => {
|
export const errorResponse = (error: string, status = 500) => {
|
||||||
return jsonResponse(
|
return jsonResponse(
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue