miinideck 0.1.1 → 0.1.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/index.js +7 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -264,13 +264,16 @@ async function deploy(args) {
264
264
  );
265
265
 
266
266
  // 1. signed URL — try as an update first if we've deployed this path before.
267
+ let replacing = Boolean(knownDocId);
267
268
  let step1 = await postJson(
268
269
  `${api}/api/v1/upload-url`,
269
- knownDocId ? { size, fileKind, replace_doc_id: knownDocId } : { size, fileKind },
270
+ replacing ? { size, fileKind, replace_doc_id: knownDocId } : { size, fileKind },
270
271
  token,
271
272
  );
272
- // The remembered doc may have been deleted on the server — fall back to new.
273
- if (!step1.ok && knownDocId) {
273
+ // The remembered doc is gone (deleted, or not ours) — fall back to a fresh
274
+ // link instead of erroring, and stop trying to replace it.
275
+ if (!step1.ok && replacing) {
276
+ replacing = false;
274
277
  step1 = await postJson(`${api}/api/v1/upload-url`, { size, fileKind }, token);
275
278
  }
276
279
  if (!step1.ok) die((step1.json && step1.json.error) || `Could not start upload (HTTP ${step1.status}).`);
@@ -288,7 +291,7 @@ async function deploy(args) {
288
291
 
289
292
  // 3. finalize.
290
293
  const finalizeBody = { path: storagePath, slug, fileKind, source_filename: sourceFilename };
291
- if (knownDocId && step1.json.slug === slug) finalizeBody.replace_doc_id = knownDocId;
294
+ if (replacing) finalizeBody.replace_doc_id = knownDocId;
292
295
  // Default the title to the file/folder name (extension stripped), matching the
293
296
  // web upload. Custom name via --name; rename later in the dashboard. (On an
294
297
  // update/replace the server keeps the existing title, so a manual rename sticks.)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miinideck",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Deploy an HTML file, folder, or ZIP to a private, unguessable miinideck link — straight from your terminal or AI coding tool.",
5
5
  "keywords": [
6
6
  "miinideck",