diff options
author | Elizabeth Alexander Hunt <me@liz.coffee> | 2025-05-18 22:54:15 -0700 |
---|---|---|
committer | Elizabeth Alexander Hunt <me@liz.coffee> | 2025-05-18 22:55:20 -0700 |
commit | d54e91c6582ed160cf2f2fcf977e48b4439d133b (patch) | |
tree | 5669367c4fa49bc0373b0c581ea3027218fd5e32 /u/server/activity/fourohfour.ts | |
parent | 9cf3fc0259730b7dcf47b3ab4a04369e39fb4614 (diff) | |
download | ci-d54e91c6582ed160cf2f2fcf977e48b4439d133b.tar.gz ci-d54e91c6582ed160cf2f2fcf977e48b4439d133b.zip |
snapshottheBigRefactor
Diffstat (limited to 'u/server/activity/fourohfour.ts')
-rw-r--r-- | u/server/activity/fourohfour.ts | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/u/server/activity/fourohfour.ts b/u/server/activity/fourohfour.ts index 48740df..6449abd 100644 --- a/u/server/activity/fourohfour.ts +++ b/u/server/activity/fourohfour.ts @@ -1,4 +1,5 @@ import { + type IActivity, type ITraceable, JsonResponse, type PenguenoRequest, @@ -16,12 +17,20 @@ const messages = [ "ヽ(;▽;)ノ Eep! This route has ghosted you~", ]; const randomFourOhFour = () => messages[Math.random() * messages.length]; -export const FourOhFourActivity = ( - req: ITraceable<PenguenoRequest, ServerTrace>, -) => - req - .move( - new JsonResponse(req, randomFourOhFour(), { - status: 404, - }), - ); + +export interface IFourOhFourActivity { + fourOhFour: IActivity; +} + +export class FourOhFourActivityImpl implements IFourOhFourActivity { + public fourOhFour( + req: ITraceable<PenguenoRequest, ServerTrace>, + ) { + return req + .move( + new JsonResponse(req, randomFourOhFour(), { status: 404 }), + ) + .map((resp) => Promise.resolve(resp.get())) + .get(); + } +} |