update
This commit is contained in:
16
src/routes/browser/page.ts
Normal file
16
src/routes/browser/page.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { app, core } from "../../app.ts";
|
||||
|
||||
|
||||
app.route({
|
||||
path: 'page',
|
||||
key: 'go',
|
||||
middleware: ['auth']
|
||||
}).define(async (ctx) => {
|
||||
const url = ctx.query?.url as string;
|
||||
if (!url) {
|
||||
ctx.throw!(400, '缺少 url 参数');
|
||||
}
|
||||
const page = await core.getPage();
|
||||
await page.goto(url);
|
||||
ctx.body = { success: true, message: `已导航到 ${url}` };
|
||||
}).addTo(app);
|
||||
Reference in New Issue
Block a user