wiki-plugin-linkitylink 0.0.5 → 0.0.7

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 +3 -2
  2. package/server/server.js +28 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wiki-plugin-linkitylink",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Linkitylink integration plugin for federated wiki",
5
5
  "keywords": [
6
6
  "wiki",
@@ -21,7 +21,8 @@
21
21
  "type": "commonjs",
22
22
  "main": "index.js",
23
23
  "scripts": {
24
- "test": "echo \"Error: no test specified\" && exit 1"
24
+ "test": "echo \"Error: no test specified\" && exit 1",
25
+ "postinstall": "npm install linkitylink@latest"
25
26
  },
26
27
  "dependencies": {
27
28
  "linkitylink": "latest",
package/server/server.js CHANGED
@@ -46,12 +46,15 @@ function loadWikiConfig() {
46
46
  // Function to check if linkitylink is running
47
47
  async function checkLinkitylinkRunning() {
48
48
  try {
49
+ console.log(`[wiki-plugin-linkitylink] Health check: GET http://localhost:${LINKITYLINK_PORT}/config`);
49
50
  const response = await fetch(`http://localhost:${LINKITYLINK_PORT}/config`, {
50
51
  method: 'GET',
51
52
  timeout: 2000
52
53
  });
54
+ console.log(`[wiki-plugin-linkitylink] Health check response: ${response.status} ${response.statusText}`);
53
55
  return response.ok;
54
56
  } catch (err) {
57
+ console.error(`[wiki-plugin-linkitylink] Health check failed: ${err.message}`);
55
58
  return false;
56
59
  }
57
60
  }
@@ -87,6 +90,13 @@ async function launchLinkitylink(wikiConfig) {
87
90
  ENABLE_APP_PURCHASE: process.env.ENABLE_APP_PURCHASE || 'false'
88
91
  };
89
92
 
93
+ console.log('[wiki-plugin-linkitylink] Environment:');
94
+ console.log(` PORT: ${env.PORT}`);
95
+ console.log(` FOUNT_BASE_URL: ${env.FOUNT_BASE_URL}`);
96
+ console.log(` BDO_BASE_URL: ${env.BDO_BASE_URL}`);
97
+ console.log(` ADDIE_BASE_URL: ${env.ADDIE_BASE_URL}`);
98
+ console.log(`[wiki-plugin-linkitylink] Spawning: node linkitylink.js`);
99
+
90
100
  // Spawn linkitylink process
91
101
  linkitylinkProcess = spawn('node', ['linkitylink.js'], {
92
102
  cwd: LINKITYLINK_PATH,
@@ -109,7 +119,13 @@ async function launchLinkitylink(wikiConfig) {
109
119
 
110
120
  // Handle process exit
111
121
  linkitylinkProcess.on('exit', (code, signal) => {
112
- console.log(`[wiki-plugin-linkitylink] Linkitylink process exited (code: ${code}, signal: ${signal})`);
122
+ if (code === 0) {
123
+ console.log(`[wiki-plugin-linkitylink] ✅ Linkitylink process exited cleanly (code: ${code})`);
124
+ } else if (code) {
125
+ console.error(`[wiki-plugin-linkitylink] ❌ Linkitylink process crashed (exit code: ${code})`);
126
+ } else if (signal) {
127
+ console.error(`[wiki-plugin-linkitylink] ❌ Linkitylink process killed by signal: ${signal}`);
128
+ }
113
129
  linkitylinkProcess = null;
114
130
  });
115
131
 
@@ -119,13 +135,23 @@ async function launchLinkitylink(wikiConfig) {
119
135
  });
120
136
 
121
137
  // Wait a bit for the service to start
138
+ console.log('[wiki-plugin-linkitylink] Waiting 3 seconds for service to start...');
122
139
  setTimeout(async () => {
123
140
  const isRunning = await checkLinkitylinkRunning();
124
141
  if (isRunning) {
125
142
  console.log('[wiki-plugin-linkitylink] ✅ Linkitylink service started successfully');
143
+ console.log(`[wiki-plugin-linkitylink] Service available at http://localhost:${LINKITYLINK_PORT}`);
126
144
  resolve();
127
145
  } else {
128
- console.error('[wiki-plugin-linkitylink] ⚠️ Linkitylink may not have started correctly');
146
+ console.error('[wiki-plugin-linkitylink] ⚠️ Linkitylink did not respond to health check');
147
+ console.error(`[wiki-plugin-linkitylink] Attempted to connect to: http://localhost:${LINKITYLINK_PORT}/config`);
148
+ if (linkitylinkProcess && linkitylinkProcess.killed) {
149
+ console.error('[wiki-plugin-linkitylink] Process was killed or crashed');
150
+ } else if (!linkitylinkProcess) {
151
+ console.error('[wiki-plugin-linkitylink] Process is not running');
152
+ } else {
153
+ console.error('[wiki-plugin-linkitylink] Process appears to be running but not responding');
154
+ }
129
155
  resolve(); // Don't reject, let it try to work anyway
130
156
  }
131
157
  }, 3000);