mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: use domain.host for default
This commit is contained in:
1 parent
cc0fc9e5b3
commit
90579a81ed
7 files changed
+13
-7
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.23.30",
|
"version": "2.23.31",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ class DomainJoinApplicationsHandler extends ManageHandler {
|
|||||||
if (!this.response.body.joinSettings) {
|
if (!this.response.body.joinSettings) {
|
||||||
delete this.response.body.expirations[domain.JOIN_EXPIRATION_KEEP_CURRENT];
|
delete this.response.body.expirations[domain.JOIN_EXPIRATION_KEEP_CURRENT];
|
||||||
}
|
}
|
||||||
this.response.body.url_prefix = system.get('server.url');
|
this.response.body.url_prefix = (this.domain.host || [])[0] || system.get('server.url');
|
||||||
this.response.body.path = [
|
this.response.body.path = [
|
||||||
['Hydro', 'homepage'],
|
['Hydro', 'homepage'],
|
||||||
['domain', null],
|
['domain', null],
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ class HomeSecurityHandler extends Handler {
|
|||||||
const m = await this.renderHTML('user_changemail_mail.html', {
|
const m = await this.renderHTML('user_changemail_mail.html', {
|
||||||
path: `home/changeMail/${code}`,
|
path: `home/changeMail/${code}`,
|
||||||
uname: this.user.uname,
|
uname: this.user.uname,
|
||||||
url_prefix: system.get('server.url'),
|
url_prefix: (this.domain.host || [])[0] || system.get('server.url'),
|
||||||
});
|
});
|
||||||
await mail.sendMail(email, 'Change Email', 'user_changemail_mail', m);
|
await mail.sendMail(email, 'Change Email', 'user_changemail_mail', m);
|
||||||
this.response.template = 'user_changemail_mail_sent.html';
|
this.response.template = 'user_changemail_mail_sent.html';
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ export class UserRegisterHandler extends Handler {
|
|||||||
if (system.get('smtp.user')) {
|
if (system.get('smtp.user')) {
|
||||||
const m = await this.renderHTML('user_register_mail.html', {
|
const m = await this.renderHTML('user_register_mail.html', {
|
||||||
path: `register/${t[0]}`,
|
path: `register/${t[0]}`,
|
||||||
url_prefix: system.get('server.url'),
|
url_prefix: (this.domain.host || [])[0] || system.get('server.url'),
|
||||||
});
|
});
|
||||||
await sendMail(mail, 'Sign Up', 'user_register_mail', m);
|
await sendMail(mail, 'Sign Up', 'user_register_mail', m);
|
||||||
this.response.template = 'user_register_mail_sent.html';
|
this.response.template = 'user_register_mail_sent.html';
|
||||||
@@ -146,7 +146,7 @@ class UserLostPassHandler extends Handler {
|
|||||||
);
|
);
|
||||||
const m = await this.renderHTML('user_lostpass_mail.html', {
|
const m = await this.renderHTML('user_lostpass_mail.html', {
|
||||||
url: `lostpass/${tid}`,
|
url: `lostpass/${tid}`,
|
||||||
url_prefix: system.get('server.url'),
|
url_prefix: this.domain.host || system.get('server.url'),
|
||||||
uname: udoc.uname,
|
uname: udoc.uname,
|
||||||
});
|
});
|
||||||
await sendMail(mail, 'Lost Password', 'user_lostpass_mail', m);
|
await sendMail(mail, 'Lost Password', 'user_lostpass_mail', m);
|
||||||
|
|||||||
@@ -305,7 +305,7 @@ export interface DomainDoc extends Record<string, any> {
|
|||||||
avatar: string,
|
avatar: string,
|
||||||
bulletin: string,
|
bulletin: string,
|
||||||
_join?: any,
|
_join?: any,
|
||||||
host?: string,
|
host?: string[],
|
||||||
}
|
}
|
||||||
|
|
||||||
// Message
|
// Message
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import user from './model/user';
|
|||||||
import problem, { Field, Pdoc } from './model/problem';
|
import problem, { Field, Pdoc } from './model/problem';
|
||||||
|
|
||||||
export async function iterateAllDomain(cb: (ddoc: DomainDoc, current?: number, total?: number) => Promise<any>) {
|
export async function iterateAllDomain(cb: (ddoc: DomainDoc, current?: number, total?: number) => Promise<any>) {
|
||||||
const ddocs = await domain.getMulti().project({ _id: 1, owner: 1 }).toArray();
|
const ddocs = await domain.getMulti().toArray();
|
||||||
for (const i in ddocs) await cb(ddocs[i], +i, ddocs.length);
|
for (const i in ddocs) await cb(ddocs[i], +i, ddocs.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -311,6 +311,12 @@ const scripts: UpgradeScript[] = [
|
|||||||
await db.collection('oplog').updateMany({}, { $set: { type: 'delete', operateIp: '127.0.0.1' } });
|
await db.collection('oplog').updateMany({}, { $set: { type: 'delete', operateIp: '127.0.0.1' } });
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
async function _24_25() {
|
||||||
|
await iterateAllDomain(async (ddoc) => {
|
||||||
|
if (typeof ddoc.host === 'string') await domain.edit(ddoc._id, { host: [ddoc.host] });
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export default scripts;
|
export default scripts;
|
||||||
Reference in new issue
Block a user