@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/app.js +7 -6
- package/auth/admin.js +226 -217
- package/auth/index.js +20 -20
- package/auth/roleadmin.js +2 -9
- package/auth/routes.js +193 -139
- package/auth/testhelp.js +62 -55
- package/fixture_persons.js +1 -1
- package/index.js +22 -22
- package/locales/en.json +3 -1
- package/locales/ru.json +25 -19
- package/markup/admin.js +86 -53
- package/markup/blockly.js +1 -1
- package/markup/expression_blurb.js +15 -15
- package/markup/forms.js +21 -22
- package/markup/index.js +20 -20
- package/markup/plugin-store.js +4 -4
- package/package.json +8 -8
- package/public/diagram_utils.js +22 -9
- package/public/saltcorn.css +6 -0
- package/restart_watcher.js +157 -157
- package/routes/actions.js +4 -11
- package/routes/admin.js +8 -5
- package/routes/api.js +9 -9
- package/routes/common_lists.js +127 -130
- package/routes/delete.js +2 -2
- package/routes/edit.js +1 -1
- package/routes/fields.js +4 -2
- package/routes/files.js +112 -94
- package/routes/homepage.js +1 -1
- package/routes/infoarch.js +1 -1
- package/routes/list.js +6 -5
- package/routes/packs.js +1 -2
- package/routes/pageedit.js +1 -1
- package/routes/tables.js +172 -165
- package/routes/tag_entries.js +1 -1
- package/routes/utils.js +3 -1
- package/routes/view.js +9 -2
- package/s3storage.js +6 -7
- package/serve.js +35 -31
- package/systemd.js +23 -21
- package/wrapper.js +44 -45
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
(opts) => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
}
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
353
|
+
blockDispatch: {},
|
|
354
|
+
role,
|
|
355
|
+
layout: s,
|
|
356
|
+
});
|