@saltcorn/server 0.9.5-beta.17 → 0.9.5-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 CHANGED
@@ -238,13 +238,7 @@ const loginWithJwt = async (email, password, saltcornApp, res, req) => {
238
238
  const token = jwt.sign(
239
239
  {
240
240
  sub: email,
241
- user: {
242
- id: user.id,
243
- email: user.email,
244
- role_id: user.role_id,
245
- language: user.language ? user.language : "en",
246
- disabled: user.disabled,
247
- },
241
+ user: user.session_object,
248
242
  iss: "saltcorn@saltcorn",
249
243
  aud: "saltcorn-mobile-app",
250
244
  iat: now.valueOf(),
package/locales/en.json CHANGED
@@ -1399,5 +1399,8 @@
1399
1399
  "Configure theme": "Configure theme",
1400
1400
  "Remove all user specific theme settings": "Remove all user specific theme settings",
1401
1401
  "Configure %s Plugin for %s": "Configure %s Plugin for %s",
1402
- "The current theme has no user specific settings": "The current theme has no user specific settings"
1403
- }
1402
+ "The current theme has no user specific settings": "The current theme has no user specific settings",
1403
+ "Some themes support only one level of menu nesting.": "Some themes support only one level of menu nesting.",
1404
+ "Apple Team ID": "Apple Team ID",
1405
+ "Please enter your Apple Team ID": "Please enter your Apple Team ID"
1406
+ }
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@saltcorn/server",
3
- "version": "0.9.5-beta.17",
3
+ "version": "0.9.5-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.5-beta.17",
11
- "@saltcorn/builder": "0.9.5-beta.17",
12
- "@saltcorn/data": "0.9.5-beta.17",
13
- "@saltcorn/admin-models": "0.9.5-beta.17",
14
- "@saltcorn/filemanager": "0.9.5-beta.17",
15
- "@saltcorn/markup": "0.9.5-beta.17",
16
- "@saltcorn/plugins-loader": "0.9.5-beta.17",
17
- "@saltcorn/sbadmin2": "0.9.5-beta.17",
10
+ "@saltcorn/base-plugin": "0.9.5-beta.18",
11
+ "@saltcorn/builder": "0.9.5-beta.18",
12
+ "@saltcorn/data": "0.9.5-beta.18",
13
+ "@saltcorn/admin-models": "0.9.5-beta.18",
14
+ "@saltcorn/filemanager": "0.9.5-beta.18",
15
+ "@saltcorn/markup": "0.9.5-beta.18",
16
+ "@saltcorn/plugins-loader": "0.9.5-beta.18",
17
+ "@saltcorn/sbadmin2": "0.9.5-beta.18",
18
18
  "@socket.io/cluster-adapter": "^0.2.1",
19
19
  "@socket.io/sticky": "^1.0.1",
20
20
  "adm-zip": "0.5.10",
@@ -751,23 +751,58 @@ function initialize_page() {
751
751
  </form>`
752
752
  );
753
753
  });
754
- $("[mobile-img-path]").each(async function () {
755
- if (parent.loadEncodedFile) {
756
- const fileId = $(this).attr("mobile-img-path");
757
- const base64Encoded = await parent.loadEncodedFile(fileId);
758
- this.src = base64Encoded;
759
- }
760
- });
761
- $("[mobile-bg-img-path]").each(async function () {
762
- if (parent.loadEncodedFile) {
763
- const fileId = $(this).attr("mobile-bg-img-path");
764
- if (fileId) {
754
+ if (!isNode) {
755
+ $("[mobile-img-path]").each(async function () {
756
+ if (parent.loadEncodedFile) {
757
+ const fileId = $(this).attr("mobile-img-path");
765
758
  const base64Encoded = await parent.loadEncodedFile(fileId);
766
- this.style.backgroundImage = `url("${base64Encoded}")`;
759
+ this.src = base64Encoded;
767
760
  }
768
- }
769
- });
761
+ });
762
+
763
+ $("[mobile-bg-img-path]").each(async function () {
764
+ if (parent.loadEncodedFile) {
765
+ const fileId = $(this).attr("mobile-bg-img-path");
766
+ if (fileId) {
767
+ const base64Encoded = await parent.loadEncodedFile(fileId);
768
+ this.style.backgroundImage = `url("${base64Encoded}")`;
769
+ }
770
+ }
771
+ });
770
772
 
773
+ $("a").each(function () {
774
+ let path = $(this).attr("href") || "";
775
+ if (path.startsWith("http")) {
776
+ const url = new URL(path);
777
+ path = `${url.pathname}${url.search}`;
778
+ }
779
+ if (path.startsWith("/view/")) {
780
+ const jThis = $(this);
781
+ const skip = jThis.attr("skip-mobile-adjust");
782
+ if (!skip) {
783
+ jThis.attr("href", `javascript:execLink('${path}')`);
784
+ if (jThis.find("i,img").length === 0 && !jThis.css("color")) {
785
+ jThis.css(
786
+ "color",
787
+ "rgba(var(--bs-link-color-rgb),var(--bs-link-opacity,1))"
788
+ );
789
+ }
790
+ }
791
+ }
792
+ });
793
+
794
+ $("img").each(async function () {
795
+ if (parent.loadEncodedFile) {
796
+ const jThis = $(this);
797
+ const src = jThis.attr("src");
798
+ if (src?.startsWith("/files/serve/")) {
799
+ const fileId = src.replace("/files/serve/", "");
800
+ const base64Encoded = await parent.loadEncodedFile(fileId);
801
+ this.src = base64Encoded;
802
+ }
803
+ }
804
+ });
805
+ }
771
806
  function setExplainer(that) {
772
807
  var id = $(that).attr("id") + "_explainer";
773
808
 
@@ -1585,3 +1620,55 @@ function set_readonly_select(e) {
1585
1620
  const option = options.find((o) => o.value == e.target.value);
1586
1621
  if (option) $disp.val(option.label);
1587
1622
  }
1623
+
1624
+ function close_saltcorn_modal() {
1625
+ $("#scmodal").off("hidden.bs.modal");
1626
+ var myModalEl = document.getElementById("scmodal");
1627
+ if (!myModalEl) return;
1628
+ var modal = bootstrap.Modal.getInstance(myModalEl);
1629
+ if (modal) {
1630
+ if (modal.hide) modal.hide();
1631
+ if (modal.dispose) modal.dispose();
1632
+ }
1633
+ }
1634
+
1635
+ function reload_embedded_view(viewname, new_query_string) {
1636
+ const isNode = getIsNode();
1637
+ const updater = ($e, res) => {
1638
+ $e.html(res);
1639
+ initialize_page();
1640
+ };
1641
+ if (window._sc_loglevel > 4)
1642
+ console.log(
1643
+ "reload_embedded_view",
1644
+ viewname,
1645
+ "found",
1646
+ $(`[data-sc-embed-viewname="${viewname}"]`).length
1647
+ );
1648
+ $(`[data-sc-embed-viewname="${viewname}"]`).each(function () {
1649
+ const $e = $(this);
1650
+ let url = $e.attr("data-sc-local-state") || $e.attr("data-sc-view-source");
1651
+ if (!url) return;
1652
+ if (new_query_string) {
1653
+ url = url.split("?")[0] + "?" + new_query_string;
1654
+ }
1655
+ if (isNode) {
1656
+ $.ajax(url, {
1657
+ headers: {
1658
+ pjaxpageload: "true",
1659
+ localizedstate: "true", //no admin bar
1660
+ },
1661
+ success: function (res, textStatus, request) {
1662
+ updater($e, res);
1663
+ },
1664
+ error: function (res) {
1665
+ notifyAlert({ type: "danger", text: res.responseText });
1666
+ },
1667
+ });
1668
+ } else {
1669
+ runUrl(url).then((html) => {
1670
+ updater($e, html);
1671
+ });
1672
+ }
1673
+ });
1674
+ }
@@ -502,3 +502,7 @@ tr[onclick] {
502
502
  .editStarRating i.fa-star {
503
503
  color: unset;
504
504
  }
505
+
506
+ .modal-header {
507
+ justify-content: space-between;
508
+ }
@@ -154,37 +154,6 @@ $(function () {
154
154
  });
155
155
  });
156
156
 
157
- function reload_embedded_view(viewname, new_query_string) {
158
- if (window._sc_loglevel > 4)
159
- console.log(
160
- "reload_embedded_view",
161
- viewname,
162
- "found",
163
- $(`[data-sc-embed-viewname="${viewname}"]`).length
164
- );
165
- $(`[data-sc-embed-viewname="${viewname}"]`).each(function () {
166
- const $e = $(this);
167
- let url = $e.attr("data-sc-local-state") || $e.attr("data-sc-view-source");
168
- if (!url) return;
169
- if (new_query_string) {
170
- url = url.split("?")[0] + "?" + new_query_string;
171
- }
172
- $.ajax(url, {
173
- headers: {
174
- pjaxpageload: "true",
175
- localizedstate: "true", //no admin bar
176
- },
177
- success: function (res, textStatus, request) {
178
- $e.html(res);
179
- initialize_page();
180
- },
181
- error: function (res) {
182
- notifyAlert({ type: "danger", text: res.responseText });
183
- },
184
- });
185
- });
186
- }
187
-
188
157
  function pjax_to(href, e) {
189
158
  let $modal = $("#scmodal");
190
159
  const inModal = $modal.length && $modal.hasClass("show");
@@ -323,17 +292,6 @@ function globalErrorCatcher(message, source, lineno, colno, error) {
323
292
  });
324
293
  }
325
294
 
326
- function close_saltcorn_modal() {
327
- $("#scmodal").off("hidden.bs.modal");
328
- var myModalEl = document.getElementById("scmodal");
329
- if (!myModalEl) return;
330
- var modal = bootstrap.Modal.getInstance(myModalEl);
331
- if (modal) {
332
- if (modal.hide) modal.hide();
333
- if (modal.dispose) modal.dispose();
334
- }
335
- }
336
-
337
295
  function ensure_modal_exists_and_closed() {
338
296
  if ($("#scmodal").length === 0) {
339
297
  $("body").append(`<div id="scmodal" class="modal">
@@ -975,6 +933,10 @@ function join_field_clicked(e, fieldPath) {
975
933
  apply_showif();
976
934
  }
977
935
 
936
+ function execLink(path) {
937
+ window.location.href = `${location.origin}${path}`;
938
+ }
939
+
978
940
  (() => {
979
941
  const e = document.querySelector("[data-sidebar-toggler]");
980
942
  let closed = localStorage.getItem("sidebarClosed") === "true";
package/routes/admin.js CHANGED
@@ -1545,17 +1545,6 @@ const buildDialogScript = (cordovaBuilderAvailable) => {
1545
1545
 
1546
1546
  function handleMessages() {
1547
1547
  notifyAlert("Building the app, please wait.", true)
1548
- ${
1549
- getState().getConfig("apple_team_id") &&
1550
- getState().getConfig("apple_team_id") !== "null"
1551
- ? ""
1552
- : `
1553
- if ($("#iOSCheckboxId")[0].checked) {
1554
- notifyAlert(
1555
- "No 'Apple Team ID' is configured, I will try to build a project for the iOS simulator."
1556
- );
1557
- }`
1558
- }
1559
1548
  }
1560
1549
  </script>`;
1561
1550
  };
@@ -2220,6 +2209,30 @@ router.get(
2220
2209
  ),
2221
2210
  div(
2222
2211
  { class: "row pb-3 pt-3" },
2212
+ div(
2213
+ { class: "col-sm-8" },
2214
+ label(
2215
+ {
2216
+ for: "splashPageInputId",
2217
+ class: "form-label fw-bold",
2218
+ },
2219
+ req.__("Apple Team ID")
2220
+ ),
2221
+ input({
2222
+ type: "text",
2223
+ class: "form-control",
2224
+ name: "appleTeamId",
2225
+ id: "appleTeamIdInputId",
2226
+ value:
2227
+ builderSettings.appleTeamId ||
2228
+ getState().getConfig("apple_team_id") ||
2229
+ "",
2230
+ placeholder: req.__("Please enter your Apple Team ID"),
2231
+ })
2232
+ )
2233
+ ),
2234
+ div(
2235
+ { class: "row pb-3 pt-2" },
2223
2236
  div(
2224
2237
  label(
2225
2238
  { class: "form-label fw-bold" },
@@ -2377,6 +2390,7 @@ router.post(
2377
2390
  allowOfflineMode,
2378
2391
  synchedTables,
2379
2392
  includedPlugins,
2393
+ appleTeamId,
2380
2394
  } = req.body;
2381
2395
  if (!includedPlugins) includedPlugins = [];
2382
2396
  if (!synchedTables) synchedTables = [];
@@ -2419,10 +2433,9 @@ router.post(
2419
2433
  if (androidPlatform) spawnParams.push("-p", "android");
2420
2434
  if (iOSPlatform) {
2421
2435
  spawnParams.push("-p", "ios");
2422
- const teamId = getState().getConfig("apple_team_id");
2423
- if (!teamId || teamId === "null") {
2436
+ if (!appleTeamId || appleTeamId === "null")
2424
2437
  spawnParams.push("--buildForEmulator");
2425
- }
2438
+ else spawnParams.push("--appleTeamId", appleTeamId);
2426
2439
  }
2427
2440
  if (appName) spawnParams.push("--appName", appName);
2428
2441
  if (appVersion) spawnParams.push("--appVersion", appVersion);
@@ -2467,6 +2480,7 @@ router.post(
2467
2480
  synchedTables: synchedTables,
2468
2481
  includedPlugins: includedPlugins,
2469
2482
  excludedPlugins,
2483
+ appleTeamId,
2470
2484
  });
2471
2485
  // end http call, return the out directory name
2472
2486
  // the gui polls for results
package/routes/menu.js CHANGED
@@ -19,7 +19,7 @@ const { save_menu_items } = require("@saltcorn/data/models/config");
19
19
  const db = require("@saltcorn/data/db");
20
20
 
21
21
  const { renderForm } = require("@saltcorn/markup");
22
- const { script, domReady, div, ul } = require("@saltcorn/markup/tags");
22
+ const { script, domReady, div, ul, i } = require("@saltcorn/markup/tags");
23
23
  const { send_infoarch_page } = require("../markup/admin.js");
24
24
  const Table = require("@saltcorn/data/models/table");
25
25
  const Trigger = require("@saltcorn/data/models/trigger");
@@ -368,7 +368,7 @@ const menuEditorScript = (menu_items) => `
368
368
  iconPicker: iconPickerOptions,
369
369
  getLabelText: (item) => item?.text || item?.type,
370
370
  labelEdit: 'Edit&nbsp;<i class="fas fa-edit clickable"></i>',
371
- maxLevel: 1 // (Optional) Default is -1 (no level limit)
371
+ maxLevel: 2 // (Optional) Default is -1 (no level limit)
372
372
  // Valid levels are from [0, 1, 2, 3,...N]
373
373
  });
374
374
  editor.setForm($('#menuForm'));
@@ -446,7 +446,16 @@ router.get(
446
446
  above: [
447
447
  {
448
448
  besides: [
449
- div(ul({ id: "myEditor", class: "sortableLists list-group" })),
449
+ div(
450
+ ul({ id: "myEditor", class: "sortableLists list-group" }),
451
+ div(
452
+ i(
453
+ req.__(
454
+ "Some themes support only one level of menu nesting."
455
+ )
456
+ )
457
+ )
458
+ ),
450
459
  div(
451
460
  renderForm(form, req.csrfToken()),
452
461
  script(domReady(menuEditorScript(menu_items)))