Self-hosted multi-platform broadcast newsroom for activist collectives: publishing pipeline with group approval and DST-proof scheduling, TweetDeck-style column wall with hostile-content-safe rendering, live control room with Auto Director, bridged chat governance with polls and quorum, distributed sandboxed transcode workers, encrypted content-addressed archive, monthly analytics. MIT licensed. See README.md and docs/.
40 lines
1.5 KiB
TypeScript
40 lines
1.5 KiB
TypeScript
import "./telemetry/otel";
|
|
import { NestFactory } from "@nestjs/core";
|
|
import { Module } from "@nestjs/common";
|
|
import { AppModule } from "./app.module";
|
|
import { FeedsModule } from "./feeds/feeds.module";
|
|
import { ArchiveModule } from "./archive/archive.module";
|
|
import { logger } from "./telemetry/logger";
|
|
|
|
@Module({ imports: [AppModule, ArchiveModule, FeedsModule] })
|
|
class RootModule {}
|
|
|
|
/** Browser origins allowed to call the API (comma-separated). Defaults cover the dev web server on :3001. */
|
|
function corsOrigins(): string[] {
|
|
const configured = process.env.CORS_ORIGINS;
|
|
if (configured !== undefined && configured.trim() !== "") return configured.split(",").map((o) => o.trim());
|
|
return ["http://localhost:3001", "http://127.0.0.1:3001", "http://localhost:3000", "http://127.0.0.1:3000"];
|
|
}
|
|
|
|
async function bootstrap(): Promise<void> {
|
|
const app = await NestFactory.create(RootModule, {
|
|
logger: ["error", "warn"],
|
|
abortOnError: false,
|
|
});
|
|
// Sessions use bearer tokens; OAuth callbacks also bind the initiating browser with an HttpOnly cookie.
|
|
app.enableCors({
|
|
origin: corsOrigins(),
|
|
credentials: true,
|
|
methods: ["GET", "POST", "PATCH", "DELETE"],
|
|
allowedHeaders: ["Authorization", "Content-Type"],
|
|
});
|
|
const port = Number(process.env.PORT ?? 3000);
|
|
app.enableShutdownHooks();
|
|
await app.listen(port);
|
|
logger.info({ port }, "api listening");
|
|
}
|
|
|
|
void bootstrap().catch((error: unknown) => {
|
|
console.error("api bootstrap failed", error);
|
|
process.exitCode = 1;
|
|
});
|