wiki-plugin-shoppe 0.0.26 → 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.
- package/client/shoppe.js +4 -4
- package/package.json +1 -1
- package/server/server.js +19 -5
package/client/shoppe.js
CHANGED
|
@@ -173,8 +173,8 @@
|
|
|
173
173
|
|
|
174
174
|
div.querySelector('#sw-remove-btn').addEventListener('click', () => {
|
|
175
175
|
const $page = $item.parents('.page');
|
|
176
|
-
if (window.pageHandler && $page.length) {
|
|
177
|
-
pageHandler.put($page, { type: 'remove', id: item.id });
|
|
176
|
+
if (window.wiki && wiki.pageHandler && $page.length) {
|
|
177
|
+
wiki.pageHandler.put($page, { type: 'remove', id: item.id });
|
|
178
178
|
$item.remove();
|
|
179
179
|
} else if (window.wiki && wiki.textEditor) {
|
|
180
180
|
wiki.textEditor($item, item);
|
|
@@ -190,8 +190,8 @@
|
|
|
190
190
|
bind: function($item, item) {
|
|
191
191
|
$item.on('dblclick', () => {
|
|
192
192
|
const $page = $item.parents('.page');
|
|
193
|
-
if (window.pageHandler && $page.length) {
|
|
194
|
-
pageHandler.put($page, { type: 'remove', id: item.id });
|
|
193
|
+
if (window.wiki && wiki.pageHandler && $page.length) {
|
|
194
|
+
wiki.pageHandler.put($page, { type: 'remove', id: item.id });
|
|
195
195
|
$item.remove();
|
|
196
196
|
} else if (window.wiki && wiki.textEditor) {
|
|
197
197
|
wiki.textEditor($item, item);
|
package/package.json
CHANGED
package/server/server.js
CHANGED
|
@@ -219,7 +219,7 @@ function generateBundleBuffer(tenant, ownerPrivateKey, ownerPubKey, wikiOrigin)
|
|
|
219
219
|
private: true,
|
|
220
220
|
description: 'Shoppe content folder',
|
|
221
221
|
dependencies: {
|
|
222
|
-
'sessionless-node': '
|
|
222
|
+
'sessionless-node': 'latest'
|
|
223
223
|
}
|
|
224
224
|
}, null, 2);
|
|
225
225
|
|
|
@@ -489,6 +489,7 @@ async function sanoraCreateProduct(tenant, title, category, description, price,
|
|
|
489
489
|
`${getSanoraUrl()}/user/${uuid}/product/${encodeURIComponent(title)}`,
|
|
490
490
|
{
|
|
491
491
|
method: 'PUT',
|
|
492
|
+
timeout: 15000,
|
|
492
493
|
headers: { 'Content-Type': 'application/json' },
|
|
493
494
|
body: JSON.stringify({
|
|
494
495
|
timestamp,
|
|
@@ -522,6 +523,7 @@ async function sanoraUploadArtifact(tenant, title, fileBuffer, filename, artifac
|
|
|
522
523
|
`${getSanoraUrl()}/user/${uuid}/product/${encodeURIComponent(title)}/artifact`,
|
|
523
524
|
{
|
|
524
525
|
method: 'PUT',
|
|
526
|
+
timeout: 30000,
|
|
525
527
|
headers: {
|
|
526
528
|
'x-pn-artifact-type': artifactType,
|
|
527
529
|
'x-pn-timestamp': timestamp,
|
|
@@ -551,6 +553,7 @@ async function sanoraUploadImage(tenant, title, imageBuffer, filename) {
|
|
|
551
553
|
`${getSanoraUrl()}/user/${uuid}/product/${encodeURIComponent(title)}/image`,
|
|
552
554
|
{
|
|
553
555
|
method: 'PUT',
|
|
556
|
+
timeout: 30000,
|
|
554
557
|
headers: {
|
|
555
558
|
'x-pn-timestamp': timestamp,
|
|
556
559
|
'x-pn-signature': signature,
|
|
@@ -1219,8 +1222,14 @@ async function processArchive(zipPath) {
|
|
|
1219
1222
|
// ============================================================
|
|
1220
1223
|
|
|
1221
1224
|
async function getShoppeGoods(tenant) {
|
|
1222
|
-
|
|
1223
|
-
|
|
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
|
+
}
|
|
1224
1233
|
const redirects = tenant.redirects || {};
|
|
1225
1234
|
|
|
1226
1235
|
const goods = { books: [], music: [], posts: [], albums: [], products: [], videos: [], appointments: [], subscriptions: [] };
|
|
@@ -1419,8 +1428,13 @@ function checkOwnerSignature(req, tenant, maxAgeMs = 5 * 60 * 1000) {
|
|
|
1419
1428
|
// Returns an array of { product, orders } objects.
|
|
1420
1429
|
async function getAllOrders(tenant) {
|
|
1421
1430
|
const sanoraUrl = getSanoraUrl();
|
|
1422
|
-
|
|
1423
|
-
|
|
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
|
+
}
|
|
1424
1438
|
|
|
1425
1439
|
sessionless.getKeys = () => tenant.keys;
|
|
1426
1440
|
|