wiki-plugin-shoppe 0.0.16 → 0.0.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server/server.js +2 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wiki-plugin-shoppe",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
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
@@ -14,9 +14,6 @@ const RECOVER_STRIPE_TMPL = fs.readFileSync(path.join(TEMPLATES_DIR, 'generic-r
14
14
  const ADDRESS_STRIPE_TMPL = fs.readFileSync(path.join(TEMPLATES_DIR, 'generic-address-stripe.html'), 'utf8');
15
15
  const EBOOK_DOWNLOAD_TMPL = fs.readFileSync(path.join(TEMPLATES_DIR, 'ebook-download.html'), 'utf8');
16
16
 
17
- function getAllyabaseOrigin() {
18
- try { return new URL(getSanoraUrl()).origin; } catch { return getSanoraUrl(); }
19
- }
20
17
 
21
18
  function fillTemplate(tmpl, vars) {
22
19
  return Object.entries(vars).reduce((html, [k, v]) =>
@@ -49,8 +46,7 @@ function getSanoraUrl() {
49
46
  }
50
47
 
51
48
  function getAddieUrl() {
52
- const config = loadConfig();
53
- if (config.addieUrl) return config.addieUrl.replace(/\/$/, '');
49
+ try { return new URL(getSanoraUrl()).origin + '/plugin/allyabase/addie'; } catch { /* fall through */ }
54
50
  return `http://localhost:${process.env.ADDIE_PORT || 3005}`;
55
51
  }
56
52
 
@@ -201,7 +197,7 @@ async function addieCreateUser() {
201
197
  const message = timestamp + addieKeys.pubKey;
202
198
  const signature = await sessionless.sign(message);
203
199
 
204
- const resp = await fetch(`${getAllyabaseOrigin()}/plugin/allyabase/addie/user/create`, {
200
+ const resp = await fetch(`${getAddieUrl()}/user/create`, {
205
201
  method: 'PUT',
206
202
  headers: { 'Content-Type': 'application/json' },
207
203
  body: JSON.stringify({ timestamp, pubKey: addieKeys.pubKey, signature })