summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.docker/env1
-rw-r--r--.dockerignore2
-rw-r--r--Dockerfile32
-rw-r--r--api/assets/schemas.json10
-rw-r--r--api/package.json10
-rw-r--r--api/src/routes/guilds/#guild_id/index.ts3
-rw-r--r--bundle/package-lock.json12
-rw-r--r--bundle/package.json6
-rw-r--r--cdn/package-lock.json18
-rw-r--r--cdn/package.json4
-rw-r--r--dashboard/package.json2
-rw-r--r--docker-compose.cfg.yml6
-rw-r--r--docker-compose.yml28
-rw-r--r--gateway/package.json2
-rw-r--r--util/package.json2
15 files changed, 50 insertions, 88 deletions
diff --git a/.docker/env b/.docker/env
deleted file mode 100644
index 595b7ba2..00000000
--- a/.docker/env
+++ /dev/null
@@ -1 +0,0 @@
-MONGO_URL=mongodb://db:27017/fosscord?readPreference=secondaryPreferred
diff --git a/.dockerignore b/.dockerignore
deleted file mode 100644
index 7ee311a4..00000000
--- a/.dockerignore
+++ /dev/null
@@ -1,2 +0,0 @@
-node_modules/
-db/
diff --git a/Dockerfile b/Dockerfile
index 3c8a0b31..64130e51 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,8 +1,6 @@
 FROM node:alpine
 
 # env vars
-ENV WORK_DIR="/srv/fosscord-server"
-ENV DEV_MODE=0
 ENV HTTP_PORT=3001
 ENV WS_PORT=3002
 ENV CDN_PORT=3003
@@ -13,28 +11,12 @@ ENV ADMIN_PORT=3005
 EXPOSE ${HTTP_PORT}/tcp ${WS_PORT}/tcp ${CDN_PORT}/tcp ${RTC_PORT}/tcp ${ADMIN_PORT}/tcp
 
 # install required apps
-RUN apk add --no-cache --update git python2 py-pip make build-base
+RUN apk add --no-cache --update git python3 py-pip make build-base
+RUN ln -s /usr/bin/python3 /usr/bin/python
 
-# optionl: packages for debugging/development
-RUN apk add --no-cache sqlite
+# Run as non-root user
+# RUN adduser -D fosscord
+# USER fosscord
 
-# download fosscord-server
-WORKDIR $WORK_DIR/src
-RUN git clone https://github.com/fosscord/fosscord-server.git .
-
-# setup and run
-WORKDIR $WORK_DIR/src/bundle
-RUN npm run setup
-RUN npm install @yukikaze-bot/erlpack
-# RUN npm install mysql --save
-
-# create update script
-RUN printf '#!/bin/sh\n\ngit -C $WORK_DIR/src/ checkout master\ngit -C $WORK_DIR/src/ reset --hard HEAD\ngit -C $WORK_DIR/src/ pull\ncd $WORK_DIR/src/bundle/\nnpm run setup\n' > $WORK_DIR/update.sh
-RUN chmod +x $WORK_DIR/update.sh
-
-# configure entrypoint file
-RUN printf '#!/bin/sh\n\nDEV_MODE=${DEV_MODE:-0}\n\nif [ "$DEV_MODE" -eq 1 ]; then\n    tail -f /dev/null\nelse\n    cd $WORK_DIR/src/bundle/\n    npm run start:bundle\nfi\n' > $WORK_DIR/entrypoint.sh
-RUN chmod +x $WORK_DIR/entrypoint.sh
-
-WORKDIR $WORK_DIR
-ENTRYPOINT ["./entrypoint.sh"]
+WORKDIR /srv/fosscord-server/bundle
+ENTRYPOINT ["npm", "run", "start:bundle"]
\ No newline at end of file
diff --git a/api/assets/schemas.json b/api/assets/schemas.json
index 2102292b..ca42e676 100644
--- a/api/assets/schemas.json
+++ b/api/assets/schemas.json
@@ -6828,6 +6828,9 @@
     "GuildUpdateSchema": {
         "type": "object",
         "properties": {
+            "name": {
+                "type": "string"
+            },
             "banner": {
                 "type": [
                     "null",
@@ -6873,10 +6876,6 @@
             "preferred_locale": {
                 "type": "string"
             },
-            "name": {
-                "maxLength": 100,
-                "type": "string"
-            },
             "region": {
                 "type": "string"
             },
@@ -6897,9 +6896,6 @@
             }
         },
         "additionalProperties": false,
-        "required": [
-            "name"
-        ],
         "definitions": {
             "Embed": {
                 "type": "object",
diff --git a/api/package.json b/api/package.json
index 051666e9..45808026 100644
--- a/api/package.json
+++ b/api/package.json
@@ -5,14 +5,14 @@
 	"main": "dist/index.js",
 	"types": "src/index.ts",
 	"scripts": {
-		"test:only": "jest --coverage --verbose --forceExit ./tests",
-		"test:routes": "jest --coverage --verbose --forceExit ./routes.test.ts",
+		"test:only": "npx jest --coverage --verbose --forceExit ./tests",
+		"test:routes": "npx jest --coverage --verbose --forceExit ./routes.test.ts",
 		"test": "npm run build && npm run test:only",
-		"test:watch": "jest --watch",
+		"test:watch": "npx jest --watch",
 		"start": "npm run build && node dist/start",
 		"build": "npx tsc -p .",
-		"dev": "tsnd --respawn src/start.ts",
-		"patch": "ts-patch install -s && npx patch-package",
+		"dev": "npx tsnd --respawn src/start.ts",
+		"patch": "npx ts-patch install -s && npx patch-package",
 		"postinstall": "npm run patch",
 		"generate:docs": "node scripts/generate_openapi",
 		"generate:schema": "node scripts/generate_schema"
diff --git a/api/src/routes/guilds/#guild_id/index.ts b/api/src/routes/guilds/#guild_id/index.ts
index 4ec3df72..be556fb2 100644
--- a/api/src/routes/guilds/#guild_id/index.ts
+++ b/api/src/routes/guilds/#guild_id/index.ts
@@ -7,7 +7,8 @@ import { GuildCreateSchema } from "../index";
 
 const router = Router();
 
-export interface GuildUpdateSchema extends Omit<GuildCreateSchema, "channels"> {
+export interface GuildUpdateSchema extends Omit<GuildCreateSchema, "channels" | "name"> {
+	name?: string;
 	banner?: string | null;
 	splash?: string | null;
 	description?: string;
diff --git a/bundle/package-lock.json b/bundle/package-lock.json
index 7a6cc91f..3f2d85ba 100644
--- a/bundle/package-lock.json
+++ b/bundle/package-lock.json
@@ -31,7 +31,7 @@
 				"exif-be-gone": "^1.2.0",
 				"express": "^4.17.1",
 				"express-async-errors": "^3.1.1",
-				"file-type": "^16.5.0",
+				"file-type": "^16.5.4",
 				"form-data": "^4.0.0",
 				"fs-extra": "^10.0.0",
 				"i18next": "^19.9.2",
@@ -5408,8 +5408,9 @@
 			}
 		},
 		"node_modules/file-type": {
-			"version": "16.5.3",
-			"integrity": "sha512-uVsl7iFhHSOY4bEONLlTK47iAHtNsFHWP5YE4xJfZ4rnX7S1Q3wce09XgqSC7E/xh8Ncv/be1lNoyprlUH/x6A==",
+			"version": "16.5.4",
+			"resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.4.tgz",
+			"integrity": "sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==",
 			"dependencies": {
 				"readable-web-to-node-stream": "^3.0.0",
 				"strtok3": "^6.2.4",
@@ -15119,8 +15120,9 @@
 			"integrity": "sha512-WOn21V8AhyE1QqVfPIVxe3tupJacq1xGkPTB4iagT6o+P2cAgEOOwIxMftr4+ZCTI6d551ij9j61DFr0nsP2uQ=="
 		},
 		"file-type": {
-			"version": "16.5.3",
-			"integrity": "sha512-uVsl7iFhHSOY4bEONLlTK47iAHtNsFHWP5YE4xJfZ4rnX7S1Q3wce09XgqSC7E/xh8Ncv/be1lNoyprlUH/x6A==",
+			"version": "16.5.4",
+			"resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.4.tgz",
+			"integrity": "sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==",
 			"requires": {
 				"readable-web-to-node-stream": "^3.0.0",
 				"strtok3": "^6.2.4",
diff --git a/bundle/package.json b/bundle/package.json
index d44d257f..4e3acce2 100644
--- a/bundle/package.json
+++ b/bundle/package.json
@@ -4,7 +4,7 @@
 	"description": "",
 	"main": "src/start.js",
 	"scripts": {
-		"setup": "node scripts/install.js && npm install --no-optional && ts-patch install -s && patch-package --patch-dir ../api/patches/ && npm run build",
+		"setup": "node scripts/install.js && npm install --no-optional && npx ts-patch install -s && npx patch-package --patch-dir ../api/patches/ && npm run build",
 		"build": "node scripts/build.js",
 		"start": "node scripts/build.js && node dist/bundle/src/start.js",
 		"start:bundle": "node dist/bundle/src/start.js",
@@ -79,7 +79,7 @@
 		"exif-be-gone": "^1.2.0",
 		"express": "^4.17.1",
 		"express-async-errors": "^3.1.1",
-		"file-type": "^16.5.0",
+		"file-type": "^16.5.4",
 		"form-data": "^4.0.0",
 		"fs-extra": "^10.0.0",
 		"i18next": "^19.9.2",
@@ -111,4 +111,4 @@
 		"typescript-json-schema": "^0.50.1",
 		"ws": "^7.4.2"
 	}
-}
\ No newline at end of file
+}
diff --git a/cdn/package-lock.json b/cdn/package-lock.json
index e6e9bb1a..62c2cdc8 100644
--- a/cdn/package-lock.json
+++ b/cdn/package-lock.json
@@ -7,7 +7,7 @@
 		"": {
 			"name": "@fosscord/cdn",
 			"version": "1.0.0",
-			"license": "GPLV3",
+			"license": "AGPL-3.0-only",
 			"dependencies": {
 				"@aws-sdk/client-s3": "^3.36.1",
 				"@aws-sdk/node-http-handler": "^3.36.0",
@@ -18,7 +18,7 @@
 				"exif-be-gone": "^1.2.0",
 				"express": "^4.17.1",
 				"express-async-errors": "^3.1.1",
-				"file-type": "^16.5.0",
+				"file-type": "^16.5.4",
 				"form-data": "^4.0.0",
 				"fs-extra": "^10.0.0",
 				"image-size": "^1.0.0",
@@ -51,7 +51,7 @@
 			"name": "@fosscord/util",
 			"version": "1.0.0",
 			"hasInstallScript": true,
-			"license": "GPLV3",
+			"license": "AGPL-3.0-only",
 			"dependencies": {
 				"amqplib": "^0.8.0",
 				"form-data": "^4.0.0",
@@ -3865,9 +3865,9 @@
 			}
 		},
 		"node_modules/file-type": {
-			"version": "16.5.3",
-			"resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.3.tgz",
-			"integrity": "sha512-uVsl7iFhHSOY4bEONLlTK47iAHtNsFHWP5YE4xJfZ4rnX7S1Q3wce09XgqSC7E/xh8Ncv/be1lNoyprlUH/x6A==",
+			"version": "16.5.4",
+			"resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.4.tgz",
+			"integrity": "sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==",
 			"dependencies": {
 				"readable-web-to-node-stream": "^3.0.0",
 				"strtok3": "^6.2.4",
@@ -10885,9 +10885,9 @@
 			}
 		},
 		"file-type": {
-			"version": "16.5.3",
-			"resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.3.tgz",
-			"integrity": "sha512-uVsl7iFhHSOY4bEONLlTK47iAHtNsFHWP5YE4xJfZ4rnX7S1Q3wce09XgqSC7E/xh8Ncv/be1lNoyprlUH/x6A==",
+			"version": "16.5.4",
+			"resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.4.tgz",
+			"integrity": "sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==",
 			"requires": {
 				"readable-web-to-node-stream": "^3.0.0",
 				"strtok3": "^6.2.4",
diff --git a/cdn/package.json b/cdn/package.json
index 46405b88..57ee89d1 100644
--- a/cdn/package.json
+++ b/cdn/package.json
@@ -5,7 +5,7 @@
 	"main": "dist/index.js",
 	"types": "src/index.ts",
 	"scripts": {
-		"test": "npm run build && jest --coverage ./tests",
+		"test": "npm run build && npx jest --coverage ./tests",
 		"build": "npx tsc -p .",
 		"start": "node dist/start.js"
 	},
@@ -44,7 +44,7 @@
 		"exif-be-gone": "^1.2.0",
 		"express": "^4.17.1",
 		"express-async-errors": "^3.1.1",
-		"file-type": "^16.5.0",
+		"file-type": "^16.5.4",
 		"form-data": "^4.0.0",
 		"fs-extra": "^10.0.0",
 		"image-size": "^1.0.0",
diff --git a/dashboard/package.json b/dashboard/package.json
index 9afe20f8..87bc1699 100644
--- a/dashboard/package.json
+++ b/dashboard/package.json
@@ -5,7 +5,7 @@
 	"main": "dist/index.js",
 	"types": "src/index.ts",
 	"scripts": {
-		"test": "npm run build && jest --coverage ./tests",
+		"test": "npm run build && npx jest --coverage ./tests",
 		"build": "npx tsc -p .",
 		"start": "node dist/start.js"
 	},
diff --git a/docker-compose.cfg.yml b/docker-compose.cfg.yml
new file mode 100644
index 00000000..18a7031d
--- /dev/null
+++ b/docker-compose.cfg.yml
@@ -0,0 +1,6 @@
+version: '3.9'
+
+services:
+
+  fosscord:
+    entrypoint: [ "npm", "run", "setup" ]
diff --git a/docker-compose.yml b/docker-compose.yml
index 13696f6f..4dc1ee41 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,46 +1,24 @@
-version: '3.8'
+version: '3.9'
 
 services:
+
   fosscord:
     container_name: fosscord
     image: fosscord
     restart: on-failure:5
-    # depends_on: mariadb
     build: .
     ports:
       - '3001-3005:3001-3005'
     volumes:
-      # - ./data/:${WORK_DIR:-/srv/fosscord-server}/data/
-      - data:${WORK_DIR:-/srv/fosscord-server}/
+      - ./:/srv/fosscord-server/
     environment:
-      WORK_DIR: ${WORK_DIR:-/srv/fosscord-server}
-      DEV_MODE: ${DEV_MODE:-0}
       THREADS: ${THREADS:-1}
-      DATABASE: ${DATABASE:-../../data/database.db}
-      STORAGE_LOCATION: ${STORAGE_LOCATION:-../../data/files/}
       HTTP_PORT: 3001
       WS_PORT: 3002
       CDN_PORT: 3003
       RTC_PORT: 3004
       ADMIN_PORT: 3005
 
-  # mariadb:
-  #   image: mariadb:latest
-  #   restart: on-failure:5
-  #   environment:
-  #     MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-secr3tpassw0rd}
-  #     MYSQL_DATABASE: ${MYSQL_DATABASE:-fosscord}
-  #     MYSQL_USER: ${MYSQL_USER:-fosscord}
-  #     MYSQL_PASSWORD: ${MYSQL_PASSWORD:-password1}
-  #   networks:
-  #     - default
-  #   volumes:
-  #     - mariadb:/var/lib/mysql
-
-volumes:
-  data:
-  # mariadb:
-
 networks:
   default:
     name: fosscord
diff --git a/gateway/package.json b/gateway/package.json
index 7a3b1012..0524cc40 100644
--- a/gateway/package.json
+++ b/gateway/package.json
@@ -9,7 +9,7 @@
 		"test": "echo \"Error: no test specified\" && exit 1",
 		"start": "npm run build && node dist/start.js",
 		"build": "npx tsc -p .",
-		"dev": "tsnd --respawn src/start.ts"
+		"dev": "npx tsnd --respawn src/start.ts"
 	},
 	"keywords": [],
 	"author": "Fosscord",
diff --git a/util/package.json b/util/package.json
index 35d2fbbe..587e8a14 100644
--- a/util/package.json
+++ b/util/package.json
@@ -6,7 +6,7 @@
 	"types": "src/index.ts",
 	"scripts": {
 		"start": "npm run build && node dist/",
-		"test": "npm run build && jest",
+		"test": "npm run build && npx jest",
 		"postinstall": "npm run build",
 		"build": "npx tsc -p .",
 		"typeorm": "node --require ts-node/register ./node_modules/typeorm/cli.js"