mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: fix database connection
This commit is contained in:
1 parent
551cf9c19f
commit
2b6986bd58
4 files changed
+4
-4
No files matched your search
@@ -23,7 +23,7 @@ if (!cluster.isMaster) {
|
||||
|
||||
if (argv._[0] === 'db') {
|
||||
function buildUrl(opts) {
|
||||
let mongourl = `${opts.protocol}://`;
|
||||
let mongourl = `${opts.protocol || 'mongodb'}://`;
|
||||
if (opts.username) mongourl += `${opts.username}:${opts.password}@`;
|
||||
mongourl += `${opts.host}:${opts.port}/${opts.name}`;
|
||||
if (opts.url) mongourl = opts.url;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.20.33",
|
||||
"version": "2.20.34",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
|
||||
@@ -21,7 +21,7 @@ class MongoService {
|
||||
private opts: MongoConfig;
|
||||
|
||||
static buildUrl(opts: MongoConfig) {
|
||||
let mongourl = `${opts.protocol}://`;
|
||||
let mongourl = `${opts.protocol || 'mongodb'}://`;
|
||||
if (opts.username) mongourl += `${opts.username}:${opts.password}@`;
|
||||
mongourl += `${opts.host}:${opts.port}/${opts.name}`;
|
||||
if (opts.url) mongourl = opts.url;
|
||||
|
||||
@@ -289,8 +289,8 @@ export class HandlerCommon {
|
||||
...this.user,
|
||||
gravatar: misc.gravatar(this.user.gravatar || '', 128),
|
||||
perm: this.user.perm.toString(),
|
||||
viewLang: this.translate('__id'),
|
||||
};
|
||||
UserContext.viewLang = this.translate('__id');
|
||||
if (!global.Hydro.lib.template) return JSON.stringify(context);
|
||||
const res = await global.Hydro.lib.template.render(name, {
|
||||
handler: this,
|
||||
|
||||
Reference in new issue
Block a user