Merge branch 'master' into maddyrtc
This commit is contained in:
commit
204fe2aed1
@ -22,10 +22,10 @@ h3.title-jXR8lp.marginBottom8-AtZOdT.base-1x0h_U.size24-RIRrxO::after {
|
|||||||
/* Logo in top left when bg removed */
|
/* Logo in top left when bg removed */
|
||||||
#app-mount > div.app-1q1i1E > div > a {
|
#app-mount > div.app-1q1i1E > div > a {
|
||||||
/* replace me: original dimensions: 130x36 */
|
/* replace me: original dimensions: 130x36 */
|
||||||
background: url(https://raw.githubusercontent.com/fosscord/fosscord/9900329e5ef2c17bdeb6893e04c0511f72027f97/assets/logo/temp.svg);
|
background: url(https://raw.githubusercontent.com/fosscord/fosscord/master/assets-rebrand/svg/Fosscord-Wordmark-Gradient.svg);
|
||||||
|
width: 130px;
|
||||||
|
height: 23px;
|
||||||
background-size: contain;
|
background-size: contain;
|
||||||
width: 128px;
|
|
||||||
height: 128px;
|
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,10 +13,14 @@
|
|||||||
/* home button icon */
|
/* home button icon */
|
||||||
#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > nav > ul > div.scroller-1Bvpku.none-2Eo-qx.scrollerBase-289Jih > div.tutorialContainer-2sGCg9 > div > div.listItemWrapper-KhRmzM > div > svg > foreignObject > div > div
|
#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > nav > ul > div.scroller-1Bvpku.none-2Eo-qx.scrollerBase-289Jih > div.tutorialContainer-2sGCg9 > div > div.listItemWrapper-KhRmzM > div > svg > foreignObject > div > div
|
||||||
{
|
{
|
||||||
background-image: url(https://raw.githubusercontent.com/fosscord/fosscord/9900329e5ef2c17bdeb6893e04c0511f72027f97/assets/logo/temp.svg);
|
background-image: url(https://raw.githubusercontent.com/fosscord/fosscord/master/assets-rebrand/svg/Fosscord-Icon-Rounded-Subtract.svg);
|
||||||
background-size: contain;
|
background-size: contain;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > nav > ul > div.scroller-1Bvpku.none-2Eo-qx.scrollerBase-289Jih > div.tutorialContainer-2sGCg9 > div > div.listItemWrapper-KhRmzM > div > svg > foreignObject > div > div, #app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > nav > ul > div.scroller-1Bvpku.none-2Eo-qx.scrollerBase-289Jih > div.tutorialContainer-2sGCg9 > div > div.listItemWrapper-KhRmzM > div > svg > foreignObject > div > div:hover {
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
/* Login QR */
|
/* Login QR */
|
||||||
#app-mount > div.app-1q1i1E > div > div > div > div > form > div > div > div.transitionGroup-aR7y1d.qrLogin-1AOZMt,
|
#app-mount > div.app-1q1i1E > div > div > div > div > form > div > div > div.transitionGroup-aR7y1d.qrLogin-1AOZMt,
|
||||||
#app-mount > div.app-1q1i1E > div > div > div > div > form > div > div > div.verticalSeparator-3huAjp,
|
#app-mount > div.app-1q1i1E > div > div > div > div > form > div > div > div.verticalSeparator-3huAjp,
|
||||||
|
@ -54,9 +54,14 @@
|
|||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
var token = JSON.parse(localStorage.getItem("token"));
|
var token = JSON.parse(localStorage.getItem("token"));
|
||||||
if (token) {
|
if (token) {
|
||||||
|
var logincss = document.querySelector('#logincss'),
|
||||||
|
canRemove = logincss ? logincss: "";
|
||||||
|
if(canRemove !== "") {
|
||||||
document.querySelector("#logincss").remove();
|
document.querySelector("#logincss").remove();
|
||||||
|
canRemove = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000)
|
||||||
|
|
||||||
const settings = JSON.parse(localStorage.getItem("UserSettingsStore"));
|
const settings = JSON.parse(localStorage.getItem("UserSettingsStore"));
|
||||||
if (settings && settings.locale.length <= 2) {
|
if (settings && settings.locale.length <= 2) {
|
||||||
@ -65,11 +70,11 @@
|
|||||||
localStorage.setItem("UserSettingsStore", JSON.stringify(settings));
|
localStorage.setItem("UserSettingsStore", JSON.stringify(settings));
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script src="/assets/checkLocale.js"></script>
|
<script src="/assets/checkLocale.js"></script>
|
||||||
<script src="/assets/479a2f1e7d625dc134b9.js"></script>
|
<script src="/assets/1e18f2aac02e172db283.js"></script>
|
||||||
<script src="/assets/a15fd133a1d2d77a2424.js"></script>
|
<script src="/assets/681e53cdfefa5b82249a.js"></script>
|
||||||
<script src="/assets/97e6fa22aa08ee4daa5e.js"></script>
|
<script src="/assets/7a036838c0a0e73f59d8.js"></script>
|
||||||
<script src="/assets/9b2b7f0632acd0c5e781.js"></script>
|
<script src="/assets/b6cf2184a7a05e7525ce.js"></script>
|
||||||
<!-- plugin marker -->
|
<!-- plugin marker -->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
833
api/package-lock.json
generated
833
api/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -86,7 +86,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.1",
|
"node-fetch": "^3.1.1",
|
||||||
"patch-package": "^6.4.7",
|
"patch-package": "^6.4.7",
|
||||||
"picocolors": "^1.0.0",
|
"picocolors": "^1.0.0",
|
||||||
"proxy-agent": "^5.0.0",
|
"proxy-agent": "^5.0.0",
|
||||||
|
20
api/scripts/stresstest/package-lock.json
generated
20
api/scripts/stresstest/package-lock.json
generated
@ -279,14 +279,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/node-fetch": {
|
"node_modules/node-fetch": {
|
||||||
"version": "2.6.6",
|
"version": "2.6.7",
|
||||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz",
|
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
|
||||||
"integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==",
|
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"whatwg-url": "^5.0.0"
|
"whatwg-url": "^5.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "4.x || >=6.0.0"
|
"node": "4.x || >=6.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"encoding": "^0.1.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"encoding": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/oauth-sign": {
|
"node_modules/oauth-sign": {
|
||||||
@ -695,9 +703,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node-fetch": {
|
"node-fetch": {
|
||||||
"version": "2.6.6",
|
"version": "2.6.7",
|
||||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz",
|
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
|
||||||
"integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==",
|
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"whatwg-url": "^5.0.0"
|
"whatwg-url": "^5.0.0"
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,11 @@ export function isTextChannel(type: ChannelType): boolean {
|
|||||||
case ChannelType.GUILD_PUBLIC_THREAD:
|
case ChannelType.GUILD_PUBLIC_THREAD:
|
||||||
case ChannelType.GUILD_PRIVATE_THREAD:
|
case ChannelType.GUILD_PRIVATE_THREAD:
|
||||||
case ChannelType.GUILD_TEXT:
|
case ChannelType.GUILD_TEXT:
|
||||||
|
case ChannelType.ENCRYPTED:
|
||||||
|
case ChannelType.ENCRYPTED_THREAD:
|
||||||
return true;
|
return true;
|
||||||
|
default:
|
||||||
|
throw new HTTPError("unimplemented", 400);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +91,7 @@ router.get("/", async (req: Request, res: Response) => {
|
|||||||
permissions.hasThrow("VIEW_CHANNEL");
|
permissions.hasThrow("VIEW_CHANNEL");
|
||||||
if (!permissions.has("READ_MESSAGE_HISTORY")) return res.json([]);
|
if (!permissions.has("READ_MESSAGE_HISTORY")) return res.json([]);
|
||||||
|
|
||||||
var query: FindManyOptions<Message> & { where: { id?: any } } = {
|
var query: FindManyOptions<Message> & { where: { id?: any; }; } = {
|
||||||
order: { id: "DESC" },
|
order: { id: "DESC" },
|
||||||
take: limit,
|
take: limit,
|
||||||
where: { channel_id },
|
where: { channel_id },
|
||||||
@ -122,6 +126,13 @@ router.get("/", async (req: Request, res: Response) => {
|
|||||||
y.proxy_url = `${endpoint == null ? "" : endpoint}${new URL(uri).pathname}`;
|
y.proxy_url = `${endpoint == null ? "" : endpoint}${new URL(uri).pathname}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Some clients ( discord.js ) only check if a property exists within the response,
|
||||||
|
//which causes erorrs when, say, the `application` property is `null`.
|
||||||
|
for (var curr in x) {
|
||||||
|
if (x[curr] === null)
|
||||||
|
delete x[curr];
|
||||||
|
}
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@ -209,6 +220,9 @@ router.post(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Fix for the client bug
|
||||||
|
delete message.member
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
message.save(),
|
message.save(),
|
||||||
emitEvent({ event: "MESSAGE_CREATE", channel_id: channel_id, data: message } as MessageCreateEvent),
|
emitEvent({ event: "MESSAGE_CREATE", channel_id: channel_id, data: message } as MessageCreateEvent),
|
||||||
@ -216,7 +230,7 @@ router.post(
|
|||||||
channel.save()
|
channel.save()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
postHandleMessage(message).catch((e) => {}); // no await as it shouldnt block the message send function and silently catch error
|
postHandleMessage(message).catch((e) => { }); // no await as it shouldnt block the message send function and silently catch error
|
||||||
|
|
||||||
return res.json(message);
|
return res.json(message);
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,10 @@ export interface WebhookCreateSchema {
|
|||||||
name: string;
|
name: string;
|
||||||
avatar: string;
|
avatar: string;
|
||||||
}
|
}
|
||||||
|
//TODO: implement webhooks
|
||||||
|
router.get("/", route({}), async (req: Request, res: Response) => {
|
||||||
|
res.json([]);
|
||||||
|
});
|
||||||
|
|
||||||
// TODO: use Image Data Type for avatar instead of String
|
// TODO: use Image Data Type for avatar instead of String
|
||||||
router.post("/", route({ body: "WebhookCreateSchema", permission: "MANAGE_WEBHOOKS" }), async (req: Request, res: Response) => {
|
router.post("/", route({ body: "WebhookCreateSchema", permission: "MANAGE_WEBHOOKS" }), async (req: Request, res: Response) => {
|
||||||
|
20
api/src/routes/guilds/#guild_id/audit-logs.ts
Normal file
20
api/src/routes/guilds/#guild_id/audit-logs.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { Router, Response, Request } from "express";
|
||||||
|
import { Channel, ChannelUpdateEvent, getPermission, emitEvent } from "@fosscord/util";
|
||||||
|
import { HTTPError } from "lambert-server";
|
||||||
|
import { route } from "@fosscord/api";
|
||||||
|
import { ChannelModifySchema } from "../../channels/#channel_id";
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
//TODO: implement audit logs
|
||||||
|
router.get("/", route({}), async (req: Request, res: Response) => {
|
||||||
|
res.json({
|
||||||
|
audit_log_entries: [],
|
||||||
|
users: [],
|
||||||
|
integrations: [],
|
||||||
|
webhooks: [],
|
||||||
|
guild_scheduled_events: [],
|
||||||
|
threads: [],
|
||||||
|
application_commands: []
|
||||||
|
});
|
||||||
|
});
|
||||||
|
export default router;
|
12
api/src/routes/guilds/#guild_id/integrations.ts
Normal file
12
api/src/routes/guilds/#guild_id/integrations.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { Router, Response, Request } from "express";
|
||||||
|
import { Channel, ChannelUpdateEvent, getPermission, emitEvent } from "@fosscord/util";
|
||||||
|
import { HTTPError } from "lambert-server";
|
||||||
|
import { route } from "@fosscord/api";
|
||||||
|
import { ChannelModifySchema } from "../../channels/#channel_id";
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
//TODO: implement integrations list
|
||||||
|
router.get("/", route({}), async (req: Request, res: Response) => {
|
||||||
|
res.json([]);
|
||||||
|
});
|
||||||
|
export default router;
|
12
api/src/routes/guilds/#guild_id/webhooks.ts
Normal file
12
api/src/routes/guilds/#guild_id/webhooks.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { Router, Response, Request } from "express";
|
||||||
|
import { Channel, ChannelUpdateEvent, getPermission, emitEvent } from "@fosscord/util";
|
||||||
|
import { HTTPError } from "lambert-server";
|
||||||
|
import { route } from "@fosscord/api";
|
||||||
|
import { ChannelModifySchema } from "../../channels/#channel_id";
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
//TODO: implement webhooks
|
||||||
|
router.get("/", route({}), async (req: Request, res: Response) => {
|
||||||
|
res.json([]);
|
||||||
|
});
|
||||||
|
export default router;
|
@ -19,7 +19,8 @@ router.post("/:code", route({}), async (req: Request, res: Response) => {
|
|||||||
const { features } = await Guild.findOneOrFail({ id: guild_id});
|
const { features } = await Guild.findOneOrFail({ id: guild_id});
|
||||||
const { public_flags } = await User.findOneOrFail({ id: req.user_id });
|
const { public_flags } = await User.findOneOrFail({ id: req.user_id });
|
||||||
|
|
||||||
if(features.includes("INTERNAL_EMPLOYEE_ONLY") && (public_flags & 1) !== 1) throw new HTTPError("The Maze isn't meant for you.", 401)
|
if(features.includes("INTERNAL_EMPLOYEE_ONLY") && (public_flags & 1) !== 1) throw new HTTPError("Only intended for the staff of this server.", 401);
|
||||||
|
if(features.includes("INVITES_CLOSED")) throw new HTTPError("Sorry, this guild has joins closed.", 403);
|
||||||
|
|
||||||
const invite = await Invite.joinGuild(req.user_id, code);
|
const invite = await Invite.joinGuild(req.user_id, code);
|
||||||
|
|
||||||
|
1992
bundle/package-lock.json
generated
1992
bundle/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "src/start.js",
|
"main": "src/start.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "node scripts/install.js && npm install && ts-patch install -s && patch-package --patch-dir ../api/patches/ && npm run build",
|
"setup": "node scripts/install.js && npm install --no-optional && ts-patch install -s && patch-package --patch-dir ../api/patches/ && npm run build",
|
||||||
"build": "node scripts/build.js",
|
"build": "node scripts/build.js",
|
||||||
"start": "node scripts/build.js && node dist/bundle/src/start.js",
|
"start": "node scripts/build.js && node dist/bundle/src/start.js",
|
||||||
"start:bundle": "node dist/bundle/src/start.js",
|
"start:bundle": "node dist/bundle/src/start.js",
|
||||||
@ -91,20 +91,20 @@
|
|||||||
"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.1",
|
"nanocolors": "^0.2.12",
|
||||||
|
"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",
|
||||||
"picocolors": "^1.0.0",
|
"picocolors": "^1.0.0",
|
||||||
"proxy-agent": "^5.0.0",
|
"proxy-agent": "^5.0.0",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
"sqlite3": "^5.0.2",
|
"sqlite3": "^4.2.0",
|
||||||
"supertest": "^6.1.6",
|
"supertest": "^6.1.6",
|
||||||
"tslib": "^2.3.1",
|
"tslib": "^2.3.1",
|
||||||
"typeorm": "^0.2.37",
|
"typeorm": "^0.2.37",
|
||||||
"typescript": "^4.1.2",
|
"typescript": "^4.1.2",
|
||||||
"typescript-json-schema": "^0.50.1",
|
"typescript-json-schema": "^0.50.1",
|
||||||
"ws": "^7.4.2",
|
"ws": "^7.4.2"
|
||||||
"nanocolors": "^0.2.12"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
32
cdn/package-lock.json
generated
32
cdn/package-lock.json
generated
@ -7,7 +7,7 @@
|
|||||||
"": {
|
"": {
|
||||||
"name": "@fosscord/cdn",
|
"name": "@fosscord/cdn",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "GPLV3",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.36.1",
|
"@aws-sdk/client-s3": "^3.36.1",
|
||||||
"@aws-sdk/node-http-handler": "^3.36.0",
|
"@aws-sdk/node-http-handler": "^3.36.0",
|
||||||
@ -28,7 +28,7 @@
|
|||||||
"missing-native-js-functions": "^1.2.17",
|
"missing-native-js-functions": "^1.2.17",
|
||||||
"multer": "^1.4.2",
|
"multer": "^1.4.2",
|
||||||
"nanocolors": "^0.2.12",
|
"nanocolors": "^0.2.12",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.7",
|
||||||
"supertest": "^6.1.6",
|
"supertest": "^6.1.6",
|
||||||
"typescript": "^4.1.2"
|
"typescript": "^4.1.2"
|
||||||
},
|
},
|
||||||
@ -59,10 +59,10 @@
|
|||||||
"lambert-server": "^1.2.12",
|
"lambert-server": "^1.2.12",
|
||||||
"missing-native-js-functions": "^1.2.18",
|
"missing-native-js-functions": "^1.2.18",
|
||||||
"multer": "^1.4.3",
|
"multer": "^1.4.3",
|
||||||
"nanocolors": "^0.2.12",
|
"node-fetch": "^2.6.2",
|
||||||
"node-fetch": "^2.6.1",
|
|
||||||
"patch-package": "^6.4.7",
|
"patch-package": "^6.4.7",
|
||||||
"pg": "^8.7.1",
|
"pg": "^8.7.1",
|
||||||
|
"picocolors": "^1.0.0",
|
||||||
"proxy-agent": "^5.0.0",
|
"proxy-agent": "^5.0.0",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
"typeorm": "^0.2.38",
|
"typeorm": "^0.2.38",
|
||||||
@ -6101,14 +6101,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/node-fetch": {
|
"node_modules/node-fetch": {
|
||||||
"version": "2.6.6",
|
"version": "2.6.7",
|
||||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz",
|
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
|
||||||
"integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==",
|
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"whatwg-url": "^5.0.0"
|
"whatwg-url": "^5.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "4.x || >=6.0.0"
|
"node": "4.x || >=6.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"encoding": "^0.1.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"encoding": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/node-fetch/node_modules/tr46": {
|
"node_modules/node-fetch/node_modules/tr46": {
|
||||||
@ -9140,10 +9148,10 @@
|
|||||||
"lambert-server": "^1.2.12",
|
"lambert-server": "^1.2.12",
|
||||||
"missing-native-js-functions": "^1.2.18",
|
"missing-native-js-functions": "^1.2.18",
|
||||||
"multer": "^1.4.3",
|
"multer": "^1.4.3",
|
||||||
"nanocolors": "^0.2.12",
|
"node-fetch": "^2.6.2",
|
||||||
"node-fetch": "^2.6.1",
|
|
||||||
"patch-package": "^6.4.7",
|
"patch-package": "^6.4.7",
|
||||||
"pg": "^8.7.1",
|
"pg": "^8.7.1",
|
||||||
|
"picocolors": "^1.0.0",
|
||||||
"proxy-agent": "^5.0.0",
|
"proxy-agent": "^5.0.0",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
"ts-node": "^10.2.1",
|
"ts-node": "^10.2.1",
|
||||||
@ -12574,9 +12582,9 @@
|
|||||||
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
|
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
|
||||||
},
|
},
|
||||||
"node-fetch": {
|
"node-fetch": {
|
||||||
"version": "2.6.6",
|
"version": "2.6.7",
|
||||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz",
|
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
|
||||||
"integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==",
|
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"whatwg-url": "^5.0.0"
|
"whatwg-url": "^5.0.0"
|
||||||
},
|
},
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
"missing-native-js-functions": "^1.2.17",
|
"missing-native-js-functions": "^1.2.17",
|
||||||
"multer": "^1.4.2",
|
"multer": "^1.4.2",
|
||||||
"nanocolors": "^0.2.12",
|
"nanocolors": "^0.2.12",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.7",
|
||||||
"supertest": "^6.1.6",
|
"supertest": "^6.1.6",
|
||||||
"typescript": "^4.1.2"
|
"typescript": "^4.1.2"
|
||||||
},
|
},
|
||||||
|
1875
gateway/package-lock.json
generated
1875
gateway/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -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": "^2.6.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"
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
var erlpack: any;
|
var erlpack: any;
|
||||||
try {
|
try {
|
||||||
erlpack = require("@yukikaze-bot/erlpack");
|
erlpack = require("@yukikaze-bot/erlpack");
|
||||||
} catch (error) {}
|
} catch (error) {
|
||||||
|
console.log("Missing @yukikaze-bot/erlpack, electron-based desktop clients designed for discord.com will not be able to connect!");
|
||||||
|
}
|
||||||
import { Payload, WebSocket } from "@fosscord/gateway";
|
import { Payload, WebSocket } from "@fosscord/gateway";
|
||||||
|
|
||||||
export async function Send(socket: WebSocket, data: Payload) {
|
export async function Send(socket: WebSocket, data: Payload) {
|
||||||
|
435
util/package-lock.json
generated
435
util/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -44,7 +44,7 @@
|
|||||||
"lambert-server": "^1.2.12",
|
"lambert-server": "^1.2.12",
|
||||||
"missing-native-js-functions": "^1.2.18",
|
"missing-native-js-functions": "^1.2.18",
|
||||||
"multer": "^1.4.3",
|
"multer": "^1.4.3",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.2",
|
||||||
"patch-package": "^6.4.7",
|
"patch-package": "^6.4.7",
|
||||||
"pg": "^8.7.1",
|
"pg": "^8.7.1",
|
||||||
"picocolors": "^1.0.0",
|
"picocolors": "^1.0.0",
|
||||||
|
@ -3,7 +3,7 @@ import { BaseClass } from "./BaseClass";
|
|||||||
import { Guild } from "./Guild";
|
import { Guild } from "./Guild";
|
||||||
import { PublicUserProjection, User } from "./User";
|
import { PublicUserProjection, User } from "./User";
|
||||||
import { HTTPError } from "lambert-server";
|
import { HTTPError } from "lambert-server";
|
||||||
import { containsAll, emitEvent, getPermission, Snowflake, trimSpecial } from "../util";
|
import { containsAll, emitEvent, getPermission, Snowflake, trimSpecial, InvisibleCharacters } from "../util";
|
||||||
import { ChannelCreateEvent, ChannelRecipientRemoveEvent } from "../interfaces";
|
import { ChannelCreateEvent, ChannelRecipientRemoveEvent } from "../interfaces";
|
||||||
import { Recipient } from "./Recipient";
|
import { Recipient } from "./Recipient";
|
||||||
import { Message } from "./Message";
|
import { Message } from "./Message";
|
||||||
@ -21,11 +21,14 @@ export enum ChannelType {
|
|||||||
GUILD_CATEGORY = 4, // an organizational category that contains up to 50 channels
|
GUILD_CATEGORY = 4, // an organizational category that contains up to 50 channels
|
||||||
GUILD_NEWS = 5, // a channel that users can follow and crosspost into their own server
|
GUILD_NEWS = 5, // a channel that users can follow and crosspost into their own server
|
||||||
GUILD_STORE = 6, // a channel in which game developers can sell their game on Discord
|
GUILD_STORE = 6, // a channel in which game developers can sell their game on Discord
|
||||||
// TODO: what are channel types between 7-9?
|
ENCRYPTED = 7, // end-to-end encrypted channel
|
||||||
|
ENCRYPTED_THREAD = 8, // end-to-end encrypted thread channel
|
||||||
GUILD_NEWS_THREAD = 10, // a temporary sub-channel within a GUILD_NEWS channel
|
GUILD_NEWS_THREAD = 10, // a temporary sub-channel within a GUILD_NEWS channel
|
||||||
GUILD_PUBLIC_THREAD = 11, // a temporary sub-channel within a GUILD_TEXT channel
|
GUILD_PUBLIC_THREAD = 11, // a temporary sub-channel within a GUILD_TEXT channel
|
||||||
GUILD_PRIVATE_THREAD = 12, // a temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission
|
GUILD_PRIVATE_THREAD = 12, // a temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission
|
||||||
GUILD_STAGE_VOICE = 13, // a voice channel for hosting events with an audience
|
GUILD_STAGE_VOICE = 13, // a voice channel for hosting events with an audience
|
||||||
|
CUSTOM_START = 64, // start custom channel types from here
|
||||||
|
UNHANDLED = 255 // unhandled unowned pass-through channel type
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity("channels")
|
@Entity("channels")
|
||||||
@ -147,6 +150,7 @@ export class Channel extends BaseClass {
|
|||||||
skipExistsCheck?: boolean;
|
skipExistsCheck?: boolean;
|
||||||
skipPermissionCheck?: boolean;
|
skipPermissionCheck?: boolean;
|
||||||
skipEventEmit?: boolean;
|
skipEventEmit?: boolean;
|
||||||
|
skipNameChecks?: boolean;
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
if (!opts?.skipPermissionCheck) {
|
if (!opts?.skipPermissionCheck) {
|
||||||
@ -155,6 +159,27 @@ export class Channel extends BaseClass {
|
|||||||
permissions.hasThrow("MANAGE_CHANNELS");
|
permissions.hasThrow("MANAGE_CHANNELS");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!opts?.skipNameChecks) {
|
||||||
|
const guild = await Guild.findOneOrFail({ id: channel.guild_id });
|
||||||
|
if (!guild.features.includes("ALLOW_INVALID_CHANNEL_NAMES") && channel.name) {
|
||||||
|
for (var character of InvisibleCharacters)
|
||||||
|
if (channel.name.includes(character))
|
||||||
|
throw new HTTPError("Channel name cannot include invalid characters", 403);
|
||||||
|
|
||||||
|
if (channel.name.match(/\-\-+/g))
|
||||||
|
throw new HTTPError("Channel name cannot include multiple adjacent dashes.", 403)
|
||||||
|
|
||||||
|
if (channel.name.charAt(0) === "-" ||
|
||||||
|
channel.name.charAt(channel.name.length - 1) === "-")
|
||||||
|
throw new HTTPError("Channel name cannot start/end with dash.", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!guild.features.includes("ALLOW_UNNAMED_CHANNELS")) {
|
||||||
|
if (!channel.name)
|
||||||
|
throw new HTTPError("Channel name cannot be empty.", 403);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (channel.type) {
|
switch (channel.type) {
|
||||||
case ChannelType.GUILD_TEXT:
|
case ChannelType.GUILD_TEXT:
|
||||||
case ChannelType.GUILD_VOICE:
|
case ChannelType.GUILD_VOICE:
|
||||||
@ -191,10 +216,10 @@ export class Channel extends BaseClass {
|
|||||||
new Channel(channel).save(),
|
new Channel(channel).save(),
|
||||||
!opts?.skipEventEmit
|
!opts?.skipEventEmit
|
||||||
? emitEvent({
|
? emitEvent({
|
||||||
event: "CHANNEL_CREATE",
|
event: "CHANNEL_CREATE",
|
||||||
data: channel,
|
data: channel,
|
||||||
guild_id: channel.guild_id,
|
guild_id: channel.guild_id,
|
||||||
} as ChannelCreateEvent)
|
} as ChannelCreateEvent)
|
||||||
: Promise.resolve(),
|
: Promise.resolve(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -239,7 +264,7 @@ export class Channel extends BaseClass {
|
|||||||
channel = await new Channel({
|
channel = await new Channel({
|
||||||
name,
|
name,
|
||||||
type,
|
type,
|
||||||
owner_id: type === ChannelType.DM ? undefined : creator_user_id,
|
owner_id: type === ChannelType.DM ? undefined : null, // 1:1 DMs are ownerless in fosscord-server
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
last_message_id: null,
|
last_message_id: null,
|
||||||
recipients: channelRecipients.map(
|
recipients: channelRecipients.map(
|
||||||
@ -286,9 +311,9 @@ export class Channel extends BaseClass {
|
|||||||
user_id: user_id,
|
user_id: user_id,
|
||||||
});
|
});
|
||||||
|
|
||||||
//If the owner leave we make the first recipient in the list the new owner
|
//If the owner leave the server user is the new owner
|
||||||
if (channel.owner_id === user_id) {
|
if (channel.owner_id === user_id) {
|
||||||
channel.owner_id = channel.recipients!.find((r) => r.user_id !== user_id)!.user_id; //Is there a criteria to choose the new owner?
|
channel.owner_id = "1"; // The channel is now owned by the server user
|
||||||
await emitEvent({
|
await emitEvent({
|
||||||
event: "CHANNEL_UPDATE",
|
event: "CHANNEL_UPDATE",
|
||||||
data: await DmChannelDTO.from(channel, [user_id]),
|
data: await DmChannelDTO.from(channel, [user_id]),
|
||||||
|
@ -41,6 +41,6 @@ export class Emoji extends BaseClass {
|
|||||||
@Column({ type: "simple-array" })
|
@Column({ type: "simple-array" })
|
||||||
roles: string[]; // roles this emoji is whitelisted to (new discord feature?)
|
roles: string[]; // roles this emoji is whitelisted to (new discord feature?)
|
||||||
|
|
||||||
@Column({ type: "simple-array" })
|
@Column({ type: "simple-array", nullable: true })
|
||||||
groups: string[]; // user groups this emoji is whitelisted to (Fosscord extension)
|
groups: string[]; // user groups this emoji is whitelisted to (Fosscord extension)
|
||||||
}
|
}
|
||||||
|
@ -84,8 +84,10 @@ export class Message extends BaseClass {
|
|||||||
@RelationId((message: Message) => message.member)
|
@RelationId((message: Message) => message.member)
|
||||||
member_id: string;
|
member_id: string;
|
||||||
|
|
||||||
@JoinColumn({ name: "member_id" })
|
@JoinColumn({ name: "author_id", referencedColumnName: "id" })
|
||||||
@ManyToOne(() => Member)
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
member?: Member;
|
member?: Member;
|
||||||
|
|
||||||
@Column({ nullable: true })
|
@Column({ nullable: true })
|
||||||
|
@ -25,6 +25,7 @@ export function initDatabase(): Promise<Connection> {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
promise = createConnection({
|
promise = createConnection({
|
||||||
type,
|
type,
|
||||||
|
charset: 'utf8mb4',
|
||||||
url: isSqlite ? undefined : dbConnectionString,
|
url: isSqlite ? undefined : dbConnectionString,
|
||||||
database: isSqlite ? dbConnectionString : undefined,
|
database: isSqlite ? dbConnectionString : undefined,
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
56
util/src/util/InvisibleCharacters.ts
Normal file
56
util/src/util/InvisibleCharacters.ts
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
// List from https://invisible-characters.com/
|
||||||
|
export const InvisibleCharacters = [
|
||||||
|
'\u{9}', //Tab
|
||||||
|
'\u{20}', //Space
|
||||||
|
'\u{ad}', //Soft hyphen
|
||||||
|
'\u{34f}', //Combining grapheme joiner
|
||||||
|
'\u{61c}', //Arabic letter mark
|
||||||
|
'\u{115f}', //Hangul choseong filler
|
||||||
|
'\u{1160}', //Hangul jungseong filler
|
||||||
|
'\u{17b4}', //Khmer vowel inherent AQ
|
||||||
|
'\u{17b5}', //Khmer vowel inherent AA
|
||||||
|
'\u{180e}', //Mongolian vowel separator
|
||||||
|
'\u{2000}', //En quad
|
||||||
|
'\u{2001}', //Em quad
|
||||||
|
'\u{2002}', //En space
|
||||||
|
'\u{2003}', //Em space
|
||||||
|
'\u{2004}', //Three-per-em space
|
||||||
|
'\u{2005}', //Four-per-em space
|
||||||
|
'\u{2006}', //Six-per-em space
|
||||||
|
'\u{2007}', //Figure space
|
||||||
|
'\u{2008}', //Punctuation space
|
||||||
|
'\u{2009}', //Thin space
|
||||||
|
'\u{200a}', //Hair space
|
||||||
|
'\u{200b}', //Zero width space
|
||||||
|
'\u{200c}', //Zero width non-joiner
|
||||||
|
'\u{200d}', //Zero width joiner
|
||||||
|
'\u{200e}', //Left-to-right mark
|
||||||
|
'\u{200f}', //Right-to-left mark
|
||||||
|
'\u{202f}', //Narrow no-break space
|
||||||
|
'\u{205f}', //Medium mathematical space
|
||||||
|
'\u{2060}', //Word joiner
|
||||||
|
'\u{2061}', //Function application
|
||||||
|
'\u{2062}', //Invisible times
|
||||||
|
'\u{2063}', //Invisible separator
|
||||||
|
'\u{2064}', //Invisible plus
|
||||||
|
'\u{206a}', //Inhibit symmetric swapping
|
||||||
|
'\u{206b}', //Activate symmetric swapping
|
||||||
|
'\u{206c}', //Inhibit arabic form shaping
|
||||||
|
'\u{206d}', //Activate arabic form shaping
|
||||||
|
'\u{206e}', //National digit shapes
|
||||||
|
'\u{206f}', //Nominal digit shapes
|
||||||
|
'\u{3000}', //Ideographic space
|
||||||
|
'\u{2800}', //Braille pattern blank
|
||||||
|
'\u{3164}', //Hangul filler
|
||||||
|
'\u{feff}', //Zero width no-break space
|
||||||
|
'\u{ffa0}', //Haldwidth hangul filler
|
||||||
|
'\u{1d159}', //Musical symbol null notehead
|
||||||
|
'\u{1d173}', //Musical symbol begin beam
|
||||||
|
'\u{1d174}', //Musical symbol end beam
|
||||||
|
'\u{1d175}', //Musical symbol begin tie
|
||||||
|
'\u{1d176}', //Musical symbol end tie
|
||||||
|
'\u{1d177}', //Musical symbol begin slur
|
||||||
|
'\u{1d178}', //Musical symbol end slur
|
||||||
|
'\u{1d179}', //Musical symbol begin phrase
|
||||||
|
'\u{1d17a}' //Musical symbol end phrase
|
||||||
|
];
|
@ -35,9 +35,9 @@ export class Rights extends BitField {
|
|||||||
ADD_MEMBERS: BitFlag(8), // can manually add any members in their guilds
|
ADD_MEMBERS: BitFlag(8), // can manually add any members in their guilds
|
||||||
BYPASS_RATE_LIMITS: BitFlag(9),
|
BYPASS_RATE_LIMITS: BitFlag(9),
|
||||||
CREATE_APPLICATIONS: BitFlag(10),
|
CREATE_APPLICATIONS: BitFlag(10),
|
||||||
CREATE_CHANNELS: BitFlag(11),
|
CREATE_CHANNELS: BitFlag(11), // can create guild channels or threads in the guilds that they have permission
|
||||||
CREATE_DMS: BitFlag(12),
|
CREATE_DMS: BitFlag(12),
|
||||||
CREATE_DM_GROUPS: BitFlag(13),
|
CREATE_DM_GROUPS: BitFlag(13), // can create group DMs or custom orphan channels
|
||||||
CREATE_GUILDS: BitFlag(14),
|
CREATE_GUILDS: BitFlag(14),
|
||||||
CREATE_INVITES: BitFlag(15), // can create mass invites in the guilds that they have CREATE_INSTANT_INVITE
|
CREATE_INVITES: BitFlag(15), // can create mass invites in the guilds that they have CREATE_INSTANT_INVITE
|
||||||
CREATE_ROLES: BitFlag(16),
|
CREATE_ROLES: BitFlag(16),
|
||||||
@ -57,6 +57,17 @@ export class Rights extends BitField {
|
|||||||
SELF_DELETE_DISABLE: BitFlag(30), // can disable/delete own account
|
SELF_DELETE_DISABLE: BitFlag(30), // can disable/delete own account
|
||||||
DEBTABLE: BitFlag(31), // can use pay-to-use features
|
DEBTABLE: BitFlag(31), // can use pay-to-use features
|
||||||
CREDITABLE: BitFlag(32), // can receive money from monetisation related features
|
CREDITABLE: BitFlag(32), // can receive money from monetisation related features
|
||||||
|
KICK_BAN_MEMBERS: BitFlag(33),
|
||||||
|
// can kick or ban guild or group DM members in the guilds/groups that they have KICK_MEMBERS, or BAN_MEMBERS
|
||||||
|
SELF_LEAVE_GROUPS: BitFlag(34),
|
||||||
|
// can leave the guilds or group DMs that they joined on their own (one can always leave a guild or group DMs they have been force-added)
|
||||||
|
PRESENCE: BitFlag(35),
|
||||||
|
// inverts the presence confidentiality default (OPERATOR's presence is not routed by default, others' are) for a given user
|
||||||
|
SELF_ADD_DISCOVERABLE: BitFlag(36), // can mark discoverable guilds that they have permissions to mark as discoverable
|
||||||
|
MANAGE_GUILD_DIRECTORY: BitFlag(37), // can change anything in the primary guild directory
|
||||||
|
INITIATE_INTERACTIONS: BitFlag(40), // can initiate interactions
|
||||||
|
RESPOND_TO_INTERACTIONS: BitFlag(41), // can respond to interactions
|
||||||
|
SEND_BACKDATED_EVENTS: BitFlag(42), // can send backdated events
|
||||||
};
|
};
|
||||||
|
|
||||||
any(permission: RightResolvable, checkOperator = true) {
|
any(permission: RightResolvable, checkOperator = true) {
|
||||||
|
@ -18,3 +18,4 @@ export * from "./Snowflake";
|
|||||||
export * from "./String";
|
export * from "./String";
|
||||||
export * from "./Array";
|
export * from "./Array";
|
||||||
export * from "./TraverseDirectory";
|
export * from "./TraverseDirectory";
|
||||||
|
export * from "./InvisibleCharacters";
|
Loading…
x
Reference in New Issue
Block a user