mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
“我的域”功能
This commit is contained in:
1 parent
d4e849a133
commit
eaed0e84f5
11 files changed
+122
-27
No files matched your search
+20
-4
@@ -241,6 +241,10 @@ class UserChangemailWithCodeHandler extends Handler {
|
||||
|
||||
class HomeDomainHandler extends Handler {
|
||||
async get() {
|
||||
const path = [
|
||||
['Hydro', 'homepage'],
|
||||
['home_domain', null],
|
||||
];
|
||||
const dudict = await domain.getDictUserByDomainId(this.user._id);
|
||||
const dids = Object.keys(dudict);
|
||||
const ddocs = await domain.getMulti({ _id: { $in: dids } }).toArray();
|
||||
@@ -252,19 +256,27 @@ class HomeDomainHandler extends Handler {
|
||||
|| udoc.hasPriv(PRIV.PRIV_MANAGE_ALL_DOMAIN);
|
||||
}
|
||||
this.response.template = 'home_domain.html';
|
||||
this.response.body = { ddocs, dudict, canManage };
|
||||
this.response.body = {
|
||||
ddocs, dudict, canManage, path,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class HomeDomainCreateHandler extends Handler {
|
||||
async get() {
|
||||
this.response.body = 'home_domain_create.html';
|
||||
this.response.body = {
|
||||
path: [
|
||||
['Hydro', 'homepage'],
|
||||
['domain_create', null],
|
||||
],
|
||||
};
|
||||
this.response.template = 'domain_create.html';
|
||||
}
|
||||
|
||||
@param('id', Types.String)
|
||||
@param('name', Types.String, isTitle)
|
||||
@param('bulletin', Types.String, isContent)
|
||||
@param('gravatar', Types.String, isEmail, true)
|
||||
@param('gravatar', Types.String, true, isEmail)
|
||||
async post(_: string, id: string, name: string, bulletin: string, gravatar: string) {
|
||||
gravatar = gravatar || this.user.gravatar || this.user.mail || 'guest@hydro.local';
|
||||
const domainId = await domain.add(id, this.user._id, name, bulletin);
|
||||
@@ -342,9 +354,13 @@ class HomeMessagesConnectionHandler extends ConnectionHandler {
|
||||
|
||||
class HomeFileHandler extends Handler {
|
||||
async get() {
|
||||
const path = [
|
||||
['Hydro', 'homepage'],
|
||||
['domain_file', null],
|
||||
];
|
||||
const ufdocs = await file.getMulti({ owner: this.user._id }).toArray();
|
||||
this.response.template = 'home_file.html';
|
||||
this.response.body = { ufdocs };
|
||||
this.response.body = { ufdocs, path };
|
||||
}
|
||||
|
||||
@param('ufid', Types.ObjectID)
|
||||
|
||||
@@ -127,7 +127,7 @@ class UiSettingsHandler extends Handler {
|
||||
'ui.header_logo', 'ui.header_logo_2x',
|
||||
'ui.nav_logo_dark', 'ui.nav_logo_light',
|
||||
'ui.nav_logo_dark_2x', 'ui.nav_logo_light_2x',
|
||||
'ui.headerBackground', 'ui.headerBackground2x',
|
||||
'ui.header_background', 'ui.header_background2x',
|
||||
]);
|
||||
this.response.body = await this.renderHTML('extra.css', {
|
||||
header_logo,
|
||||
|
||||
@@ -361,7 +361,7 @@ class ProblemDataUploadHandler extends ProblemManageHandler {
|
||||
async post({ domainId }) {
|
||||
let md5;
|
||||
if (!this.request.files.file) throw new BadRequestError();
|
||||
await problem.setTestdata(
|
||||
this.pdoc = await problem.setTestdata(
|
||||
domainId, this.pdoc.docId, this.request.files.file.path,
|
||||
);
|
||||
if (this.pdoc.data && typeof this.pdoc.data === 'object') {
|
||||
|
||||
Reference in new issue
Block a user