summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/benchmark/connections.js18
-rw-r--r--scripts/benchmark/index.js18
-rw-r--r--scripts/benchmark/users.js18
-rw-r--r--scripts/changelog.js18
-rw-r--r--scripts/client.js18
-rw-r--r--scripts/license.js60
-rw-r--r--scripts/openapi.js18
-rw-r--r--scripts/rights.js18
-rw-r--r--scripts/schema.js36
-rw-r--r--scripts/stagingMigration/index.js18
-rw-r--r--scripts/stagingMigration/maria/1672833135670-staging.js18
-rw-r--r--scripts/stagingMigration/mysql/1672833135670-staging.js18
-rw-r--r--scripts/stagingMigration/postgres/1672815835837-staging.js36
-rw-r--r--scripts/stresstest/index.js18
-rw-r--r--scripts/stresstest/src/login/index.js18
-rw-r--r--scripts/stresstest/src/message/send.js18
-rw-r--r--scripts/stresstest/src/register/index.js18
-rw-r--r--scripts/syncronise.js18
-rw-r--r--scripts/util/getRouteDescriptions.js18
-rw-r--r--scripts/util/licensePreamble.txt15
-rw-r--r--scripts/util/walk.js37
21 files changed, 442 insertions, 30 deletions
diff --git a/scripts/benchmark/connections.js b/scripts/benchmark/connections.js
index 1a30d49f..6e65b8c7 100644
--- a/scripts/benchmark/connections.js
+++ b/scripts/benchmark/connections.js
@@ -1,3 +1,21 @@
+/*
+	Fosscord: A FOSS re-implementation and extension of the Discord.com backend.
+	Copyright (C) 2023 Fosscord and Fosscord Contributors
+	
+	This program is free software: you can redistribute it and/or modify
+	it under the terms of the GNU Affero General Public License as published
+	by the Free Software Foundation, either version 3 of the License, or
+	(at your option) any later version.
+	
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU Affero General Public License for more details.
+	
+	You should have received a copy of the GNU Affero General Public License
+	along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
 require("dotenv").config();
 const cluster = require("cluster");
 const WebSocket = require("ws");
diff --git a/scripts/benchmark/index.js b/scripts/benchmark/index.js
index 37ac5633..e56d6f06 100644
--- a/scripts/benchmark/index.js
+++ b/scripts/benchmark/index.js
@@ -1,3 +1,21 @@
+/*
+	Fosscord: A FOSS re-implementation and extension of the Discord.com backend.
+	Copyright (C) 2023 Fosscord and Fosscord Contributors
+	
+	This program is free software: you can redistribute it and/or modify
+	it under the terms of the GNU Affero General Public License as published
+	by the Free Software Foundation, either version 3 of the License, or
+	(at your option) any later version.
+	
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU Affero General Public License for more details.
+	
+	You should have received a copy of the GNU Affero General Public License
+	along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
 require("dotenv").config();
 
 require("./connections");
diff --git a/scripts/benchmark/users.js b/scripts/benchmark/users.js
index bce67bf4..ac927aab 100644
--- a/scripts/benchmark/users.js
+++ b/scripts/benchmark/users.js
@@ -1,3 +1,21 @@
+/*
+	Fosscord: A FOSS re-implementation and extension of the Discord.com backend.
+	Copyright (C) 2023 Fosscord and Fosscord Contributors
+	
+	This program is free software: you can redistribute it and/or modify
+	it under the terms of the GNU Affero General Public License as published
+	by the Free Software Foundation, either version 3 of the License, or
+	(at your option) any later version.
+	
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU Affero General Public License for more details.
+	
+	You should have received a copy of the GNU Affero General Public License
+	along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
 require("dotenv").config();
 const fetch = require("node-fetch");
 const count = Number(process.env.COUNT) || 50;
diff --git a/scripts/changelog.js b/scripts/changelog.js
index bb1799c6..9f564bcd 100644
--- a/scripts/changelog.js
+++ b/scripts/changelog.js
@@ -1,4 +1,22 @@
 /*
+	Fosscord: A FOSS re-implementation and extension of the Discord.com backend.
+	Copyright (C) 2023 Fosscord and Fosscord Contributors
+	
+	This program is free software: you can redistribute it and/or modify
+	it under the terms of the GNU Affero General Public License as published
+	by the Free Software Foundation, either version 3 of the License, or
+	(at your option) any later version.
+	
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU Affero General Public License for more details.
+	
+	You should have received a copy of the GNU Affero General Public License
+	along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
+/*
 	Changelogs are baked inside the discord.com web client.
 	To change them, we simply need to update the changelog in a specific file of the client.
 	For v134842, thats 9c4b2d313c6e1c864e89.js, but it'll be different for every version.
diff --git a/scripts/client.js b/scripts/client.js
index 606430be..1ec110b3 100644
--- a/scripts/client.js
+++ b/scripts/client.js
@@ -1,4 +1,22 @@
 /*
+	Fosscord: A FOSS re-implementation and extension of the Discord.com backend.
+	Copyright (C) 2023 Fosscord and Fosscord Contributors
+	
+	This program is free software: you can redistribute it and/or modify
+	it under the terms of the GNU Affero General Public License as published
+	by the Free Software Foundation, either version 3 of the License, or
+	(at your option) any later version.
+	
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU Affero General Public License for more details.
+	
+	You should have received a copy of the GNU Affero General Public License
+	along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
+/*
 	This file downloads a ( mostly ) complete discord.com web client for testing,
 	and performs some basic patching:
 	* Replaces all mentions of "Server" -> "Guild"
diff --git a/scripts/license.js b/scripts/license.js
new file mode 100644
index 00000000..31321cd1
--- /dev/null
+++ b/scripts/license.js
@@ -0,0 +1,60 @@
+/*
+	Automatically appends our license preamble to each source file.
+	Does not prepend if preamble already exists.
+	Does not replace if change in util/licensePreamble.txt was made.
+	Does not prepend is file contains @fc-license-skip
+*/
+
+const Path = require("path");
+const fs = require("fs");
+const walk = require("./util/walk");
+
+const FOSSCORD_SOURCE_DIR = Path.join(__dirname, "..", "src");
+const FOSSCORD_SCRIPTS_DIR = Path.join(__dirname);
+const FOSSCORD_LICENSE_PREAMBLE = fs
+	.readFileSync(Path.join(__dirname, "util", "licensePreamble.txt"))
+	.toString()
+	.split("\r") // remove windows bs
+	.join("") // ^
+	.split("\n")
+	.map((x) => `\t${x}`)
+	.join("\n");
+
+const languageCommentStrings = {
+	js: ["/*", "*/"],
+	ts: ["/*", "*/"],
+};
+
+const addToDir = (dir) => {
+	const files = walk(dir, Object.keys(languageCommentStrings));
+
+	for (let path of files) {
+		const file = fs.readFileSync(path).toString().split("\r").join("");
+		const fileType = path.slice(path.lastIndexOf(".") + 1);
+		const commentStrings = languageCommentStrings[fileType];
+		if (!commentStrings) continue;
+
+		const preamble =
+			commentStrings[0] +
+			"\n" +
+			FOSSCORD_LICENSE_PREAMBLE +
+			"\n" +
+			commentStrings[1];
+
+		if (file.startsWith(preamble)) {
+			continue;
+		}
+
+		// This is kind of lame.
+		if (file.includes("@fc-license-skip") && path != __filename) {
+			console.log(`skipping ${path} as it has a different license.`);
+			continue;
+		}
+
+		console.log(`writing to ${path}`);
+		fs.writeFileSync(path, preamble + "\n\n" + file);
+	}
+};
+
+addToDir(FOSSCORD_SOURCE_DIR);
+addToDir(FOSSCORD_SCRIPTS_DIR);
diff --git a/scripts/openapi.js b/scripts/openapi.js
index 6f066e94..f280eba4 100644
--- a/scripts/openapi.js
+++ b/scripts/openapi.js
@@ -1,3 +1,21 @@
+/*
+	Fosscord: A FOSS re-implementation and extension of the Discord.com backend.
+	Copyright (C) 2023 Fosscord and Fosscord Contributors
+	
+	This program is free software: you can redistribute it and/or modify
+	it under the terms of the GNU Affero General Public License as published
+	by the Free Software Foundation, either version 3 of the License, or
+	(at your option) any later version.
+	
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU Affero General Public License for more details.
+	
+	You should have received a copy of the GNU Affero General Public License
+	along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
 require("module-alias/register");
 const getRouteDescriptions = require("./util/getRouteDescriptions");
 const path = require("path");
diff --git a/scripts/rights.js b/scripts/rights.js
index 86c8db16..0fbdf128 100644
--- a/scripts/rights.js
+++ b/scripts/rights.js
@@ -1,4 +1,22 @@
 /*
+	Fosscord: A FOSS re-implementation and extension of the Discord.com backend.
+	Copyright (C) 2023 Fosscord and Fosscord Contributors
+	
+	This program is free software: you can redistribute it and/or modify
+	it under the terms of the GNU Affero General Public License as published
+	by the Free Software Foundation, either version 3 of the License, or
+	(at your option) any later version.
+	
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU Affero General Public License for more details.
+	
+	You should have received a copy of the GNU Affero General Public License
+	along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
+/*
 	Calculates a discord.com-like rights value.
 */
 
diff --git a/scripts/schema.js b/scripts/schema.js
index fedbf25f..be1a7a3f 100644
--- a/scripts/schema.js
+++ b/scripts/schema.js
@@ -1,10 +1,29 @@
 /*
+	Fosscord: A FOSS re-implementation and extension of the Discord.com backend.
+	Copyright (C) 2023 Fosscord and Fosscord Contributors
+	
+	This program is free software: you can redistribute it and/or modify
+	it under the terms of the GNU Affero General Public License as published
+	by the Free Software Foundation, either version 3 of the License, or
+	(at your option) any later version.
+	
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU Affero General Public License for more details.
+	
+	You should have received a copy of the GNU Affero General Public License
+	along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
+/*
 	Regenerates the `fosscord-server/assets/schemas.json` file, used for API/Gateway input validation.
 */
 
 const path = require("path");
 const fs = require("fs");
 const TJS = require("typescript-json-schema");
+const walk = require("./util/walk");
 const schemaPath = path.join(__dirname, "..", "assets", "schemas.json");
 
 const settings = {
@@ -98,20 +117,3 @@ function main() {
 }
 
 main();
-
-function walk(dir) {
-	var results = [];
-	var list = fs.readdirSync(dir);
-	list.forEach(function (file) {
-		file = dir + "/" + file;
-		var stat = fs.statSync(file);
-		if (stat && stat.isDirectory()) {
-			/* Recurse into a subdirectory */
-			results = results.concat(walk(file));
-		} else {
-			if (!file.endsWith(".ts")) return;
-			results.push(file);
-		}
-	});
-	return results;
-}
diff --git a/scripts/stagingMigration/index.js b/scripts/stagingMigration/index.js
index a1acaabb..505405c8 100644
--- a/scripts/stagingMigration/index.js
+++ b/scripts/stagingMigration/index.js
@@ -1,3 +1,21 @@
+/*
+	Fosscord: A FOSS re-implementation and extension of the Discord.com backend.
+	Copyright (C) 2023 Fosscord and Fosscord Contributors
+	
+	This program is free software: you can redistribute it and/or modify
+	it under the terms of the GNU Affero General Public License as published
+	by the Free Software Foundation, either version 3 of the License, or
+	(at your option) any later version.
+	
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU Affero General Public License for more details.
+	
+	You should have received a copy of the GNU Affero General Public License
+	along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
 const { DataSourceOptions, DatabaseType, initDatabase } = require("../..");
 const path = require("path");
 
diff --git a/scripts/stagingMigration/maria/1672833135670-staging.js b/scripts/stagingMigration/maria/1672833135670-staging.js
index ce0c1ed8..fc04ba58 100644
--- a/scripts/stagingMigration/maria/1672833135670-staging.js
+++ b/scripts/stagingMigration/maria/1672833135670-staging.js
@@ -1,3 +1,21 @@
+/*
+	Fosscord: A FOSS re-implementation and extension of the Discord.com backend.
+	Copyright (C) 2023 Fosscord and Fosscord Contributors
+	
+	This program is free software: you can redistribute it and/or modify
+	it under the terms of the GNU Affero General Public License as published
+	by the Free Software Foundation, either version 3 of the License, or
+	(at your option) any later version.
+	
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU Affero General Public License for more details.
+	
+	You should have received a copy of the GNU Affero General Public License
+	along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
 const { MigrationInterface, QueryRunner } = require("typeorm");
 
 module.exports = class staging1672833135670 {
diff --git a/scripts/stagingMigration/mysql/1672833135670-staging.js b/scripts/stagingMigration/mysql/1672833135670-staging.js
index ce0c1ed8..fc04ba58 100644
--- a/scripts/stagingMigration/mysql/1672833135670-staging.js
+++ b/scripts/stagingMigration/mysql/1672833135670-staging.js
@@ -1,3 +1,21 @@
+/*
+	Fosscord: A FOSS re-implementation and extension of the Discord.com backend.
+	Copyright (C) 2023 Fosscord and Fosscord Contributors
+	
+	This program is free software: you can redistribute it and/or modify
+	it under the terms of the GNU Affero General Public License as published
+	by the Free Software Foundation, either version 3 of the License, or
+	(at your option) any later version.
+	
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU Affero General Public License for more details.
+	
+	You should have received a copy of the GNU Affero General Public License
+	along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
 const { MigrationInterface, QueryRunner } = require("typeorm");
 
 module.exports = class staging1672833135670 {
diff --git a/scripts/stagingMigration/postgres/1672815835837-staging.js b/scripts/stagingMigration/postgres/1672815835837-staging.js
index 675f84ca..64031e5f 100644
--- a/scripts/stagingMigration/postgres/1672815835837-staging.js
+++ b/scripts/stagingMigration/postgres/1672815835837-staging.js
@@ -1,3 +1,21 @@
+/*
+	Fosscord: A FOSS re-implementation and extension of the Discord.com backend.
+	Copyright (C) 2023 Fosscord and Fosscord Contributors
+	
+	This program is free software: you can redistribute it and/or modify
+	it under the terms of the GNU Affero General Public License as published
+	by the Free Software Foundation, either version 3 of the License, or
+	(at your option) any later version.
+	
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU Affero General Public License for more details.
+	
+	You should have received a copy of the GNU Affero General Public License
+	along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
 const { MigrationInterface, QueryRunner } = require("typeorm");
 
 module.exports = class staging1672815835837 {
@@ -130,22 +148,14 @@ module.exports = class staging1672815835837 {
 		await queryRunner.query(
 			`ALTER TABLE "members" ADD "premium_since" bigint`,
 		);
-		await queryRunner.query(
-			`ALTER TABLE members ADD theme_colors text`
-		);
-		await queryRunner.query(
-			`ALTER TABLE members ADD pronouns varchar`
-		);
+		await queryRunner.query(`ALTER TABLE members ADD theme_colors text`);
+		await queryRunner.query(`ALTER TABLE members ADD pronouns varchar`);
 		await queryRunner.query(`UPDATE users SET bio = '' WHERE bio IS NULL`);
 		await queryRunner.query(
 			`ALTER TABLE users ALTER COLUMN bio SET NOT NULL`,
 		);
-		await queryRunner.query(
-			`ALTER TABLE users ADD theme_colors text`
-		);
-		await queryRunner.query(
-			`ALTER TABLE users ADD pronouns varchar`
-		);
+		await queryRunner.query(`ALTER TABLE users ADD theme_colors text`);
+		await queryRunner.query(`ALTER TABLE users ADD pronouns varchar`);
 		await queryRunner.query(
 			`UPDATE users SET mfa_enabled = false WHERE mfa_enabled IS NULL`,
 		);
@@ -157,5 +167,5 @@ module.exports = class staging1672815835837 {
 		);
 	}
 
-	async down(queryRunner) { }
+	async down(queryRunner) {}
 };
diff --git a/scripts/stresstest/index.js b/scripts/stresstest/index.js
index a9a65097..07e17de7 100644
--- a/scripts/stresstest/index.js
+++ b/scripts/stresstest/index.js
@@ -1,3 +1,21 @@
+/*
+	Fosscord: A FOSS re-implementation and extension of the Discord.com backend.
+	Copyright (C) 2023 Fosscord and Fosscord Contributors
+	
+	This program is free software: you can redistribute it and/or modify
+	it under the terms of the GNU Affero General Public License as published
+	by the Free Software Foundation, either version 3 of the License, or
+	(at your option) any later version.
+	
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU Affero General Public License for more details.
+	
+	You should have received a copy of the GNU Affero General Public License
+	along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
 const register = require("./src/register");
 const login = require("./src/login/index");
 const config = require("./config.json");
diff --git a/scripts/stresstest/src/login/index.js b/scripts/stresstest/src/login/index.js
index 291e2b8b..fb68c8b2 100644
--- a/scripts/stresstest/src/login/index.js
+++ b/scripts/stresstest/src/login/index.js
@@ -1,3 +1,21 @@
+/*
+	Fosscord: A FOSS re-implementation and extension of the Discord.com backend.
+	Copyright (C) 2023 Fosscord and Fosscord Contributors
+	
+	This program is free software: you can redistribute it and/or modify
+	it under the terms of the GNU Affero General Public License as published
+	by the Free Software Foundation, either version 3 of the License, or
+	(at your option) any later version.
+	
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU Affero General Public License for more details.
+	
+	You should have received a copy of the GNU Affero General Public License
+	along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
 const fetch = require("node-fetch");
 const fs = require("fs");
 var config = require("../../config.json");
diff --git a/scripts/stresstest/src/message/send.js b/scripts/stresstest/src/message/send.js
index 1e5ea062..622fc1fb 100644
--- a/scripts/stresstest/src/message/send.js
+++ b/scripts/stresstest/src/message/send.js
@@ -1,3 +1,21 @@
+/*
+	Fosscord: A FOSS re-implementation and extension of the Discord.com backend.
+	Copyright (C) 2023 Fosscord and Fosscord Contributors
+	
+	This program is free software: you can redistribute it and/or modify
+	it under the terms of the GNU Affero General Public License as published
+	by the Free Software Foundation, either version 3 of the License, or
+	(at your option) any later version.
+	
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU Affero General Public License for more details.
+	
+	You should have received a copy of the GNU Affero General Public License
+	along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
 const fetch = require("node-fetch");
 const fs = require("fs");
 var config = require("../../config.json");
diff --git a/scripts/stresstest/src/register/index.js b/scripts/stresstest/src/register/index.js
index 38089dc7..4097d854 100644
--- a/scripts/stresstest/src/register/index.js
+++ b/scripts/stresstest/src/register/index.js
@@ -1,3 +1,21 @@
+/*
+	Fosscord: A FOSS re-implementation and extension of the Discord.com backend.
+	Copyright (C) 2023 Fosscord and Fosscord Contributors
+	
+	This program is free software: you can redistribute it and/or modify
+	it under the terms of the GNU Affero General Public License as published
+	by the Free Software Foundation, either version 3 of the License, or
+	(at your option) any later version.
+	
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU Affero General Public License for more details.
+	
+	You should have received a copy of the GNU Affero General Public License
+	along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
 const fetch = require("node-fetch");
 const fs = require("fs");
 var config = require("../../config.json");
diff --git a/scripts/syncronise.js b/scripts/syncronise.js
index 38895662..b1658deb 100644
--- a/scripts/syncronise.js
+++ b/scripts/syncronise.js
@@ -1,4 +1,22 @@
 /*
+	Fosscord: A FOSS re-implementation and extension of the Discord.com backend.
+	Copyright (C) 2023 Fosscord and Fosscord Contributors
+	
+	This program is free software: you can redistribute it and/or modify
+	it under the terms of the GNU Affero General Public License as published
+	by the Free Software Foundation, either version 3 of the License, or
+	(at your option) any later version.
+	
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU Affero General Public License for more details.
+	
+	You should have received a copy of the GNU Affero General Public License
+	along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
+/*
 	"Why?" I hear you say! "Why don't you just use `typeorm schema:sync`?"!
 	Because we have a lot ( like, 30? ) cyclic imports in the entities folder,
 	which breaks that command entirely!
diff --git a/scripts/util/getRouteDescriptions.js b/scripts/util/getRouteDescriptions.js
index 21c36ca7..274c0d14 100644
--- a/scripts/util/getRouteDescriptions.js
+++ b/scripts/util/getRouteDescriptions.js
@@ -1,3 +1,21 @@
+/*
+	Fosscord: A FOSS re-implementation and extension of the Discord.com backend.
+	Copyright (C) 2023 Fosscord and Fosscord Contributors
+	
+	This program is free software: you can redistribute it and/or modify
+	it under the terms of the GNU Affero General Public License as published
+	by the Free Software Foundation, either version 3 of the License, or
+	(at your option) any later version.
+	
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU Affero General Public License for more details.
+	
+	You should have received a copy of the GNU Affero General Public License
+	along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
 const { traverseDirectory } = require("lambert-server");
 const path = require("path");
 const express = require("express");
diff --git a/scripts/util/licensePreamble.txt b/scripts/util/licensePreamble.txt
new file mode 100644
index 00000000..f6c70e00
--- /dev/null
+++ b/scripts/util/licensePreamble.txt
@@ -0,0 +1,15 @@
+Fosscord: A FOSS re-implementation and extension of the Discord.com backend.
+Copyright (C) 2023 Fosscord and Fosscord Contributors
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published
+by the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program.  If not, see <https://www.gnu.org/licenses/>.
\ No newline at end of file
diff --git a/scripts/util/walk.js b/scripts/util/walk.js
new file mode 100644
index 00000000..66e98447
--- /dev/null
+++ b/scripts/util/walk.js
@@ -0,0 +1,37 @@
+/*
+	Fosscord: A FOSS re-implementation and extension of the Discord.com backend.
+	Copyright (C) 2023 Fosscord and Fosscord Contributors
+	
+	This program is free software: you can redistribute it and/or modify
+	it under the terms of the GNU Affero General Public License as published
+	by the Free Software Foundation, either version 3 of the License, or
+	(at your option) any later version.
+	
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU Affero General Public License for more details.
+	
+	You should have received a copy of the GNU Affero General Public License
+	along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
+const fs = require("fs");
+
+/** dir: string. types: string[] ( file types ) */
+module.exports = function walk(dir, types = ["ts"]) {
+	var results = [];
+	var list = fs.readdirSync(dir);
+	list.forEach(function (file) {
+		file = dir + "/" + file;
+		var stat = fs.statSync(file);
+		if (stat && stat.isDirectory()) {
+			/* Recurse into a subdirectory */
+			results = results.concat(walk(file, types));
+		} else {
+			if (!types.find((x) => file.endsWith(x))) return;
+			results.push(file);
+		}
+	});
+	return results;
+};