@saltcorn/server 0.9.1-beta.16 → 0.9.1-beta.18
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/auth/routes.js +23 -3
- package/locales/en.json +2 -1
- package/package.json +8 -8
- package/public/saltcorn-common.js +4 -0
- package/public/saltcorn.js +3 -0
- package/routes/pageedit.js +2 -0
- package/routes/view.js +19 -6
package/auth/routes.js
CHANGED
|
@@ -1586,9 +1586,17 @@ router.post(
|
|
|
1586
1586
|
*/
|
|
1587
1587
|
router.post(
|
|
1588
1588
|
"/settings",
|
|
1589
|
+
setTenant,
|
|
1589
1590
|
loggedIn,
|
|
1590
1591
|
error_catcher(async (req, res) => {
|
|
1591
|
-
const user = await User.findOne({ id: req.user
|
|
1592
|
+
const user = await User.findOne({ id: req.user?.id });
|
|
1593
|
+
if (!user) {
|
|
1594
|
+
res.sendWrap(
|
|
1595
|
+
req.__("User settings") || "User settings",
|
|
1596
|
+
"Must be logged in"
|
|
1597
|
+
);
|
|
1598
|
+
return;
|
|
1599
|
+
}
|
|
1592
1600
|
if (req.body.new_password && user.password) {
|
|
1593
1601
|
const pwform = changPwForm(req);
|
|
1594
1602
|
|
|
@@ -1615,12 +1623,24 @@ router.post(
|
|
|
1615
1623
|
if (user_settings_form) {
|
|
1616
1624
|
const view = await View.findOne({ name: user_settings_form });
|
|
1617
1625
|
if (view) {
|
|
1626
|
+
const fakeRes = {
|
|
1627
|
+
status() {},
|
|
1628
|
+
sendWrap() {},
|
|
1629
|
+
json() {},
|
|
1630
|
+
redirect() {},
|
|
1631
|
+
};
|
|
1618
1632
|
await view.runPost({ id: user.id }, req.body, {
|
|
1619
1633
|
req,
|
|
1620
|
-
res,
|
|
1634
|
+
res: fakeRes,
|
|
1621
1635
|
redirect: "/auth/settings",
|
|
1622
1636
|
});
|
|
1623
|
-
|
|
1637
|
+
const u = await User.findForSession({ id: user.id });
|
|
1638
|
+
req.login(u.session_object, function (err) {
|
|
1639
|
+
if (err) req.flash("danger", err);
|
|
1640
|
+
else req.flash("success", req.__("User settings changed"));
|
|
1641
|
+
|
|
1642
|
+
res.redirect("/auth/settings");
|
|
1643
|
+
});
|
|
1624
1644
|
}
|
|
1625
1645
|
} else {
|
|
1626
1646
|
res.redirect("/auth/settings");
|
package/locales/en.json
CHANGED
|
@@ -1284,5 +1284,6 @@
|
|
|
1284
1284
|
"Set theme for each user role »": "Set theme for each user role »",
|
|
1285
1285
|
"Available themes": "Available themes",
|
|
1286
1286
|
"Install more themes »": "Install more themes »",
|
|
1287
|
-
"Configure action": "Configure action"
|
|
1287
|
+
"Configure action": "Configure action",
|
|
1288
|
+
"No changes detected, snapshot skipped": "No changes detected, snapshot skipped"
|
|
1288
1289
|
}
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saltcorn/server",
|
|
3
|
-
"version": "0.9.1-beta.
|
|
3
|
+
"version": "0.9.1-beta.18",
|
|
4
4
|
"description": "Server app for Saltcorn, open-source no-code platform",
|
|
5
5
|
"homepage": "https://saltcorn.com",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@aws-sdk/client-s3": "^3.451.0",
|
|
10
|
-
"@saltcorn/base-plugin": "0.9.1-beta.
|
|
11
|
-
"@saltcorn/builder": "0.9.1-beta.
|
|
12
|
-
"@saltcorn/data": "0.9.1-beta.
|
|
13
|
-
"@saltcorn/admin-models": "0.9.1-beta.
|
|
14
|
-
"@saltcorn/filemanager": "0.9.1-beta.
|
|
15
|
-
"@saltcorn/markup": "0.9.1-beta.
|
|
16
|
-
"@saltcorn/sbadmin2": "0.9.1-beta.
|
|
10
|
+
"@saltcorn/base-plugin": "0.9.1-beta.18",
|
|
11
|
+
"@saltcorn/builder": "0.9.1-beta.18",
|
|
12
|
+
"@saltcorn/data": "0.9.1-beta.18",
|
|
13
|
+
"@saltcorn/admin-models": "0.9.1-beta.18",
|
|
14
|
+
"@saltcorn/filemanager": "0.9.1-beta.18",
|
|
15
|
+
"@saltcorn/markup": "0.9.1-beta.18",
|
|
16
|
+
"@saltcorn/sbadmin2": "0.9.1-beta.18",
|
|
17
17
|
"@socket.io/cluster-adapter": "^0.2.1",
|
|
18
18
|
"@socket.io/sticky": "^1.0.1",
|
|
19
19
|
"adm-zip": "0.5.10",
|
|
@@ -1102,6 +1102,10 @@ function common_done(res, viewname, isWeb = true) {
|
|
|
1102
1102
|
if (res.notify) handle(res.notify, notifyAlert);
|
|
1103
1103
|
if (res.error)
|
|
1104
1104
|
handle(res.error, (text) => notifyAlert({ type: "danger", text: text }));
|
|
1105
|
+
if (res.notify_success)
|
|
1106
|
+
handle(res.notify_success, (text) =>
|
|
1107
|
+
notifyAlert({ type: "success", text: text })
|
|
1108
|
+
);
|
|
1105
1109
|
if (res.eval_js) handle(res.eval_js, eval_it);
|
|
1106
1110
|
|
|
1107
1111
|
if (res.reload_page) {
|
package/public/saltcorn.js
CHANGED
|
@@ -422,6 +422,9 @@ function saveAndContinue(e, k) {
|
|
|
422
422
|
if (res.notify) {
|
|
423
423
|
notifyAlert(res.notify);
|
|
424
424
|
}
|
|
425
|
+
if (res.notify_success) {
|
|
426
|
+
notifyAlert({ type: "success", text: res.notify });
|
|
427
|
+
}
|
|
425
428
|
if (res.reload_page) {
|
|
426
429
|
location.reload(); //TODO notify to cookie if reload or goto
|
|
427
430
|
}
|
package/routes/pageedit.js
CHANGED
|
@@ -216,9 +216,11 @@ const pageBuilderData = async (req, context) => {
|
|
|
216
216
|
images,
|
|
217
217
|
pages,
|
|
218
218
|
actions,
|
|
219
|
+
builtInActions: ["GoBack"],
|
|
219
220
|
library,
|
|
220
221
|
min_role: context.min_role,
|
|
221
222
|
actionConfigForms,
|
|
223
|
+
allowMultiStepAction: true,
|
|
222
224
|
page_name: context.name,
|
|
223
225
|
page_id: context.id,
|
|
224
226
|
mode: "page",
|
package/routes/view.js
CHANGED
|
@@ -10,7 +10,7 @@ const View = require("@saltcorn/data/models/view");
|
|
|
10
10
|
const Table = require("@saltcorn/data/models/table");
|
|
11
11
|
const Trigger = require("@saltcorn/data/models/trigger");
|
|
12
12
|
|
|
13
|
-
const { text, style } = require("@saltcorn/markup/tags");
|
|
13
|
+
const { text, style, div } = require("@saltcorn/markup/tags");
|
|
14
14
|
const {
|
|
15
15
|
isAdmin,
|
|
16
16
|
error_catcher,
|
|
@@ -70,11 +70,11 @@ router.get(
|
|
|
70
70
|
}
|
|
71
71
|
const isModal = req.headers?.saltcornmodalrequest;
|
|
72
72
|
|
|
73
|
-
const
|
|
73
|
+
const contents0 = await view.run_possibly_on_page(query, req, res);
|
|
74
74
|
const title =
|
|
75
75
|
isModal && view.attributes?.popup_title
|
|
76
76
|
? view.attributes?.popup_title
|
|
77
|
-
: scan_for_page_title(
|
|
77
|
+
: scan_for_page_title(contents0, view.name);
|
|
78
78
|
if (isModal && view.attributes?.popup_width)
|
|
79
79
|
res.set(
|
|
80
80
|
"SaltcornModalWidth",
|
|
@@ -95,9 +95,21 @@ router.get(
|
|
|
95
95
|
name: viewname,
|
|
96
96
|
render_time: ms,
|
|
97
97
|
});
|
|
98
|
-
if (typeof
|
|
99
|
-
res.redirect(
|
|
100
|
-
else
|
|
98
|
+
if (typeof contents0 === "object" && contents0.goto)
|
|
99
|
+
res.redirect(contents0.goto);
|
|
100
|
+
else {
|
|
101
|
+
const qs = "";
|
|
102
|
+
const contents =
|
|
103
|
+
typeof contents0 === "string" && !req.xhr
|
|
104
|
+
? div(
|
|
105
|
+
{
|
|
106
|
+
class: "d-inline",
|
|
107
|
+
"data-sc-embed-viewname": view.name,
|
|
108
|
+
"data-sc-view-source": req.originalUrl,
|
|
109
|
+
},
|
|
110
|
+
contents0
|
|
111
|
+
)
|
|
112
|
+
: contents0;
|
|
101
113
|
res.sendWrap(
|
|
102
114
|
title,
|
|
103
115
|
add_edit_bar({
|
|
@@ -112,6 +124,7 @@ router.get(
|
|
|
112
124
|
table: view.table_id || view.exttable_name,
|
|
113
125
|
})
|
|
114
126
|
);
|
|
127
|
+
}
|
|
115
128
|
})
|
|
116
129
|
);
|
|
117
130
|
|