Merge branch 'master' into develop

This commit is contained in:
undefined committed 2021-05-02 14:31:33 +08:00
commit 0454acdbf9
13 files changed
+29 -18

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.23.30",
"version": "2.23.31",
"bin": "bin/hydrooj.js",
"main": "dist/loader.js",
"typings": "dist/loader.d.ts",
+1 -1
View File
@@ -219,7 +219,7 @@ class DomainJoinApplicationsHandler extends ManageHandler {
if (!this.response.body.joinSettings) {
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 = [
['Hydro', 'homepage'],
['domain', null],
+1 -1
View File
@@ -168,7 +168,7 @@ class HomeSecurityHandler extends Handler {
const m = await this.renderHTML('user_changemail_mail.html', {
path: `home/changeMail/${code}`,
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);
this.response.template = 'user_changemail_mail_sent.html';
+2 -2
View File
@@ -79,7 +79,7 @@ export class UserRegisterHandler extends Handler {
if (system.get('smtp.user')) {
const m = await this.renderHTML('user_register_mail.html', {
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);
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', {
url: `lostpass/${tid}`,
url_prefix: system.get('server.url'),
url_prefix: this.domain.host || system.get('server.url'),
uname: udoc.uname,
});
await sendMail(mail, 'Lost Password', 'user_lostpass_mail', m);
+1 -1
View File
@@ -307,7 +307,7 @@ export interface DomainDoc extends Record<string, any> {
avatar: string,
bulletin: string,
_join?: any,
host?: string,
host?: string[],
}
// Message
+1 -1
View File
@@ -5,7 +5,7 @@ import user from './model/user';
import problem, { Field, Pdoc } from './model/problem';
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);
}
+6
View File
@@ -311,6 +311,12 @@ const scripts: UpgradeScript[] = [
await db.collection('oplog').updateMany({}, { $set: { type: 'delete', operateIp: '127.0.0.1' } });
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;