wiki-plugin-shoppe 0.0.27 → 0.0.28

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 (2) hide show
  1. package/package.json +1 -1
  2. package/server/server.js +15 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wiki-plugin-shoppe",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "description": "Multi-tenant digital goods shoppe for federated wiki, powered by Sanora",
5
5
  "keywords": [
6
6
  "wiki",
package/server/server.js CHANGED
@@ -1222,8 +1222,14 @@ async function processArchive(zipPath) {
1222
1222
  // ============================================================
1223
1223
 
1224
1224
  async function getShoppeGoods(tenant) {
1225
- const resp = await fetch(`${getSanoraUrl()}/products/${tenant.uuid}`);
1226
- const products = await resp.json();
1225
+ let products = {};
1226
+ try {
1227
+ const resp = await fetch(`${getSanoraUrl()}/products/${tenant.uuid}`, { timeout: 15000 });
1228
+ if (resp.ok) products = await resp.json();
1229
+ else console.warn(`[shoppe] getShoppeGoods: Sanora returned ${resp.status} for ${tenant.uuid}`);
1230
+ } catch (err) {
1231
+ console.warn(`[shoppe] getShoppeGoods: Sanora unreachable — ${err.message}`);
1232
+ }
1227
1233
  const redirects = tenant.redirects || {};
1228
1234
 
1229
1235
  const goods = { books: [], music: [], posts: [], albums: [], products: [], videos: [], appointments: [], subscriptions: [] };
@@ -1422,8 +1428,13 @@ function checkOwnerSignature(req, tenant, maxAgeMs = 5 * 60 * 1000) {
1422
1428
  // Returns an array of { product, orders } objects.
1423
1429
  async function getAllOrders(tenant) {
1424
1430
  const sanoraUrl = getSanoraUrl();
1425
- const productsResp = await fetch(`${sanoraUrl}/products/${tenant.uuid}`);
1426
- const products = await productsResp.json();
1431
+ let products = {};
1432
+ try {
1433
+ const productsResp = await fetch(`${sanoraUrl}/products/${tenant.uuid}`, { timeout: 15000 });
1434
+ if (productsResp.ok) products = await productsResp.json();
1435
+ } catch (err) {
1436
+ console.warn(`[shoppe] getAllOrders: Sanora unreachable — ${err.message}`);
1437
+ }
1427
1438
 
1428
1439
  sessionless.getKeys = () => tenant.keys;
1429
1440