mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 00:18:19 +01:00
Fix ESLint errors
This commit is contained in:
parent
103115efa1
commit
1ed3fb474e
|
|
@ -1,92 +1 @@
|
|||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { getConfig } from "@config";
|
||||
import { AppDataSource } from "~database/datasource";
|
||||
import { ApplicationAction } from "~database/entities/Application";
|
||||
import { RawActivity } from "~database/entities/RawActivity";
|
||||
import { Token, TokenType } from "~database/entities/Token";
|
||||
import { UserAction } from "~database/entities/User";
|
||||
|
||||
const config = getConfig();
|
||||
|
||||
let token: Token;
|
||||
if (!AppDataSource.isInitialized) await AppDataSource.initialize();
|
||||
|
||||
// Initialize test user
|
||||
const user = await UserAction.createNewLocal({
|
||||
email: "test@test.com",
|
||||
username: "test",
|
||||
password: "test",
|
||||
display_name: "",
|
||||
});
|
||||
|
||||
const app = new ApplicationAction();
|
||||
|
||||
app.name = "Test Application";
|
||||
app.website = "https://example.com";
|
||||
app.client_id = "test";
|
||||
app.redirect_uris = "https://example.com";
|
||||
app.scopes = "read write";
|
||||
app.secret = "test";
|
||||
app.vapid_key = null;
|
||||
|
||||
await app.save();
|
||||
|
||||
// Initialize test token
|
||||
token = new Token();
|
||||
|
||||
token.access_token = "test";
|
||||
token.application = app;
|
||||
token.code = "test";
|
||||
token.scope = "read write";
|
||||
token.token_type = TokenType.BEARER;
|
||||
token.user = user;
|
||||
|
||||
token = await token.save();
|
||||
|
||||
await fetch(`${config.http.base_url}/api/v1/statuses`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
status: "Hello, world!",
|
||||
visibility: "public",
|
||||
}),
|
||||
});
|
||||
|
||||
const timeBefore = performance.now();
|
||||
|
||||
// Repeat 100 times
|
||||
for (let i = 0; i < 100; i++) {
|
||||
await fetch(`${config.http.base_url}/api/v1/timelines/public`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token.access_token}`,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const timeAfter = performance.now();
|
||||
|
||||
const activities = await RawActivity.createQueryBuilder("activity")
|
||||
.where("activity.data->>'actor' = :actor", {
|
||||
actor: `${config.http.base_url}/users/test`,
|
||||
})
|
||||
.leftJoinAndSelect("activity.objects", "objects")
|
||||
.getMany();
|
||||
|
||||
// Delete all created objects and activities as part of testing
|
||||
await Promise.all(
|
||||
activities.map(async activity => {
|
||||
await Promise.all(
|
||||
activity.objects.map(async object => await object.remove())
|
||||
);
|
||||
await activity.remove();
|
||||
})
|
||||
);
|
||||
|
||||
await user.remove();
|
||||
|
||||
console.log(`Time taken: ${timeAfter - timeBefore}ms`);
|
||||
//
|
||||
|
|
|
|||
|
|
@ -35,7 +35,9 @@
|
|||
"dev": "bun run index.ts",
|
||||
"start": "bun run index.ts",
|
||||
"migrate-dev": "bunx prisma migrate dev",
|
||||
"migrate": "bunx prisma migrate deploy"
|
||||
"migrate": "bunx prisma migrate deploy",
|
||||
"lint": "eslint --config .eslintrc.cjs --ext .ts .",
|
||||
"generate": "bunx prisma generate"
|
||||
},
|
||||
"trustedDependencies": [
|
||||
"sharp",
|
||||
|
|
@ -64,7 +66,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "^3.429.0",
|
||||
"@prisma/client": "^5.5.2",
|
||||
"@prisma/client": "^5.6.0",
|
||||
"chalk": "^5.3.0",
|
||||
"html-to-text": "^9.0.5",
|
||||
"ip-matching": "^2.1.2",
|
||||
|
|
@ -73,7 +75,7 @@
|
|||
"jsonld": "^8.3.1",
|
||||
"marked": "^9.1.2",
|
||||
"pg": "^8.11.3",
|
||||
"prisma": "^5.5.2",
|
||||
"prisma": "latest",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"sharp": "^0.32.6",
|
||||
"typeorm": "^0.3.17"
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@ export interface APIIdentityProof {
|
|||
updated_at: string;
|
||||
proof_url: string;
|
||||
profile_url: string;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { ExtensionType } from "../../Extension";
|
||||
|
||||
export interface OrgLysandReactionsType extends ExtensionType {
|
||||
extension_type: "org.lysand:reactions/Reaction";
|
||||
author: string;
|
||||
object: string;
|
||||
content: string;
|
||||
}
|
||||
extension_type: "org.lysand:reactions/Reaction";
|
||||
author: string;
|
||||
object: string;
|
||||
content: string;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue