fix: fix hot-api for not build in bun app.mjs
This commit is contained in:
19
assistant/src/routes/hot-api/key-sender/index.ts
Normal file
19
assistant/src/routes/hot-api/key-sender/index.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { app } from '@/app.ts';
|
||||
import { Hotkeys } from '@kevisual/hot-api';
|
||||
import { useContextKey } from '@kevisual/context';
|
||||
app.route({
|
||||
path: 'key-sender',
|
||||
middleware: ['admin-auth']
|
||||
}).define(async (ctx) => {
|
||||
let keys = ctx.query.keys;
|
||||
if (keys.includes(' ')) {
|
||||
keys = keys.replace(/\s+/g, '+');
|
||||
}
|
||||
const hotKeys: Hotkeys = useContextKey('hotkeys', () => new Hotkeys());
|
||||
if (typeof keys === 'string') {
|
||||
await hotKeys.pressHotkey({
|
||||
hotkey: keys,
|
||||
});
|
||||
}
|
||||
ctx.body = 'ok';
|
||||
}).addTo(app);
|
||||
Reference in New Issue
Block a user