@fyresmith/hive-server 2.3.1 → 2.3.2

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/cli/tunnel.js +17 -1
  2. package/package.json +1 -1
package/cli/tunnel.js CHANGED
@@ -160,7 +160,18 @@ export async function ensureDnsRoute({ tunnelName, domain }) {
160
160
  }
161
161
 
162
162
  export async function installCloudflaredService() {
163
- await runInherit('sudo', ['cloudflared', 'service', 'install']);
163
+ try {
164
+ await runInherit('sudo', ['cloudflared', 'service', 'install']);
165
+ } catch (err) {
166
+ const output = getCloudflaredErrorOutput(err);
167
+ if (!isAlreadyInstalledCloudflaredService(output)) {
168
+ throw err;
169
+ }
170
+ warn('cloudflared service already installed; skipping reinstall');
171
+ }
172
+
173
+ // Ensure the existing/new service is actually running.
174
+ await startCloudflaredServiceIfInstalled();
164
175
  }
165
176
 
166
177
  function isMissingCloudflaredService(output) {
@@ -175,6 +186,11 @@ function isMissingCloudflaredService(output) {
175
186
  );
176
187
  }
177
188
 
189
+ function isAlreadyInstalledCloudflaredService(output) {
190
+ const text = String(output ?? '').toLowerCase();
191
+ return text.includes('cloudflared service is already installed at');
192
+ }
193
+
178
194
  function getCloudflaredErrorOutput(err) {
179
195
  return [
180
196
  err?.stdout,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fyresmith/hive-server",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "type": "module",
5
5
  "description": "Collaborative Obsidian vault server",
6
6
  "main": "index.js",