summary refs log tree commit diff
path: root/api
diff options
context:
space:
mode:
authorChris Chrome <christophercookman@gmail.com>2021-12-26 13:38:25 -0500
committerGitHub <noreply@github.com>2021-12-26 13:38:25 -0500
commit565f3b9e5f067745dfb4339b621973c9c39bb690 (patch)
treeb601211fedf84401165b0e8626cf3fec1fc88db1 /api
parentFix the casing (diff)
parentAdd env name in sentry, set default sentry endpoint (diff)
downloadserver-565f3b9e5f067745dfb4339b621973c9c39bb690.tar.xz
Merge pull request #553 from TheArcaneBrony/master
Remove fs-extras, add Sentry support, fix compile errors, fix some typos
Diffstat (limited to 'api')
-rw-r--r--api/assets/fosscord-login.css69
-rw-r--r--api/assets/fosscord.css42
-rw-r--r--api/package.json4
-rw-r--r--api/src/Server.ts2
-rw-r--r--api/src/routes/channels/#channel_id/messages/index.ts8
5 files changed, 119 insertions, 6 deletions
diff --git a/api/assets/fosscord-login.css b/api/assets/fosscord-login.css
new file mode 100644
index 00000000..bc32b82e
--- /dev/null
+++ b/api/assets/fosscord-login.css
@@ -0,0 +1,69 @@
+/* replace tos acceptance popup */
+#app-mount > div:nth-child(7) > div > div > div.tooltipContent-bqVLWK {
+    visibility: hidden;
+}
+#app-mount > div:nth-child(7) > div > div > div.tooltipContent-bqVLWK::after{
+    visibility: visible;
+    display: block;
+    content: "You need to agree to this instance's rules to continue";
+    margin-top: -32px;
+}
+/* replace login header */
+#app-mount > div.app-1q1i1E > div > div > div > div > form > div > div > div.mainLoginContainer-1ddwnR > h3 {
+	visibility: hidden;
+}
+h3.title-jXR8lp.marginBottom8-AtZOdT.base-1x0h_U.size24-RIRrxO::after {
+	margin-top: -32px;
+	content: "Welcome to Fosscord!";
+	visibility: visible;
+	display: block;
+}
+
+/* Logo in top left when bg removed */
+#app-mount > div.app-1q1i1E > div > a {
+	/* replace me: original dimensions: 130x36 */
+	background: url(https://raw.githubusercontent.com/fosscord/fosscord/9900329e5ef2c17bdeb6893e04c0511f72027f97/assets/logo/temp.svg);
+	background-size: contain;
+	width: 128px;
+	height: 128px;
+	border-radius: 50%;
+}
+
+/* replace TOS text */
+
+#app-mount
+	> div.app-1q1i1E
+	> div
+	> div
+	> div
+	> form
+	> div
+	> div
+	> div.flex-1xMQg5.flex-1O1GKY.horizontal-1ae9ci.horizontal-2EEEnY.flex-1O1GKY.directionRow-3v3tfG.justifyStart-2NDFzi.alignCenter-1dQNNs.noWrap-3jynv6.marginTop20-3TxNs6
+	> label
+	> div.label-cywgfr.labelClickable-11AuB8.labelForward-1wfipV
+	> * {
+	visibility: hidden;
+}
+
+#app-mount
+	> div.app-1q1i1E
+	> div
+	> div
+	> div
+	> form
+	> div
+	> div
+	> div.flex-1xMQg5.flex-1O1GKY.horizontal-1ae9ci.horizontal-2EEEnY.flex-1O1GKY.directionRow-3v3tfG.justifyStart-2NDFzi.alignCenter-1dQNNs.noWrap-3jynv6.marginTop20-3TxNs6
+	> label
+	> div.label-cywgfr.labelClickable-11AuB8.labelForward-1wfipV::after {
+	visibility: visible;
+	content: "I have read and agree with the rules set by this instance.";
+	display: block;
+	margin-top: -16px;
+}
+
+/* shrink login box to same size as register */
+.authBoxExpanded-2jqaBe {
+	width: 480px !important;
+}
diff --git a/api/assets/fosscord.css b/api/assets/fosscord.css
new file mode 100644
index 00000000..6a8b4c64
--- /dev/null
+++ b/api/assets/fosscord.css
@@ -0,0 +1,42 @@
+
+/* loading spinner */
+#app-mount > div.app-1q1i1E > div.container-16j22k.fixClipping-3qAKRb > div.content-1-zrf2 > video {
+	filter: opacity(1);
+	background: url("http://www.clipartbest.com/cliparts/7ca/6Rr/7ca6RrLAi.gif");
+	background-size: contain;
+	/* width: 64px;
+    height: 64px; */
+	padding-bottom: 64px;
+	background-repeat: no-repeat;
+}
+
+/* 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
+{
+    background-image: url(https://raw.githubusercontent.com/fosscord/fosscord/9900329e5ef2c17bdeb6893e04c0511f72027f97/assets/logo/temp.svg);
+    background-size: contain;
+    border-radius: 50%;
+}
+/* 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.verticalSeparator-3huAjp,
+/* Remove login bg */
+#app-mount > div.app-1q1i1E > div > svg,
+/* Download bar */
+#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.notice-3bPHh-.colorDefault-22HBa0,
+/* Connection problem links */
+#app-mount > div.app-1q1i1E > div.container-16j22k.fixClipping-3qAKRb > div.problems-3mgf6w.slideIn-sCvzGz > div:nth-child(2),
+/* Downloads button */
+#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > nav > ul > div.scroller-1Bvpku.none-2Eo-qx.scrollerBase-289Jih > div:nth-child(7) > div.listItemWrapper-KhRmzM > div > svg > foreignObject > 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:nth-child(6) > div,
+/* help button */
+#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.chat-3bRxxu > section > div.toolbar-1t6TWx > a,
+/* download button start of guild */
+#chat-messages-899316648933185083 > div > div > div:nth-child(5),
+/* Thread permissions etc popups */
+#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.sidebar-2K8pFh.hasNotice-1XRy4h > nav > div.container-3O_wAf,
+/* 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 > svg
+{
+    display: none;
+}
\ No newline at end of file
diff --git a/api/package.json b/api/package.json
index 9701e12d..303d5871 100644
--- a/api/package.json
+++ b/api/package.json
@@ -65,6 +65,8 @@
 		"@babel/preset-env": "^7.15.8",
 		"@babel/preset-typescript": "^7.15.0",
 		"@fosscord/util": "file:../util",
+		"@sentry/node": "^6.16.1",
+		"@sentry/tracing": "^6.16.1",
 		"ajv": "8.6.2",
 		"ajv-formats": "^2.1.1",
 		"amqplib": "^0.8.0",
@@ -84,9 +86,9 @@
 		"missing-native-js-functions": "^1.2.18",
 		"morgan": "^1.10.0",
 		"multer": "^1.4.2",
-		"nanocolors": "^0.2.13",
 		"node-fetch": "^2.6.1",
 		"patch-package": "^6.4.7",
+		"picocolors": "^1.0.0",
 		"proxy-agent": "^5.0.0",
 		"supertest": "^6.1.6",
 		"typeorm": "^0.2.37"
diff --git a/api/src/Server.ts b/api/src/Server.ts
index 259c2a6b..b0683dfc 100644
--- a/api/src/Server.ts
+++ b/api/src/Server.ts
@@ -12,7 +12,7 @@ import { initTranslation } from "./middlewares/Translation";
 import morgan from "morgan";
 import { initInstance } from "./util/Instance";
 import { registerRoutes } from "@fosscord/util";
-import { red } from "nanocolors"
+import { red } from "picocolors"
 
 export interface FosscordServerOptions extends ServerOptions {}
 
diff --git a/api/src/routes/channels/#channel_id/messages/index.ts b/api/src/routes/channels/#channel_id/messages/index.ts
index d3c0a409..b2fb615c 100644
--- a/api/src/routes/channels/#channel_id/messages/index.ts
+++ b/api/src/routes/channels/#channel_id/messages/index.ts
@@ -107,7 +107,7 @@ router.get("/", async (req: Request, res: Response) => {
 	const endpoint = Config.get().cdn.endpointPublic;
 
 	return res.json(
-		messages.map((x) => {
+		messages.map((x: any) => {
 			(x.reactions || []).forEach((x: any) => {
 				// @ts-ignore
 				if ((x.user_ids || []).includes(req.user_id)) x.me = true;
@@ -116,10 +116,10 @@ router.get("/", async (req: Request, res: Response) => {
 			});
 			// @ts-ignore
 			if (!x.author) x.author = { discriminator: "0000", username: "Deleted User", public_flags: "0", avatar: null };
-			x.attachments?.forEach((x) => {
+			x.attachments?.forEach((y: any) => {
 				// dynamically set attachment proxy_url in case the endpoint changed
-				const uri = x.proxy_url.startsWith("http") ? x.proxy_url : `https://example.org${x.proxy_url}`;
-				x.proxy_url = `${endpoint == null ? "" : endpoint}${new URL(uri).pathname}`;
+				const uri = y.proxy_url.startsWith("http") ? y.proxy_url : `https://example.org${y.proxy_url}`;
+				y.proxy_url = `${endpoint == null ? "" : endpoint}${new URL(uri).pathname}`;
 			});
 
 			return x;