@raketa-cloud/admin 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/Adapter.js +3 -3
- package/src/currentPath.cjs +1 -0
- package/src/setupAuthentication.js +2 -5
package/package.json
CHANGED
package/src/Adapter.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import currentPath from "./currentPath.cjs";
|
|
1
2
|
import { existsSync } from "node:fs";
|
|
2
|
-
import nodePath from "node:path";
|
|
3
3
|
import ejs from "ejs";
|
|
4
4
|
import FormBuilder from "./helpers/FormBuilder";
|
|
5
5
|
import HTMLBuilder from "./helpers/HTMLBuilder";
|
|
@@ -110,7 +110,7 @@ export default class Adapter {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
getActionPath(resource, action) {
|
|
113
|
-
const packagePath = `${
|
|
113
|
+
const packagePath = `${currentPath}/views/${resource}/${action}.ejs`;
|
|
114
114
|
const appPath = `${process.cwd()}/src/views/${resource}/${action}.ejs`;
|
|
115
115
|
|
|
116
116
|
return existsSync(appPath) ? appPath : packagePath;
|
|
@@ -124,7 +124,7 @@ export default class Adapter {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
async renderLayout(assigns, body) {
|
|
127
|
-
const layoutTemplate = `${
|
|
127
|
+
const layoutTemplate = `${currentPath}/views/layouts/application.ejs`;
|
|
128
128
|
return await ejs.renderFile(layoutTemplate, {
|
|
129
129
|
...assigns,
|
|
130
130
|
body,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = __dirname;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
// const __filename = fileURLToPath(import.meta.url);
|
|
3
|
-
|
|
4
|
-
import nodePath from "node:path";
|
|
1
|
+
import currentPath from "./currentPath.cjs";
|
|
5
2
|
import ejs from "ejs";
|
|
6
3
|
import { deleteCookie, getCookie, setCookie } from "hono/cookie";
|
|
7
4
|
import AuthHelper from "./helpers/AuthHelper";
|
|
@@ -32,7 +29,7 @@ const setupAuthentication = (app, opts) => {
|
|
|
32
29
|
|
|
33
30
|
app.get("/login", async (c) => {
|
|
34
31
|
const googleURL = AuthHelper.getGoogleURL();
|
|
35
|
-
const templatePath = `${
|
|
32
|
+
const templatePath = `${currentPath}/views/_auth/login.ejs`;
|
|
36
33
|
|
|
37
34
|
const rendered = await ejs.renderFile(templatePath, {
|
|
38
35
|
googleURL,
|