Compare commits
No commits in common. "dc1879e75455f179ddd76c5ef4bb27de636136cf" and "c4630633b88527b0532f95bc00d3e8d14043d1af" have entirely different histories.
dc1879e754
...
c4630633b8
@ -49,21 +49,6 @@ footer {
|
|||||||
.background {
|
.background {
|
||||||
background-color: var(--gbot-blue);
|
background-color: var(--gbot-blue);
|
||||||
height: 86vh;
|
height: 86vh;
|
||||||
/* background-color: #406c7e; */
|
|
||||||
/* opacity: 0.4; */
|
|
||||||
background-image: linear-gradient(30deg, #ffffff 12%, transparent 12.5%, transparent 87%, #ffffff 87.5%, #ffffff),
|
|
||||||
linear-gradient(150deg, #ffffff 12%, transparent 12.5%, transparent 87%, #ffffff 87.5%, #ffffff),
|
|
||||||
linear-gradient(30deg, #ffffff 12%, transparent 12.5%, transparent 87%, #ffffff 87.5%, #ffffff),
|
|
||||||
linear-gradient(150deg, #ffffff 12%, transparent 12.5%, transparent 87%, #ffffff 87.5%, #ffffff),
|
|
||||||
linear-gradient(60deg, #ffffff77 25%, transparent 25.5%, transparent 75%, #ffffff77 75%, #ffffff77),
|
|
||||||
linear-gradient(60deg, #ffffff77 25%, transparent 25.5%, transparent 75%, #ffffff77 75%, #ffffff77);
|
|
||||||
background-size: 52px 91px;
|
|
||||||
background-position: 0 0,
|
|
||||||
0 0,
|
|
||||||
26px 46px,
|
|
||||||
26px 46px,
|
|
||||||
0 0,
|
|
||||||
26px 46px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.foreground {
|
.foreground {
|
||||||
|
1
server/.gitignore
vendored
1
server/.gitignore
vendored
@ -2,7 +2,6 @@ node_modules
|
|||||||
logs
|
logs
|
||||||
media
|
media
|
||||||
thumbnails
|
thumbnails
|
||||||
files
|
|
||||||
|
|
||||||
clipIndex.json
|
clipIndex.json
|
||||||
.env
|
.env
|
@ -12,7 +12,7 @@ class MongoDB {
|
|||||||
|
|
||||||
if (!client) throw new Error('Missing reference to client!');
|
if (!client) throw new Error('Missing reference to client!');
|
||||||
if (!config) throw new Error('No config file provided!');
|
if (!config) throw new Error('No config file provided!');
|
||||||
if (config && (!config.database || !config.host)) throw new Error('Invalid config provided!');
|
if (config && (!config.database || !config.url)) throw new Error('Invalid config file provided!');
|
||||||
|
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.client = null; // Mongo Client
|
this.client = null; // Mongo Client
|
||||||
@ -22,13 +22,6 @@ class MongoDB {
|
|||||||
this.logger = new Logger(this);
|
this.logger = new Logger(this);
|
||||||
this.logger._debug = this.parent._debug;
|
this.logger._debug = this.parent._debug;
|
||||||
|
|
||||||
const { API_DB_USERNAME, API_DB_PASSWORD } = process.env;
|
|
||||||
this._auth = API_DB_USERNAME ? `${API_DB_USERNAME}:${API_DB_PASSWORD}@` : '';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
URI(database) {
|
|
||||||
return `mongodb://${this._auth}${this.config.host}/${database}?authSource=${database}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
@ -36,7 +29,8 @@ class MongoDB {
|
|||||||
this.logger.info('Initializing database connection.');
|
this.logger.info('Initializing database connection.');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const client = new MongoClient(this.URI(this.config.database), { useNewUrlParser: true });
|
|
||||||
|
const client = new MongoClient(this.config.url + this.config.database, { useUnifiedTopology: true });
|
||||||
this.client = await client.connect();
|
this.client = await client.connect();
|
||||||
this.db = await this.client.db(this.config.database);
|
this.db = await this.client.db(this.config.database);
|
||||||
this.logger.info('Database connected.');
|
this.logger.info('Database connected.');
|
||||||
|
@ -33,7 +33,7 @@ class Client extends EventEmitter {
|
|||||||
this._debug = env.DEBUG;
|
this._debug = env.DEBUG;
|
||||||
this._mongoOpts = {
|
this._mongoOpts = {
|
||||||
database: env.API_DB,
|
database: env.API_DB,
|
||||||
host: env.API_DB_HOST
|
url: env.API_DB_URL
|
||||||
};
|
};
|
||||||
|
|
||||||
this.ready = false;
|
this.ready = false;
|
||||||
@ -120,7 +120,7 @@ class Client extends EventEmitter {
|
|||||||
resave: false,
|
resave: false,
|
||||||
saveUninitialized: false,
|
saveUninitialized: false,
|
||||||
store: MongoStore.create({
|
store: MongoStore.create({
|
||||||
mongoUrl: this.database.URI(env.API_SESSION_STORE),
|
mongoUrl: this._mongoOpts.url + env.API_SESSION_STORE,
|
||||||
collectionName: env.API_SESSION_COLLECTION
|
collectionName: env.API_SESSION_COLLECTION
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
// Endpoint for hosting arbitrary files
|
|
||||||
const { APIEndpoint } = require('../../interfaces');
|
|
||||||
const fs = require('fs');
|
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
class FilesEndpoint extends APIEndpoint {
|
|
||||||
|
|
||||||
constructor(client, opts) {
|
|
||||||
super(client, {
|
|
||||||
name: 'files',
|
|
||||||
path: '/files/:filename',
|
|
||||||
...opts
|
|
||||||
});
|
|
||||||
|
|
||||||
this.methods = [
|
|
||||||
['get', this.get.bind(this)]
|
|
||||||
];
|
|
||||||
|
|
||||||
this.init();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async get(req, res) {
|
|
||||||
|
|
||||||
const { filename } = req.params;
|
|
||||||
const _path = path.join(process.cwd(), 'files');
|
|
||||||
if (!fs.existsSync(_path)) return res.status(500).send('File serving not set up');
|
|
||||||
|
|
||||||
const files = fs.readdirSync(_path);
|
|
||||||
if (!filename || !files.includes(filename)) return res.status(404).end();
|
|
||||||
|
|
||||||
res.sendFile(`${filename}`, { root: _path });
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = FilesEndpoint;
|
|
@ -135,7 +135,7 @@ class Manager extends EventEmitter {
|
|||||||
return {
|
return {
|
||||||
NODE_ENV: env.NODE_ENV,
|
NODE_ENV: env.NODE_ENV,
|
||||||
API_DB: env.API_DB,
|
API_DB: env.API_DB,
|
||||||
API_DB_HOST: env.API_DB_HOST,
|
API_DB_URL: env.API_DB_URL,
|
||||||
API_SESSION_STORE: env.API_SESSION_STORE,
|
API_SESSION_STORE: env.API_SESSION_STORE,
|
||||||
API_SESSION_COLLECTION: env.API_SESSION_COLLECTION,
|
API_SESSION_COLLECTION: env.API_SESSION_COLLECTION,
|
||||||
API_USER_COLLECTION: env.API_USER_COLLECTION,
|
API_USER_COLLECTION: env.API_USER_COLLECTION,
|
||||||
@ -146,9 +146,7 @@ class Manager extends EventEmitter {
|
|||||||
DISCORD_ID: env.DISCORD_ID,
|
DISCORD_ID: env.DISCORD_ID,
|
||||||
DISCORD_SCOPE: opts.discord.scope,
|
DISCORD_SCOPE: opts.discord.scope,
|
||||||
DOMAIN: opts.domain,
|
DOMAIN: opts.domain,
|
||||||
DEBUG: opts.debug,
|
DEBUG: opts.debug
|
||||||
API_DB_USERNAME: env.API_DB_USERNAME,
|
|
||||||
API_DB_PASSWORD: env.API_DB_PASSWORD
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,9 +185,9 @@
|
|||||||
form-data "^3.0.0"
|
form-data "^3.0.0"
|
||||||
|
|
||||||
"@types/node@*":
|
"@types/node@*":
|
||||||
version "17.0.25"
|
version "17.0.21"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.25.tgz#527051f3c2f77aa52e5dc74e45a3da5fb2301448"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.21.tgz#864b987c0c68d07b4345845c3e63b75edd143644"
|
||||||
integrity sha512-wANk6fBrUwdpY4isjWrKTufkrXdu1D2YHCot2fD/DfWxF5sMrVSA+KN7ydckvaTCh0HiqX9IVl0L5/ZoXg5M7w==
|
integrity sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ==
|
||||||
|
|
||||||
"@types/webidl-conversions@*":
|
"@types/webidl-conversions@*":
|
||||||
version "6.1.1"
|
version "6.1.1"
|
||||||
@ -364,10 +364,10 @@ brace-expansion@^1.1.7:
|
|||||||
balanced-match "^1.0.0"
|
balanced-match "^1.0.0"
|
||||||
concat-map "0.0.1"
|
concat-map "0.0.1"
|
||||||
|
|
||||||
bson@^4.6.2:
|
bson@^4.6.1:
|
||||||
version "4.6.3"
|
version "4.6.1"
|
||||||
resolved "https://registry.yarnpkg.com/bson/-/bson-4.6.3.tgz#d1a9a0b84b9e84b62390811fc5580f6a8b1d858c"
|
resolved "https://registry.yarnpkg.com/bson/-/bson-4.6.1.tgz#2b5da517539bb0f7f3ffb54ac70a384ca899641c"
|
||||||
integrity sha512-rAqP5hcUVJhXP2MCSNVsf0oM2OGU1So6A9pVRDYayvJ5+hygXHQApf87wd5NlhPM1J9RJnbqxIG/f8QTzRoQ4A==
|
integrity sha512-I1LQ7Hz5zgwR4QquilLNZwbhPw0Apx7i7X9kGMBTsqPdml/03Q9NBtD9nt/19ahjlphktQImrnderxqpzeVDjw==
|
||||||
dependencies:
|
dependencies:
|
||||||
buffer "^5.6.0"
|
buffer "^5.6.0"
|
||||||
|
|
||||||
@ -1208,11 +1208,11 @@ mongodb-connection-string-url@^2.5.2:
|
|||||||
whatwg-url "^11.0.0"
|
whatwg-url "^11.0.0"
|
||||||
|
|
||||||
mongodb@^4.4.1:
|
mongodb@^4.4.1:
|
||||||
version "4.5.0"
|
version "4.4.1"
|
||||||
resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-4.5.0.tgz#d74c2008567b606dccef220f62a44cd7b934eb92"
|
resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-4.4.1.tgz#e604cfbe2d5e125ae156ad04b52d261bed480b99"
|
||||||
integrity sha512-A2l8MjEpKojnhbCM0MK3+UOGUSGvTNNSv7AkP1fsT7tkambrkkqN/5F2y+PhzsV0Nbv58u04TETpkaSEdI2zKA==
|
integrity sha512-IAD3nFtCR4s22vi5qjqkCBnuyDDrOW8WVSSmgHquOvGaP1iTD+XpC5tr8wAUbZ2EeZkaswwBKQFHDvl4qYcKqQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
bson "^4.6.2"
|
bson "^4.6.1"
|
||||||
denque "^2.0.1"
|
denque "^2.0.1"
|
||||||
mongodb-connection-string-url "^2.5.2"
|
mongodb-connection-string-url "^2.5.2"
|
||||||
socks "^2.6.2"
|
socks "^2.6.2"
|
||||||
|
Loading…
Reference in New Issue
Block a user