Skip to content

Commit

Permalink
1760002018-v2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
CE1CECL committed Dec 3, 2023
1 parent 02d13d0 commit 8ab9fe1
Show file tree
Hide file tree
Showing 26 changed files with 98 additions and 63 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ database.db
tsconfig.tsbuildinfo
files/
assets/cache
.env
config.json
assets/cacheMisses

Expand All @@ -17,6 +16,5 @@ build
*.log
*.log.ansi
*.tmp
#tmp/
dump/
package-lock.json
10 changes: 10 additions & 0 deletions scripts/rights.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,13 @@ discordLike -= Rights.FLAGS.EDIT_FLAGS;
discordLike -= Rights.FLAGS.SELF_EDIT_FLAGS;
discordLike -= Rights.FLAGS.MANAGE_GROUPS;
console.log(`Discord.com-like rights:`, discordLike);

//start 1760002018
discordLike -= Rights.FLAGS.SELF_ADD_DISCOVERABLE;
discordLike -= Rights.FLAGS.SELF_DELETE_DISABLE;
discordLike -= Rights.FLAGS.DEBTABLE;
discordLike -= Rights.FLAGS.POGGERS;
discordLike -= Rights.FLAGS.SELF_EDIT_NAME;
//end 1760002018

console.log(`1760002018-like rights: ${discordRights}`);
5 changes: 3 additions & 2 deletions src/api/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ config();
import { FosscordServer } from "./Server";
import cluster from "cluster";
import os from "os";
let cores = 1;
const cores = 1;
/*
try {
cores = Number(process.env.THREADS) || os.cpus().length;
} catch {
console.log("[API] Failed to get thread count! Using 1...");
}

*/
if (cluster.isPrimary && process.env.NODE_ENV == "production") {
console.log(`Primary ${process.pid} is running`);

Expand Down
2 changes: 1 addition & 1 deletion src/cdn/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require("module-alias/register");
import "dotenv/config";

import { CDNServer } from "./Server";
const server = new CDNServer({ port: Number(process.env.PORT) || 3003 });
const server = new CDNServer({ port: Number(process.env.PORT) || 3001 });
server
.start()
.then(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/gateway/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { config } from "dotenv";
config();

let port = Number(process.env.PORT);
if (isNaN(port)) port = 3002;
if (isNaN(port)) port = 3001;

const server = new Server({
port,
Expand Down
10 changes: 7 additions & 3 deletions src/util/config/types/ApiConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@
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/>.
*/

import fs from "fs";
export class ApiConfiguration {
defaultVersion: string = "9";
activeVersions: string[] = ["6", "7", "8", "9"];
useFosscordEnhancements: boolean = true;
endpointPublic: string = "";
useFosscordEnhancements: boolean = false;
endpointPublic: string =
fs.readFileSync("./tmp/PROT", { encoding: "utf8" }) +
"://" +
fs.readFileSync("./tmp/HOST", { encoding: "utf8" }) ||
"http://localhost:3001";
}
20 changes: 16 additions & 4 deletions src/util/config/types/EndpointConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,21 @@
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/>.
*/

import fs from "fs";
export class EndpointConfiguration {
endpointClient: string | null = null;
endpointPrivate: string | null = null;
endpointPublic: string | null = null;
endpointClient: string | null =
fs.readFileSync("./tmp/PROT", { encoding: "utf8" }) +
"://" +
fs.readFileSync("./tmp/HOST", { encoding: "utf8" }) ||
"http://localhost:3001";
endpointPrivate: string | null =
fs.readFileSync("./tmp/PROT", { encoding: "utf8" }) +
"://" +
fs.readFileSync("./tmp/HOST", { encoding: "utf8" }) ||
"http://localhost:3001";
endpointPublic: string | null =
fs.readFileSync("./tmp/PROT", { encoding: "utf8" }) +
"://" +
fs.readFileSync("./tmp/HOST", { encoding: "utf8" }) ||
"http://localhost:3001";
}
23 changes: 15 additions & 8 deletions src/util/config/types/GeneralConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,22 @@
*/

import { Snowflake } from "@fosscord/util";

import fs from "fs";
export class GeneralConfiguration {
instanceName: string = "Fosscord Instance";
instanceDescription: string | null =
"This is a Fosscord instance made in the pre-release days";
frontPage: string | null = null;
tosPage: string | null = null;
correspondenceEmail: string | null = null;
correspondenceUserID: string | null = null;
instanceName: string = "CE1CECL";
instanceDescription: string | null = "ChrisEric1 CECL";
frontPage: string | null =
fs.readFileSync("./tmp/PROT", { encoding: "utf8" }) +
"://" +
fs.readFileSync("./tmp/HOST", { encoding: "utf8" }) ||
"http://localhost:3001";
tosPage: string | null =
fs.readFileSync("./tmp/PROT", { encoding: "utf8" }) +
"://" +
fs.readFileSync("./tmp/HOST", { encoding: "utf8" }) ||
"http://localhost:3001";
correspondenceEmail: string | null = "christopherericlentocha@gmail.com";
correspondenceUserID: string | null = "christopherericlentocha@gmail.com";
image: string | null = null;
instanceId: string = Snowflake.generate();
}
4 changes: 2 additions & 2 deletions src/util/config/types/GifConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

export class GifConfiguration {
enabled: boolean = true;
enabled: boolean = false;
provider = "tenor" as const; // more coming soon
apiKey?: string = "LIVDSRZULELA";
apiKey?: string = "";
}
12 changes: 6 additions & 6 deletions src/util/config/types/RegionConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ import fs from "fs";
import { Region } from ".";

export class RegionConfiguration {
default: string = "fosscord";
default: string = "cecl";
useDefaultAsOptimal: boolean = true;
available: Region[] = [
{
id: "fosscord",
name: "Fosscord",
id: "cecl",
name: "CECL",
endpoint:
fs.readFileSync("./tmp/HOST", { encoding: "utf8" }) ||
"localhost:3004",
vip: false,
custom: false,
"localhost:3001",
vip: true,
custom: true,
deprecated: false,
},
];
Expand Down
10 changes: 5 additions & 5 deletions src/util/config/types/RegisterConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ export class RegisterConfiguration {
dateOfBirth: DateOfBirthConfiguration = new DateOfBirthConfiguration();
password: PasswordConfiguration = new PasswordConfiguration();
disabled: boolean = false;
requireCaptcha: boolean = true;
requireCaptcha: boolean = false;
requireInvite: boolean = false;
guestsRequireInvite: boolean = true;
allowNewRegistration: boolean = true;
allowNewRegistration: boolean = false;
allowMultipleAccounts: boolean = true;
blockProxies: boolean = true;
incrementingDiscriminators: boolean = false; // random otherwise
defaultRights: string = "875069521787904"; // See `npm run generate:rights`
blockProxies: boolean = false;
incrementingDiscriminators: boolean = true; // random otherwise
defaultRights: string = "30297756269806"; // See `npm run generate:rights`
}
2 changes: 1 addition & 1 deletion src/util/config/types/SecurityConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { CaptchaConfiguration, TwoFactorConfiguration } from ".";
export class SecurityConfiguration {
captcha: CaptchaConfiguration = new CaptchaConfiguration();
twoFactor: TwoFactorConfiguration = new TwoFactorConfiguration();
autoUpdate: boolean | number = true;
autoUpdate: boolean | number = false;
requestSignature: string = crypto.randomBytes(32).toString("base64");
jwtSecret: string = crypto.randomBytes(256).toString("base64");
// header to get the real user ip address
Expand Down
7 changes: 5 additions & 2 deletions src/util/config/types/SentryConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
*/

import { hostname } from "os";

import fs from "fs";
export class SentryConfiguration {
enabled: boolean = false;
endpoint: string =
"https://05e8e3d005f34b7d97e920ae5870a5e5@sentry.thearcanebrony.net/6";
fs.readFileSync("./tmp/PROT", { encoding: "utf8" }) +
"://" +
fs.readFileSync("./tmp/HOST", { encoding: "utf8" }) ||
"http://localhost:3001";
traceSampleRate: number = 1.0;
environment: string = hostname();
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@

export class ClientReleaseConfiguration {
useLocalRelease: boolean = true; //TODO
upstreamVersion: string = "0.0.264";
upstreamVersion: string = "0.0.0";
}
2 changes: 1 addition & 1 deletion src/util/config/types/subconfigurations/guild/AutoJoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
export class AutoJoinConfiguration {
enabled: boolean = true;
guilds: string[] = [];
canLeave: boolean = true;
canLeave: boolean = false;
}
2 changes: 1 addition & 1 deletion src/util/config/types/subconfigurations/guild/Discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ export class DiscoveryConfiguration {
showAllGuilds: boolean = false;
useRecommendation: boolean = false; // TODO: Recommendation, privacy concern?
offset: number = 0;
limit: number = 24;
limit: number = 100;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
*/

export class DateOfBirthConfiguration {
required: boolean = true;
minimum: number = 13; // in years
required: boolean = false;
minimum: number = 0; // in years
}
4 changes: 2 additions & 2 deletions src/util/config/types/subconfigurations/register/Email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
*/

export class RegistrationEmailConfiguration {
required: boolean = false;
required: boolean = true;
allowlist: boolean = false;
blocklist: boolean = true;
blocklist: boolean = false;
domains: string[] = []; // TODO: efficiently save domain blocklist in database
// domains: fs.readFileSync(__dirname + "/blockedEmailDomains.txt", { encoding: "utf8" }).split("\n"),
}
8 changes: 4 additions & 4 deletions src/util/config/types/subconfigurations/register/Password.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
*/

export class PasswordConfiguration {
required: boolean = false;
minLength: number = 8;
minNumbers: number = 2;
minUpperCase: number = 2;
required: boolean = true;
minLength: number = 1;
minNumbers: number = 0;
minUpperCase: number = 0;
minSymbols: number = 0;
}
18 changes: 9 additions & 9 deletions src/util/entities/UserSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ export class UserSettings extends BaseClassWithoutId {
animate_emoji: boolean = true;

@Column({ nullable: true })
animate_stickers: number = 0;
animate_stickers: number = 1;

@Column({ nullable: true })
contact_sync_enabled: boolean = false;
contact_sync_enabled: boolean = true;

@Column({ nullable: true })
convert_emoticons: boolean = false;
Expand All @@ -49,16 +49,16 @@ export class UserSettings extends BaseClassWithoutId {
default_guilds_restricted: boolean = false;

@Column({ nullable: true })
detect_platform_accounts: boolean = false;
detect_platform_accounts: boolean = true;

@Column({ nullable: true })
developer_mode: boolean = true;

@Column({ nullable: true })
disable_games_tab: boolean = true;
disable_games_tab: boolean = false;

@Column({ nullable: true })
enable_tts_command: boolean = false;
enable_tts_command: boolean = true;

@Column({ nullable: true })
explicit_content_filter: number = 0;
Expand All @@ -67,10 +67,10 @@ export class UserSettings extends BaseClassWithoutId {
friend_source_flags: FriendSourceFlags = { all: true };

@Column({ nullable: true })
gateway_connected: boolean = false;
gateway_connected: boolean = true;

@Column({ nullable: true })
gif_auto_play: boolean = false;
gif_auto_play: boolean = true;

@Column({ nullable: true, type: "simple-json" })
guild_folders: GuildFolder[] = []; // every top guild is displayed as a "folder"
Expand Down Expand Up @@ -106,10 +106,10 @@ export class UserSettings extends BaseClassWithoutId {
show_current_game: boolean = true;

@Column({ nullable: true })
status: "online" | "offline" | "dnd" | "idle" | "invisible" = "online";
status: "online" | "offline" | "dnd" | "idle" | "invisible" = "dnd";

@Column({ nullable: true })
stream_notifications_enabled: boolean = false;
stream_notifications_enabled: boolean = true;

@Column({ nullable: true })
theme: "dark" | "light" = "dark"; // dark
Expand Down
2 changes: 1 addition & 1 deletion src/util/entities/VoiceState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class VoiceState extends BaseClass {
self_stream?: boolean;

@Column({ nullable: true })
self_video: boolean;
self_video?: boolean;

@Column()
suppress: boolean; // whether this user is muted by the current user
Expand Down
2 changes: 1 addition & 1 deletion src/webrtc/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { config } from "dotenv";
import { Server } from "./Server";
config();

const port = Number(process.env.PORT) || 3004;
const port = Number(process.env.PORT) || 3001;

const server = new Server({
port,
Expand Down
2 changes: 1 addition & 1 deletion tmp/HOST
Original file line number Diff line number Diff line change
@@ -1 +1 @@
localhost:3001
localhost:3001/spacebar
2 changes: 1 addition & 1 deletion tmp/IPv4
Original file line number Diff line number Diff line change
@@ -1 +1 @@
127.0.0.1
127.0.0.1
2 changes: 1 addition & 1 deletion tmp/NAME
Original file line number Diff line number Diff line change
@@ -1 +1 @@
localhost
localhost
2 changes: 1 addition & 1 deletion tmp/PORT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3001
3001

0 comments on commit 8ab9fe1

Please sign in to comment.