MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / get

Method get

packages/hydrooj/src/handler/home.ts:147–178  ·  view source on GitHub ↗
({ domainId })

Source from the content-addressed store, hash-verified

145 }
146
147 async get({ domainId }) {
148 const homepageConfig = this.ctx.setting.get('hydrooj.homepage');
149 const info = yaml.load(homepageConfig) as any;
150 const contents = [];
151 for (const column of info) {
152 const tasks = [];
153 for (const name in column) {
154 if (name === 'width') continue;
155 const func = `get${camelCase(name).replace(/^[a-z]/, (i) => i.toUpperCase())}`;
156 if (!this[func]) tasks.push([name, column[name]]);
157 else {
158 tasks.push(
159 this[func](domainId, column[name])
160 .then((res) => [name, res])
161 .catch((err) => ['error', err.message]),
162 );
163 }
164 }
165 contents.push({
166 width: column.width,
167 // eslint-disable-next-line no-await-in-loop
168 sections: await Promise.all(tasks),
169 });
170 }
171 const udict = await user.getList(domainId, Array.from(this.uids));
172 this.response.template = 'main.html';
173 this.response.body = {
174 contents,
175 udict,
176 domain: this.domain,
177 };
178 }
179}
180
181class HomeSecurityHandler extends Handler {

Callers 12

prepareMethod · 0.45
unsubscribeMethod · 0.45
subscribeMethod · 0.45
getMethod · 0.45
postChangeMailMethod · 0.45
getAuthnHostMethod · 0.45
postRegisterMethod · 0.45
getMethod · 0.45
postStarMethod · 0.45
postLeaveMethod · 0.45
postMethod · 0.45
postDeleteMessageMethod · 0.45

Calls 5

thenMethod · 0.80
loadMethod · 0.45
pushMethod · 0.45
allMethod · 0.45
getListMethod · 0.45

Tested by

no test coverage detected