commit cfee611fdc9ab1730e3c31d7e376d49596fc5d98 Author: Simon Cloutier Date: Wed May 20 13:38:46 2026 -0400 feat: initial commit — OST to PST/MBOX converter with Docker support diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..433aa51 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,19 @@ +# Build artifacts +node_modules/ + +# User data — never bake OST files or converted output into the image +uploads/ +converted/ +*.ost +*.pst +*.zip + +# OS & editor noise +.DS_Store +Thumbs.db +.env +*.log + +# Git +.git/ +.gitignore diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..db0054f --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,64 @@ +name: Build & Push Multi-Arch Image + +on: + push: + branches: [main] + tags: + - "v*.*.*" # Triggers on version tags like v1.0.0 + workflow_dispatch: # Allow manual trigger from GitHub UI + +env: + IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/ost2pst + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + # ── Checkout source ───────────────────────────────────────────────────── + - name: Checkout + uses: actions/checkout@v4 + + # ── Set up QEMU (required for ARM64 emulation on GitHub runners) ──────── + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + # ── Set up Buildx (multi-arch builder) ────────────────────────────────── + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + # ── Log in to Docker Hub ───────────────────────────────────────────────── + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + # ── Determine image tags ───────────────────────────────────────────────── + - name: Extract metadata (tags, labels) + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE_NAME }} + tags: | + # Push :latest on every main branch commit + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} + # Push semver tags: v1.2.3 → 1.2.3, 1.2, 1 + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + # Always tag with the short commit SHA + type=sha,prefix=sha- + + # ── Build & push for linux/amd64 + linux/arm64 ────────────────────────── + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + # Layer caching via GitHub Actions cache — speeds up subsequent builds + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4d7fa77 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +node_modules/ +uploads/ +converted/ +*.ost +*.pst +*.zip +.env +*.log diff --git a/Convert.java b/Convert.java new file mode 100644 index 0000000..1823b31 --- /dev/null +++ b/Convert.java @@ -0,0 +1,332 @@ +import com.aspose.email.FileFormatVersion; +import com.aspose.email.FolderInfo; +import com.aspose.email.MapiMessage; +import com.aspose.email.MessageInfo; +import com.aspose.email.PersonalStorage; +import com.aspose.email.MailMessage; +import com.aspose.email.MailConversionOptions; +import com.aspose.email.MboxrdStorageWriter; +import com.aspose.email.MapiContact; +import com.aspose.email.MapiItemType; +import com.aspose.email.ContactSaveFormat; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +public class Convert { + private static PersonalStorage sourceStorage; + + public static void main(String[] args) { + if (args.length < 2) { + System.err.println("Usage: java -cp Convert [format]"); + System.exit(1); + } + + String inputPath = args[0]; + String outputPath = args[1]; + String format = (args.length >= 3) ? args[2].toLowerCase() : "pst"; + boolean combineVcf = (args.length >= 4) && args[3].equalsIgnoreCase("true"); + + System.out.println("Starting manual copy conversion of OST: " + inputPath + " to format: " + format.toUpperCase()); + long startTime = System.currentTimeMillis(); + + try { + // Delete existing output file if it exists + File outFile = new File(outputPath); + if (outFile.exists()) { + System.out.println("Destination file already exists. Deleting " + outputPath + "..."); + if (outFile.delete()) { + System.out.println("Deleted existing file successfully."); + } else { + System.err.println("Warning: Failed to delete existing file."); + } + } + + // Load the source OST file + System.out.println("Loading OST file..."); + sourceStorage = PersonalStorage.fromFile(inputPath); + + if (format.equals("mbox")) { + // Export folders to a temporary directory of .mbox files, then zip them + File tempDir = new File("mbox_temp_" + System.currentTimeMillis()); + if (!tempDir.exists()) { + tempDir.mkdirs(); + } + + System.out.println("Exporting folder structure, email messages, and contacts..."); + exportFoldersToMbox(sourceStorage.getRootFolder(), "", tempDir, combineVcf); + + // If combineVcf was requested, merge all individual VCFs in the contacts subdirs + if (combineVcf) { + System.out.println("Merging contact VCF files into a single contacts.vcf..."); + mergeVcfFiles(tempDir); + } + + System.out.println("Packaging MBOX files and VCards into ZIP archive..."); + zipDirectory(tempDir, outputPath); + + System.out.println("Cleaning up temporary MBOX/VCard files..."); + cleanDirectory(tempDir); + tempDir.delete(); + + long duration = System.currentTimeMillis() - startTime; + System.out.println("Conversion completed successfully in " + (duration / 1000.0) + " seconds."); + } else { + // Default PST format + System.out.println("Creating destination PST file..."); + try (PersonalStorage destPst = PersonalStorage.create(outputPath, FileFormatVersion.Unicode)) { + System.out.println("Copying folder structure and messages..."); + copyFolders(sourceStorage.getRootFolder(), destPst.getRootFolder()); + + long duration = System.currentTimeMillis() - startTime; + System.out.println("Conversion completed successfully in " + (duration / 1000.0) + " seconds."); + } + } + + sourceStorage.close(); + System.exit(0); + } catch (Exception e) { + System.err.println("Error during conversion: " + e.getMessage()); + e.printStackTrace(); + if (sourceStorage != null) { + try { + sourceStorage.close(); + } catch (Exception ex) { + // Ignore + } + } + System.exit(1); + } + } + + private static void copyFolders(FolderInfo sourceFolder, FolderInfo destParentFolder) { + for (FolderInfo subFolder : sourceFolder.getSubFolders()) { + String folderName = subFolder.getDisplayName(); + System.out.println("Processing Folder: " + folderName); + + // Recreate folder in destination + FolderInfo newDestFolder = destParentFolder.addSubFolder(folderName); + + // Copy messages + int copiedCount = 0; + for (MessageInfo msgInfo : subFolder.enumerateMessages()) { + try { + MapiMessage msg = sourceStorage.extractMessage(msgInfo); + newDestFolder.addMessage(msg); + copiedCount++; + if (copiedCount % 100 == 0) { + System.out.println(" Copied " + copiedCount + " messages..."); + } + } catch (Exception ex) { + System.err.println(" Warning: Failed to copy message '" + msgInfo.getSubject() + "': " + ex.getMessage()); + } + } + if (copiedCount > 0) { + System.out.println(" Successfully copied " + copiedCount + " messages to folder: " + folderName); + } + + // Recursively copy subfolders + copyFolders(subFolder, newDestFolder); + } + } + + private static void exportFoldersToMbox(FolderInfo sourceFolder, String currentPath, File tempDir, boolean combineVcf) { + for (FolderInfo subFolder : sourceFolder.getSubFolders()) { + String folderName = subFolder.getDisplayName(); + String fullPath = currentPath.isEmpty() ? folderName : currentPath + " - " + folderName; + System.out.println("Processing Folder: " + folderName); + + boolean isContactsFolder = folderName.toLowerCase().contains("contacts"); + + // Skip other non-email folders + if (folderName.toLowerCase().contains("calendrier") || + folderName.toLowerCase().contains("journal") || + folderName.toLowerCase().contains("tâches") || + folderName.toLowerCase().contains("notes")) { + System.out.println(" Skipping non-email/non-contact folder: " + folderName); + + // Still process children in case there are nested folders + exportFoldersToMbox(subFolder, fullPath, tempDir, combineVcf); + continue; + } + + if (isContactsFolder) { + System.out.println(" Processing contacts in folder: " + folderName); + String safeSubDirName = "Contacts - " + folderName.replaceAll("[\\\\/:*?\"<>|]", "_"); + File contactsDir = new File(tempDir, safeSubDirName); + if (!contactsDir.exists()) { + contactsDir.mkdirs(); + } + + int contactCount = 0; + for (MessageInfo msgInfo : subFolder.enumerateMessages()) { + try { + MapiMessage msg = sourceStorage.extractMessage(msgInfo); + if (msg.getSupportedType() == MapiItemType.Contact) { + MapiContact contact = (MapiContact) msg.toMapiMessageItem(); + + // Determine a suitable name for the .vcf file + String displayName = null; + if (contact.getNameInfo() != null) { + displayName = contact.getNameInfo().getDisplayName(); + } + if (displayName == null || displayName.trim().isEmpty()) { + if (contact.getElectronicAddresses() != null && + contact.getElectronicAddresses().getEmail1() != null) { + displayName = contact.getElectronicAddresses().getEmail1().getEmailAddress(); + } + } + if (displayName == null || displayName.trim().isEmpty()) { + displayName = "Contact_" + (contactCount + 1); + } + + String safeContactName = displayName.replaceAll("[\\\\/:*?\"<>|]", "_") + ".vcf"; + File vcfFile = new File(contactsDir, safeContactName); + + // Check for duplicates + int index = 1; + while (vcfFile.exists()) { + String nameWithIndex = displayName.replaceAll("[\\\\/:*?\"<>|]", "_") + "_" + index + ".vcf"; + vcfFile = new File(contactsDir, nameWithIndex); + index++; + } + + contact.save(vcfFile.getAbsolutePath(), ContactSaveFormat.VCard); + contactCount++; + } + } catch (Exception ex) { + System.err.println(" Warning: Failed to export contact: " + ex.getMessage()); + } + } + + if (contactCount > 0) { + System.out.println(" Successfully exported " + contactCount + " contacts to folder: " + folderName); + } else { + contactsDir.delete(); + } + + // Recursively walk subfolders + exportFoldersToMbox(subFolder, fullPath, tempDir, combineVcf); + continue; + } + + // Otherwise, it's an email folder. Export to MBOX... + int copiedCount = 0; + String safeFileName = fullPath.replaceAll("[\\\\/:*?\"<>|]", "_") + ".mbox"; + File mboxFile = new File(tempDir, safeFileName); + + MailConversionOptions options = new MailConversionOptions(); + MboxrdStorageWriter writer = null; + + for (MessageInfo msgInfo : subFolder.enumerateMessages()) { + try { + if (writer == null) { + writer = new MboxrdStorageWriter(mboxFile.getAbsolutePath(), false); + } + MapiMessage msg = sourceStorage.extractMessage(msgInfo); + MailMessage mailMsg = msg.toMailMessage(options); + writer.writeMessage(mailMsg); + copiedCount++; + if (copiedCount % 100 == 0) { + System.out.println(" Exported " + copiedCount + " messages..."); + } + } catch (Exception ex) { + System.err.println(" Warning: Failed to export message '" + msgInfo.getSubject() + "': " + ex.getMessage()); + } + } + + if (writer != null) { + try { + writer.close(); + } catch (Exception ex) { + // Ignore + } + } + + if (copiedCount > 0) { + System.out.println(" Successfully copied " + copiedCount + " messages to folder: " + folderName); + } else { + // Delete empty mbox file if created + if (mboxFile.exists()) { + mboxFile.delete(); + } + } + + // Recursively walk subfolders + exportFoldersToMbox(subFolder, fullPath, tempDir, combineVcf); + } + } + + /** + * Walk all contact subdirectories, read each .vcf, and write them all + * into a single contacts.vcf at the root of tempDir. + * Then delete the now-merged individual files and empty subdirs. + */ + private static void mergeVcfFiles(File tempDir) throws Exception { + File combinedVcf = new File(tempDir, "contacts.vcf"); + try (FileOutputStream fos = new FileOutputStream(combinedVcf)) { + for (File child : tempDir.listFiles()) { + if (child.isDirectory() && child.getName().startsWith("Contacts")) { + for (File vcf : child.listFiles()) { + if (vcf.isFile() && vcf.getName().endsWith(".vcf")) { + byte[] data = java.nio.file.Files.readAllBytes(vcf.toPath()); + fos.write(data); + // Ensure each vCard ends with a newline separator + if (data.length > 0 && data[data.length - 1] != '\n') { + fos.write('\n'); + } + } + } + // Remove the now-merged individual VCF directory + cleanDirectory(child); + child.delete(); + } + } + } + System.out.println(" Merged VCF written: " + combinedVcf.getName()); + } + + private static void zipDirectory(File dir, String zipFilePath) throws Exception { + try (FileOutputStream fos = new FileOutputStream(zipFilePath); + ZipOutputStream zos = new ZipOutputStream(fos)) { + zipFolder(dir, dir, zos); + } + } + + private static void zipFolder(File rootDir, File currentDir, ZipOutputStream zos) throws Exception { + File[] files = currentDir.listFiles(); + if (files != null) { + byte[] buffer = new byte[8192]; + for (File file : files) { + if (file.isDirectory()) { + zipFolder(rootDir, file, zos); + } else { + String relativePath = rootDir.toURI().relativize(file.toURI()).getPath(); + try (FileInputStream fis = new FileInputStream(file)) { + ZipEntry ze = new ZipEntry(relativePath); + zos.putNextEntry(ze); + int len; + while ((len = fis.read(buffer)) > 0) { + zos.write(buffer, 0, len); + } + zos.closeEntry(); + } + } + } + } + } + + private static void cleanDirectory(File dir) { + File[] files = dir.listFiles(); + if (files != null) { + for (File file : files) { + if (file.isDirectory()) { + cleanDirectory(file); + } + file.delete(); + } + } + } +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a591878 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +# ───────────────────────────────────────────────────────────────────────────── +# OST to PST Converter +# Base: Eclipse Temurin 21 JRE (Debian Bookworm slim) + Node.js 22 LTS +# ───────────────────────────────────────────────────────────────────────────── +FROM eclipse-temurin:21-jre-bookworm + +LABEL maintainer="OST2PST Converter" +LABEL description="Converts Outlook OST files to PST or MBOX format via a web UI" + +# ── Install Node.js 22 via NodeSource ──────────────────────────────────────── +RUN apt-get update && apt-get install -y curl ca-certificates --no-install-recommends \ + && curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \ + && apt-get install -y nodejs --no-install-recommends \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +# ── App directory ───────────────────────────────────────────────────────────── +WORKDIR /app + +# ── Install Node dependencies first (better layer caching) ──────────────────── +COPY package.json package-lock.json ./ +RUN npm ci --omit=dev + +# ── Copy application files ──────────────────────────────────────────────────── +COPY server.js Convert.java aspose-email-24.12-jdk16.jar ./ +COPY public/ ./public/ + +# ── Create runtime directories ──────────────────────────────────────────────── +RUN mkdir -p uploads converted + +# ── Expose web UI port ──────────────────────────────────────────────────────── +EXPOSE 3000 + +# ── Health check ────────────────────────────────────────────────────────────── +HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ + CMD curl -f http://localhost:3000 || exit 1 + +# ── Start server ────────────────────────────────────────────────────────────── +CMD ["node", "server.js"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..32d4de0 --- /dev/null +++ b/README.md @@ -0,0 +1,193 @@ +# OST to PST / MBOX Converter + +A self-contained web app that converts Outlook `.ost` files to **PST** or **MBOX (ZIP)** format, +including contacts as vCard `.vcf` files. Runs entirely locally — no cloud, no data leaves your machine. + +Supports **linux/amd64** (x86 servers, most PCs) and **linux/arm64** (Apple M-series, Raspberry Pi, AWS Graviton). + +--- + +## 🚀 Quickest start — pull from Docker Hub + +```bash +# Pull and run (no source code needed) +docker run -d \ + --name ost2pst \ + -p 3000:3000 \ + -v $(pwd)/converted:/app/converted \ + yourname/ost2pst:latest + +# Open in browser +open http://localhost:3000 +``` + +Or with Compose (just a `docker-compose.yml` file needed): +```bash +DOCKER_IMAGE=yourname/ost2pst:latest docker compose up -d +``` + +--- + +## 📤 Publishing to Docker Hub (multi-arch) + +### Option A — Local build & push (one-time or on-demand) +```bash +chmod +x build-multiarch.sh +./build-multiarch.sh yourDockerHubUsername # pushes :latest +./build-multiarch.sh yourDockerHubUsername v1.0.0 # pushes :v1.0.0 + :latest +``` +This uses `docker buildx` to build native `amd64` and `arm64` layers simultaneously and push a multi-arch manifest to Hub. + +### Option B — Automated via GitHub Actions (CI/CD) +1. Push this repo to GitHub. +2. Go to **Settings → Secrets and variables → Actions** and add: + - `DOCKERHUB_USERNAME` — your Docker Hub username + - `DOCKERHUB_TOKEN` — a Docker Hub [access token](https://hub.docker.com/settings/security) +3. Every push to `main` publishes `:latest`; every `v*.*.*` tag also publishes versioned tags. + +--- + +## Requirements + +| Method | What you need | +|---|---| +| **Docker (recommended)** | [Docker Desktop](https://www.docker.com/products/docker-desktop/) or Docker Engine | +| **Raw Node.js** | Node.js ≥ 18, Java JRE ≥ 11 | + +--- + +## 🐳 Option A — Docker (recommended, zero setup) + +Everything — Java, Node.js, and the Aspose library — is bundled inside the image. + +### One-liner (uses `run.sh`) +```bash +./run.sh +``` +Then open **http://localhost:3000** in your browser. + +Converted files are saved to `./converted/` on your host automatically. + +--- + +### With Docker Compose +```bash +# Build & start +docker compose up -d --build + +# Open the app +open http://localhost:3000 # macOS +xdg-open http://localhost:3000 # Linux + +# Stop +docker compose down +``` + +--- + +### Plain Docker commands +```bash +# Build +docker build -t ost2pst:latest . + +# Run +docker run -d \ + --name ost2pst \ + -p 3000:3000 \ + -v $(pwd)/converted:/app/converted \ + ost2pst:latest + +# Stop +docker stop ost2pst && docker rm ost2pst +``` + +--- + +### Change the port +```bash +PORT=8080 ./run.sh +# or +docker run -d -p 8080:3000 -v $(pwd)/converted:/app/converted ost2pst:latest +``` + +--- + +## ⚙️ Option B — Run directly with Node.js + Java + +Use this if you already have Node.js and a Java JRE installed locally. + +```bash +# Install Node dependencies +npm install + +# Start the server +node server.js +``` + +Open **http://localhost:3000**. + +**Requirements:** +- Node.js ≥ 18 +- Java JRE ≥ 11 (`java` must be on `$PATH`) +- The file `aspose-email-24.12-jdk16.jar` must be in the project root (already included) + +--- + +## 📦 Distributing to another machine + +To move the whole app: + +```bash +# On the source machine — package everything +tar -czf ost2pst.tar.gz \ + Dockerfile docker-compose.yml run.sh \ + server.js Convert.java package.json package-lock.json \ + aspose-email-24.12-jdk16.jar public/ + +# On the target machine +tar -xzf ost2pst.tar.gz +cd ost2pst +./run.sh # or: docker compose up -d --build +``` + +Or share the Docker image directly: +```bash +# Save image to a file +docker save ost2pst:latest | gzip > ost2pst-image.tar.gz + +# Load on another machine (no build needed) +docker load < ost2pst-image.tar.gz +docker run -d -p 3000:3000 -v $(pwd)/converted:/app/converted ost2pst:latest +``` + +--- + +## How it works + +| Format | Output | Use case | +|---|---|---| +| **PST** | `.pst` file | Direct import into Outlook; Google Workspace migration via GWMMO | +| **MBOX (ZIP)** | `.zip` with `.mbox` files + `.vcf` contacts | Thunderbird, Apple Mail, or Gmail import | +| **MBOX + Merged VCF** | `.zip` with a single `contacts.vcf` | Drag-and-drop import into [contacts.google.com](https://contacts.google.com) | + +Conversions run entirely in-process using the [Aspose.Email for Java](https://products.aspose.com/email/java/) library. +No data is sent to any external server. + +--- + +## Project structure + +``` +ost2pst/ +├── Dockerfile # Container definition +├── docker-compose.yml # Compose config +├── run.sh # One-command launcher +├── server.js # Express backend + SSE streaming +├── Convert.java # Java conversion engine +├── aspose-email-24.12-jdk16.jar # Aspose library (bundled) +├── package.json +└── public/ + ├── index.html + ├── style.css + └── app.js +``` diff --git a/aspose-email-24.12-jdk16.jar b/aspose-email-24.12-jdk16.jar new file mode 100644 index 0000000..d8d20d3 Binary files /dev/null and b/aspose-email-24.12-jdk16.jar differ diff --git a/build-multiarch.sh b/build-multiarch.sh new file mode 100755 index 0000000..cdc1087 --- /dev/null +++ b/build-multiarch.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash +# build-multiarch.sh +# Builds and pushes a multi-arch Docker image (linux/amd64 + linux/arm64) +# directly from your local machine. +# +# Usage: +# ./build-multiarch.sh yourDockerHubUsername +# ./build-multiarch.sh yourDockerHubUsername v1.2.0 +# +set -euo pipefail + +DOCKERHUB_USER="${1:-}" +VERSION_TAG="${2:-latest}" + +if [[ -z "$DOCKERHUB_USER" ]]; then + echo "❌ Usage: $0 [version-tag]" + echo " Example: $0 myname v1.0.0" + exit 1 +fi + +IMAGE="${DOCKERHUB_USER}/ost2pst" +BUILDER="ost2pst-multiarch" + +echo "▶ Image : ${IMAGE}:${VERSION_TAG}" +echo "▶ Arches : linux/amd64, linux/arm64" +echo "" + +# ── Ensure a buildx builder with multi-arch support exists ────────────────── +if ! docker buildx inspect "$BUILDER" &>/dev/null; then + echo "Creating buildx builder '${BUILDER}'..." + docker buildx create --name "$BUILDER" --driver docker-container --bootstrap +fi +docker buildx use "$BUILDER" + +# ── Log in ─────────────────────────────────────────────────────────────────── +echo "Logging in to Docker Hub as ${DOCKERHUB_USER}..." +docker login --username "$DOCKERHUB_USER" + +# ── Build & push ───────────────────────────────────────────────────────────── +TAGS="-t ${IMAGE}:${VERSION_TAG}" +if [[ "$VERSION_TAG" != "latest" ]]; then + TAGS="$TAGS -t ${IMAGE}:latest" +fi + +echo "" +echo "Building and pushing (this may take a few minutes)..." +# shellcheck disable=SC2086 +docker buildx build \ + --platform linux/amd64,linux/arm64 \ + $TAGS \ + --push \ + . + +echo "" +echo "✅ Done!" +echo " Image pushed: ${IMAGE}:${VERSION_TAG}" +[[ "$VERSION_TAG" != "latest" ]] && echo " Also tagged: ${IMAGE}:latest" +echo "" +echo " Pull anywhere:" +echo " docker pull ${IMAGE}:${VERSION_TAG}" +echo " docker run -d -p 3000:3000 -v \$(pwd)/converted:/app/converted ${IMAGE}:${VERSION_TAG}" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c004ac7 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +services: + ost2pst: + # Use DOCKER_IMAGE env var to pull from Hub, or default to local build. + # Example: DOCKER_IMAGE=yourname/ost2pst:latest docker compose up -d + image: ${DOCKER_IMAGE:-ost2pst:latest} + build: + context: . + # Only used when building locally — skipped if image is pulled from Hub + container_name: ost2pst + ports: + - "${PORT:-3000}:3000" + volumes: + # Converted files land here on your host — easy access without docker cp + - ./converted:/app/converted + restart: unless-stopped + environment: + - NODE_ENV=production diff --git a/ost2pst.jar b/ost2pst.jar new file mode 100644 index 0000000..0ef713e Binary files /dev/null and b/ost2pst.jar differ diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..a8d02f7 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,999 @@ +{ + "name": "ost2pst-converter", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "ost2pst-converter", + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "express": "^4.19.2", + "multer": "^1.4.5-lts.1" + } + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "license": "MIT", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/append-field": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", + "integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==", + "license": "MIT" + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "license": "MIT" + }, + "node_modules/body-parser": { + "version": "1.20.5", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.5.tgz", + "integrity": "sha512-3grm+/2tUOvu2cjJkvsIxrv/wVpfXQW4PsQHYm7yk4vfpu7Ekl6nEsYBoJUL6qDwZUx8wUhQ8tR2qz+ad9c9OA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "~1.2.0", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "on-finished": "~2.4.1", + "qs": "~6.15.1", + "raw-body": "~2.5.3", + "type-is": "~1.6.18", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "license": "MIT" + }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "engines": [ + "node >= 0.8" + ], + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz", + "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==", + "license": "MIT" + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "license": "MIT" + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "license": "MIT", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "4.22.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.22.2.tgz", + "integrity": "sha512-IuL+Elrou2ZvCFHs18/CIzy2Nzvo25nZ1/D2eIZlz7c+QUayAcYoiM2BthCjs+EBHVpjYjcuLDAiCWgeIX3X1Q==", + "license": "MIT", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "~1.20.5", + "content-disposition": "~0.5.4", + "content-type": "~1.0.4", + "cookie": "~0.7.1", + "cookie-signature": "~1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "~1.3.1", + "fresh": "~0.5.2", + "http-errors": "~2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "~2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "~0.1.12", + "proxy-addr": "~2.0.7", + "qs": "~6.15.1", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "~0.19.0", + "serve-static": "~1.16.2", + "setprototypeof": "1.2.0", + "statuses": "~2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/finalhandler": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz", + "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "~2.4.1", + "parseurl": "~1.3.3", + "statuses": "~2.0.2", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.3.tgz", + "integrity": "sha512-ej4AhfhfL2Q2zpMmLo7U1Uv9+PyhIZpgQLGT1F9miIGmiCJIoCgSmczFdrc97mWT4kVY72KA+WnnhJ5pghSvSg==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "license": "MIT" + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, + "node_modules/multer": { + "version": "1.4.5-lts.2", + "resolved": "https://registry.npmjs.org/multer/-/multer-1.4.5-lts.2.tgz", + "integrity": "sha512-VzGiVigcG9zUAoCNU+xShztrlr1auZOlurXynNvO9GiWD1/mTBbUljOKY+qMeazBqXgRnjzeEgJI/wyjJUHg9A==", + "deprecated": "Multer 1.x is impacted by a number of vulnerabilities, which have been patched in 2.x. You should upgrade to the latest 2.x version.", + "license": "MIT", + "dependencies": { + "append-field": "^1.0.0", + "busboy": "^1.0.0", + "concat-stream": "^1.5.2", + "mkdirp": "^0.5.4", + "object-assign": "^4.1.1", + "type-is": "^1.6.4", + "xtend": "^4.0.0" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz", + "integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==", + "license": "MIT" + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "license": "MIT" + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.15.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.2.tgz", + "integrity": "sha512-Rzq0KEyX/w/tEybncDgdkZrJgVUsUMk3xjh3t5bv3S1HTAtg+uOYt72+ZfwiQwKdysThkTBdL/rTi6HDmX9Ddw==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz", + "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/send": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz", + "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "~0.5.2", + "http-errors": "~2.0.1", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "~2.4.1", + "range-parser": "~1.2.1", + "statuses": "~2.0.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/serve-static": { + "version": "1.16.3", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz", + "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==", + "license": "MIT", + "dependencies": { + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "~0.19.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz", + "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", + "license": "MIT" + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..c1c3e28 --- /dev/null +++ b/package.json @@ -0,0 +1,16 @@ +{ + "name": "ost2pst-converter", + "version": "1.0.0", + "description": "Outlook OST to PST converter local web utility", + "main": "server.js", + "scripts": { + "start": "node server.js", + "dev": "node server.js" + }, + "dependencies": { + "express": "^4.19.2", + "multer": "^1.4.5-lts.1" + }, + "author": "Antigravity", + "license": "MIT" +} diff --git a/public/app.js b/public/app.js new file mode 100644 index 0000000..9b164d9 --- /dev/null +++ b/public/app.js @@ -0,0 +1,280 @@ +document.addEventListener('DOMContentLoaded', () => { + const dropZone = document.getElementById('drop-zone'); + const fileInput = document.getElementById('file-input'); + const fileDetails = document.getElementById('file-details'); + const fileNameEl = document.getElementById('file-name'); + const fileSizeEl = document.getElementById('file-size'); + const btnCancelFile = document.getElementById('btn-cancel-file'); + const btnConvert = document.getElementById('btn-convert'); + + const progressContainer = document.getElementById('progress-container'); + const progressStatus = document.getElementById('progress-status'); + const progressPercentage = document.getElementById('progress-percentage'); + const progressBarFill = document.getElementById('progress-bar-fill'); + + const terminalContainer = document.getElementById('terminal-container'); + const terminalLogs = document.getElementById('terminal-logs'); + + const successContainer = document.getElementById('success-container'); + const outFileNameEl = document.getElementById('out-file-name'); + const btnDownload = document.getElementById('btn-download'); + const btnReset = document.getElementById('btn-reset'); + + let selectedFile = null; + let eventSource = null; + + // Helper: format bytes to human readable format + function formatBytes(bytes, decimals = 2) { + if (bytes === 0) return '0 Bytes'; + const k = 1024; + const dm = decimals < 0 ? 0 : decimals; + const sizes = ['Bytes', 'KB', 'MB', 'GB']; + const i = Math.floor(Math.log(bytes) / Math.log(k)); + return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; + } + + // Handle Drag & Drop events + ['dragenter', 'dragover'].forEach(eventName => { + dropZone.addEventListener(eventName, (e) => { + e.preventDefault(); + dropZone.classList.add('dragover'); + }, false); + }); + + ['dragleave', 'drop'].forEach(eventName => { + dropZone.addEventListener(eventName, (e) => { + e.preventDefault(); + dropZone.classList.remove('dragover'); + }, false); + }); + + dropZone.addEventListener('drop', (e) => { + const dt = e.dataTransfer; + const files = dt.files; + if (files.length > 0) { + handleFileSelection(files[0]); + } + }); + + fileInput.addEventListener('change', (e) => { + if (fileInput.files.length > 0) { + handleFileSelection(fileInput.files[0]); + } + }); + + function handleFileSelection(file) { + if (!file.name.toLowerCase().endsWith('.ost')) { + alert('Please select an Outlook OST file (.ost).'); + return; + } + selectedFile = file; + fileNameEl.textContent = file.name; + fileSizeEl.textContent = formatBytes(file.size); + + dropZone.classList.add('hidden'); + fileDetails.classList.remove('hidden'); + } + + btnCancelFile.addEventListener('click', () => { + resetUI(); + }); + + // Reset UI to initial state + function resetUI() { + selectedFile = null; + fileInput.value = ''; + if (eventSource) { + eventSource.close(); + eventSource = null; + } + + dropZone.classList.remove('hidden'); + fileDetails.classList.add('hidden'); + progressContainer.classList.add('hidden'); + successContainer.classList.add('hidden'); + document.getElementById('summary-card').classList.add('hidden'); + + progressBarFill.style.width = '0%'; + progressPercentage.textContent = '0%'; + terminalLogs.innerHTML = '
Waiting for process start...
'; + } + + // Show/hide the combine-VCF sub-option based on selected format + const vcfCombineWrap = document.getElementById('vcf-combine-wrap'); + document.querySelectorAll('input[name="output-format"]').forEach(radio => { + radio.addEventListener('change', () => { + if (radio.value === 'mbox' && radio.checked) { + vcfCombineWrap.classList.remove('hidden'); + } else { + vcfCombineWrap.classList.add('hidden'); + document.getElementById('combine-vcf').checked = false; + } + }); + }); + + // Convert button click handler + btnConvert.addEventListener('click', () => { + if (!selectedFile) return; + + // Update UI states + fileDetails.classList.add('hidden'); + progressContainer.classList.remove('hidden'); + progressStatus.textContent = 'Uploading OST file to local server...'; + + // Start file upload + uploadFile(selectedFile); + }); + + function uploadFile(file) { + const xhr = new XMLHttpRequest(); + const formData = new FormData(); + formData.append('ostFile', file); + + const selectedFormat = document.querySelector('input[name="output-format"]:checked').value; + formData.append('format', selectedFormat); + + const combineVcf = document.getElementById('combine-vcf').checked; + formData.append('combineVcf', combineVcf ? 'true' : 'false'); + // Upload progress listener + xhr.upload.addEventListener('progress', (e) => { + if (e.lengthComputable) { + const percentComplete = Math.round((e.loaded / e.total) * 100); + progressBarFill.style.width = percentComplete + '%'; + progressPercentage.textContent = percentComplete + '%'; + } + }); + + xhr.onload = () => { + if (xhr.status === 200) { + const response = JSON.parse(xhr.responseText); + startStream(response.taskId); + } else { + showError('Upload failed: ' + (xhr.statusText || 'Server error')); + } + }; + + xhr.onerror = () => { + showError('Network error occurred during upload.'); + }; + + xhr.open('POST', '/api/upload', true); + xhr.send(formData); + } + + function startStream(taskId) { + progressStatus.textContent = 'Converting OST to PST (processing folders)...'; + progressBarFill.style.width = '100%'; + progressPercentage.textContent = 'Running'; + // Terminal is always visible in the right column — no toggle needed + + eventSource = new EventSource(`/api/stream/${taskId}`); + + eventSource.onmessage = (event) => { + const data = JSON.parse(event.data); + + if (data.status === 'starting') { + appendLog(data.message, 'system'); + } else if (data.status === 'running') { + const log = data.log; + // Filter out Java compiler noise (deprecation warnings, caret markers, raw code lines) + if (log.trim() === '^' || + /^\s+\w.*new MboxrdStorageWriter/.test(log) || + /\.java:\d+: warning:/.test(log) || + /\d+ warning/.test(log)) { + return; // Silently drop compiler noise + } + // Style warnings/errors/successes + let type = ''; + if (log.toLowerCase().includes('warning') || log.toLowerCase().includes('skipping')) type = 'warning'; + else if (log.toLowerCase().includes('error')) type = 'error'; + else if (log.toLowerCase().includes('success') || log.toLowerCase().includes('completed')) type = 'system'; + appendLog(log, type); + } else if (data.status === 'completed') { + eventSource.close(); + showSuccess(data.fileName, data.downloadUrl, data.summary); + } else if (data.status === 'failed') { + eventSource.close(); + showError(data.error); + } + }; + + eventSource.onerror = (err) => { + console.error('SSE Error:', err); + eventSource.close(); + showError('Lost connection to conversion engine.'); + }; + } + + function appendLog(message, type = '') { + const logLine = document.createElement('div'); + logLine.className = 'log-line'; + if (type) logLine.classList.add(type); + logLine.textContent = message; + terminalLogs.appendChild(logLine); + + // Auto-scroll to bottom of logs + terminalLogs.scrollTop = terminalLogs.scrollHeight; + } + + function showSuccess(fileName, downloadUrl, summary) { + progressContainer.classList.add('hidden'); + // Keep terminal logs visible so the user can inspect completion states/warnings + successContainer.classList.remove('hidden'); + + outFileNameEl.textContent = fileName; + btnDownload.href = downloadUrl; + btnDownload.setAttribute('download', fileName); + + const isMbox = fileName.endsWith('.zip'); + btnDownload.textContent = isMbox ? 'Download MBOX ZIP Archive' : 'Download PST File'; + + const summaryCard = document.getElementById('summary-card'); + const summaryFoldersCount = document.getElementById('summary-folders-count'); + const summaryMessagesCount = document.getElementById('summary-messages-count'); + const summaryDuration = document.getElementById('summary-duration'); + const summaryTableBody = document.getElementById('summary-table-body'); + + if (summary) { + summaryCard.classList.remove('hidden'); + summaryFoldersCount.textContent = summary.folders ? summary.folders.length : 0; + summaryMessagesCount.textContent = summary.totalMessages || 0; + summaryDuration.textContent = (summary.duration || 0).toFixed(1) + 's'; + + summaryTableBody.innerHTML = ''; + if (summary.folders && summary.folders.length > 0) { + summary.folders.forEach(f => { + const row = document.createElement('tr'); + row.innerHTML = ` + ${escapeHtml(f.folder)} + ${f.messages} + `; + summaryTableBody.appendChild(row); + }); + } else { + summaryTableBody.innerHTML = `No folders containing emails were converted.`; + } + } else { + summaryCard.classList.add('hidden'); + } + } + + function escapeHtml(unsafe) { + return unsafe + .replace(/&/g, "&") + .replace(//g, ">") + .replace(/"/g, """) + .replace(/'/g, "'"); + } + + function showError(errorMessage) { + progressStatus.textContent = 'Error'; + progressPercentage.textContent = 'Failed'; + progressBarFill.style.backgroundColor = 'var(--error-color)'; + appendLog(`[ERROR] ${errorMessage}`, 'error'); + } + + btnReset.addEventListener('click', () => { + resetUI(); + }); +}); diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..f72a1b3 --- /dev/null +++ b/public/index.html @@ -0,0 +1,179 @@ + + + + + + OST to PST Converter + + + + + + + +
+
+
+
+
+ +
+
+
+ +

OST to PST

+
+

Convert Microsoft Outlook Offline Storage files (.ost) into Personal Storage files (.pst) locally and securely.

+
+ +
+ +
+
+

File Conversion

+ Local Engine +
+ + +
+ +
+
📁
+

Drag & Drop your OST file

+

or browse files

+

Maximum size: 1 GB

+
+
+ + + + + + + + + +
+ + +
+
+
+
+ + + +
+ Conversion Log +
+
+
Waiting for process start...
+
+
+
+
+ +
+

OST to PST Converter • Local Web Utility

+
+
+ + + diff --git a/public/style.css b/public/style.css new file mode 100644 index 0000000..ddb7731 --- /dev/null +++ b/public/style.css @@ -0,0 +1,834 @@ +/* CSS Variable definitions for global design consistency */ +:root { + --bg-dark: #0a0b0d; + --card-bg: rgba(20, 22, 28, 0.65); + --card-border: rgba(255, 255, 255, 0.08); + --text-primary: #f3f4f6; + --text-secondary: #9ca3af; + --accent-color: #8b5cf6; /* Purple */ + --accent-glow: rgba(139, 92, 246, 0.45); + --cyan-glow: rgba(6, 182, 212, 0.45); + --success-color: #10b981; /* Green */ + --success-glow: rgba(16, 185, 129, 0.35); + --error-color: #ef4444; + --terminal-bg: rgba(7, 8, 12, 0.9); +} + +* { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +body { + background-color: var(--bg-dark); + color: var(--text-primary); + font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; + min-height: 100vh; + display: flex; + justify-content: center; + position: relative; + overflow-x: hidden; +} + +/* Background gradient blobs */ +.background-decor { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: -1; + overflow: hidden; + pointer-events: none; +} + +.orb { + position: absolute; + border-radius: 50%; + filter: blur(120px); + opacity: 0.15; + animation: orb-bounce 25s infinite alternate ease-in-out; +} + +.orb-1 { + top: -10%; + left: -10%; + width: 50vw; + height: 50vw; + background: radial-gradient(circle, var(--accent-color) 0%, rgba(0,0,0,0) 70%); +} + +.orb-2 { + bottom: -10%; + right: -10%; + width: 60vw; + height: 60vw; + background: radial-gradient(circle, #06b6d4 0%, rgba(0,0,0,0) 70%); /* Cyan */ + animation-delay: -5s; +} + +.orb-3 { + top: 30%; + right: 20%; + width: 40vw; + height: 40vw; + background: radial-gradient(circle, #ec4899 0%, rgba(0,0,0,0) 70%); /* Pink */ + animation-delay: -10s; +} + +@keyframes orb-bounce { + 0% { transform: translate(0, 0) scale(1); } + 100% { transform: translate(8%, 10%) scale(1.15); } +} + +/* Container */ +.container { + width: 100%; + max-width: 1100px; + padding: 40px 20px; + display: flex; + flex-direction: column; + gap: 40px; +} + +/* Header */ +header { + text-align: center; + margin-bottom: 10px; +} + +.logo-area { + display: inline-flex; + align-items: center; + gap: 15px; + margin-bottom: 15px; +} + +.logo-icon { + font-size: 2.5rem; + background: linear-gradient(135deg, #06b6d4, var(--accent-color)); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + font-weight: 800; +} + +header h1 { + font-size: 2.8rem; + font-weight: 800; + letter-spacing: -0.03em; + background: linear-gradient(to right, #ffffff, #d1d5db); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; +} + +header h1 span { + font-weight: 300; + color: var(--text-secondary); + background: none; + -webkit-text-fill-color: initial; +} + +.subtitle { + color: var(--text-secondary); + font-size: 1.15rem; + max-width: 600px; + margin: 0 auto; + font-weight: 300; + line-height: 1.6; +} + +/* Layout — converter left, log right */ +main { + display: grid; + grid-template-columns: 2fr 1.2fr; + gap: 30px; + align-items: start; +} + +/* Right column: log sticks to top and fills height */ +.log-column { + position: sticky; + top: 30px; +} + +.log-column .terminal-container { + /* Always visible — not toggled hidden in this layout */ + height: 100%; + min-height: 480px; + max-height: calc(100vh - 120px); + display: flex; + flex-direction: column; +} + +.log-column .terminal-body { + flex: 1; + overflow-y: auto; +} + +@media (max-width: 900px) { + main { + grid-template-columns: 1fr; + } + .log-column { + position: static; + } + .log-column .terminal-container { + min-height: 280px; + max-height: 400px; + } +} + +/* Cards & Glassmorphism */ +.glass { + background: var(--card-bg); + border: 1px solid var(--card-border); + backdrop-filter: blur(16px); + -webkit-backdrop-filter: blur(16px); + border-radius: 20px; + box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3); +} + +.card { + padding: 35px; + display: flex; + flex-direction: column; + gap: 25px; +} + +.card-header { + display: flex; + justify-content: space-between; + align-items: center; + border-bottom: 1px solid rgba(255, 255, 255, 0.05); + padding-bottom: 15px; +} + +.card-header h2, .card-header h3 { + font-size: 1.4rem; + font-weight: 600; +} + +.badge { + background: rgba(139, 92, 246, 0.15); + border: 1px solid rgba(139, 92, 246, 0.3); + color: #a78bfa; + padding: 4px 10px; + border-radius: 99px; + font-size: 0.75rem; + font-weight: 600; + letter-spacing: 0.05em; + text-transform: uppercase; +} + +.badge-accent { + background: rgba(6, 182, 212, 0.15); + border: 1px solid rgba(6, 182, 212, 0.3); + color: #22d3ee; +} + +/* Drop Zone */ +.drop-zone { + border: 2px dashed rgba(255, 255, 255, 0.15); + border-radius: 16px; + padding: 45px 20px; + text-align: center; + position: relative; + cursor: pointer; + background: rgba(255, 255, 255, 0.02); + transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); +} + +.drop-zone:hover, .drop-zone.dragover { + border-color: var(--accent-color); + background: rgba(139, 92, 246, 0.04); + box-shadow: 0 0 20px var(--accent-glow); +} + +.drop-zone.dragover { + transform: scale(0.99); +} + +.file-input { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + opacity: 0; + cursor: pointer; +} + +.drop-zone-content { + display: flex; + flex-direction: column; + align-items: center; + gap: 12px; + pointer-events: none; +} + +.upload-icon { + font-size: 3rem; + filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.1)); + margin-bottom: 5px; + transition: transform 0.3s ease; +} + +.drop-zone:hover .upload-icon { + transform: translateY(-5px); +} + +.drop-zone-content h3 { + font-size: 1.2rem; + font-weight: 600; +} + +.browse-link { + color: var(--accent-color); + text-decoration: underline; + font-weight: 600; +} + +.file-limit { + color: var(--text-secondary); + font-size: 0.8rem; +} + +/* Selected File Details */ +.file-details { + display: flex; + flex-direction: column; + gap: 20px; + padding: 20px; + background: rgba(255, 255, 255, 0.03); + border: 1px solid rgba(255, 255, 255, 0.05); + border-radius: 12px; + transition: all 0.3s ease; +} + +.file-info-header { + display: flex; + align-items: center; + gap: 15px; +} + +.file-icon { + font-size: 2.2rem; +} + +.file-meta { + flex-grow: 1; + overflow: hidden; +} + +.file-meta h4 { + font-size: 1rem; + font-weight: 600; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} + +.file-meta p { + color: var(--text-secondary); + font-size: 0.85rem; +} + +/* Buttons */ +.btn { + display: inline-flex; + align-items: center; + justify-content: center; + padding: 14px 28px; + border-radius: 12px; + font-weight: 600; + font-size: 1rem; + cursor: pointer; + transition: all 0.25s ease; + border: none; + outline: none; + text-decoration: none; + text-align: center; +} + +.btn-primary { + background: linear-gradient(135deg, var(--accent-color) 0%, #7c3aed 100%); + color: white; + box-shadow: 0 4px 15px var(--accent-glow); +} + +.btn-primary:hover { + transform: translateY(-2px); + box-shadow: 0 6px 20px var(--accent-glow); +} + +.btn-primary:active { + transform: translateY(0); +} + +.btn-success { + background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%); + color: white; + box-shadow: 0 4px 15px var(--success-glow); +} + +.btn-success:hover { + transform: translateY(-2px); + box-shadow: 0 6px 20px var(--success-glow); +} + +.btn-secondary { + background: rgba(255, 255, 255, 0.05); + color: var(--text-primary); + border: 1px solid rgba(255, 255, 255, 0.08); +} + +.btn-secondary:hover { + background: rgba(255, 255, 255, 0.1); +} + +.btn-close { + background: transparent; + color: var(--text-secondary); + padding: 8px; + font-size: 1.1rem; + border-radius: 50%; +} + +.btn-close:hover { + background: rgba(255, 255, 255, 0.08); + color: white; +} + +.btn-block { + width: 100%; +} + +/* Progress Section */ +.progress-container { + display: flex; + flex-direction: column; + gap: 10px; + padding: 10px 0; +} + +.progress-header { + display: flex; + justify-content: space-between; + font-size: 0.9rem; + font-weight: 600; +} + +.progress-bar-bg { + width: 100%; + height: 8px; + background: rgba(255, 255, 255, 0.06); + border-radius: 99px; + overflow: hidden; +} + +.progress-bar-fill { + height: 100%; + width: 0%; + background: linear-gradient(to right, #06b6d4, var(--accent-color)); + border-radius: 99px; + transition: width 0.2s ease; +} + +/* Terminal Log */ +.terminal-container { + border-radius: 12px; + overflow: hidden; + border: 1px solid rgba(255, 255, 255, 0.06); + box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); +} + +.terminal-header { + background: rgba(25, 27, 36, 0.85); + padding: 12px 16px; + display: flex; + align-items: center; + gap: 15px; + border-bottom: 1px solid rgba(255, 255, 255, 0.05); +} + +.terminal-dots { + display: flex; + gap: 6px; +} + +.dot { + width: 10px; + height: 10px; + border-radius: 50%; +} + +.dot.red { background-color: #ef4444; } +.dot.yellow { background-color: #f59e0b; } +.dot.green { background-color: #10b981; } + +.terminal-title { + font-family: 'JetBrains Mono', monospace; + font-size: 0.75rem; + color: var(--text-secondary); + text-transform: uppercase; + letter-spacing: 0.05em; +} + +.terminal-body { + background-color: var(--terminal-bg); + padding: 20px; + height: 200px; + overflow-y: auto; + font-family: 'JetBrains Mono', monospace; + font-size: 0.85rem; + line-height: 1.5; + color: #34d399; /* Green text */ + display: flex; + flex-direction: column; + gap: 6px; + scroll-behavior: smooth; +} + +.log-line.system { + color: #60a5fa; /* Blue */ +} + +.log-line.warning { + color: #fbbf24; /* Amber */ +} + +.log-line.error { + color: #f87171; /* Red */ +} + +/* Success Container */ +.success-container { + display: flex; + flex-direction: column; + align-items: center; + gap: 20px; + text-align: center; + padding: 10px 0; +} + +.success-icon { + width: 60px; + height: 60px; + background: rgba(16, 185, 129, 0.1); + border: 2px solid var(--success-color); + border-radius: 50%; + color: var(--success-color); + display: flex; + align-items: center; + justify-content: center; + font-size: 1.8rem; + font-weight: 800; + box-shadow: 0 0 15px var(--success-glow); + animation: success-pulse 2s infinite; +} + +@keyframes success-pulse { + 0% { transform: scale(1); } + 50% { transform: scale(1.05); } + 100% { transform: scale(1); } +} + +.success-message { + color: var(--text-secondary); + font-size: 0.95rem; + margin-top: -10px; +} + +.output-file-card { + display: flex; + align-items: center; + gap: 15px; + padding: 15px 20px; + background: rgba(16, 185, 129, 0.05); + border: 1px solid rgba(16, 185, 129, 0.15); + border-radius: 12px; + width: 100%; +} + +.ready-badge { + color: var(--success-color) !important; + font-weight: 600; +} + +/* Sidebar styling */ +.sidebar { + display: flex; + flex-direction: column; + gap: 30px; +} + +.code-block { + background: rgba(0, 0, 0, 0.4); + border: 1px solid rgba(255, 255, 255, 0.05); + border-radius: 10px; + padding: 15px; + overflow-x: auto; + font-family: 'JetBrains Mono', monospace; + font-size: 0.8rem; + color: #e5e7eb; +} + +.code-block pre { + margin: 0; +} + +.info-list { + list-style: none; + display: flex; + flex-direction: column; + gap: 20px; +} + +.info-title { + font-size: 0.95rem; + font-weight: 600; + display: block; + margin-bottom: 5px; + color: var(--text-primary); +} + +.info-list p { + font-size: 0.85rem; + color: var(--text-secondary); + line-height: 1.5; +} + +/* Footer */ +footer { + text-align: center; + color: var(--text-secondary); + font-size: 0.8rem; + margin-top: 10px; + border-top: 1px solid rgba(255, 255, 255, 0.05); + padding-top: 20px; +} + +/* Summary Card Details */ +.summary-card { + width: 100%; + background: rgba(255, 255, 255, 0.02); + border: 1px solid rgba(255, 255, 255, 0.05); + border-radius: 12px; + padding: 20px; + text-align: left; + display: flex; + flex-direction: column; + gap: 15px; +} + +.summary-card h4 { + font-size: 1rem; + font-weight: 600; + color: var(--text-primary); + border-bottom: 1px solid rgba(255, 255, 255, 0.05); + padding-bottom: 8px; +} + +.summary-metrics { + display: flex; + justify-content: space-between; + gap: 15px; +} + +.metric { + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + background: rgba(255, 255, 255, 0.02); + border: 1px solid rgba(255, 255, 255, 0.03); + border-radius: 8px; + padding: 10px 5px; +} + +.metric-label { + font-size: 0.75rem; + color: var(--text-secondary); + text-transform: uppercase; + letter-spacing: 0.05em; + margin-bottom: 4px; +} + +.metric-value { + font-size: 1.25rem; + font-weight: 800; + background: linear-gradient(135deg, #06b6d4, var(--accent-color)); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; +} + +.summary-table-container { + max-height: 200px; + overflow-y: auto; + border: 1px solid rgba(255, 255, 255, 0.05); + border-radius: 8px; + background: rgba(0, 0, 0, 0.2); +} + +.summary-table { + width: 100%; + border-collapse: collapse; + font-size: 0.85rem; + color: var(--text-primary); +} + +.summary-table th, .summary-table td { + padding: 10px 12px; + text-align: left; +} + +.summary-table th { + background: rgba(255, 255, 255, 0.03); + color: var(--text-secondary); + font-weight: 600; + position: sticky; + top: 0; + border-bottom: 1px solid rgba(255, 255, 255, 0.05); +} + +.summary-table td { + border-bottom: 1px solid rgba(255, 255, 255, 0.02); +} + +.summary-table tr:last-child td { + border-bottom: none; +} + +/* Format Selection Styling */ +.format-selection { + display: flex; + flex-direction: column; + gap: 10px; + margin: 10px 0; + text-align: left; +} + +.format-label { + font-size: 0.8rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.05em; + color: var(--text-secondary); +} + +.format-options { + display: flex; + flex-direction: column; + gap: 12px; +} + +.format-option-card { + display: flex; + align-items: flex-start; + gap: 15px; + padding: 15px; + background: rgba(255, 255, 255, 0.02); + border: 1px solid rgba(255, 255, 255, 0.05); + border-radius: 12px; + cursor: pointer; + transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); +} + +.format-option-card:hover { + border-color: rgba(139, 92, 246, 0.3); + background: rgba(255, 255, 255, 0.04); +} + +.format-option-card input[type="radio"] { + margin-top: 4px; + accent-color: var(--accent-color); + width: 16px; + height: 16px; +} + +.format-option-card:has(input[type="radio"]:checked) { + border-color: var(--accent-color); + background: rgba(139, 92, 246, 0.04); + box-shadow: 0 0 15px rgba(139, 92, 246, 0.15); +} + +.option-details { + display: flex; + flex-direction: column; + gap: 4px; +} + +.option-title { + font-size: 0.95rem; + font-weight: 600; + color: var(--text-primary); +} + +.option-desc { + font-size: 0.8rem; + color: var(--text-secondary); + line-height: 1.4; +} + +/* VCF Combine sub-option */ +.vcf-combine-option { + display: flex; + align-items: flex-start; + gap: 12px; + padding: 13px 15px; + margin-top: 4px; + background: rgba(139, 92, 246, 0.06); + border: 1px solid rgba(139, 92, 246, 0.25); + border-radius: 10px; + cursor: pointer; + transition: all 0.2s ease; + animation: slideDown 0.2s ease; +} + +@keyframes slideDown { + from { opacity: 0; transform: translateY(-6px); } + to { opacity: 1; transform: translateY(0); } +} + +.vcf-combine-option:hover { + border-color: rgba(139, 92, 246, 0.5); + background: rgba(139, 92, 246, 0.1); +} + +.vcf-combine-option input[type="checkbox"] { + margin-top: 3px; + accent-color: var(--accent-color); + width: 16px; + height: 16px; + flex-shrink: 0; +} + +.vcf-combine-details { + display: flex; + flex-direction: column; + gap: 3px; + font-size: 0.88rem; +} + +.vcf-combine-details strong { + color: var(--text-primary); + font-weight: 600; +} + +.vcf-combine-details span { + color: var(--text-secondary); + line-height: 1.4; + font-size: 0.8rem; +} + +.vcf-combine-details em { + color: var(--accent-color); + font-style: normal; + font-weight: 500; +} + +/* Utility classes */ +.hidden { + display: none !important; +} diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..37a3758 --- /dev/null +++ b/run.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# run.sh — Build and run the OST-to-PST converter without docker-compose +set -e + +IMAGE="ost2pst:latest" +CONTAINER="ost2pst" +PORT="${PORT:-3000}" + +# ── Ensure converted output directory exists on the host ───────────────────── +mkdir -p "$(pwd)/converted" + +# ── Stop + remove any existing container ───────────────────────────────────── +if [ "$(docker ps -aq -f name=^/${CONTAINER}$)" ]; then + echo "Stopping existing container..." + docker stop "$CONTAINER" >/dev/null 2>&1 || true + docker rm "$CONTAINER" >/dev/null 2>&1 || true +fi + +# ── Build (skipped automatically if image is up-to-date) ───────────────────── +echo "Building image $IMAGE ..." +docker build -t "$IMAGE" . + +# ── Run ─────────────────────────────────────────────────────────────────────── +echo "Starting $CONTAINER on http://localhost:${PORT} ..." +docker run -d \ + --name "$CONTAINER" \ + --restart unless-stopped \ + -p "${PORT}:3000" \ + -v "$(pwd)/converted:/app/converted" \ + "$IMAGE" + +echo "" +echo "✅ Converter is running at: http://localhost:${PORT}" +echo " Converted files will appear in: $(pwd)/converted/" +echo "" +echo " To stop: docker stop $CONTAINER" +echo " To logs: docker logs -f $CONTAINER" diff --git a/server.js b/server.js new file mode 100644 index 0000000..b17df69 --- /dev/null +++ b/server.js @@ -0,0 +1,234 @@ +const express = require('express'); +const multer = require('multer'); +const { spawn } = require('child_process'); +const path = require('path'); +const fs = require('fs'); + +const app = express(); +const PORT = process.env.PORT || 3000; + +// Ensure directories exist +const UPLOADS_DIR = path.join(__dirname, 'uploads'); +const CONVERTED_DIR = path.join(__dirname, 'converted'); +if (!fs.existsSync(UPLOADS_DIR)) fs.mkdirSync(UPLOADS_DIR); +if (!fs.existsSync(CONVERTED_DIR)) fs.mkdirSync(CONVERTED_DIR); + +// Configure Multer for local uploads +const storage = multer.diskStorage({ + destination: (req, file, cb) => { + cb(null, UPLOADS_DIR); + }, + filename: (req, file, cb) => { + const uniqueSuffix = Date.now() + '-' + Math.round(Math.random() * 1e9); + cb(null, uniqueSuffix + path.extname(file.originalname)); + } +}); + +const upload = multer({ + storage: storage, + limits: { fileSize: 1024 * 1024 * 1024 } // 1GB limit +}); + +// Serve static frontend files +app.use(express.static(path.join(__dirname, 'public'))); +app.use(express.json()); + +// In-memory task tracking +const tasks = new Map(); + +// File upload endpoint +app.post('/api/upload', upload.single('ostFile'), (req, res) => { + if (!req.file) { + return res.status(400).json({ error: 'No file uploaded' }); + } + + const format = req.body.format === 'mbox' ? 'mbox' : 'pst'; + const combineVcf = req.body.combineVcf === 'true'; + const taskId = 'task-' + Date.now() + '-' + Math.round(Math.random() * 1000); + const originalName = req.file.originalname; + const baseName = path.basename(originalName, path.extname(originalName)).replace(/[^a-zA-Z0-9_-]/g, '_'); + const outputFileName = `${baseName}-${Date.now()}.${format === 'mbox' ? 'zip' : 'pst'}`; + const outputPath = path.join(CONVERTED_DIR, outputFileName); + + tasks.set(taskId, { + id: taskId, + originalName: originalName, + inputPath: req.file.path, + outputPath: outputPath, + outputFileName: outputFileName, + format: format, + combineVcf: combineVcf, + status: 'uploaded', + logs: [], + error: null + }); + + res.json({ taskId }); +}); + +// SSE Streaming endpoint for real-time logs and status +app.get('/api/stream/:taskId', (req, res) => { + const { taskId } = req.params; + const task = tasks.get(taskId); + + if (!task) { + return res.status(404).json({ error: 'Task not found' }); + } + + // Set headers for Server-Sent Events (SSE) + res.writeHead(200, { + 'Content-Type': 'text/event-stream', + 'Cache-Control': 'no-cache', + 'Connection': 'keep-alive' + }); + + res.write(`data: ${JSON.stringify({ status: 'starting', message: 'Starting Java conversion engine...' })}\n\n`); + + task.status = 'converting'; + + // Spawn Java conversion process + const classpath = 'aspose-email-24.12-jdk16.jar:.'; + const child = spawn('java', [ + '-cp', classpath, + 'Convert.java', + task.inputPath, + task.outputPath, + task.format, + task.combineVcf ? 'true' : 'false' + ], { + cwd: __dirname + }); + + const folderStats = []; + let totalMessages = 0; + let duration = 0; + + let buffer = ''; + const sendLog = (data) => { + buffer += data.toString(); + const lines = buffer.split('\n'); + buffer = lines.pop(); // Keep incomplete line + + for (const line of lines) { + const trimmed = line.trim(); + if (trimmed) { + task.logs.push(trimmed); + + // Parse stats in real-time + const folderMatch = trimmed.match(/Processing Folder:\s+(.+)/); + if (folderMatch) { + const fName = folderMatch[1]; + if (!folderStats.find(item => item.folder === fName)) { + folderStats.push({ folder: fName, messages: 0 }); + } + } + + const msgMatch = trimmed.match(/Successfully copied\s+(\d+)\s+messages to folder:\s+(.+)/); + if (msgMatch) { + const count = parseInt(msgMatch[1], 10); + const fName = msgMatch[2]; + const found = folderStats.find(item => item.folder === fName); + if (found) { + found.messages = count; + } else { + folderStats.push({ folder: fName, messages: count }); + } + totalMessages += count; + } + + const durationMatch = trimmed.match(/Conversion completed successfully in\s+([\d\.]+)\s+seconds/); + if (durationMatch) { + duration = parseFloat(durationMatch[1]); + } + + res.write(`data: ${JSON.stringify({ status: 'running', log: trimmed })}\n\n`); + } + } + }; + + child.stdout.on('data', sendLog); + child.stderr.on('data', sendLog); + + child.on('close', (code) => { + // Handle remaining buffer + if (buffer.trim()) { + task.logs.push(buffer.trim()); + res.write(`data: ${JSON.stringify({ status: 'running', log: buffer.trim() })}\n\n`); + } + + // Clean up uploaded input OST file immediately to save disk space + try { + if (fs.existsSync(task.inputPath)) { + fs.unlinkSync(task.inputPath); + } + } catch (err) { + console.error('Failed to delete input file:', err); + } + + if (code === 0) { + task.status = 'completed'; + + // Send completed state with parsed statistics + res.write(`data: ${JSON.stringify({ + status: 'completed', + downloadUrl: `/api/download/${taskId}`, + fileName: task.outputFileName, + summary: { + folders: folderStats.filter(f => f.messages > 0), + totalMessages: totalMessages, + duration: duration || 0 + } + })}\n\n`); + } else { + task.status = 'failed'; + task.error = 'Conversion process exited with code ' + code; + res.write(`data: ${JSON.stringify({ status: 'failed', error: task.error })}\n\n`); + } + res.end(); + }); + + req.on('close', () => { + // If client closes connection prematurely, terminate the conversion process + if (task.status === 'converting') { + child.kill(); + } + }); +}); + +// Download endpoint +app.get('/api/download/:taskId', (req, res) => { + const { taskId } = req.params; + const task = tasks.get(taskId); + + if (!task || task.status !== 'completed') { + return res.status(404).send('PST file not found or task not completed.'); + } + + if (!fs.existsSync(task.outputPath)) { + return res.status(404).send('PST file has expired or was removed.'); + } + + res.setHeader('Content-Type', task.format === 'mbox' ? 'application/zip' : 'application/octet-stream'); + res.setHeader('Content-Disposition', `attachment; filename="${task.outputFileName}"`); + res.sendFile(task.outputPath, (err) => { + if (err) { + console.error('Download error:', err); + } + + // Clean up output file after download (or set a timeout) + setTimeout(() => { + try { + if (fs.existsSync(task.outputPath)) { + fs.unlinkSync(task.outputPath); + } + tasks.delete(taskId); + } catch (cleanupErr) { + console.error('Failed to clean up output file:', cleanupErr); + } + }, 60000); // Wait 1 minute before removing to ensure download succeeds + }); +}); + +app.listen(PORT, () => { + console.log(`OST to PST Converter running at http://localhost:${PORT}`); +});