diff --git a/src/node/hooks/express/admin.ts b/src/node/hooks/express/admin.ts index 90e491396..b819b255a 100644 --- a/src/node/hooks/express/admin.ts +++ b/src/node/hooks/express/admin.ts @@ -2,7 +2,10 @@ import {ArgsExpressType} from "../../types/ArgsExpressType"; const eejs = require('../../eejs'); +import next from 'next' +const app = next({dev: process.env.NODE_ENV !== 'production'}) +const handle = app.getRequestHandler() /** * Add the admin navigation link * @param hookName {String} the name of the hook @@ -11,6 +14,15 @@ const eejs = require('../../eejs'); * @return {*} */ exports.expressCreateServer = (hookName:string, args: ArgsExpressType, cb:Function): any => { + + args.app.get('/admin-new', (req:any, res:any) => { + return app.render(req, res, '/admin', req.query) + }) + + args.app.all('/admin/*', (req:any, res:any) => { + return handle(req, res) + }) + args.app.get('/admin', (req:any, res:any) => { if ('/' !== req.path[req.path.length - 1]) return res.redirect('./admin/'); res.send(eejs.require('ep_etherpad-lite/templates/admin/index.html', {req})); diff --git a/src/package.json b/src/package.json index dee0a66ab..0001e9c8b 100644 --- a/src/package.json +++ b/src/package.json @@ -54,9 +54,12 @@ "log4js": "^6.9.1", "measured-core": "^2.0.0", "mime-types": "^2.1.35", + "next": "^14.1.0", "openapi-backend": "^5.10.6", "proxy-addr": "^2.0.7", "rate-limiter-flexible": "^5.0.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", "rehype": "^13.0.1", "rehype-minify-whitespace": "^6.0.0", "resolve": "1.22.8", diff --git a/src/pages/Admin.tsx b/src/pages/Admin.tsx new file mode 100644 index 000000000..5eb903aff --- /dev/null +++ b/src/pages/Admin.tsx @@ -0,0 +1,7 @@ +export const Admin = ()=>{ + return( +