koztv-blog-tools 1.2.8 → 1.2.10

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/dist/index.js CHANGED
@@ -333,7 +333,7 @@ Do not add any explanations or notes.`
333
333
  let lastError = null;
334
334
  for (let attempt = 0; attempt < maxRetries; attempt++) {
335
335
  if (attempt > 0) {
336
- const delay = 3e3 * Math.pow(2, attempt - 1);
336
+ const delay = 1e3 * Math.pow(2, attempt - 1);
337
337
  await new Promise((r) => setTimeout(r, delay));
338
338
  }
339
339
  const response = await fetch(endpoint, {
@@ -770,11 +770,12 @@ async function processPost(post, options, exportDir) {
770
770
  } catch (error) {
771
771
  onProgress?.(` Error translating to ${targetLang}: ${error.message}`);
772
772
  }
773
- await new Promise((r) => setTimeout(r, 2e3));
773
+ await new Promise((r) => setTimeout(r, 500));
774
774
  }
775
775
  } else {
776
+ const defaultLang = translate?.sourceLang || "ru";
776
777
  languages.push({
777
- lang: "original",
778
+ lang: defaultLang,
778
779
  title: originalTitle,
779
780
  body: originalBody,
780
781
  isOriginal: true
@@ -782,12 +783,7 @@ async function processPost(post, options, exportDir) {
782
783
  }
783
784
  for (const { lang, title, body, isOriginal } of languages) {
784
785
  const slug = generateSlug2(title, lang);
785
- let postDir;
786
- if (languages.length > 1 || translate && translate.targetLangs.length > 0) {
787
- postDir = path2.join(outputDir, lang, slug);
788
- } else {
789
- postDir = path2.join(outputDir, slug);
790
- }
786
+ const postDir = path2.join(outputDir, lang, slug);
791
787
  if (fs2.existsSync(postDir)) {
792
788
  onProgress?.(` Skipping existing: ${lang}/${slug}`);
793
789
  continue;
package/dist/index.mjs CHANGED
@@ -276,7 +276,7 @@ Do not add any explanations or notes.`
276
276
  let lastError = null;
277
277
  for (let attempt = 0; attempt < maxRetries; attempt++) {
278
278
  if (attempt > 0) {
279
- const delay = 3e3 * Math.pow(2, attempt - 1);
279
+ const delay = 1e3 * Math.pow(2, attempt - 1);
280
280
  await new Promise((r) => setTimeout(r, delay));
281
281
  }
282
282
  const response = await fetch(endpoint, {
@@ -713,11 +713,12 @@ async function processPost(post, options, exportDir) {
713
713
  } catch (error) {
714
714
  onProgress?.(` Error translating to ${targetLang}: ${error.message}`);
715
715
  }
716
- await new Promise((r) => setTimeout(r, 2e3));
716
+ await new Promise((r) => setTimeout(r, 500));
717
717
  }
718
718
  } else {
719
+ const defaultLang = translate?.sourceLang || "ru";
719
720
  languages.push({
720
- lang: "original",
721
+ lang: defaultLang,
721
722
  title: originalTitle,
722
723
  body: originalBody,
723
724
  isOriginal: true
@@ -725,12 +726,7 @@ async function processPost(post, options, exportDir) {
725
726
  }
726
727
  for (const { lang, title, body, isOriginal } of languages) {
727
728
  const slug = generateSlug2(title, lang);
728
- let postDir;
729
- if (languages.length > 1 || translate && translate.targetLangs.length > 0) {
730
- postDir = path2.join(outputDir, lang, slug);
731
- } else {
732
- postDir = path2.join(outputDir, slug);
733
- }
729
+ const postDir = path2.join(outputDir, lang, slug);
734
730
  if (fs2.existsSync(postDir)) {
735
731
  onProgress?.(` Skipping existing: ${lang}/${slug}`);
736
732
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koztv-blog-tools",
3
- "version": "1.2.8",
3
+ "version": "1.2.10",
4
4
  "description": "Shared utilities for Telegram-based blog sites",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",