From 578c961932a81be6380901eab9ca638e651a1009 Mon Sep 17 00:00:00 2001 From: KnugiHK <24708955+KnugiHK@users.noreply.github.com> Date: Sun, 27 Apr 2025 13:00:51 +0800 Subject: [PATCH 01/11] Add workflow for generating website from readme --- .github/generate-website.js | 477 +++++++++++++++++++++++++ .github/workflows/generate-website.yml | 35 ++ 2 files changed, 512 insertions(+) create mode 100644 .github/generate-website.js create mode 100644 .github/workflows/generate-website.yml diff --git a/.github/generate-website.js b/.github/generate-website.js new file mode 100644 index 0000000..9ac779a --- /dev/null +++ b/.github/generate-website.js @@ -0,0 +1,477 @@ +const fs = require('fs-extra'); +const marked = require('marked'); +const path = require('path'); +const markedAlert = require('marked-alert'); + +fs.ensureDirSync('docs'); +fs.ensureDirSync('docs/imgs'); + +if (fs.existsSync('imgs')) { + fs.copySync('imgs', 'docs/imgs'); +} + +const readmeContent = fs.readFileSync('README.md', 'utf8'); + +const generateHTML = (content) => +` + + + + + WhatsApp Chat Exporter + + + + +
+
+

WhatsApp Chat Exporter

+
+ Latest in PyPI + License MIT + Python + Matrix Chat Room +
+

A customizable Android and iPhone Whatsapp database parser that will give you the history of your Whatsapp conversations in HTML and JSON

+ +
+
+ +
+
+
+

Table of Contents

+ +
+ +
+ ${content} +
+ +
+

Key Features

+ +
+
+
+

Cross-Platform

+

Support for both Android and iOS/iPadOS WhatsApp databases

+
+ +
+
+

Backup Decryption

+

Support for Crypt12, Crypt14, and Crypt15 (End-to-End) encrypted backups

+
+ +
+
+

Multiple Formats

+

Export your chats in HTML, JSON, and text formats

+
+ +
+
+

Customizable

+

Use custom HTML templates and styling for your chat exports

+
+ +
+
+

Media Support

+

Properly handles and organizes your media files in the exports

+
+ +
+
+

Filtering Options

+

Filter chats by date, phone number, and more

+
+
+
+ + +
+
+ + + + + + +`; + +const processedContent = readmeContent.replace(/\[!\[.*?\]\(.*?\)\]\(.*?\)/g, '').replace(/!\[.*?\]\(.*?\)/g, '') + +const htmlContent = marked.use(markedAlert()).parse(processedContent, { + gfm: true, + breaks: true, + renderer: new marked.Renderer() +}); + +const finalHTML = generateHTML(htmlContent); +fs.writeFileSync('docs/index.html', finalHTML); + +console.log('Website generated successfully!'); \ No newline at end of file diff --git a/.github/workflows/generate-website.yml b/.github/workflows/generate-website.yml new file mode 100644 index 0000000..69ca165 --- /dev/null +++ b/.github/workflows/generate-website.yml @@ -0,0 +1,35 @@ +name: Generate Website from README + +on: + push: + paths: + - 'README.md' + - '.github/workflows/generate-website.yml' + - '.github/generate-website.js' + workflow_dispatch: + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install dependencies + run: npm install marked fs-extra marked-alert + + - name: Generate website from README + run: node .github/generate-website.js + + - name: Deploy to GitHub Pages + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: gh-pages + folder: docs + clean: true \ No newline at end of file From ae6a65f98d8119cf641630d57329509b670fd456 Mon Sep 17 00:00:00 2001 From: KnugiHK <24708955+KnugiHK@users.noreply.github.com> Date: Sun, 27 Apr 2025 14:07:51 +0800 Subject: [PATCH 02/11] Update generate-website.js --- .github/generate-website.js | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/generate-website.js b/.github/generate-website.js index 9ac779a..9988e23 100644 --- a/.github/generate-website.js +++ b/.github/generate-website.js @@ -12,6 +12,17 @@ if (fs.existsSync('imgs')) { const readmeContent = fs.readFileSync('README.md', 'utf8'); +const toc = `
+

Table of Contents

+ +
+` + const generateHTML = (content) => ` @@ -366,20 +377,6 @@ const generateHTML = (content) =>
-
-

Table of Contents

- -
- -
- ${content} -
-

Key Features

@@ -421,6 +418,11 @@ const generateHTML = (content) =>
+ +
+ ${content} +
+
View on GitHub From dc639d5dac898df306ea27294605541af545b902 Mon Sep 17 00:00:00 2001 From: KnugiHK <24708955+KnugiHK@users.noreply.github.com> Date: Sun, 27 Apr 2025 14:40:48 +0800 Subject: [PATCH 03/11] Update pyproject.toml --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 7514020..0027184 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Development Status :: 4 - Beta", From 07b525b0c64e8b63577060ed019c5e5d15949fd8 Mon Sep 17 00:00:00 2001 From: Knugi <24708955+KnugiHK@users.noreply.github.com> Date: Sun, 27 Apr 2025 07:19:21 +0000 Subject: [PATCH 04/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b0e1e22..5730519 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ wtsexporter -a -k encrypted_backup.key -b msgstore.db.crypt15 ``` If you have the 32 bytes hex key, simply put the hex key in the -k option and invoke the command from shell like this: ```sh -wtsexporter -a -k 432435053b5204b08e5c3823423399aa30ff061435ab89bc4e6713969cdaa5a8 -b msgstore.db.crypt15 +wtsexporter -a -k 133735053b5204b08e5c3823423399aa30ff061435ab89bc4e6713969cda1337 -b msgstore.db.crypt15 ``` ## Working with iOS/iPadOS (iPhone or iPad) From 15d667464479633632a48ba96f68ee6e1ef44701 Mon Sep 17 00:00:00 2001 From: Knugi <24708955+KnugiHK@users.noreply.github.com> Date: Sun, 27 Apr 2025 08:16:50 +0000 Subject: [PATCH 05/11] Delete CNAME --- CNAME | 1 - 1 file changed, 1 deletion(-) delete mode 100644 CNAME diff --git a/CNAME b/CNAME deleted file mode 100644 index 7dc94d5..0000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -wts.knugi.dev \ No newline at end of file From b3ce22ddbcaf4fec1400f00f38ab54e969427447 Mon Sep 17 00:00:00 2001 From: KnugiHK <24708955+KnugiHK@users.noreply.github.com> Date: Sun, 27 Apr 2025 16:21:38 +0800 Subject: [PATCH 06/11] Add docs.html to gh-page --- docs.html => .github/docs.html | 0 .github/generate-website.js | 3 +++ .github/workflows/generate-website.yml | 3 +++ 3 files changed, 6 insertions(+) rename docs.html => .github/docs.html (100%) diff --git a/docs.html b/.github/docs.html similarity index 100% rename from docs.html rename to .github/docs.html diff --git a/.github/generate-website.js b/.github/generate-website.js index 9988e23..4bff870 100644 --- a/.github/generate-website.js +++ b/.github/generate-website.js @@ -9,6 +9,9 @@ fs.ensureDirSync('docs/imgs'); if (fs.existsSync('imgs')) { fs.copySync('imgs', 'docs/imgs'); } +if (fs.existsSync('.github/docs.html')) { + fs.copySync('.github/docs.html', 'docs/docs.html'); +} const readmeContent = fs.readFileSync('README.md', 'utf8'); diff --git a/.github/workflows/generate-website.yml b/.github/workflows/generate-website.yml index 69ca165..4711afc 100644 --- a/.github/workflows/generate-website.yml +++ b/.github/workflows/generate-website.yml @@ -2,10 +2,13 @@ name: Generate Website from README on: push: + branches: + - main paths: - 'README.md' - '.github/workflows/generate-website.yml' - '.github/generate-website.js' + - '.github/docs.html' workflow_dispatch: jobs: From c37e5054084d9708b81b9dbe71a9ab2e592eb969 Mon Sep 17 00:00:00 2001 From: Knugi <24708955+KnugiHK@users.noreply.github.com> Date: Tue, 29 Apr 2025 08:49:57 +0000 Subject: [PATCH 07/11] Update generate-website.yml --- .github/workflows/generate-website.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/generate-website.yml b/.github/workflows/generate-website.yml index 4711afc..2aef613 100644 --- a/.github/workflows/generate-website.yml +++ b/.github/workflows/generate-website.yml @@ -30,9 +30,10 @@ jobs: - name: Generate website from README run: node .github/generate-website.js - - name: Deploy to GitHub Pages - uses: JamesIves/github-pages-deploy-action@v4 + - name: Deploy to gh-pages + if: github.ref == 'refs/heads/main' # Ensure deployment only happens from main + uses: peaceiris/actions-gh-pages@v4 with: - branch: gh-pages - folder: docs - clean: true \ No newline at end of file + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs + publish_branch: gh-pages From 9cfbb560ebf6f6c6748eb0139c83ac590d0346f6 Mon Sep 17 00:00:00 2001 From: Knugi <24708955+KnugiHK@users.noreply.github.com> Date: Tue, 29 Apr 2025 08:52:32 +0000 Subject: [PATCH 08/11] Update generate-website.yml --- .github/workflows/generate-website.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/generate-website.yml b/.github/workflows/generate-website.yml index 2aef613..467ac69 100644 --- a/.github/workflows/generate-website.yml +++ b/.github/workflows/generate-website.yml @@ -10,7 +10,9 @@ on: - '.github/generate-website.js' - '.github/docs.html' workflow_dispatch: - +permissions: + contents: write + pages: write jobs: build-and-deploy: runs-on: ubuntu-latest From bacbcda474708e843f9278868c2f1692776f2f3d Mon Sep 17 00:00:00 2001 From: Knugi <24708955+KnugiHK@users.noreply.github.com> Date: Tue, 29 Apr 2025 08:55:31 +0000 Subject: [PATCH 09/11] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 5730519..f61f710 100644 --- a/README.md +++ b/README.md @@ -246,9 +246,11 @@ licenses. ``` # To do + See [issues](https://github.com/KnugiHK/Whatsapp-Chat-Exporter/issues). # Legal Stuff & Disclaimer + This is a MIT licensed project. The Telegram Desktop's export is the reference for whatsapp.html in this repo. From 2d8960d5e39f020905f527f7a63bd2106496ec23 Mon Sep 17 00:00:00 2001 From: Knugi <24708955+KnugiHK@users.noreply.github.com> Date: Tue, 29 Apr 2025 13:20:14 +0000 Subject: [PATCH 10/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f61f710..19cd848 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![License MIT](https://img.shields.io/pypi/l/whatsapp-chat-exporter?color=427B93)](https://github.com/KnugiHK/WhatsApp-Chat-Exporter/blob/main/LICENSE) [![Python](https://img.shields.io/pypi/pyversions/Whatsapp-Chat-Exporter)](https://pypi.org/project/Whatsapp-Chat-Exporter/) [![Matrix Chat Room](https://img.shields.io/matrix/wtsexporter:matrix.org.svg?label=Matrix%20Chat%20Room)](https://matrix.to/#/#wtsexporter:matrix.org) -![Since 2021](https://img.shields.io/github/created-at/knugihk/WhatsApp-Chat-Exporter?label=Since&color=purple) +[![Since 2021](https://img.shields.io/github/created-at/knugihk/WhatsApp-Chat-Exporter?label=Since&color=purple)](https://wts.knugi.dev) A customizable Android and iPhone Whatsapp database parser that will give you the history of your Whatsapp conversations in HTML and JSON. Inspired by [Telegram Chat Export Tool](https://telegram.org/blog/export-and-more). > [!TIP] From 81f072f899afa84cba07585706fc8c7019d5a37e Mon Sep 17 00:00:00 2001 From: Knugi <24708955+KnugiHK@users.noreply.github.com> Date: Tue, 29 Apr 2025 13:22:05 +0000 Subject: [PATCH 11/11] Update generate-website.js --- .github/generate-website.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/generate-website.js b/.github/generate-website.js index 4bff870..2936de4 100644 --- a/.github/generate-website.js +++ b/.github/generate-website.js @@ -468,7 +468,7 @@ const generateHTML = (content) => `; -const processedContent = readmeContent.replace(/\[!\[.*?\]\(.*?\)\]\(.*?\)/g, '').replace(/!\[.*?\]\(.*?\)/g, '') +const processedContent = readmeContent.replace(/\[!\[.*?\]\(.*?\)\]\(.*?\)/g, '') const htmlContent = marked.use(markedAlert()).parse(processedContent, { gfm: true, @@ -479,4 +479,4 @@ const htmlContent = marked.use(markedAlert()).parse(processedContent, { const finalHTML = generateHTML(htmlContent); fs.writeFileSync('docs/index.html', finalHTML); -console.log('Website generated successfully!'); \ No newline at end of file +console.log('Website generated successfully!');