← back to DaisyQuest__OpenAutoTag

Function bodies 1,518 total

All specs Real LLM only Function bodies
buildPlaceholderIco function · javascript · L33-L53 (21 LOC)
desktop/icons/generate-icons.js
function buildPlaceholderIco() {
  const png = PLACEHOLDER_PNG;
  // ICO header: 0=reserved, 1=ICO type, 1 image
  const header = Buffer.alloc(6);
  header.writeUInt16LE(0, 0);  // reserved
  header.writeUInt16LE(1, 2);  // type: ICO
  header.writeUInt16LE(1, 4);  // image count

  // ICO directory entry (16 bytes)
  const entry = Buffer.alloc(16);
  entry.writeUInt8(1, 0);      // width (1 pixel; 0 would mean 256)
  entry.writeUInt8(1, 1);      // height
  entry.writeUInt8(0, 2);      // color palette
  entry.writeUInt8(0, 3);      // reserved
  entry.writeUInt16LE(1, 4);   // color planes
  entry.writeUInt16LE(32, 6);  // bits per pixel
  entry.writeUInt32LE(png.length, 8);  // image data size
  entry.writeUInt32LE(6 + 16, 12);     // offset to image data

  return Buffer.concat([header, entry, png]);
}
generateWithSharp function · javascript · L62-L108 (47 LOC)
desktop/icons/generate-icons.js
async function generateWithSharp() {
  const sharp = (await import("sharp")).default;
  const svgPath = join(__dirname, "icon.svg");
  const svg = readFileSync(svgPath);

  // icon.png — 512x512
  await sharp(svg).resize(512, 512).png().toFile(join(OUT, "icon.png"));
  console.log("  icon.png (512x512)");

  // tray-icon.png — 16x16
  await sharp(svg).resize(16, 16).png().toFile(join(OUT, "tray-icon.png"));
  console.log("  tray-icon.png (16x16)");

  // splash-bg.png — 800x600 centered on dark background
  const centered = await sharp(svg).resize(240, 240).png().toBuffer();
  await sharp({
    create: { width: 800, height: 600, channels: 4, background: { r: 19, g: 38, b: 40, alpha: 1 } },
  })
    .composite([{ input: centered, gravity: "centre" }])
    .png()
    .toFile(join(OUT, "splash-bg.png"));
  console.log("  splash-bg.png (800x600)");

  // icon.ico — generate multiple sizes, then write as ICO
  // (For a production ICO, use png-to-ico or electron-icon-builder.)
  // For now,
writePlaceholders function · javascript · L110-L120 (11 LOC)
desktop/icons/generate-icons.js
function writePlaceholders() {
  for (const t of targets) {
    const out = join(OUT, t.name);
    if (t.name.endsWith(".ico")) {
      writeFileSync(out, buildPlaceholderIco());
    } else {
      writeFileSync(out, PLACEHOLDER_PNG);
    }
    console.log(`  ${t.name} (placeholder) — ${t.desc}`);
  }
}
main function · javascript · L122-L145 (24 LOC)
desktop/icons/generate-icons.js
async function main() {
  console.log("PDF Accessibility Engine — Icon Generator\n");

  let hasSharp = false;
  try {
    await import("sharp");
    hasSharp = true;
  } catch {
    // sharp not available
  }

  if (hasSharp) {
    console.log("sharp detected — generating real icons from icon.svg:\n");
    await generateWithSharp();
  } else {
    console.log(
      "sharp not installed — writing 1x1 placeholder PNGs.\n" +
      "Install sharp for real icons:  npm i -D sharp\n"
    );
    writePlaceholders();
  }

  console.log("\nDone.");
}
generateElectronBuilderConfig function · javascript · L13-L56 (44 LOC)
desktop/installer/index.js
export function generateElectronBuilderConfig(config) {
  const validated = mergeWithDefaults(config);
  const result = {
    appId: `com.${(validated.branding.company || "app").toLowerCase().replace(/\s+/g, "")}.${validated.productName.toLowerCase().replace(/\s+/g, "")}`,
    productName: validated.productName,
    directories: { output: "dist" },
    files: [
      "main.js", "preload.js", "splash.html", "about.html", "icons/**",
      "../orchestrator/**", "../modules/**", "../contracts/**", "../scripts/**",
      "../package.json", "../node_modules/**"
    ]
  };

  if (validated.platforms.windows.enabled) {
    result.win = generateWindowsConfig(validated);
  }
  if (validated.platforms.macos.enabled) {
    result.mac = generateMacConfig(validated);
  }
  if (validated.platforms.linux.enabled) {
    result.linux = generateLinuxConfig(validated);
  }

  if (validated.platforms.windows.enabled) {
    result.nsis = {
      oneClick: !validated.advanced.allowCustomInstallPath,
      a
buildInstaller function · javascript · L58-L91 (34 LOC)
desktop/installer/index.js
export async function buildInstaller(config) {
  const validation = validateConfig(config);
  if (!validation.valid) {
    return { success: false, errors: validation.errors, outputPaths: [], duration: 0 };
  }

  const builderConfig = generateElectronBuilderConfig(config);
  const buildDir = path.resolve(__dirname, "..");
  const configPath = path.join(buildDir, "electron-builder-generated.yml");

  await writeFile(configPath, JSON.stringify(builderConfig, null, 2));

  const start = Date.now();
  try {
    const { build } = await import("electron-builder");
    const results = await build({
      config: builderConfig,
      projectDir: buildDir
    });
    return {
      success: true,
      outputPaths: results.map(String),
      duration: Date.now() - start,
      errors: []
    };
  } catch (err) {
    return {
      success: false,
      outputPaths: [],
      duration: Date.now() - start,
      errors: [err.message]
    };
  }
}
getDefaultConfig function · javascript · L47-L58 (12 LOC)
desktop/installer/installer-config.js
export function getDefaultConfig() {
  return {
    productName: "PDF Accessibility Engine",
    version: "1.0.0",
    description: "PDF Accessibility Engine — Desktop Edition",
    platforms: CONFIG_SCHEMA.platforms.default,
    components: CONFIG_SCHEMA.components.default,
    java: CONFIG_SCHEMA.java.default,
    branding: { ...CONFIG_SCHEMA.branding.default },
    advanced: { ...CONFIG_SCHEMA.advanced.default }
  };
}
Repobility — the code-quality scanner for AI-generated software · https://repobility.com
mergeWithDefaults function · javascript · L60-L71 (12 LOC)
desktop/installer/installer-config.js
export function mergeWithDefaults(partial) {
  const defaults = getDefaultConfig();
  return {
    ...defaults,
    ...partial,
    platforms: { ...defaults.platforms, ...partial?.platforms },
    components: { ...defaults.components, ...partial?.components },
    java: { ...defaults.java, ...partial?.java },
    branding: { ...defaults.branding, ...partial?.branding },
    advanced: { ...defaults.advanced, ...partial?.advanced }
  };
}
validateConfig function · javascript · L73-L82 (10 LOC)
desktop/installer/installer-config.js
export function validateConfig(config) {
  const errors = [];
  if (!config?.productName) errors.push("productName is required");
  if (!config?.version) errors.push("version is required");
  if (config?.platforms) {
    const hasTarget = Object.values(config.platforms).some((p) => p?.enabled);
    if (!hasTarget) errors.push("at least one platform must be enabled");
  }
  return { valid: errors.length === 0, errors };
}
generateLinuxConfig function · javascript · L1-L8 (8 LOC)
desktop/installer/platforms/linux.js
export function generateLinuxConfig(config) {
  return {
    target: config.platforms.linux.target || ["AppImage", "deb"],
    icon: config.branding.icon || "icons/icon.png",
    category: "Office",
    artifactName: "${productName}-${version}.${ext}"
  };
}
generateMacConfig function · javascript · L1-L8 (8 LOC)
desktop/installer/platforms/macos.js
export function generateMacConfig(config) {
  return {
    target: config.platforms.macos.target || "dmg",
    icon: config.branding.icon || "icons/icon.icns",
    category: "public.app-category.productivity",
    artifactName: "${productName}-${version}.${ext}"
  };
}
generateWindowsConfig function · javascript · L1-L7 (7 LOC)
desktop/installer/platforms/windows.js
export function generateWindowsConfig(config) {
  return {
    target: config.platforms.windows.target || "nsis",
    icon: config.branding.icon || "icons/icon.ico",
    artifactName: "${productName}-Setup-${version}.${ext}"
  };
}
init function · javascript · L75-L95 (21 LOC)
desktop/installer/wizard/wizard.js
  function init() {
    panels     = document.querySelectorAll('.wiz-step-panel');
    circles    = document.querySelectorAll('.wiz-step-circle');
    connectors = document.querySelectorAll('.wiz-step-line');
    prevBtn    = document.getElementById('wizPrev');
    nextBtn    = document.getElementById('wizNext');

    // Read version from the hidden span if present
    const versionEl = document.getElementById('wizVersionValue');
    if (versionEl) config.version = versionEl.textContent.trim();

    bindNavigation();
    bindStep1();
    bindStep2();
    bindStep3();
    bindStep4();
    bindStep5();
    bindStep6();
    renderColorSwatches();
    showStep(0);
  }
showStep function · javascript · L99-L129 (31 LOC)
desktop/installer/wizard/wizard.js
  function showStep(idx) {
    currentStep = idx;

    panels.forEach(function (p, i) {
      p.classList.toggle('visible', i === idx);
    });

    // Update step indicator
    var stepItems = document.querySelectorAll('.wiz-step-item');
    stepItems.forEach(function (item, i) {
      item.classList.remove('active', 'done');
      if (i < idx)      item.classList.add('done');
      else if (i === idx) item.classList.add('active');
    });

    connectors.forEach(function (c, i) {
      c.classList.toggle('done-line', i < idx);
    });

    // Nav buttons
    prevBtn.style.visibility = idx === 0 ? 'hidden' : 'visible';
    if (idx === TOTAL_STEPS - 1) {
      nextBtn.style.display = 'none';
    } else {
      nextBtn.style.display = '';
      nextBtn.textContent = idx === TOTAL_STEPS - 2 ? 'Review' : 'Next';
    }

    // Populate review on step 7 (index 6)
    if (idx === 6) populateReview();
  }
goNext function · javascript · L131-L136 (6 LOC)
desktop/installer/wizard/wizard.js
  function goNext() {
    if (currentStep >= TOTAL_STEPS - 1) return;
    if (!validateStep(currentStep)) return;
    collectStepData(currentStep);
    showStep(currentStep + 1);
  }
Want this analysis on your repo? https://repobility.com/scan/
goPrev function · javascript · L138-L141 (4 LOC)
desktop/installer/wizard/wizard.js
  function goPrev() {
    if (currentStep <= 0) return;
    showStep(currentStep - 1);
  }
goToStep function · javascript · L143-L148 (6 LOC)
desktop/installer/wizard/wizard.js
  function goToStep(idx) {
    if (idx >= 0 && idx < TOTAL_STEPS) {
      collectStepData(currentStep);
      showStep(idx);
    }
  }
bindNavigation function · javascript · L150-L153 (4 LOC)
desktop/installer/wizard/wizard.js
  function bindNavigation() {
    prevBtn.addEventListener('click', goPrev);
    nextBtn.addEventListener('click', goNext);
  }
validateStep function · javascript · L157-L170 (14 LOC)
desktop/installer/wizard/wizard.js
  function validateStep(idx) {
    clearErrors();
    switch (idx) {
      case 0: return validateWelcome();
      case 1: return validatePlatforms();
      case 2: return true; // accessibility tagging always selected
      case 3: return validateJava();
      case 4: return true; // branding is optional
      case 5: return true; // advanced is optional
      case 6: return true; // review
      case 7: return true; // build
    }
    return true;
  }
validateWelcome function · javascript · L172-L179 (8 LOC)
desktop/installer/wizard/wizard.js
  function validateWelcome() {
    var name = document.getElementById('wizProductName');
    if (!name.value.trim()) {
      showError(name, 'Product name is required');
      return false;
    }
    return true;
  }
validatePlatforms function · javascript · L181-L195 (15 LOC)
desktop/installer/wizard/wizard.js
  function validatePlatforms() {
    var checks = document.querySelectorAll('.wiz-platform-cb:checked');
    if (checks.length === 0) {
      var el = document.getElementById('wizPlatformError');
      if (el) { el.classList.add('show'); }
      return false;
    }
    var archChecks = document.querySelectorAll('.wiz-arch-cb:checked');
    if (archChecks.length === 0) {
      var el2 = document.getElementById('wizArchError');
      if (el2) { el2.classList.add('show'); }
      return false;
    }
    return true;
  }
validateJava function · javascript · L197-L206 (10 LOC)
desktop/installer/wizard/wizard.js
  function validateJava() {
    if (config.javaBundle === 'bundle' && config.javaBundleSource === 'local') {
      var pathInput = document.getElementById('wizJavaLocalPath');
      if (pathInput && !pathInput.value.trim()) {
        showError(pathInput, 'Please provide the path to a local JRE');
        return false;
      }
    }
    return true;
  }
showError function · javascript · L208-L215 (8 LOC)
desktop/installer/wizard/wizard.js
  function showError(inputEl, msg) {
    inputEl.classList.add('invalid');
    var errEl = inputEl.parentElement.querySelector('.wiz-error-msg');
    if (errEl) {
      errEl.textContent = msg;
      errEl.classList.add('show');
    }
  }
Repobility · open methodology · https://repobility.com/research/
clearErrors function · javascript · L217-L220 (4 LOC)
desktop/installer/wizard/wizard.js
  function clearErrors() {
    document.querySelectorAll('.invalid').forEach(function (el) { el.classList.remove('invalid'); });
    document.querySelectorAll('.wiz-error-msg.show').forEach(function (el) { el.classList.remove('show'); });
  }
collectStepData function · javascript · L224-L233 (10 LOC)
desktop/installer/wizard/wizard.js
  function collectStepData(idx) {
    switch (idx) {
      case 0: collectWelcome(); break;
      case 1: collectPlatforms(); break;
      case 2: collectComponents(); break;
      case 3: collectJava(); break;
      case 4: collectBranding(); break;
      case 5: collectAdvanced(); break;
    }
  }
collectWelcome function · javascript · L235-L238 (4 LOC)
desktop/installer/wizard/wizard.js
  function collectWelcome() {
    config.productName = val('wizProductName');
    config.description = val('wizDescription');
  }
collectPlatforms function · javascript · L240-L246 (7 LOC)
desktop/installer/wizard/wizard.js
  function collectPlatforms() {
    config.platforms.windows = checked('wizPlatWindows');
    config.platforms.macos   = checked('wizPlatMacos');
    config.platforms.linux   = checked('wizPlatLinux');
    config.architectures.x64   = checked('wizArchX64');
    config.architectures.arm64 = checked('wizArchArm64');
  }
collectComponents function · javascript · L248-L252 (5 LOC)
desktop/installer/wizard/wizard.js
  function collectComponents() {
    config.components.ssnRedaction       = checked('wizCompSsn');
    config.components.pdfCorruptionRepair = checked('wizCompRepair');
    config.components.fontHealthAnalysis = checked('wizCompFont');
  }
collectJava function · javascript · L254-L262 (9 LOC)
desktop/installer/wizard/wizard.js
  function collectJava() {
    config.javaBundle = document.querySelector('input[name="wizJavaBundle"]:checked')
      ? document.querySelector('input[name="wizJavaBundle"]:checked').value
      : 'bundle';
    config.javaBundleSource = document.querySelector('input[name="wizJavaSource"]:checked')
      ? document.querySelector('input[name="wizJavaSource"]:checked').value
      : 'auto';
    config.javaLocalPath = val('wizJavaLocalPath');
  }
collectBranding function · javascript · L264-L269 (6 LOC)
desktop/installer/wizard/wizard.js
  function collectBranding() {
    config.splashText  = val('wizSplashText');
    config.companyName = val('wizCompanyName');
    config.copyright   = val('wizCopyright');
    config.licenseText = val('wizLicense');
  }
collectAdvanced function · javascript · L271-L278 (8 LOC)
desktop/installer/wizard/wizard.js
  function collectAdvanced() {
    config.autoUpdateUrl   = val('wizAutoUpdateUrl');
    config.installPath     = val('wizInstallPath');
    config.fileAssocPdf    = checked('wizFileAssocPdf');
    config.desktopShortcut = checked('wizDesktopShortcut');
    config.startMenuEntry  = checked('wizStartMenu');
    config.runAfterInstall = checked('wizRunAfter');
  }
Repobility · code-quality intelligence platform · https://repobility.com
bindStep1 function · javascript · L282-L284 (3 LOC)
desktop/installer/wizard/wizard.js
  function bindStep1() {
    // No special bindings; fields are standard inputs.
  }
bindStep2 function · javascript · L286-L297 (12 LOC)
desktop/installer/wizard/wizard.js
  function bindStep2() {
    // Card selection highlight
    document.querySelectorAll('#wizStep2 .wiz-card-option').forEach(function (card) {
      var input = card.querySelector('input');
      if (!input) return;
      input.addEventListener('change', function () {
        card.classList.toggle('selected', input.checked);
      });
      // Init state
      if (input.checked) card.classList.add('selected');
    });
  }
bindStep3 function · javascript · L299-L308 (10 LOC)
desktop/installer/wizard/wizard.js
  function bindStep3() {
    document.querySelectorAll('#wizStep3 .wiz-card-option').forEach(function (card) {
      var input = card.querySelector('input');
      if (!input) return;
      input.addEventListener('change', function () {
        card.classList.toggle('selected', input.checked);
      });
      if (input.checked) card.classList.add('selected');
    });
  }
bindStep4 function · javascript · L310-L332 (23 LOC)
desktop/installer/wizard/wizard.js
  function bindStep4() {
    // Show/hide JRE source options based on radio
    var radios = document.querySelectorAll('input[name="wizJavaBundle"]');
    var sourceGroup = document.getElementById('wizJavaSourceGroup');
    radios.forEach(function (r) {
      r.addEventListener('change', function () {
        if (sourceGroup) {
          sourceGroup.style.display = r.value === 'bundle' && r.checked ? '' : 'none';
        }
      });
    });

    // Show/hide local path
    var sourceRadios = document.querySelectorAll('input[name="wizJavaSource"]');
    var localGroup = document.getElementById('wizJavaLocalGroup');
    sourceRadios.forEach(function (r) {
      r.addEventListener('change', function () {
        if (localGroup) {
          localGroup.style.display = r.value === 'local' && r.checked ? '' : 'none';
        }
      });
    });
  }
bindStep5 function · javascript · L334-L353 (20 LOC)
desktop/installer/wizard/wizard.js
  function bindStep5() {
    // Icon upload
    var uploadArea = document.getElementById('wizIconUpload');
    var fileInput  = document.getElementById('wizIconFile');
    var preview    = document.getElementById('wizIconPreview');

    if (uploadArea && fileInput) {
      uploadArea.addEventListener('click', function () { fileInput.click(); });
      uploadArea.addEventListener('dragover', function (e) { e.preventDefault(); uploadArea.style.borderColor = 'var(--wiz-primary)'; });
      uploadArea.addEventListener('dragleave', function () { uploadArea.style.borderColor = ''; });
      uploadArea.addEventListener('drop', function (e) {
        e.preventDefault();
        uploadArea.style.borderColor = '';
        if (e.dataTransfer.files.length) handleIconFile(e.dataTransfer.files[0], preview);
      });
      fileInput.addEventListener('change', function () {
        if (fileInput.files.length) handleIconFile(fileInput.files[0], preview);
      });
    }
  }
handleIconFile function · javascript · L355-L366 (12 LOC)
desktop/installer/wizard/wizard.js
  function handleIconFile(file, preview) {
    config.appIcon = file;
    var reader = new FileReader();
    reader.onload = function (e) {
      config.appIconPreviewUrl = e.target.result;
      if (preview) {
        preview.src = e.target.result;
        preview.style.display = 'block';
      }
    };
    reader.readAsDataURL(file);
  }
bindStep6 function · javascript · L368-L370 (3 LOC)
desktop/installer/wizard/wizard.js
  function bindStep6() {
    // Nothing extra required — standard form fields.
  }
renderColorSwatches function · javascript · L374-L390 (17 LOC)
desktop/installer/wizard/wizard.js
  function renderColorSwatches() {
    var container = document.getElementById('wizColorPicker');
    if (!container) return;
    THEME_COLORS.forEach(function (color) {
      var swatch = document.createElement('button');
      swatch.type = 'button';
      swatch.className = 'wiz-swatch' + (color === config.themeColor ? ' selected' : '');
      swatch.style.background = color;
      swatch.setAttribute('data-color', color);
      swatch.addEventListener('click', function () {
        config.themeColor = color;
        container.querySelectorAll('.wiz-swatch').forEach(function (s) { s.classList.remove('selected'); });
        swatch.classList.add('selected');
      });
      container.appendChild(swatch);
    });
  }
Repobility — the code-quality scanner for AI-generated software · https://repobility.com
populateReview function · javascript · L394-L455 (62 LOC)
desktop/installer/wizard/wizard.js
  function populateReview() {
    collectStepData(currentStep - 1); // collect the last edited step

    // Product info card
    setReviewList('wizRevProduct', [
      config.productName + ' v' + config.version,
      config.description || '(no description)',
    ]);

    // Platforms
    var platList = [];
    if (config.platforms.windows) platList.push('Windows (.exe)');
    if (config.platforms.macos)   platList.push('macOS (.dmg)');
    if (config.platforms.linux)   platList.push('Linux (.AppImage/.deb)');
    var archList = [];
    if (config.architectures.x64)   archList.push('x64');
    if (config.architectures.arm64) archList.push('arm64');
    platList.push('Architecture: ' + archList.join(', '));
    setReviewList('wizRevPlatforms', platList);

    // Components
    var compList = ['Accessibility Tagging (core)'];
    if (config.components.ssnRedaction)       compList.push('SSN Redaction');
    if (config.components.pdfCorruptionRepair) compList.push('PDF Corruption Repair')
setReviewList function · javascript · L457-L461 (5 LOC)
desktop/installer/wizard/wizard.js
  function setReviewList(id, items) {
    var ul = document.getElementById(id);
    if (!ul) return;
    ul.innerHTML = items.map(function (t) { return '<li>' + escapeHtml(t) + '</li>'; }).join('');
  }
generateElectronBuilderYml function · javascript · L465-L540 (76 LOC)
desktop/installer/wizard/wizard.js
  function generateElectronBuilderYml(cfg) {
    var lines = [];
    lines.push('appId: com.' + slugify(cfg.companyName || 'company') + '.' + slugify(cfg.productName));
    lines.push('productName: "' + cfg.productName + '"');
    lines.push('');
    lines.push('# Directories');
    lines.push('directories:');
    lines.push('  output: dist');
    lines.push('  buildResources: build');
    lines.push('');

    if (cfg.platforms.windows) {
      lines.push('win:');
      lines.push('  target:');
      lines.push('    - target: nsis');
      lines.push('      arch:');
      if (cfg.architectures.x64)   lines.push('        - x64');
      if (cfg.architectures.arm64) lines.push('        - arm64');
      lines.push('');
      lines.push('nsis:');
      lines.push('  oneClick: false');
      lines.push('  perMachine: true');
      lines.push('  allowToChangeInstallationDirectory: true');
      if (cfg.desktopShortcut) lines.push('  createDesktopShortcut: true');
      if (cfg.startMenuEntry)
generateBuildConfig function · javascript · L542-L587 (46 LOC)
desktop/installer/wizard/wizard.js
  function generateBuildConfig(cfg) {
    var obj = {
      product: {
        name: cfg.productName,
        version: cfg.version,
        description: cfg.description,
      },
      platforms: [],
      architectures: [],
      components: {
        accessibilityTagging: true,
        ssnRedaction: cfg.components.ssnRedaction,
        pdfCorruptionRepair: cfg.components.pdfCorruptionRepair,
        fontHealthAnalysis: cfg.components.fontHealthAnalysis,
      },
      java: {
        bundle: cfg.javaBundle === 'bundle',
        source: cfg.javaBundle === 'bundle' ? cfg.javaBundleSource : null,
        localPath: cfg.javaBundle === 'bundle' && cfg.javaBundleSource === 'local' ? cfg.javaLocalPath : null,
      },
      branding: {
        splashText: cfg.splashText,
        companyName: cfg.companyName,
        copyright: cfg.copyright,
        themeColor: cfg.themeColor,
        hasCustomIcon: !!cfg.appIcon,
        hasLicense: !!cfg.licenseText,
      },
      installer: {
        au
startBuild function · javascript · L591-L645 (55 LOC)
desktop/installer/wizard/wizard.js
  function startBuild() {
    var btn       = document.getElementById('wizBuildBtn');
    var bar       = document.getElementById('wizProgressFill');
    var logEl     = document.getElementById('wizBuildLog');
    var statusEl  = document.getElementById('wizBuildStatus');
    var dlEl      = document.getElementById('wizDownloadLink');

    if (!btn || !bar || !logEl) return;

    btn.disabled = true;
    logEl.textContent = '';
    if (statusEl) { statusEl.className = 'wiz-status'; statusEl.style.display = 'none'; }
    if (dlEl) dlEl.style.display = 'none';

    var steps = [
      { pct: 5,   msg: '[info]  Validating configuration...' },
      { pct: 10,  msg: '[info]  Configuration valid.' },
      { pct: 15,  msg: '[info]  Generating electron-builder.yml...' },
      { pct: 20,  msg: '[info]  Generating build-config.json...' },
      { pct: 25,  msg: '[info]  Preparing build directory...' },
      { pct: 35,  msg: '[info]  Copying application resources...' },
      { pct: 40,  msg:
tick function · javascript · L623-L643 (21 LOC)
desktop/installer/wizard/wizard.js
    function tick() {
      if (i >= steps.length) {
        btn.disabled = false;
        if (statusEl) {
          statusEl.textContent = 'Build succeeded';
          statusEl.className = 'wiz-status success';
          statusEl.style.display = 'inline-flex';
        }
        if (dlEl) {
          dlEl.style.display = 'inline-flex';
          dlEl.textContent = 'Download installer (simulated)';
        }
        return;
      }
      var step = steps[i];
      bar.style.width = step.pct + '%';
      logEl.textContent += step.msg + '\n';
      logEl.scrollTop = logEl.scrollHeight;
      i++;
      setTimeout(tick, 350 + Math.random() * 250);
    }
highlightYaml function · javascript · L649-L669 (21 LOC)
desktop/installer/wizard/wizard.js
  function highlightYaml(str) {
    return str.split('\n').map(function (line) {
      // Comments
      if (/^\s*#/.test(line)) return '<span class="hl-comment">' + escapeHtml(line) + '</span>';
      // Key-value
      var m = line.match(/^(\s*)([\w-]+)(\s*:\s*)(.*)/);
      if (m) {
        var val2 = m[4];
        var valClass = '';
        if (/^".*"$/.test(val2) || /^'.*'$/.test(val2)) valClass = 'hl-str';
        else if (/^(true|false)$/i.test(val2)) valClass = 'hl-bool';
        else if (/^\d+$/.test(val2)) valClass = 'hl-num';
        else valClass = 'hl-str';
        return escapeHtml(m[1]) + '<span class="hl-key">' + escapeHtml(m[2]) + '</span>' + escapeHtml(m[3]) + (val2 ? '<span class="' + valClass + '">' + escapeHtml(val2) + '</span>' : '');
      }
      // List items
      var lm = line.match(/^(\s*-\s+)(.*)/);
      if (lm) return escapeHtml(lm[1]) + '<span class="hl-str">' + escapeHtml(lm[2]) + '</span>';
      return escapeHtml(line);
    }).join('\n');
  }
highlightJson function · javascript · L671-L678 (8 LOC)
desktop/installer/wizard/wizard.js
  function highlightJson(str) {
    return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
      .replace(/"([^"]+)"(\s*:)/g, '<span class="hl-key">"$1"</span>$2')
      .replace(/:\s*"([^"]*)"/g, ': <span class="hl-str">"$1"</span>')
      .replace(/:\s*(true|false)/g, ': <span class="hl-bool">$1</span>')
      .replace(/:\s*(\d+)/g, ': <span class="hl-num">$1</span>')
      .replace(/:\s*(null)/g, ': <span class="hl-bool">$1</span>');
  }
Want this analysis on your repo? https://repobility.com/scan/
escapeHtml function · javascript · L685-L715 (31 LOC)
desktop/installer/wizard/wizard.js
  function escapeHtml(s) { return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;'); }

  // ── Public API ─────────────────────────────────────────────────

  /**
   * Returns the current wizard configuration object (deep copy).
   * @returns {object}
   */
  function getWizardConfig() {
    // Collect whatever step we're on
    collectStepData(currentStep);
    return JSON.parse(JSON.stringify(config));
  }

  // Expose to global scope for programmatic access
  window.InstallerWizard = {
    init: init,
    getWizardConfig: getWizardConfig,
    generateElectronBuilderYml: generateElectronBuilderYml,
    generateBuildConfig: generateBuildConfig,
    goToStep: goToStep,
    startBuild: startBuild,
  };

  // Auto-init when DOM is ready
  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', init);
  } else {
    init();
  }
})();
getWizardConfig function · javascript · L693-L697 (5 LOC)
desktop/installer/wizard/wizard.js
  function getWizardConfig() {
    // Collect whatever step we're on
    collectStepData(currentStep);
    return JSON.parse(JSON.stringify(config));
  }
findFreePort function · javascript · L31-L40 (10 LOC)
desktop/main.js
function findFreePort() {
  return new Promise((resolve, reject) => {
    const srv = net.createServer();
    srv.listen(0, "127.0.0.1", () => {
      const { port } = srv.address();
      srv.close(() => resolve(port));
    });
    srv.on("error", reject);
  });
}
page 1 / 31next ›