Add nix flake to repo (#1111)
This commit is contained in:
parent
3eb5a3f420
commit
29df169c81
3
.github/CODEOWNERS
vendored
Normal file
3
.github/CODEOWNERS
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Nix stuff is owned by Rory& - we& want to be notified if these are changed.
|
||||||
|
/flake.nix root@rory.gay
|
||||||
|
/nix-update.sh root@rory.gay
|
||||||
18
.github/workflows/nix-build.yml
vendored
Normal file
18
.github/workflows/nix-build.yml
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
name: Nix build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-nix:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: cachix/install-nix-action@v25
|
||||||
|
with:
|
||||||
|
nix_path: nixpkgs=channel:nixos-unstable
|
||||||
|
- uses: DeterminateSystems/magic-nix-cache-action@v2
|
||||||
|
- run: nix build -L
|
||||||
|
- run: nix develop --command echo OK
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@ -18,4 +18,5 @@ build
|
|||||||
*.log.ansi
|
*.log.ansi
|
||||||
*.tmp
|
*.tmp
|
||||||
tmp/
|
tmp/
|
||||||
dump/
|
dump/
|
||||||
|
result
|
||||||
|
|||||||
@ -1,4 +1,28 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
#!nix-shell -i "bash" -p bash prefetch-npm-deps jq nodejs nix-output-monitor
|
||||||
. "$(dirname -- "$0")/_/husky.sh"
|
. "$(dirname -- "$0")/_/husky.sh"
|
||||||
|
|
||||||
npx -y lint-staged
|
# Check if nix is available
|
||||||
|
if [ -x "$(/usr/bin/env which nix-shell 2>/dev/null)" ]; then
|
||||||
|
# Check if we haven't re-executed ourselves yet
|
||||||
|
if [ ! "$HOOK_NIX_SHELL" ]; then
|
||||||
|
echo "Nix is available, updating nix flake..."
|
||||||
|
export HOOK_NIX_SHELL=1
|
||||||
|
nix-shell $0
|
||||||
|
exit $?
|
||||||
|
else
|
||||||
|
nix flake update
|
||||||
|
# run ./nix-update.sh if package lock has changed and has no unstaged changes
|
||||||
|
if [ -n "$(git status --porcelain=v1 2>/dev/null | grep -E '^(MM| M) package-lock.json')" ]; then
|
||||||
|
echo "package-lock.json has unstaged changes. Skipping update of nix dependencies."
|
||||||
|
elif [ ! -n "$(git status --porcelain=v1 2>/dev/null | grep -E '^M package-lock.json')" ]; then
|
||||||
|
echo "package-lock.json has no changes. Skipping update of nix dependencies."
|
||||||
|
else
|
||||||
|
./nix-update.sh || exit $?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "You do not appear to have nix installed. Skipping update of nix dependencies."
|
||||||
|
fi
|
||||||
|
|
||||||
|
npx -y lint-staged
|
||||||
|
|||||||
@ -1,38 +0,0 @@
|
|||||||
const supportedLocales = [
|
|
||||||
"bg",
|
|
||||||
"cs",
|
|
||||||
"da",
|
|
||||||
"de",
|
|
||||||
"el",
|
|
||||||
"en-GB",
|
|
||||||
"es-ES",
|
|
||||||
"fi",
|
|
||||||
"fr",
|
|
||||||
"hi",
|
|
||||||
"hr",
|
|
||||||
"hu",
|
|
||||||
"it",
|
|
||||||
"ja",
|
|
||||||
"ko",
|
|
||||||
"lt",
|
|
||||||
"nl",
|
|
||||||
"no",
|
|
||||||
"pl",
|
|
||||||
"pt-BR",
|
|
||||||
"ro",
|
|
||||||
"ru",
|
|
||||||
"sv-SE",
|
|
||||||
"th",
|
|
||||||
"tr",
|
|
||||||
"uk",
|
|
||||||
"vi",
|
|
||||||
"zh-CN",
|
|
||||||
"zh-TW"
|
|
||||||
];
|
|
||||||
|
|
||||||
const settings = JSON.parse(window.localStorage.getItem("UserSettingsStore"));
|
|
||||||
if (settings && !supportedLocales.includes(settings.locale)) {
|
|
||||||
// fix client locale wrong and client not loading at all
|
|
||||||
settings.locale = "en-US";
|
|
||||||
window.localStorage.setItem("UserSettingsStore", JSON.stringify(settings));
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
// Fixes /oauth2 endpoints not requesting a CSS file
|
|
||||||
|
|
||||||
if (location.pathname.startsWith("/oauth2/")) {
|
|
||||||
const link = document.createElement("link");
|
|
||||||
link.rel = "stylesheet"
|
|
||||||
link.type = "text/css"
|
|
||||||
link.href = "/assets/40532.f7b1e10347ef10e790ac.css"
|
|
||||||
document.head.appendChild(link)
|
|
||||||
}
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
/* 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 Spacebar!";
|
|
||||||
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/spacebarchat/spacebarchat/master/branding/svg/Spacebar__Logo-Blue.svg);
|
|
||||||
width: 130px;
|
|
||||||
height: 23px;
|
|
||||||
background-size: contain;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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;
|
|
||||||
}
|
|
||||||
@ -1,92 +0,0 @@
|
|||||||
/* 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/spacebarchat/spacebarchat/master/branding/svg/Spacebar__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;
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
/* Your custom CSS goes here, enjoy! */
|
|
||||||
@ -1,82 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is used to patch client version 134842 ( and probably a lot more ) to send additional info when using webrtc.
|
|
||||||
If you want to use it, throw it into the `preload-plugins` folder.
|
|
||||||
TODO: Make it so this file is not required for webrtc.
|
|
||||||
|
|
||||||
Do note that webrtc, as of 17/12/2022, is not implemented yet in spacebarchat/server.
|
|
||||||
*/
|
|
||||||
|
|
||||||
(this.webpackChunkdiscord_app = this.webpackChunkdiscord_app || []).push([
|
|
||||||
[[228974]],
|
|
||||||
{
|
|
||||||
632540: (module, exports, req) => {
|
|
||||||
window.find = (filter, options = {}) => {
|
|
||||||
const { cacheOnly = false } = options;
|
|
||||||
for (let i in req.c) {
|
|
||||||
if (req.c.hasOwnProperty(i)) {
|
|
||||||
let m = req.c[i].exports;
|
|
||||||
if (m && m.__esModule && m.default && filter(m.default)) return m.default;
|
|
||||||
if (m && filter(m)) return m;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (cacheOnly) {
|
|
||||||
console.warn("Cannot find loaded module in cache");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
console.warn("Cannot find loaded module in cache. Loading all modules may have unexpected side effects");
|
|
||||||
for (let i = 0; i < req.m.length; ++i) {
|
|
||||||
let m = req(i);
|
|
||||||
if (m && m.__esModule && m.default && filter(m.default)) return m.default;
|
|
||||||
if (m && filter(m)) return m;
|
|
||||||
}
|
|
||||||
console.warn("Cannot find module");
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
window.findByUniqueProperties = (propNames, options) =>
|
|
||||||
find((module) => propNames.every((prop) => module[prop] !== undefined), options);
|
|
||||||
window.findByDisplayName = (displayName, options) => find((module) => module.displayName === displayName, options);
|
|
||||||
window.req = req;
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
(t) => t(632540)
|
|
||||||
]);
|
|
||||||
|
|
||||||
function retry(callback) {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
const interval = setInterval(() => {
|
|
||||||
const mod = callback();
|
|
||||||
if (!mod) return;
|
|
||||||
|
|
||||||
clearInterval(interval);
|
|
||||||
resolve(mod);
|
|
||||||
}, 50);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async function init() {
|
|
||||||
const SDP = await retry(() => findByUniqueProperties(["truncateSDP"]));
|
|
||||||
const StringManipulator = findByUniqueProperties(["uniq"]);
|
|
||||||
|
|
||||||
const truncateSDP = SDP.truncateSDP;
|
|
||||||
SDP.truncateSDP = (e) => {
|
|
||||||
const result = truncateSDP(e);
|
|
||||||
const i = result.codecs.find((x) => x.name === "VP8");
|
|
||||||
const a = new RegExp("^a=ice|a=extmap|opus|VP8|fingerprint|" + i?.rtxPayloadType + " rtx", "i");
|
|
||||||
return {
|
|
||||||
sdp: StringManipulator(e)
|
|
||||||
.split(/\r\n/)
|
|
||||||
.filter(function (e) {
|
|
||||||
return a.test(e);
|
|
||||||
})
|
|
||||||
.uniq()
|
|
||||||
.join("\n"),
|
|
||||||
codecs: result.codecs
|
|
||||||
};
|
|
||||||
};
|
|
||||||
// SDP.generateUnifiedSessionDescription = (e) => {
|
|
||||||
// console.log(e);
|
|
||||||
// return new RTCSessionDescription({ sdp: e.baseSDP.replace(/sendonly/g, "recvonly"), type: "answer" });
|
|
||||||
// };
|
|
||||||
}
|
|
||||||
BIN
flake.lock
generated
Normal file
BIN
flake.lock
generated
Normal file
Binary file not shown.
70
flake.nix
Normal file
70
flake.nix
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
{
|
||||||
|
description = "Spacebar server, written in Typescript.";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, flake-utils }:
|
||||||
|
flake-utils.lib.eachSystem flake-utils.lib.allSystems (system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
};
|
||||||
|
hashesFile = builtins.fromJSON (builtins.readFile ./hashes.json);
|
||||||
|
in rec {
|
||||||
|
packages.default = pkgs.buildNpmPackage {
|
||||||
|
pname = "spacebar-server-ts";
|
||||||
|
src = ./.;
|
||||||
|
name = "spacebar-server-ts";
|
||||||
|
nativeBuildInputs = with pkgs; [ python3 ];
|
||||||
|
npmDepsHash = hashesFile.npmDepsHash;
|
||||||
|
makeCacheWritable = true;
|
||||||
|
postPatch = ''
|
||||||
|
substituteInPlace package.json --replace 'npx patch-package' '${pkgs.nodePackages.patch-package}/bin/patch-package'
|
||||||
|
'';
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
set -x
|
||||||
|
#remove packages not needed for production, or at least try to...
|
||||||
|
npm prune --omit dev --no-save $npmInstallFlags "''${npmInstallFlagsArray[@]}" $npmFlags "''${npmFlagsArray[@]}"
|
||||||
|
find node_modules -maxdepth 1 -type d -empty -delete
|
||||||
|
|
||||||
|
mkdir -p $out/node_modules/
|
||||||
|
cp -r node_modules/* $out/node_modules/
|
||||||
|
cp -r dist/ $out/node_modules/@spacebar
|
||||||
|
for i in dist/**/start.js
|
||||||
|
do
|
||||||
|
makeWrapper ${pkgs.nodejs-slim}/bin/node $out/bin/start-`dirname ''${i/dist\//}` --prefix NODE_PATH : $out/node_modules --add-flags $out/node_modules/@spacebar`dirname ''${i/dist/}`/start.js
|
||||||
|
done
|
||||||
|
set +x
|
||||||
|
substituteInPlace package.json --replace 'dist/' 'node_modules/@spacebar/'
|
||||||
|
find $out/node_modules/@spacebar/ -type f -name "*.js" | while read srcFile; do
|
||||||
|
echo Patching imports in ''${srcFile/$out\/node_modules\/@spacebar//}...
|
||||||
|
substituteInPlace $srcFile --replace 'require("./' 'require(__dirname + "/'
|
||||||
|
substituteInPlace $srcFile --replace 'require("../' 'require(__dirname + "/../'
|
||||||
|
substituteInPlace $srcFile --replace ', "assets"' ', "..", "assets"'
|
||||||
|
#substituteInPlace $srcFile --replace 'require("@spacebar/' 'require("
|
||||||
|
done
|
||||||
|
set -x
|
||||||
|
cp -r assets/ $out/
|
||||||
|
cp package.json $out/
|
||||||
|
rm -v $out/assets/openapi.json
|
||||||
|
#rm -v $out/assets/schemas.json
|
||||||
|
|
||||||
|
#debug utils:
|
||||||
|
#cp $out/node_modules/@spacebar/ $out/build_output -r
|
||||||
|
set +x
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
devShell = pkgs.mkShell {
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
nodejs
|
||||||
|
nodePackages.typescript
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
3
hashes.json
Normal file
3
hashes.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"npmDepsHash": "sha256-fZNDN2/fNy6Nu7tbr0RhQ8j4BP7X1Yhrh/fSTH7hbJc="
|
||||||
|
}
|
||||||
10
nix-update.sh
Executable file
10
nix-update.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#!nix-shell -i "bash -x" -p bash prefetch-npm-deps jq git nix-output-monitor
|
||||||
|
nix flake update
|
||||||
|
DEPS_HASH=`prefetch-npm-deps package-lock.json`
|
||||||
|
TMPFILE=$(mktemp)
|
||||||
|
jq '.npm_deps_hash = "'$DEPS_HASH'"' hashes.json > $TMPFILE
|
||||||
|
mv -- "$TMPFILE" hashes.json
|
||||||
|
|
||||||
|
nom build .# || exit $?
|
||||||
|
git add hashes.json flake.lock flake.nix
|
||||||
BIN
package-lock.json
generated
BIN
package-lock.json
generated
Binary file not shown.
@ -116,9 +116,11 @@
|
|||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"erlpack": "^0.1.4",
|
"erlpack": "^0.1.4",
|
||||||
|
"mysql": "^2.18.1",
|
||||||
"nodemailer-mailgun-transport": "^2.1.5",
|
"nodemailer-mailgun-transport": "^2.1.5",
|
||||||
"nodemailer-mailjet-transport": "github:n0script22/nodemailer-mailjet-transport",
|
"nodemailer-mailjet-transport": "github:n0script22/nodemailer-mailjet-transport",
|
||||||
"nodemailer-sendgrid-transport": "github:Maria-Golomb/nodemailer-sendgrid-transport",
|
"nodemailer-sendgrid-transport": "github:Maria-Golomb/nodemailer-sendgrid-transport",
|
||||||
|
"pg": "^8.11.3",
|
||||||
"sqlite3": "^5.1.6"
|
"sqlite3": "^5.1.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,15 @@ router.get("/avatars/:id", async (req: Request, res: Response) => {
|
|||||||
id = id.split(".")[0]; // remove .file extension
|
id = id.split(".")[0]; // remove .file extension
|
||||||
const hash = defaultAvatarHashMap.get(id);
|
const hash = defaultAvatarHashMap.get(id);
|
||||||
if (!hash) throw new HTTPError("not found", 404);
|
if (!hash) throw new HTTPError("not found", 404);
|
||||||
const path = join(process.cwd(), "assets", "public", `${hash}.png`);
|
const path = join(
|
||||||
|
__dirname,
|
||||||
|
"..",
|
||||||
|
"..",
|
||||||
|
"..",
|
||||||
|
"assets",
|
||||||
|
"public",
|
||||||
|
`${hash}.png`,
|
||||||
|
);
|
||||||
|
|
||||||
const file = await getFile(path);
|
const file = await getFile(path);
|
||||||
if (!file) throw new HTTPError("not found", 404);
|
if (!file) throw new HTTPError("not found", 404);
|
||||||
@ -80,7 +88,15 @@ router.get("/group-avatars/:id", async (req: Request, res: Response) => {
|
|||||||
id = id.split(".")[0]; // remove .file extension
|
id = id.split(".")[0]; // remove .file extension
|
||||||
const hash = defaultGroupDMAvatarHashMap.get(id);
|
const hash = defaultGroupDMAvatarHashMap.get(id);
|
||||||
if (!hash) throw new HTTPError("not found", 404);
|
if (!hash) throw new HTTPError("not found", 404);
|
||||||
const path = join(process.cwd(), "assets", "public", `${hash}.png`);
|
const path = join(
|
||||||
|
__dirname,
|
||||||
|
"..",
|
||||||
|
"..",
|
||||||
|
"..",
|
||||||
|
"assets",
|
||||||
|
"public",
|
||||||
|
`${hash}.png`,
|
||||||
|
);
|
||||||
|
|
||||||
const file = await getFile(path);
|
const file = await getFile(path);
|
||||||
if (!file) throw new HTTPError("not found", 404);
|
if (!file) throw new HTTPError("not found", 404);
|
||||||
|
|||||||
@ -22,7 +22,7 @@ import path from "path";
|
|||||||
import { ConnectionConfig } from "./ConnectionConfig";
|
import { ConnectionConfig } from "./ConnectionConfig";
|
||||||
import { ConnectionStore } from "./ConnectionStore";
|
import { ConnectionStore } from "./ConnectionStore";
|
||||||
|
|
||||||
const root = "dist/connections";
|
const root = path.join(__dirname, "..", "..", "connections");
|
||||||
const connectionsLoaded = false;
|
const connectionsLoaded = false;
|
||||||
|
|
||||||
export class ConnectionLoader {
|
export class ConnectionLoader {
|
||||||
|
|||||||
Reference in New Issue
Block a user