add external

This commit is contained in:
2025-12-17 22:32:08 +08:00
parent 22de8cad52
commit 8f29ddb449
4 changed files with 109 additions and 19 deletions

View File

@@ -1,19 +1,20 @@
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);
import { Hotkeys } from './lib.ts';
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);