diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 320ec5fe8b..0000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Lint - -on: - push: - pull_request: - -jobs: - eslint: - name: ESLint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Install node v14 - uses: actions/setup-node@v2 - with: - node-version: '14' - - name: Install dependencies - run: npm install - - name: Run ESLint - run: ./node_modules/.bin/eslint . diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml deleted file mode 100644 index c6a160142d..0000000000 --- a/.github/workflows/update.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Update - -on: - schedule: - - cron: '0 12 * * 0' - workflow_dispatch: - -permissions: - contents: write - pull-requests: write - -concurrency: - group: wa-update - cancel-in-progress: false - -jobs: - update: - if: github.repository_owner == 'pedroslopez' - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./tools/version-checker - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - - - name: Install dependencies - run: npm install - - - name: Run Updater - run: ./update-version - - - name: Store WA Version - run: echo "WA_VERSION=$(cat ./.version)" >> $GITHUB_ENV - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v7 - with: - branch: auto-wa-web-update/patch - delete-branch: true - commit-message: 'chore: update supported WhatsApp Web version to v${{ env.WA_VERSION }}' - title: 'chore: update WhatsApp Web version (${{ env.WA_VERSION }})' - body: | - A new version of WhatsApp Web has been detected! - - Tests should be run against this new version before merging. - labels: whatsapp change - reviewers: pedroslopez diff --git a/tools/version-checker/.version b/tools/version-checker/.version deleted file mode 100644 index 8d7185a54e..0000000000 --- a/tools/version-checker/.version +++ /dev/null @@ -1 +0,0 @@ -2.3000.1017054665 \ No newline at end of file diff --git a/tools/version-checker/update-version b/tools/version-checker/update-version deleted file mode 100755 index 5f0e0dbab4..0000000000 --- a/tools/version-checker/update-version +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env node - -const fs = require('fs'); -const puppeteer = require('puppeteer'); - -const args = [ - '--autoplay-policy=user-gesture-required', - '--disable-background-networking', - '--disable-background-timer-throttling', - '--disable-backgrounding-occluded-windows', - '--disable-breakpad', - '--disable-client-side-phishing-detection', - '--disable-component-update', - '--disable-default-apps', - '--disable-dev-shm-usage', - '--disable-domain-reliability', - '--disable-extensions', - '--disable-features=AudioServiceOutOfProcess', - '--disable-hang-monitor', - '--disable-ipc-flooding-protection', - '--disable-notifications', - '--disable-offer-store-unmasked-wallet-cards', - '--disable-popup-blocking', - '--disable-print-preview', - '--disable-prompt-on-repost', - '--disable-renderer-backgrounding', - '--disable-speech-api', - '--disable-sync', - '--disable-gpu', - '--disable-accelerated-2d-canvas', - '--hide-scrollbars', - '--ignore-gpu-blacklist', - '--metrics-recording-only', - '--mute-audio', - '--no-default-browser-check', - '--no-first-run', - '--no-pings', - '--no-zygote', - '--password-store=basic', - '--use-gl=swiftshader', - '--use-mock-keychain', - '--disable-setuid-sandbox', - '--no-sandbox', - '--disable-blink-features=AutomationControlled', - '--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36', -]; - -const getLatestVersion = async () => { - const browser = await puppeteer.launch({ - args: args, - }); - const page = await browser.newPage(); - await page.goto('https://web.whatsapp.com', { - waitUntil: 'load', - timeout: 0, - referer: 'https://whatsapp.com/', - }); - - await page.waitForFunction( - () => window.require && window.require('WAWebBuildConstants'), - ); - - const version = await page.evaluate(() => { - return window.require('WAWebBuildConstants').VERSION_STR; - }); - - await browser.close(); - return version; -}; - -const getCurrentVersion = () => { - try { - const versionFile = fs.readFileSync('./.version'); - return versionFile ? versionFile.toString().trim() : null; - } catch (_) { - return null; - } -}; - -const updateInFile = (filePath, oldVersion, newVersion) => { - const originalFile = fs.readFileSync(filePath); - const newFile = originalFile.toString().replaceAll(oldVersion, newVersion); - - fs.writeFileSync(filePath, newFile); -}; - -const updateVersion = async (oldVersion, newVersion) => { - const filesToUpdate = ['../../src/util/Constants.js', '../../README.md']; - - for (const file of filesToUpdate) { - updateInFile(file, oldVersion, newVersion); - } - - fs.writeFileSync('./.version', newVersion); -}; - -(async () => { - const currentVersion = getCurrentVersion(); - const version = (await getLatestVersion()) ?? currentVersion; - - console.log(`Current version: ${currentVersion}`); - console.log(`Latest version: ${version}`); - - if (currentVersion !== version) { - console.log('Updating files...'); - await updateVersion(currentVersion, version); - console.log('Updated!'); - } else { - console.log('No changes.'); - } -})();