zyket 1.2.9 → 1.2.10
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/services/auth/index.js +6 -0
- package/src/templates/default/frontend/src/hooks/useLayout.jsx +1 -1
- package/src/templates/default/frontend/src/layouts/auth/routes.js +3 -3
- package/src/templates/default/frontend/src/layouts/landing/index.jsx +1 -0
- package/src/templates/default/frontend/src/layouts/landing/routes.js +1 -1
- package/src/templates/default/frontend/src/layouts/panel/index.jsx +1 -2
- package/src/templates/default/frontend/src/layouts/panel/routes.js +2 -2
package/package.json
CHANGED
|
@@ -37,6 +37,11 @@ module.exports = class AuthService extends Service {
|
|
|
37
37
|
if (originsAdded) {
|
|
38
38
|
this.#container.get('logger').info('Added TRUSTED_ORIGINS to .env file');
|
|
39
39
|
}
|
|
40
|
+
|
|
41
|
+
const betterAuthUrlAdded = EnvManager.addEnvVariable(envPath, 'BETTER_AUTH_URL', 'http://localhost:3000');
|
|
42
|
+
if (betterAuthUrlAdded) {
|
|
43
|
+
this.#container.get('logger').info('Added BETTER_AUTH_URL to .env file');
|
|
44
|
+
}
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
#getDatabaseConnection() {
|
|
@@ -183,6 +188,7 @@ module.exports = class AuthService extends Service {
|
|
|
183
188
|
expiresIn: 60 * 60 * 24 * 7,
|
|
184
189
|
updateAge: 60 * 60 * 24
|
|
185
190
|
},
|
|
191
|
+
baseURL: process.env.BETTER_AUTH_URL || 'http://localhost:3000',
|
|
186
192
|
secret: process.env.AUTH_SECRET || 'your-secret-key-change-in-production',
|
|
187
193
|
trustedOrigins: process.env.TRUSTED_ORIGINS?.split(',') || ['http://localhost:5173', 'http://localhost:6632']
|
|
188
194
|
})
|
|
@@ -3,7 +3,7 @@ import { Route } from 'react-router-dom';
|
|
|
3
3
|
|
|
4
4
|
export default function useLayout(routeList) {
|
|
5
5
|
|
|
6
|
-
const routes =
|
|
6
|
+
const routes = routeList.map((route, index) => {
|
|
7
7
|
const middlewares = route.middlewares ? [...route.middlewares].reverse() : [];
|
|
8
8
|
let element = <route.component />;
|
|
9
9
|
middlewares.forEach((middleware) => {
|
|
@@ -2,16 +2,16 @@ import AuthView from "../../views/auth";
|
|
|
2
2
|
import AuthRegisterView from "../../views/auth/register";
|
|
3
3
|
import NotLoggedMiddleware from "../../middlewares/NotLoggedMiddleware";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export default [
|
|
6
6
|
{
|
|
7
7
|
name: "Auth",
|
|
8
|
-
path: "/
|
|
8
|
+
path: "/",
|
|
9
9
|
component: AuthView,
|
|
10
10
|
middlewares: [NotLoggedMiddleware],
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
name: "Auth Register",
|
|
14
|
-
path: "/
|
|
14
|
+
path: "/register",
|
|
15
15
|
component: AuthRegisterView,
|
|
16
16
|
middlewares: [NotLoggedMiddleware],
|
|
17
17
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Navigate, Routes, Route, Link, useLocation } from "react-router-dom";
|
|
2
2
|
import useLayout from "../../hooks/useLayout";
|
|
3
|
-
import PanelDashboardView from "../../views/panel/dashboard";
|
|
4
3
|
import layoutRoutes from "./routes";
|
|
5
4
|
|
|
6
5
|
export default function PanelLayout() {
|
|
7
6
|
const location = useLocation();
|
|
8
|
-
const { routes } = useLayout();
|
|
7
|
+
const { routes } = useLayout(layoutRoutes);
|
|
9
8
|
|
|
10
9
|
const navItems = [
|
|
11
10
|
{ name: "Dashboard", path: "/panel/dashboard", icon: "📊" },
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import PanelDashboardView from "../../views/panel/dashboard";
|
|
2
2
|
import LoggedMiddleware from "../../middlewares/LoggedMiddleware";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export default [
|
|
5
5
|
{
|
|
6
6
|
name: "Panel Dashboard",
|
|
7
|
-
path: "/
|
|
7
|
+
path: "/dashboard",
|
|
8
8
|
component: PanelDashboardView,
|
|
9
9
|
middlewares: [LoggedMiddleware],
|
|
10
10
|
}
|