mirror of
https://github.com/spacebarchat/server.git
synced 2026-05-22 19:15:58 +00:00
Merge branch 'spacebarchat:master' into errorFix
This commit is contained in:
@@ -102,7 +102,7 @@ flake-utils.lib.eachSystem flake-utils.lib.allSystems (
|
||||
# };
|
||||
};
|
||||
|
||||
containers.admin-api = pkgs.dockerTools.buildLayeredImage {
|
||||
containers.docker.admin-api = pkgs.dockerTools.buildLayeredImage {
|
||||
name = "spacebar-server-ts-admin-api";
|
||||
tag = builtins.replaceStrings [ "+" ] [ "_" ] self.packages.${system}.Spacebar-AdminApi.version;
|
||||
contents = [ self.packages.${system}.Spacebar-AdminApi ];
|
||||
@@ -122,7 +122,7 @@ flake-utils.lib.eachSystem flake-utils.lib.allSystems (
|
||||
pkgs.lib.recursiveUpdate (pkgs.lib.attrsets.unionOfDisjoint { } self.packages) {
|
||||
x86_64-linux = {
|
||||
# spacebar-server-tests = self.packages.x86_64-linux.default.passthru.tests;
|
||||
docker-admin-api = self.containers.x86_64-linux.admin-api;
|
||||
docker-admin-api = self.containers.x86_64-linux.docker.admin-api;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
+14
-3
@@ -114,9 +114,20 @@ export class SpacebarServer extends Server {
|
||||
|
||||
app.use("/imageproxy/:hash/:size/:url", ImageProxy);
|
||||
|
||||
app.get("/", (req, res) => res.sendFile(path.join(PUBLIC_ASSETS_FOLDER, "index.html")));
|
||||
app.get("/verify-email", (req, res) => res.sendFile(path.join(PUBLIC_ASSETS_FOLDER, "verify.html")));
|
||||
app.get("/widget", (req, res) => res.sendFile(path.join(PUBLIC_ASSETS_FOLDER, "widget.html")));
|
||||
app.get("/", (req, res) => {
|
||||
res.set("Cache-Control", "public, max-age=21600");
|
||||
return res.sendFile(path.join(PUBLIC_ASSETS_FOLDER, "index.html"));
|
||||
});
|
||||
|
||||
app.get("/verify-email", (req, res) => {
|
||||
res.set("Cache-Control", "public, max-age=21600");
|
||||
return res.sendFile(path.join(PUBLIC_ASSETS_FOLDER, "verify.html"));
|
||||
});
|
||||
|
||||
app.get("/widget", (req, res) => {
|
||||
res.set("Cache-Control", "public, max-age=21600");
|
||||
return res.sendFile(path.join(PUBLIC_ASSETS_FOLDER, "widget.html"));
|
||||
});
|
||||
|
||||
app.get("/_spacebar/api/schemas.json", (req, res) => {
|
||||
res.sendFile(path.join(ASSETS_FOLDER, "schemas.json"));
|
||||
|
||||
@@ -44,7 +44,7 @@ router.get(
|
||||
relations: PublicInviteRelation,
|
||||
});
|
||||
|
||||
res.status(200).send(invite);
|
||||
res.status(200).send(invite.toPublicJSON());
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import { Snowflake } from "@spacebar/util";
|
||||
|
||||
export class GeneralConfiguration {
|
||||
instanceName: string = "Spacebar Instance";
|
||||
serverName: string | null = null;
|
||||
instanceDescription: string | null = "This is a Spacebar instance made in the pre-release days";
|
||||
frontPage: string | null = null;
|
||||
tosPage: string | null = null;
|
||||
|
||||
@@ -104,6 +104,12 @@ export class Invite extends BaseClassWithoutId {
|
||||
if (this.max_uses !== 0 && this.uses >= this.max_uses) return true;
|
||||
return false;
|
||||
}
|
||||
toPublicJSON() {
|
||||
return {
|
||||
...this,
|
||||
inviter: this.inviter.toPublicUser(),
|
||||
};
|
||||
}
|
||||
|
||||
static async joinGuild(user_id: string, code: string) {
|
||||
const invite = await Invite.findOneOrFail({ where: { code } });
|
||||
|
||||
@@ -184,10 +184,15 @@ function validateFinalConfig(config: ConfigValue) {
|
||||
}
|
||||
}
|
||||
|
||||
assertConfig("api_endpointPublic", (v) => v != null, 'A valid public API endpoint URL, ex. "http://localhost:3001/api/v9"');
|
||||
assertConfig("cdn_endpointPublic", (v) => v != null, 'A valid public CDN endpoint URL, ex. "http://localhost:3003/"');
|
||||
assertConfig("cdn_endpointPrivate", (v) => v != null, 'A valid private CDN endpoint URL, ex. "http://localhost:3003/" - must be routable from the API server!');
|
||||
assertConfig("gateway_endpointPublic", (v) => v != null, 'A valid public gateway endpoint URL, ex. "ws://localhost:3002/"');
|
||||
assertConfig(
|
||||
"general_serverName",
|
||||
(v) => v != null,
|
||||
'A valid domain hosting your .well-known (defaulting to https at port 443), eg. "spacebar.chat" or "http://localhost:3001"',
|
||||
);
|
||||
assertConfig("api_endpointPublic", (v) => v != null, 'A valid public API endpoint URL, eg. "http://localhost:3001/api/v9"');
|
||||
assertConfig("cdn_endpointPublic", (v) => v != null, 'A valid public CDN endpoint URL, eg. "http://localhost:3003/"');
|
||||
assertConfig("cdn_endpointPrivate", (v) => v != null, 'A valid private CDN endpoint URL, eg. "http://localhost:3003/" - must be routable from the API server!');
|
||||
assertConfig("gateway_endpointPublic", (v) => v != null, 'A valid public gateway endpoint URL, eg. "ws://localhost:3002/"');
|
||||
|
||||
if (hasErrors) {
|
||||
console.error("[Config] Your config has invalid values. Fix them first https://docs.spacebar.chat/setup/server/configuration");
|
||||
|
||||
Reference in New Issue
Block a user