mirror of
https://github.com/versia-pub/server.git
synced 2025-12-07 08:48:19 +01:00
Try and fix some building issues
This commit is contained in:
parent
d29915456c
commit
986cc8a89c
9
build.ts
9
build.ts
|
|
@ -1,6 +1,13 @@
|
|||
// Delete dist directory
|
||||
import chalk from "chalk";
|
||||
import { rm, cp, mkdir, exists } from "fs/promises";
|
||||
|
||||
console.log(
|
||||
chalk.red(
|
||||
"Warning: Build is currently broken due to a bug in Bun causing it not to parse dynamic imports"
|
||||
)
|
||||
);
|
||||
|
||||
if (!(await exists("./pages/dist"))) {
|
||||
console.log("Please build the Vite server first, or use `bun prod-build`");
|
||||
process.exit(1);
|
||||
|
|
@ -22,7 +29,7 @@ await Bun.build({
|
|||
outdir: process.cwd() + "/dist",
|
||||
target: "bun",
|
||||
splitting: true,
|
||||
minify: true,
|
||||
minify: false,
|
||||
external: ["bullmq"],
|
||||
}).then(output => {
|
||||
if (!output.success) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Queue } from "bullmq";
|
||||
// import { Queue } from "bullmq";
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import { ConfigManager } from "config-manager";
|
||||
|
||||
|
|
@ -8,13 +8,13 @@ const client = new PrismaClient({
|
|||
datasourceUrl: `postgresql://${config.database.username}:${config.database.password}@${config.database.host}:${config.database.port}/${config.database.database}`,
|
||||
});
|
||||
|
||||
const federationQueue = new Queue("federation", {
|
||||
/* const federationQueue = new Queue("federation", {
|
||||
connection: {
|
||||
host: config.redis.queue.host,
|
||||
port: Number(config.redis.queue.port),
|
||||
password: config.redis.queue.password || undefined,
|
||||
db: config.redis.queue.database || undefined,
|
||||
},
|
||||
});
|
||||
}); */
|
||||
|
||||
export { client, federationQueue };
|
||||
export { client /* federationQueue */ };
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Worker } from "bullmq";
|
||||
import { client, federationQueue } from "~database/datasource";
|
||||
// import { Worker } from "bullmq";
|
||||
import { client /* federationQueue */ } from "~database/datasource";
|
||||
import {
|
||||
statusAndUserRelations,
|
||||
statusToLysand,
|
||||
|
|
@ -10,7 +10,7 @@ import { ConfigManager } from "config-manager";
|
|||
|
||||
const config = await new ConfigManager({}).getConfig();
|
||||
|
||||
export const federationWorker = new Worker(
|
||||
/* export const federationWorker = new Worker(
|
||||
"federation",
|
||||
async job => {
|
||||
await job.updateProgress(0);
|
||||
|
|
@ -123,7 +123,7 @@ export const federationWorker = new Worker(
|
|||
count: 3000,
|
||||
},
|
||||
}
|
||||
);
|
||||
); */
|
||||
|
||||
/**
|
||||
* Convert a string into an ArrayBuffer
|
||||
|
|
@ -191,7 +191,7 @@ export const federateStatusTo = async (
|
|||
};
|
||||
|
||||
export const addStatusFederationJob = async (statusId: string) => {
|
||||
await federationQueue.add("federation", {
|
||||
/* await federationQueue.add("federation", {
|
||||
id: statusId,
|
||||
});
|
||||
}); */
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
previewFeatures = ["postgresqlExtensions"]
|
||||
binaryTargets = ["native", "debian-openssl-3.0.x"]
|
||||
}
|
||||
|
||||
datasource db {
|
||||
|
|
|
|||
136
routes.ts
136
routes.ts
|
|
@ -1,167 +1,161 @@
|
|||
import type { RouteHandler } from "~server/api/routes.type";
|
||||
import type { APIRouteMeta } from "~types/api";
|
||||
|
||||
const serverPath = process.cwd() + "/server/api";
|
||||
import type { RouteHandler } from "./server/api/routes.type";
|
||||
import type { APIRouteMeta } from "./types/api";
|
||||
|
||||
// Why are these routes specified manually instead of using Bun's FileSystemRouter?
|
||||
// This is to allow for compilation of the routes, so that we can minify them and
|
||||
// node_modules in production
|
||||
export const rawRoutes = {
|
||||
"/api/v1/accounts": await import(serverPath + "/api/v1/accounts/index.ts"),
|
||||
"/api/v1/accounts": await import("./server/api/api/v1/accounts"),
|
||||
"/api/v1/accounts/familiar_followers": await import(
|
||||
serverPath + "/api/v1/accounts/familiar_followers/index.ts"
|
||||
"./server/api/api/v1/accounts/familiar_followers/index"
|
||||
),
|
||||
"/api/v1/accounts/relationships": await import(
|
||||
serverPath + "/api/v1/accounts/relationships/index.ts"
|
||||
"./server/api/api/v1/accounts/relationships/index"
|
||||
),
|
||||
"/api/v1/accounts/search": await import(
|
||||
serverPath + "/api/v1/accounts/search/index.ts"
|
||||
"./server/api/api/v1/accounts/search/index"
|
||||
),
|
||||
"/api/v1/accounts/update_credentials": await import(
|
||||
serverPath + "/api/v1/accounts/update_credentials/index.ts"
|
||||
"./server/api/api/v1/accounts/update_credentials/index"
|
||||
),
|
||||
"/api/v1/accounts/verify_credentials": await import(
|
||||
serverPath + "/api/v1/accounts/verify_credentials/index.ts"
|
||||
"./server/api/api/v1/accounts/verify_credentials/index"
|
||||
),
|
||||
"/api/v1/apps": await import(serverPath + "/api/v1/apps/index.ts"),
|
||||
"/api/v1/apps": await import("./server/api/api/v1/apps/index"),
|
||||
"/api/v1/apps/verify_credentials": await import(
|
||||
serverPath + "/api/v1/apps/verify_credentials/index.ts"
|
||||
"./server/api/api/v1/apps/verify_credentials/index"
|
||||
),
|
||||
"/api/v1/blocks": await import(serverPath + "/api/v1/blocks/index.ts"),
|
||||
"/api/v1/blocks": await import("./server/api/api/v1/blocks/index"),
|
||||
"/api/v1/custom_emojis": await import(
|
||||
serverPath + "/api/v1/custom_emojis/index.ts"
|
||||
),
|
||||
"/api/v1/favourites": await import(
|
||||
serverPath + "/api/v1/favourites/index.ts"
|
||||
"./server/api/api/v1/custom_emojis/index"
|
||||
),
|
||||
"/api/v1/favourites": await import("./server/api/api/v1/favourites/index"),
|
||||
"/api/v1/follow_requests": await import(
|
||||
serverPath + "/api/v1/follow_requests/index.ts"
|
||||
"./server/api/api/v1/follow_requests/index"
|
||||
),
|
||||
"/api/v1/instance": await import(serverPath + "/api/v1/instance/index.ts"),
|
||||
"/api/v1/media": await import(serverPath + "/api/v1/media/index.ts"),
|
||||
"/api/v1/mutes": await import(serverPath + "/api/v1/mutes/index.ts"),
|
||||
"/api/v1/instance": await import("./server/api/api/v1/instance/index"),
|
||||
"/api/v1/media": await import("./server/api/api/v1/media/index"),
|
||||
"/api/v1/mutes": await import("./server/api/api/v1/mutes/index"),
|
||||
"/api/v1/notifications": await import(
|
||||
serverPath + "/api/v1/notifications/index.ts"
|
||||
"./server/api/api/v1/notifications/index"
|
||||
),
|
||||
"/api/v1/profile/avatar": await import(
|
||||
serverPath + "/api/v1/profile/avatar.ts"
|
||||
"./server/api/api/v1/profile/avatar"
|
||||
),
|
||||
"/api/v1/profile/header": await import(
|
||||
serverPath + "/api/v1/profile/header.ts"
|
||||
"./server/api/api/v1/profile/header"
|
||||
),
|
||||
"/api/v1/statuses": await import(serverPath + "/api/v1/statuses/index.ts"),
|
||||
"/api/v1/statuses": await import("./server/api/api/v1/statuses/index"),
|
||||
"/api/v1/timelines/home": await import(
|
||||
serverPath + "/api/v1/timelines/home.ts"
|
||||
"./server/api/api/v1/timelines/home"
|
||||
),
|
||||
"/api/v1/timelines/public": await import(
|
||||
serverPath + "/api/v1/timelines/public.ts"
|
||||
"./server/api/api/v1/timelines/public"
|
||||
),
|
||||
"/api/v2/media": await import(serverPath + "/api/v2/media/index.ts"),
|
||||
"/api/v2/search": await import(serverPath + "/api/v2/search/index.ts"),
|
||||
"/auth/login": await import(serverPath + "/auth/login/index.ts"),
|
||||
"/nodeinfo/2.0": await import(serverPath + "/nodeinfo/2.0/index.ts"),
|
||||
"/api/v2/media": await import("./server/api/api/v2/media/index"),
|
||||
"/api/v2/search": await import("./server/api/api/v2/search/index"),
|
||||
"/auth/login": await import("./server/api/auth/login/index"),
|
||||
"/nodeinfo/2.0": await import("./server/api/nodeinfo/2.0/index"),
|
||||
"/oauth/authorize-external": await import(
|
||||
serverPath + "/oauth/authorize-external/index.ts"
|
||||
"./server/api/oauth/authorize-external/index"
|
||||
),
|
||||
"/oauth/providers": await import(serverPath + "/oauth/providers/index.ts"),
|
||||
"/oauth/token": await import(serverPath + "/oauth/token/index.ts"),
|
||||
"/oauth/providers": await import("./server/api/oauth/providers/index"),
|
||||
"/oauth/token": await import("./server/api/oauth/token/index"),
|
||||
"/api/v1/accounts/[id]": await import(
|
||||
serverPath + "/api/v1/accounts/[id]/index.ts"
|
||||
"./server/api/api/v1/accounts/[id]/index"
|
||||
),
|
||||
"/api/v1/accounts/[id]/block": await import(
|
||||
serverPath + "/api/v1/accounts/[id]/block.ts"
|
||||
"./server/api/api/v1/accounts/[id]/block"
|
||||
),
|
||||
"/api/v1/accounts/[id]/follow": await import(
|
||||
serverPath + "/api/v1/accounts/[id]/follow.ts"
|
||||
"./server/api/api/v1/accounts/[id]/follow"
|
||||
),
|
||||
"/api/v1/accounts/[id]/followers": await import(
|
||||
serverPath + "/api/v1/accounts/[id]/followers.ts"
|
||||
"./server/api/api/v1/accounts/[id]/followers"
|
||||
),
|
||||
"/api/v1/accounts/[id]/following": await import(
|
||||
serverPath + "/api/v1/accounts/[id]/following.ts"
|
||||
"./server/api/api/v1/accounts/[id]/following"
|
||||
),
|
||||
"/api/v1/accounts/[id]/mute": await import(
|
||||
serverPath + "/api/v1/accounts/[id]/mute.ts"
|
||||
"./server/api/api/v1/accounts/[id]/mute"
|
||||
),
|
||||
"/api/v1/accounts/[id]/note": await import(
|
||||
serverPath + "/api/v1/accounts/[id]/note.ts"
|
||||
"./server/api/api/v1/accounts/[id]/note"
|
||||
),
|
||||
"/api/v1/accounts/[id]/pin": await import(
|
||||
serverPath + "/api/v1/accounts/[id]/pin.ts"
|
||||
"./server/api/api/v1/accounts/[id]/pin"
|
||||
),
|
||||
"/api/v1/accounts/[id]/remove_from_followers": await import(
|
||||
serverPath + "/api/v1/accounts/[id]/remove_from_followers.ts"
|
||||
"./server/api/api/v1/accounts/[id]/remove_from_followers"
|
||||
),
|
||||
"/api/v1/accounts/[id]/statuses": await import(
|
||||
serverPath + "/api/v1/accounts/[id]/statuses.ts"
|
||||
"./server/api/api/v1/accounts/[id]/statuses"
|
||||
),
|
||||
"/api/v1/accounts/[id]/unblock": await import(
|
||||
serverPath + "/api/v1/accounts/[id]/unblock.ts"
|
||||
"./server/api/api/v1/accounts/[id]/unblock"
|
||||
),
|
||||
"/api/v1/accounts/[id]/unfollow": await import(
|
||||
serverPath + "/api/v1/accounts/[id]/unfollow.ts"
|
||||
"./server/api/api/v1/accounts/[id]/unfollow"
|
||||
),
|
||||
"/api/v1/accounts/[id]/unmute": await import(
|
||||
serverPath + "/api/v1/accounts/[id]/unmute.ts"
|
||||
"./server/api/api/v1/accounts/[id]/unmute"
|
||||
),
|
||||
"/api/v1/accounts/[id]/unpin": await import(
|
||||
serverPath + "/api/v1/accounts/[id]/unpin.ts"
|
||||
"./server/api/api/v1/accounts/[id]/unpin"
|
||||
),
|
||||
"/api/v1/follow_requests/[account_id]/authorize": await import(
|
||||
serverPath + "/api/v1/follow_requests/[account_id]/authorize.ts"
|
||||
"./server/api/api/v1/follow_requests/[account_id]/authorize"
|
||||
),
|
||||
"/api/v1/follow_requests/[account_id]/reject": await import(
|
||||
serverPath + "/api/v1/follow_requests/[account_id]/reject.ts"
|
||||
),
|
||||
"/api/v1/media/[id]": await import(
|
||||
serverPath + "/api/v1/media/[id]/index.ts"
|
||||
"./server/api/api/v1/follow_requests/[account_id]/reject"
|
||||
),
|
||||
"/api/v1/media/[id]": await import("./server/api/api/v1/media/[id]/index"),
|
||||
"/api/v1/statuses/[id]": await import(
|
||||
serverPath + "/api/v1/statuses/[id]/index.ts"
|
||||
"./server/api/api/v1/statuses/[id]/index"
|
||||
),
|
||||
"/api/v1/statuses/[id]/context": await import(
|
||||
serverPath + "/api/v1/statuses/[id]/context.ts"
|
||||
"./server/api/api/v1/statuses/[id]/context"
|
||||
),
|
||||
"/api/v1/statuses/[id]/favourite": await import(
|
||||
serverPath + "/api/v1/statuses/[id]/favourite.ts"
|
||||
"./server/api/api/v1/statuses/[id]/favourite"
|
||||
),
|
||||
"/api/v1/statuses/[id]/favourited_by": await import(
|
||||
serverPath + "/api/v1/statuses/[id]/favourited_by.ts"
|
||||
"./server/api/api/v1/statuses/[id]/favourited_by"
|
||||
),
|
||||
"/api/v1/statuses/[id]/pin": await import(
|
||||
serverPath + "/api/v1/statuses/[id]/pin.ts"
|
||||
"./server/api/api/v1/statuses/[id]/pin"
|
||||
),
|
||||
"/api/v1/statuses/[id]/reblog": await import(
|
||||
serverPath + "/api/v1/statuses/[id]/reblog.ts"
|
||||
"./server/api/api/v1/statuses/[id]/reblog"
|
||||
),
|
||||
"/api/v1/statuses/[id]/reblogged_by": await import(
|
||||
serverPath + "/api/v1/statuses/[id]/reblogged_by.ts"
|
||||
"./server/api/api/v1/statuses/[id]/reblogged_by"
|
||||
),
|
||||
"/api/v1/statuses/[id]/source": await import(
|
||||
serverPath + "/api/v1/statuses/[id]/source.ts"
|
||||
"./server/api/api/v1/statuses/[id]/source"
|
||||
),
|
||||
"/api/v1/statuses/[id]/unfavourite": await import(
|
||||
serverPath + "/api/v1/statuses/[id]/unfavourite.ts"
|
||||
"./server/api/api/v1/statuses/[id]/unfavourite"
|
||||
),
|
||||
"/api/v1/statuses/[id]/unpin": await import(
|
||||
serverPath + "/api/v1/statuses/[id]/unpin.ts"
|
||||
"./server/api/api/v1/statuses/[id]/unpin"
|
||||
),
|
||||
"/api/v1/statuses/[id]/unreblog": await import(
|
||||
serverPath + "/api/v1/statuses/[id]/unreblog.ts"
|
||||
"./server/api/api/v1/statuses/[id]/unreblog"
|
||||
),
|
||||
"/media/[id]": await import(serverPath + "/media/[id]/index.ts"),
|
||||
"/media/[id]": await import("./server/api/media/[id]/index"),
|
||||
"/oauth/callback/[issuer]": await import(
|
||||
serverPath + "/oauth/callback/[issuer]/index.ts"
|
||||
"./server/api/oauth/callback/[issuer]/index"
|
||||
),
|
||||
"/object/[uuid]": await import(serverPath + "/object/[uuid]/index.ts"),
|
||||
"/users/[uuid]": await import(serverPath + "/users/[uuid]/index.ts"),
|
||||
"/object/[uuid]": await import("./server/api/object/[uuid]/index"),
|
||||
"/users/[uuid]": await import("./server/api/users/[uuid]/index"),
|
||||
"/users/[uuid]/inbox": await import(
|
||||
serverPath + "/users/[uuid]/inbox/index.ts"
|
||||
"./server/api/users/[uuid]/inbox/index"
|
||||
),
|
||||
"/users/[uuid]/outbox": await import(
|
||||
serverPath + "/users/[uuid]/outbox/index.ts"
|
||||
"./server/api/users/[uuid]/outbox/index"
|
||||
),
|
||||
"/[...404]": await import(serverPath + "/[...404].ts"),
|
||||
"/[...404]": await import("./server/api/[...404]"),
|
||||
};
|
||||
|
||||
// Returns the route filesystem path when given a URL
|
||||
|
|
|
|||
Loading…
Reference in a new issue