@saltcorn/server 0.8.0-beta.3 → 0.8.0

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/systemd.js CHANGED
@@ -5,9 +5,9 @@
5
5
  const fetch = require("node-fetch");
6
6
 
7
7
  /**
8
- * @param {number} interval
9
- * @param {object} notify
10
- * @param {object} opts
8
+ * @param {number} interval
9
+ * @param {object} notify
10
+ * @param {object} opts
11
11
  * @param {string} opts.port
12
12
  * @returns {void}
13
13
  */
@@ -48,22 +48,24 @@ const watchDog = (interval, notify, { port }) => {
48
48
  }
49
49
  };
50
50
 
51
- module.exports =
52
- /**
53
- * @function
54
- * @name "module.exports function"
55
- * @param {object} opts
56
- */
57
- (opts) => {
58
- try {
59
- const notify = require("sd-notify");
60
- notify.ready();
61
- const watchdogInterval = notify.watchdogInterval();
62
- if (watchdogInterval && watchdogInterval > 0) {
63
- const interval = Math.floor(watchdogInterval / 2);
64
- setInterval(() => {
65
- watchDog(interval, notify, opts);
66
- }, interval);
51
+ module.exports =
52
+ /**
53
+ * @function
54
+ * @name "module.exports function"
55
+ * @param {object} opts
56
+ */
57
+ (opts) => {
58
+ try {
59
+ const notify = require("sd-notify");
60
+ notify.ready();
61
+ const watchdogInterval = notify.watchdogInterval();
62
+ if (watchdogInterval && watchdogInterval > 0) {
63
+ const interval = Math.floor(watchdogInterval / 2);
64
+ setInterval(() => {
65
+ watchDog(interval, notify, opts);
66
+ }, interval);
67
+ }
68
+ } catch {
69
+ //ignore, systemd lib not installed
67
70
  }
68
- } catch {}
69
- };
71
+ };
package/wrapper.js CHANGED
@@ -45,12 +45,12 @@ const get_extra_menu = (role, state, req) => {
45
45
  item.type === "Link"
46
46
  ? item.url
47
47
  : item.type === "Action"
48
- ? `javascript:ajax_post_json('/menu/runaction/${item.action_name}')`
49
- : item.type === "View"
50
- ? `/view/${encodeURIComponent(item.viewname)}`
51
- : item.type === "Page"
52
- ? `/page/${encodeURIComponent(item.pagename)}`
53
- : undefined,
48
+ ? `javascript:ajax_post_json('/menu/runaction/${item.action_name}')`
49
+ : item.type === "View"
50
+ ? `/view/${encodeURIComponent(item.viewname)}`
51
+ : item.type === "Page"
52
+ ? `/page/${encodeURIComponent(item.pagename)}`
53
+ : undefined,
54
54
  ...(item.subitems ? { subitems: transform(item.subitems) } : {}),
55
55
  }));
56
56
  return transform(cfg);
@@ -70,34 +70,34 @@ const get_menu = (req) => {
70
70
  const extra_menu = get_extra_menu(role, state, req);
71
71
  const authItems = isAuth
72
72
  ? [
73
- {
74
- label: req.__("User"),
75
- icon: "far fa-user",
76
- isUser: true,
77
- subitems: [
78
- { label: small((req.user.email || "").split("@")[0]) },
79
- {
80
- label: req.__("User Settings"),
81
- icon: "fas fa-user-cog",
73
+ {
74
+ label: req.__("User"),
75
+ icon: "far fa-user",
76
+ isUser: true,
77
+ subitems: [
78
+ { label: small((req.user.email || "").split("@")[0]) },
79
+ {
80
+ label: req.__("User Settings"),
81
+ icon: "fas fa-user-cog",
82
82
 
83
- link: "/auth/settings",
84
- },
85
- {
86
- link: "/auth/logout",
87
- icon: "fas fa-sign-out-alt",
88
- label: req.__("Logout"),
89
- },
90
- ],
91
- },
92
- ]
83
+ link: "/auth/settings",
84
+ },
85
+ {
86
+ link: "/auth/logout",
87
+ icon: "fas fa-sign-out-alt",
88
+ label: req.__("Logout"),
89
+ },
90
+ ],
91
+ },
92
+ ]
93
93
  : [
94
- ...(allow_signup
95
- ? [{ link: "/auth/signup", label: req.__("Sign up") }]
96
- : []),
97
- ...(login_menu
98
- ? [{ link: "/auth/login", label: req.__("Login") }]
99
- : []),
100
- ];
94
+ ...(allow_signup
95
+ ? [{ link: "/auth/signup", label: req.__("Sign up") }]
96
+ : []),
97
+ ...(login_menu
98
+ ? [{ link: "/auth/login", label: req.__("Login") }]
99
+ : []),
100
+ ];
101
101
  // const schema = db.getTenantSchema();
102
102
  // Admin role id (todo move to common constants)
103
103
  const isAdmin = role === 1;
@@ -163,7 +163,6 @@ const get_menu = (req) => {
163
163
  items: authItems,
164
164
  },
165
165
  ].filter((s) => s);
166
-
167
166
  };
168
167
  /**
169
168
  * Get Headers
@@ -179,17 +178,17 @@ const get_headers = (req, version_tag, description, extras = []) => {
179
178
 
180
179
  const iconHeader = favicon
181
180
  ? [
182
- {
183
- headerTag: `<link rel="icon" type="image/png" href="/files/serve/${favicon}">`,
184
- },
185
- ]
181
+ {
182
+ headerTag: `<link rel="icon" type="image/png" href="/files/serve/${favicon}">`,
183
+ },
184
+ ]
186
185
  : [];
187
186
  const meta_description = description
188
187
  ? [
189
- {
190
- headerTag: `<meta name="description" content="${description}">`,
191
- },
192
- ]
188
+ {
189
+ headerTag: `<meta name="description" content="${description}">`,
190
+ },
191
+ ]
193
192
  : [];
194
193
  const stdHeaders = [
195
194
  {
@@ -351,7 +350,7 @@ const defaultRenderToHtml = (s, role) =>
351
350
  typeof s === "string"
352
351
  ? s
353
352
  : renderLayout({
354
- blockDispatch: {},
355
- role,
356
- layout: s,
357
- });
353
+ blockDispatch: {},
354
+ role,
355
+ layout: s,
356
+ });