zyket 1.2.8 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zyket",
3
- "version": "1.2.8",
3
+ "version": "1.2.10",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -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
  })
@@ -11,7 +11,9 @@ module.exports = class Cache extends Service {
11
11
  constructor(container, url) {
12
12
  super("cache");
13
13
  this.#container = container;
14
- this.#useRedis = !!url && url !== '';
14
+ // Check if URL is a valid Redis URL (starts with redis://)
15
+ // Empty string, 'memory', or 'in-memory' will use in-memory cache
16
+ this.#useRedis = !!url && url.startsWith('redis://');
15
17
 
16
18
  if (this.#useRedis) {
17
19
  this.#client = createClient({ url });
@@ -8,8 +8,7 @@ const EventService = require("./events");
8
8
 
9
9
  const eventsActivated = process.env.DISABLE_EVENTS !== 'true';
10
10
  const databaseActivated = !!process.env.DATABASE_URL;
11
- const cacheActivated = !!process.env.CACHE_URL;
12
- const bullmqActivated = !!process.env.CACHE_URL && process.env.DISABLE_BULLMQ !== 'true';
11
+ const bullmqActivated = process.env.DISABLE_BULLMQ !== 'true';
13
12
  const s3Activated = process.env.S3_ENDPOINT && process.env.S3_ACCESS_KEY && process.env.S3_SECRET_KEY;
14
13
  const schedulerActivated = process.env.DISABLE_SCHEDULER !== 'true';
15
14
  const socketActivated = process.env.DISABLE_SOCKET !== 'true';
@@ -21,7 +20,7 @@ module.exports = [
21
20
  ["template-manager", require("./template-manager"), []],
22
21
  eventsActivated ? ["events", EventService, ["@service_container"]] : null,
23
22
  databaseActivated ? ["database", Database, ["@service_container", process.env.DATABASE_URL]] : null,
24
- cacheActivated ? ["cache", Cache, ["@service_container", process.env.CACHE_URL]] : null,
23
+ ["cache", Cache, ["@service_container", process.env.CACHE_URL || '']],
25
24
  s3Activated ? ["s3", S3, ["@service_container", process.env.S3_ENDPOINT, process.env.S3_PORT, process.env.S3_USE_SSL === "true", process.env.S3_ACCESS_KEY, process.env.S3_SECRET_KEY]] : null,
26
25
  schedulerActivated ? ["scheduler", Scheduler, ["@service_container"]] : null,
27
26
  bullmqActivated ? ["bullmq", require("./bullmq"), ["@service_container"]] : null,
@@ -3,7 +3,7 @@ import { Route } from 'react-router-dom';
3
3
 
4
4
  export default function useLayout(routeList) {
5
5
 
6
- const routes = routesJSON.map((route, index) => {
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
- module.exports = [
5
+ export default [
6
6
  {
7
7
  name: "Auth",
8
- path: "/auth",
8
+ path: "/",
9
9
  component: AuthView,
10
10
  middlewares: [NotLoggedMiddleware],
11
11
  },
12
12
  {
13
13
  name: "Auth Register",
14
- path: "/auth/register",
14
+ path: "/register",
15
15
  component: AuthRegisterView,
16
16
  middlewares: [NotLoggedMiddleware],
17
17
  }
@@ -1,5 +1,6 @@
1
1
  import { Navigate, Routes, Route, Link } from "react-router-dom";
2
2
  import useLayout from "../../hooks/useLayout";
3
+ import layoutRoutes from "./routes";
3
4
 
4
5
  export default function LandingLayout() {
5
6
  const { routes } = useLayout(layoutRoutes)
@@ -1,6 +1,6 @@
1
1
  import LandingView from "../../views/landing";
2
2
 
3
- module.exports = [
3
+ export default [
4
4
  {
5
5
  name: "Landing",
6
6
  path: "/",
@@ -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
- module.exports = [
4
+ export default [
5
5
  {
6
6
  name: "Panel Dashboard",
7
- path: "/panel/dashboard",
7
+ path: "/dashboard",
8
8
  component: PanelDashboardView,
9
9
  middlewares: [LoggedMiddleware],
10
10
  }
@@ -13,8 +13,7 @@ module.exports = class EnvManager {
13
13
 
14
14
  static getDefaultSecrets() {
15
15
  const header = `# Zyket Environment Configuration
16
- # Leave CACHE_URL empty to use in-memory cache, or set to redis://localhost:6379 for Redis
17
-
16
+ # CACHE_URL: Leave empty or set to 'memory' for in-memory cache, or 'redis://localhost:6379' for Redis
18
17
  `;
19
18
  const envsToCreate = {
20
19
  DEBUG: true,