mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-06 10:52:31 +01:00
category + discovery + custom status fix, new config
This commit is contained in:
parent
ba70cf4b97
commit
e3f20f849d
@ -26,7 +26,6 @@ h3.title-jXR8lp.marginBottom8-AtZOdT.base-1x0h_U.size24-RIRrxO::after {
|
|||||||
width: 130px;
|
width: 130px;
|
||||||
height: 23px;
|
height: 23px;
|
||||||
background-size: contain;
|
background-size: contain;
|
||||||
border-radius: 50%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* replace TOS text */
|
/* replace TOS text */
|
||||||
|
@ -6,26 +6,29 @@ import { route } from "@fosscord/api";
|
|||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
router.get("/", route({}), async (req: Request, res: Response) => {
|
router.get("/", route({}), async (req: Request, res: Response) => {
|
||||||
const { limit, categories } = req.query;
|
const { offset, limit, categories } = req.query;
|
||||||
var showAllGuilds = Config.get().guild.showAllGuildsInDiscovery;
|
var showAllGuilds = Config.get().guild.discovery.showAllGuilds;
|
||||||
|
var configLimit = Config.get().guild.discovery.limit;
|
||||||
// ! this only works using SQL querys
|
// ! this only works using SQL querys
|
||||||
// TODO: implement this with default typeorm query
|
// TODO: implement this with default typeorm query
|
||||||
// const guilds = await Guild.find({ where: { features: "DISCOVERABLE" } }); //, take: Math.abs(Number(limit)) });
|
// const guilds = await Guild.find({ where: { features: "DISCOVERABLE" } }); //, take: Math.abs(Number(limit)) });
|
||||||
let guilds;
|
let guilds;
|
||||||
let total;
|
let total;
|
||||||
switch (categories) {
|
if (categories == undefined) {
|
||||||
case "1":
|
guilds = showAllGuilds
|
||||||
guilds = showAllGuilds
|
? await Guild.find({ take: Math.abs(Number(limit || configLimit)) })
|
||||||
? await Guild.find({ take: Math.abs(Number(limit || 24)) })
|
: await Guild.find({ where: `"features" LIKE '%COMMUNITY%'`, take: Math.abs(Number(limit || configLimit)) });
|
||||||
: await Guild.find({ where: `"primary_category_id" = 1 AND "features" LIKE '%COMMUNITY%'`, take: Math.abs(Number(limit || 24)) });
|
total = guilds.length;
|
||||||
total = guilds.length;
|
} else {
|
||||||
default:
|
guilds = showAllGuilds
|
||||||
guilds = showAllGuilds
|
? await Guild.find({ where: `"primary_category_id" = ${categories}`, take: Math.abs(Number(limit || configLimit)) })
|
||||||
? await Guild.find({ take: Math.abs(Number(limit || 24)) })
|
: await Guild.find({
|
||||||
: await Guild.find({ where: `"features" LIKE '%COMMUNITY%'`, take: Math.abs(Number(limit || 24)) });
|
where: `"primary_category_id" = ${categories} AND "features" LIKE '%COMMUNITY%'`,
|
||||||
|
take: Math.abs(Number(limit || configLimit))
|
||||||
|
});
|
||||||
total = guilds.length;
|
total = guilds.length;
|
||||||
}
|
}
|
||||||
res.send({ total: total, guilds: guilds, offset: 0, limit: limit});
|
res.send({ total: total, guilds: guilds, offset: Number(offset || Config.get().guild.discovery.offset), limit: Number(limit || configLimit) });
|
||||||
});
|
});
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
@ -3,7 +3,7 @@ import { route } from "@fosscord/api";
|
|||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
router.get("/", route({}), (req: Request, res: Response) => {
|
router.get("/categories", route({}), (req: Request, res: Response) => {
|
||||||
// TODO:
|
// TODO:
|
||||||
// Load categories from db instead
|
// Load categories from db instead
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ router.get("/", route({}), (req: Request, res: Response) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res.json(out).status(200);
|
res.send(out);
|
||||||
});
|
});
|
||||||
|
|
||||||
export default router;
|
export default router;
|
@ -7,7 +7,7 @@ const router = Router();
|
|||||||
|
|
||||||
router.get("/", route({}), async (req: Request, res: Response) => {
|
router.get("/", route({}), async (req: Request, res: Response) => {
|
||||||
const { limit, personalization_disabled } = req.query;
|
const { limit, personalization_disabled } = req.query;
|
||||||
var showAllGuilds = Config.get().guild.showAllGuildsInDiscovery;
|
var showAllGuilds = Config.get().guild.discovery.showAllGuilds;
|
||||||
// ! this only works using SQL querys
|
// ! this only works using SQL querys
|
||||||
// TODO: implement this with default typeorm query
|
// TODO: implement this with default typeorm query
|
||||||
// const guilds = await Guild.find({ where: { features: "DISCOVERABLE" } }); //, take: Math.abs(Number(limit)) });
|
// const guilds = await Guild.find({ where: { features: "DISCOVERABLE" } }); //, take: Math.abs(Number(limit)) });
|
||||||
|
6
bundle/package-lock.json
generated
6
bundle/package-lock.json
generated
@ -46,7 +46,7 @@
|
|||||||
"morgan": "^1.10.0",
|
"morgan": "^1.10.0",
|
||||||
"multer": "^1.4.2",
|
"multer": "^1.4.2",
|
||||||
"nanocolors": "^0.2.12",
|
"nanocolors": "^0.2.12",
|
||||||
"node-fetch": "^2.6.7",
|
"node-fetch": "^2.6.2",
|
||||||
"node-os-utils": "^1.3.5",
|
"node-os-utils": "^1.3.5",
|
||||||
"patch-package": "^6.4.7",
|
"patch-package": "^6.4.7",
|
||||||
"pg": "^8.7.1",
|
"pg": "^8.7.1",
|
||||||
@ -213,7 +213,7 @@
|
|||||||
"jsonwebtoken": "^8.5.1",
|
"jsonwebtoken": "^8.5.1",
|
||||||
"lambert-server": "^1.2.11",
|
"lambert-server": "^1.2.11",
|
||||||
"missing-native-js-functions": "^1.2.18",
|
"missing-native-js-functions": "^1.2.18",
|
||||||
"node-fetch": "^3.1.1",
|
"node-fetch": "^2.6.2",
|
||||||
"proxy-agent": "^5.0.0",
|
"proxy-agent": "^5.0.0",
|
||||||
"typeorm": "^0.2.37",
|
"typeorm": "^0.2.37",
|
||||||
"ws": "^7.4.2"
|
"ws": "^7.4.2"
|
||||||
@ -13377,7 +13377,7 @@
|
|||||||
"jsonwebtoken": "^8.5.1",
|
"jsonwebtoken": "^8.5.1",
|
||||||
"lambert-server": "^1.2.11",
|
"lambert-server": "^1.2.11",
|
||||||
"missing-native-js-functions": "^1.2.18",
|
"missing-native-js-functions": "^1.2.18",
|
||||||
"node-fetch": "^3.1.1",
|
"node-fetch": "^2.6.2",
|
||||||
"proxy-agent": "^5.0.0",
|
"proxy-agent": "^5.0.0",
|
||||||
"ts-node-dev": "^1.1.6",
|
"ts-node-dev": "^1.1.6",
|
||||||
"ts-patch": "^1.4.4",
|
"ts-patch": "^1.4.4",
|
||||||
|
@ -91,7 +91,7 @@
|
|||||||
"missing-native-js-functions": "^1.2.18",
|
"missing-native-js-functions": "^1.2.18",
|
||||||
"morgan": "^1.10.0",
|
"morgan": "^1.10.0",
|
||||||
"multer": "^1.4.2",
|
"multer": "^1.4.2",
|
||||||
"node-fetch": "^2.6.7",
|
"node-fetch": "^2.6.2",
|
||||||
"node-os-utils": "^1.3.5",
|
"node-os-utils": "^1.3.5",
|
||||||
"patch-package": "^6.4.7",
|
"patch-package": "^6.4.7",
|
||||||
"pg": "^8.7.1",
|
"pg": "^8.7.1",
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
"jsonwebtoken": "^8.5.1",
|
"jsonwebtoken": "^8.5.1",
|
||||||
"lambert-server": "^1.2.11",
|
"lambert-server": "^1.2.11",
|
||||||
"missing-native-js-functions": "^1.2.18",
|
"missing-native-js-functions": "^1.2.18",
|
||||||
"node-fetch": "^3.1.1",
|
"node-fetch": "^2.6.2",
|
||||||
"proxy-agent": "^5.0.0",
|
"proxy-agent": "^5.0.0",
|
||||||
"typeorm": "^0.2.37",
|
"typeorm": "^0.2.37",
|
||||||
"ws": "^7.4.2"
|
"ws": "^7.4.2"
|
||||||
|
@ -157,8 +157,12 @@ export interface ConfigValue {
|
|||||||
available: Region[];
|
available: Region[];
|
||||||
};
|
};
|
||||||
guild: {
|
guild: {
|
||||||
showAllGuildsInDiscovery: boolean;
|
discovery: {
|
||||||
homeDiscoveryUseRecommendation: boolean; // TODO: Recommendation, privacy concern?
|
showAllGuilds: boolean;
|
||||||
|
useRecommendation: boolean; // TODO: Recommendation, privacy concern?
|
||||||
|
offset: number;
|
||||||
|
limit: number;
|
||||||
|
};
|
||||||
autoJoin: {
|
autoJoin: {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
guilds: string[];
|
guilds: string[];
|
||||||
@ -354,8 +358,12 @@ export const DefaultConfigOptions: ConfigValue = {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
guild: {
|
guild: {
|
||||||
showAllGuildsInDiscovery: false,
|
discovery: {
|
||||||
homeDiscoveryUseRecommendation: false,
|
showAllGuilds: false,
|
||||||
|
useRecommendation: false,
|
||||||
|
offset: 0,
|
||||||
|
limit: 24,
|
||||||
|
},
|
||||||
autoJoin: {
|
autoJoin: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
canLeave: true,
|
canLeave: true,
|
||||||
|
@ -287,7 +287,7 @@ export class Guild extends BaseClass {
|
|||||||
default_message_notifications: 1, // defaults effect: setting the push default at mentions-only will save a lot
|
default_message_notifications: 1, // defaults effect: setting the push default at mentions-only will save a lot
|
||||||
explicit_content_filter: 0,
|
explicit_content_filter: 0,
|
||||||
features: [],
|
features: [],
|
||||||
primary_category_id: 0,
|
primary_category_id: null,
|
||||||
id: guild_id,
|
id: guild_id,
|
||||||
max_members: 250000,
|
max_members: 250000,
|
||||||
max_presences: 250000,
|
max_presences: 250000,
|
||||||
|
@ -289,12 +289,7 @@ export const defaultSettings: UserSettings = {
|
|||||||
animate_stickers: 0,
|
animate_stickers: 0,
|
||||||
contact_sync_enabled: false,
|
contact_sync_enabled: false,
|
||||||
convert_emoticons: false,
|
convert_emoticons: false,
|
||||||
custom_status: {
|
custom_status: null,
|
||||||
emoji_id: undefined,
|
|
||||||
emoji_name: undefined,
|
|
||||||
expires_at: undefined,
|
|
||||||
text: undefined,
|
|
||||||
},
|
|
||||||
default_guilds_restricted: false,
|
default_guilds_restricted: false,
|
||||||
detect_platform_accounts: true,
|
detect_platform_accounts: true,
|
||||||
developer_mode: false,
|
developer_mode: false,
|
||||||
@ -334,7 +329,7 @@ export interface UserSettings {
|
|||||||
emoji_name?: string;
|
emoji_name?: string;
|
||||||
expires_at?: number;
|
expires_at?: number;
|
||||||
text?: string;
|
text?: string;
|
||||||
};
|
} | null;
|
||||||
default_guilds_restricted: boolean;
|
default_guilds_restricted: boolean;
|
||||||
detect_platform_accounts: boolean;
|
detect_platform_accounts: boolean;
|
||||||
developer_mode: boolean;
|
developer_mode: boolean;
|
||||||
|
Loading…
Reference in New Issue
Block a user