Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure project + server plugins #837

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
File renamed without changes.
32 changes: 32 additions & 0 deletions .github/workflows/test_build.yml
@@ -0,0 +1,32 @@
on:
workflow_dispatch:
push:
paths:
- "**"

name: Test Build

jobs:
insiders-build:
strategy:
matrix:
os: [windows, macos, ubuntu]
include:
- os: windows
deps: ""
- os: macos
deps: ""
- os: ubuntu
deps: "sudo apt install -y libpango1.0-dev libgif-dev"
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
env:
MONGOMS_VERSION: 4.4.3
with:
node-version: 18
- run: |
${{ matrix.deps }}
npm run setup
npm run build clean logerrors pretty-errors propagate-err
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -32,3 +32,6 @@ yarn.lock
dbconf.json

migrations.db

assets/cache_src/
package-lock.json
6 changes: 4 additions & 2 deletions .vscode/launch.json
Expand Up @@ -7,7 +7,9 @@
"name": "Launch Program",
"skipFiles": ["<node_internals>/**"],
"program": "${file}",
"outFiles": ["${workspaceFolder}/**/*.js"]
"outFiles": ["${workspaceFolder}/**/*.js"],
"internalConsoleOptions": "openOnSessionStart"
}
]
],
"internalConsoleOptions": "openOnSessionStart"
}
68 changes: 0 additions & 68 deletions assets/fosscord-login.css

This file was deleted.

94 changes: 3 additions & 91 deletions assets/fosscord.css
@@ -1,92 +1,4 @@
/* 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/master/assets-rebrand/svg/Fosscord-Icon-Rounded-Subtract.svg);
background-size: contain;
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 */
#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;
}
:root {
--brand-hue: 22;
}
8 changes: 4 additions & 4 deletions assets/index.html
Expand Up @@ -5,7 +5,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Discord Test Client</title>
<link rel="stylesheet" href="/assets/fosscord.css" />
<link id="logincss" rel="stylesheet" href="/assets/fosscord-login.css" />
<link id="customcss" rel="stylesheet" href="/assets/user.css" />
<!-- inline plugin marker -->
<!-- preload plugin marker -->
Expand All @@ -28,20 +27,21 @@
INVITE_HOST: `${location.hostname}/invite`,
GUILD_TEMPLATE_HOST: "${location.host}",
GIFT_CODE_HOST: "${location.hostname}",
RELEASE_CHANNEL: "stable",
MARKETING_ENDPOINT: "//discord.com",
BRAINTREE_KEY: "production_5st77rrc_49pp2rp4phym7387",
STRIPE_KEY: "pk_live_CUQtlpQUF0vufWpnpUmQvcdi",
NETWORKING_ENDPOINT: "//router.discordapp.net",
RTC_LATENCY_ENDPOINT: "//${location.hostname}/rtc",
ACTIVITY_APPLICATION_HOST: "discordsays.com",
PROJECT_ENV: "production",
REMOTE_AUTH_ENDPOINT: "//localhost:3020",
SENTRY_TAGS: { buildId: "75e36d9", buildType: "normal" },
MIGRATION_SOURCE_ORIGIN: "https://${location.hostname}",
MIGRATION_DESTINATION_ORIGIN: "https://${location.hostname}",
HTML_TIMESTAMP: Date.now(),
ALGOLIA_KEY: "aca0d7082e4e63af5ba5917d5e96bed0"
ALGOLIA_KEY: "aca0d7082e4e63af5ba5917d5e96bed0",
SENTRY_TAGS: { instance: document.location.host },
PROJECT_ENV: "development",
RELEASE_CHANNEL: "staging",
};
GLOBAL_ENV.MEDIA_PROXY_ENDPOINT = location.protocol + "//" + GLOBAL_ENV.CDN_HOST;
const localStorage = window.localStorage;
Expand Down
Empty file.
1 change: 1 addition & 0 deletions assets/private/icons/homeIcon.path
@@ -0,0 +1 @@
M 0,0 47.999993,2.7036528e-4 C 48.001796,3.3028172 47.663993,6.5968018 46.991821,9.8301938 43.116101,28.454191 28.452575,43.116441 9.8293509,46.992163 6.5960834,47.664163 3.3023222,48.001868 0,47.999992 Z m 9.8293509,28.735114 v 9.248482 C 22.673599,33.047696 32.857154,22.749268 37.63852,9.829938 H 9.8293509 v 8.679899 H 22.931288 c -3.554489,3.93617 -7.735383,7.257633 -12.373436,9.829938 -0.241031,0.133684 -0.483864,0.265492 -0.7285011,0.395339 z
16 changes: 16 additions & 0 deletions build.json
@@ -0,0 +1,16 @@
{
"compiler": "tsc",
"verbose": true,
"writeBuildLog": true,
"writeAnsiBuildLog": true,
"logErrors": true,
"tsc": {
"prettyErrors": true
},
"clean": true,
"quiet": false,
"steps": {
"pre": ["clean", "plugin_prepare"],
"post": ["plugin_resources", "remap_imports"]
}
}
10 changes: 9 additions & 1 deletion fosscord-server.code-workspace
Expand Up @@ -16,6 +16,8 @@
"settings": {
"files.exclude": {
"*.ansi": true,
"**/cache": true,
"**/cache_src": true
}
},
"launch": {
Expand All @@ -28,10 +30,16 @@
"type": "node-terminal"
},
{
"command": "kitty npm run start:bundle:vscode-dbg",
"command": "[ \"$(basename $PWD)\" != \"fosscord-server\" ] && cd ..; node scripts/build_new.js && kitty node --enable-source-maps --inspect dist/start.js",
"name": "Run Fosscord with debugger (kitty)",
"request": "launch",
"type": "node-terminal"
},
{
"command": "[ \"$(basename $PWD)\" != \"fosscord-server\" ] && cd ..; $(ps -o comm= $PPID) assets/cache",
"name": "Open testclient patch workspace",
"request": "launch",
"type": "node-terminal"
}
]
}
Expand Down
3 changes: 3 additions & 0 deletions package.json
Expand Up @@ -50,6 +50,7 @@
"@types/ws": "^8.5.3",
"jest": "^28.1.3",
"jest-expect-message": "^1.0.2",
"prettier": "^2.7.1",
"prettier-plugin-organize-imports": "^3.0.3",
"supertest": "^6.1.6",
"ts-node": "^10.2.1",
Expand All @@ -65,6 +66,7 @@
"ajv": "^8.11.0",
"ajv-formats": "^2.1.1",
"amqplib": "^0.10.1",
"bcrypt": "^5.0.1",
"bcryptjs": "^2.4.3",
"body-parser": "^1.19.0",
"cheerio": "^1.0.0-rc.10",
Expand All @@ -85,6 +87,7 @@
"multer": "^1.4.5-lts.1",
"node-2fa": "^2.0.3",
"node-fetch": "^2.6.7",
"node-git-hooks": "^1.0.6",
"patch-package": "^6.4.7",
"picocolors": "^1.0.0",
"prettier": "^2.7.1",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.js
Expand Up @@ -29,7 +29,7 @@ if (silent) console.error = console.log = function () {};

if (argv.includes("clean")) {
console.log(`[${++i}/${steps}] Cleaning...`);
let d = "dist";
let d = "../" + "/dist";
if (fs.existsSync(d)) {
fs.rmSync(d, { recursive: true });
if (verbose) console.log(`Deleted ${d}!`);
Expand Down
2 changes: 2 additions & 0 deletions scripts/depclean.js
Expand Up @@ -5,6 +5,8 @@ const { execSync } = require("child_process");
const { argv, stdout, exit } = require("process");
const { execIn, getLines } = require("./utils");

const { execIn, getLines } = require("./utils");

const bundleRequired = ["@ovos-media/ts-transform-paths"];
const removeModules = argv.includes("cleanup");

Expand Down
24 changes: 24 additions & 0 deletions scripts/patches/applyPatches.js
@@ -0,0 +1,24 @@
const { execSync } = require("child_process");
const path = require("path");
const fs = require("fs");
const { argv, stdout, exit } = require("process");
const { execIn, parts, getDirs, walk, sanitizeVarName } = require("../utils");

//apply patches
const patchDir = path.join(__dirname, "..", "..", "assets", "testclient_patches");
const targetDir = path.join(__dirname, "..", "..", "assets", "cache");
const files = fs.readdirSync(patchDir);
files.forEach((file) => {
const filePath = path.join(patchDir, file);
const stats = fs.statSync(filePath);
if (stats.isFile()) {
const ext = path.extname(file);
if (ext === ".patch") {
execSync(`git apply ${filePath}`, {
cwd: targetDir,
maxBuffer: 1024 * 1024 * 10,
});
console.log(`Applied patch ${file} to ${newFilePath}`);
}
}
});