@saltcorn/server 0.7.4 → 0.8.0-beta.1

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.
Files changed (50) hide show
  1. package/app.js +18 -11
  2. package/auth/admin.js +370 -120
  3. package/auth/roleadmin.js +5 -23
  4. package/auth/routes.js +40 -15
  5. package/locales/de.json +1049 -273
  6. package/locales/en.json +58 -3
  7. package/locales/es.json +134 -134
  8. package/locales/it.json +6 -1
  9. package/locales/ru.json +44 -7
  10. package/markup/admin.js +46 -42
  11. package/markup/forms.js +4 -3
  12. package/package.json +8 -7
  13. package/public/blockly.js +19 -31
  14. package/public/diagram_utils.js +530 -0
  15. package/public/gridedit.js +4 -1
  16. package/public/jquery-menu-editor.min.js +112 -112
  17. package/public/saltcorn-common.js +31 -8
  18. package/public/saltcorn.css +11 -0
  19. package/public/saltcorn.js +211 -70
  20. package/restart_watcher.js +1 -0
  21. package/routes/actions.js +6 -14
  22. package/routes/admin.js +229 -79
  23. package/routes/api.js +19 -2
  24. package/routes/common_lists.js +137 -134
  25. package/routes/delete.js +6 -5
  26. package/routes/diagram.js +43 -117
  27. package/routes/edit.js +5 -10
  28. package/routes/fields.js +63 -29
  29. package/routes/files.js +137 -101
  30. package/routes/homepage.js +2 -2
  31. package/routes/infoarch.js +2 -2
  32. package/routes/list.js +12 -13
  33. package/routes/page.js +16 -3
  34. package/routes/pageedit.js +13 -8
  35. package/routes/scapi.js +1 -1
  36. package/routes/search.js +1 -1
  37. package/routes/tables.js +9 -14
  38. package/routes/tag_entries.js +31 -10
  39. package/routes/tags.js +10 -10
  40. package/routes/tenant.js +114 -50
  41. package/routes/utils.js +12 -0
  42. package/routes/view.js +3 -4
  43. package/routes/viewedit.js +57 -55
  44. package/serve.js +5 -0
  45. package/tests/admin.test.js +6 -2
  46. package/tests/auth.test.js +20 -0
  47. package/tests/fields.test.js +1 -0
  48. package/tests/files.test.js +11 -20
  49. package/tests/tenant.test.js +12 -2
  50. package/tests/viewedit.test.js +15 -1
package/app.js CHANGED
@@ -122,12 +122,10 @@ const getApp = async (opts = {}) => {
122
122
  app.use(passport.initialize());
123
123
  app.use(passport.authenticate(["jwt", "session"]));
124
124
  app.use((req, res, next) => {
125
- if (jwt_extractor(req) && req.cookies && req.cookies["connect.sid"])
126
- throw new Error(
127
- "Don't set a session cookie and JSON Web Token at the same time."
128
- );
129
- next();
130
- });
125
+ // no jwt and session id at the same time
126
+ if (!(jwt_extractor(req) && req.cookies && req.cookies["connect.sid"]))
127
+ next();
128
+ });
131
129
  app.use(flash());
132
130
 
133
131
  //static serving
@@ -170,6 +168,15 @@ const getApp = async (opts = {}) => {
170
168
  }
171
169
  )
172
170
  );
171
+ app.use(
172
+ `/static_assets/${version_tag}`,
173
+ express.static(
174
+ path.dirname(require.resolve("@saltcorn/filemanager/package.json")) + "/public/build",
175
+ {
176
+ maxAge: development_mode ? 0 : "100d",
177
+ }
178
+ )
179
+ );
173
180
 
174
181
  passport.use(
175
182
  "local",
@@ -248,7 +255,7 @@ const getApp = async (opts = {}) => {
248
255
  };
249
256
  if (
250
257
  db.is_it_multi_tenant() &&
251
- jwt_payload.tenant?.length > 0 &&
258
+ jwt_payload.tenant?.length > 0 &&
252
259
  jwt_payload.tenant !== db.connectObj.default_schema
253
260
  ) {
254
261
  return await db.runWithTenant(jwt_payload.tenant, userCheck);
@@ -341,13 +348,13 @@ Sitemap: ${base}sitemap.xml
341
348
  <urlset
342
349
  xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
343
350
  ${urls
344
- .map(
345
- (url) => `<url>
351
+ .map(
352
+ (url) => `<url>
346
353
  <loc>${url}</loc>
347
354
  <lastmod>${now}</lastmod>
348
355
  </url>`
349
- )
350
- .join("")}
356
+ )
357
+ .join("")}
351
358
 
352
359
  </urlset>`);
353
360
  })