diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..aec8f13978bf73e8cce42f72c500f29ce76eb54a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,45 @@ +Dockerfile +.*sessions +files +venv +.wwebjs_auth +docs +examples +.github +.git + +# compiled output +/dist +/node_modules +.yarn + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# OS +.DS_Store + +# Tests +/coverage +/.nyc_output + +# IDEs and editors +/.idea +.project +.classpath +.c9/ +*.launch +.settings/ +*.sublime-workspace + +# IDE - VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000000000000000000000000000000000000..19c8bd16bf6b1aff249534db189d83de31f6ab3f --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,36 @@ +module.exports = { + parser: '@typescript-eslint/parser', + parserOptions: { + project: 'tsconfig.json', + sourceType: 'module', + }, + plugins: ['@typescript-eslint/eslint-plugin', 'simple-import-sort'], + extends: [ + 'plugin:@typescript-eslint/eslint-recommended', + 'plugin:@typescript-eslint/recommended', + 'prettier', + 'prettier/@typescript-eslint', + ], + root: true, + env: { + node: true, + jest: true, + }, + rules: { + 'simple-import-sort/imports': 'error', + 'simple-import-sort/exports': 'error', + '@typescript-eslint/interface-name-prefix': 'off', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-inferrable-types': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/ban-ts-ignore': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/no-unused-vars': 'off', + 'lines-between-class-members': [ + 'error', + 'always', + { exceptAfterSingleLine: true }, + ], + }, +}; diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000000000000000000000000000000000000..bcc3cc5f6df9d69e9dfd3dbd971606e436dd6731 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,14 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: wa_http_api +open_collective: # doks Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: + - https://boosty.to/wa-http-api + - https://portal.devlike.pro/ diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000000000000000000000000000000000000..4277afa767d45d6690f2b1587637f2ae496e7564 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,61 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '[BUG][WEBJS] - ' +labels: bug +assignees: '' +--- + +**Describe the bug** + +> A clear and concise description of what the bug is. Feel free to remove +> sections that you don't feel to make the text shorter! + +**Version** + +```json +{ + "version": "2023.11.1", + "engine": "NOWEB", + "tier": "PLUS", + "browser": "/usr/bin/google-chrome-stable" +} +``` + +> You can get the WAHA version by calling `GET /api/version` Try to update to +> [the latest version](https://github.com/devlikeapro/whatsapp-http-api/releases) +> before creating an issue! + +**To Reproduce** Steps to reproduce the behavior: + +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** + +> A clear and concise description of what you expected to happen. + +**Engine** I'm using **WEBJS** engine. + +> If you set `WHATSAPP_DEFAULT_ENGINE` explicitly to +> [one of the engine](https://waha.devlike.pro/docs/how-to/engines/) - please +> provide that information here and in the issue title. + +**Requests - Responses** + +> Please attach all sent requests, responses that you sent. + +**Docker Logs** + +> Collect and attach related docker logs if you have any +> https://waha.devlike.pro/docs/how-to/deploy/#viewing-the-logs + +**Screenshots** + +> If applicable, add screenshots to help explain your problem. + +**Additional context** + +> Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000000000000000000000000000000000000..d4def5618db6c60f04c44b86a57881f04bb87fdf --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,24 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '[Feature Request]' +labels: '' +assignees: '' +--- + +**Is your feature request related to a problem? Please describe.** I'm always +frustrated when [...] + +> A clear and concise description of what the problem is. Ex. + +**Describe the solution you'd like** + +> A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** + +> A clear and concise description of any alternative solutions or features +> you've considered. + +**Additional context** Add any other context or screenshots about the feature +request here. diff --git a/.github/clear-gh-runs.sh b/.github/clear-gh-runs.sh new file mode 100644 index 0000000000000000000000000000000000000000..11f3009da11737ef69a257bc19cb77db89664e9a --- /dev/null +++ b/.github/clear-gh-runs.sh @@ -0,0 +1,18 @@ +# Idea from +# https://stackoverflow.com/a/65539398/6753144 +# + +OWNER=devlikeapro +REPO=whatsapp-http-api-plus + +# list workflows +gh api -X GET /repos/$OWNER/$REPO/actions/workflows | jq '.workflows[] | .name,.id' + +# copy the ID of the workflow you want to clear and set it +WORKFLOW_ID=40218610 + +# list runs +gh api -X GET /repos/$OWNER/$REPO/actions/workflows/$WORKFLOW_ID/runs --paginate | jq '.workflow_runs[] | .id' + +# delete runs +gh api -X GET /repos/$OWNER/$REPO/actions/workflows/$WORKFLOW_ID/runs --paginate | jq '.workflow_runs[] | .id' | xargs -I{} gh api -X DELETE /repos/$OWNER/$REPO/actions/runs/{} --silent diff --git a/.github/gh-team-labels.yml b/.github/gh-team-labels.yml new file mode 100644 index 0000000000000000000000000000000000000000..35b7ce05809730db021021e8235353920743c311 --- /dev/null +++ b/.github/gh-team-labels.yml @@ -0,0 +1,15 @@ +ignore: + teams: + - no-labels + users: + - allburov +teamLabels: + - team: waha-patrons-pro + label: patron:PRO + comment: '[![patron:PRO](https://img.shields.io/badge/patron-PRO-188a42)](https://waha.devlike.pro/docs/how-to/plus-version/#tiers)' + - team: waha-patrons-advanced + label: patron:ADVANCED + comment: '[![patron:ADVANCED](https://img.shields.io/badge/patron-ADVANCED-4cd07d)](https://waha.devlike.pro/docs/how-to/plus-version/#tiers)' + - team: waha-patrons-plus + label: patron:PLUS + comment: '[![patron:PLUS](https://img.shields.io/badge/patron-PLUS-a0e6ba)](https://waha.devlike.pro/docs/how-to/plus-version/#tiers)' diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0464f0a019ba5bf2736db760db377086a7613b90 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,76 @@ +name: Release + +on: + push: + tags: + - '*' + +jobs: + docker-build: + runs-on: ${{ matrix.runner }} + name: ${{ matrix.platform }} - ${{ matrix.browser }} - ${{ matrix.tag }} + strategy: + matrix: + include: + # Chromium + - runner: 'buildjet-4vcpu-ubuntu-2204' + tag: 'latest' + platform: 'amd64' + browser: 'chromium' + - runner: 'buildjet-4vcpu-ubuntu-2204-arm' + tag: 'arm' + platform: 'linux/arm64' + browser: 'chromium' + # Chrome + - runner: 'buildjet-4vcpu-ubuntu-2204' + tag: 'chrome' + platform: 'amd64' + browser: 'chrome' + # Chrome is not supported on arm64 + # - runner: "buildjet-4vcpu-ubuntu-2204-arm" + # tag: "chrome-arm" + # platform: "linux/arm64" + # browser: "chrome" + # No browser + - runner: 'buildjet-4vcpu-ubuntu-2204' + tag: 'noweb' + platform: 'amd64' + browser: 'none' + - runner: 'buildjet-4vcpu-ubuntu-2204-arm' + tag: 'noweb-arm' + platform: 'linux/arm64' + browser: 'none' + + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ vars.DOCKER_IMAGE }} + flavor: latest=false + tags: | + type=raw,value=${{ matrix.tag }} + + - name: Login to image repository + if: github.ref_type == 'tag' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + file: Dockerfile + platforms: ${{ matrix.platform }} + build-args: | + USE_BROWSER=${{ matrix.browser }} + push: ${{ github.ref_type == 'tag' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/manual-push.yaml b/.github/workflows/manual-push.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6fb9b29f1d456309d2e21b638f1928966fd60545 --- /dev/null +++ b/.github/workflows/manual-push.yaml @@ -0,0 +1,84 @@ +name: Manual push + +on: + workflow_dispatch: + inputs: + tag: + description: 'Tag to push' + required: true + default: 'dev' + push: + description: 'Push to registry' + required: true + type: boolean + default: true + +jobs: + docker-build: + runs-on: ${{ matrix.runner }} + name: ${{ matrix.platform }} - ${{ matrix.browser }} - ${{ matrix.tag }} + strategy: + matrix: + include: + # Chromium + - runner: 'buildjet-4vcpu-ubuntu-2204' + tag: 'latest' + platform: 'amd64' + browser: 'chromium' + - runner: 'buildjet-4vcpu-ubuntu-2204-arm' + tag: 'arm' + platform: 'linux/arm64' + browser: 'chromium' + # Chrome + - runner: 'buildjet-4vcpu-ubuntu-2204' + tag: 'chrome' + platform: 'amd64' + browser: 'chrome' + # Chrome is not supported on arm64 + # - runner: "buildjet-4vcpu-ubuntu-2204-arm" + # tag: "chrome-arm" + # platform: "linux/arm64" + # browser: "chrome" + # No browser + - runner: 'buildjet-4vcpu-ubuntu-2204' + tag: 'noweb' + platform: 'amd64' + browser: 'none' + - runner: 'buildjet-4vcpu-ubuntu-2204-arm' + tag: 'noweb-arm' + platform: 'linux/arm64' + browser: 'none' + + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ vars.DOCKER_IMAGE }} + flavor: latest=false + tags: | + type=raw,value=${{ inputs.tag }}-${{ matrix.tag }} + + - name: Login to image repository + if: github.ref_type == 'tag' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + file: Dockerfile + platforms: ${{ matrix.platform }} + build-args: | + USE_BROWSER=${{ matrix.browser }} + push: ${{ inputs.push }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000000000000000000000000000000000000..90ce49e5c075a32965695038ea20b6c8dfd7cb50 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,61 @@ +name: Deploy Pages + +on: + push: + branches: + - core + +jobs: + build: + runs-on: ubuntu-latest + defaults: + run: + working-directory: docs/site + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + persist-credentials: false + + - name: Install dependencies + run: | + npm install + + - name: Build + run: | + npm run build + + - name: Upload folder + uses: actions/upload-artifact@v2 + with: + path: docs/site/public + name: public + retention-days: 5 + + deploy-github-pages: + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + persist-credentials: false + + - name: Download folder + uses: actions/download-artifact@v2 + with: + name: public + path: public + + - name: File list + run: | + ls -la && ls -la public + + - name: Deploy + uses: JamesIves/github-pages-deploy-action@4.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + BRANCH: gh-pages + FOLDER: public + CLEAN: true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e47ea737ced4ec0207e4643421eaee94266e4c64 --- /dev/null +++ b/.gitignore @@ -0,0 +1,44 @@ +.yarn +example.ts +.*sessions +tokens +files +venv +.wwebjs_auth +test.js +.wwebjs_cache + +# compiled output +/dist +/node_modules + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# OS +.DS_Store + +# Tests +/coverage +/.nyc_output + +# IDEs and editors +/.idea +.project +.classpath +.c9/ +*.launch +.settings/ +*.sublime-workspace + +# IDE - VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000000000000000000000000000000000000..1df6fd41c7037d4b9995ff11adff67439ee2b4e6 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v20.5.0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e22e44553ba03c943c490c81ea62ff8357a3f335 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,41 @@ +repos: + - repo: local + hooks: + - id: lint + name: lint + language: system + entry: bash -c '$HOME/.nvm/nvm-exec npm run lint' + pass_filenames: false + files: | + (?x)^( + src/.*| + )$ + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: 'v3.1.0' + hooks: + - id: prettier + exclude: | + (?x)^( + docs/.*| + README.md| + )$ + - repo: https://github.com/Lucas-C/pre-commit-hooks-nodejs + rev: v1.1.2 + hooks: + - id: markdown-toc + name: README.md + files: ^README.md$ + - repo: local + hooks: + - id: no-plus-in-core + name: No "plus" in core + language: pygrep + entry: 'plus' + files: | + (?x)^( + src/api/.*| + src/core/.*| + src/structures/.*| + src/config.service.ts| + )$ diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000000000000000000000000000000000000..42c02aa80c14ac88b02e78189d684a11d7f7886d --- /dev/null +++ b/.prettierrc @@ -0,0 +1,13 @@ +{ + "singleQuote": true, + "trailingComma": "all", + "endOfLine": "auto", + "arrowParens": "always", + "bracketSpacing": true, + "useTabs": false, + "tabWidth": 2, + "semi": true, + "quoteProps": "as-needed", + "proseWrap": "always", + "printWidth": 80 +} diff --git a/.yarnrc b/.yarnrc new file mode 100644 index 0000000000000000000000000000000000000000..e6fe73b634780eee794097dbfd7da6e4715a3487 --- /dev/null +++ b/.yarnrc @@ -0,0 +1 @@ +network-timeout 60000 diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 0000000000000000000000000000000000000000..0563839dc83bd4ba259106a04aacfa71fc0eb332 --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1,3 @@ +nodeLinker: node-modules + +yarnPath: .yarn/releases/yarn-3.6.3.cjs diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..690077754b19029c3c9f9437410015c9b84f2062 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,4 @@ +# Changelog + +You can find changelog on +[the changelog page](https://waha.devlike.pro/docs/help/changelog/) diff --git a/CNAME b/CNAME new file mode 100644 index 0000000000000000000000000000000000000000..11f96f8e4e7b10f46df4836bac02a08efd6893e1 --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +waha.devlike.pro \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..d3a981969859a511fa71c9bce699c15456f17114 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,71 @@ +# +# Build +# +FROM node:20-bullseye as build +ENV PUPPETEER_SKIP_DOWNLOAD=True + +# npm packages +RUN apt-get update \ + && apt-get install -y openssh-client +RUN apt install openssh-client +RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts + +WORKDIR /src +COPY package.json . +COPY yarn.lock . +RUN yarn set version 3.6.3 +RUN --mount=type=ssh yarn install + +# App +WORKDIR /src +ADD . /src +RUN --mount=type=ssh yarn install +RUN yarn build && find ./dist -name "*.d.ts" -delete + +# +# Final +# +FROM node:20-bullseye as release +ENV PUPPETEER_SKIP_DOWNLOAD=True +ARG USE_BROWSER=chromium + +RUN echo "USE_BROWSER=$USE_BROWSER" + +# Install fonts if using either chromium or chrome +RUN if [ "$USE_BROWSER" = "chromium" ] || [ "$USE_BROWSER" = "chrome" ]; then \ + apt-get update \ + && apt-get install -y fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf \ + --no-install-recommends \ + && rm -rf /var/lib/apt/lists/*; \ + fi + +# Install Chromium +RUN if [ "$USE_BROWSER" = "chromium" ]; then \ + apt-get update \ + && apt-get update \ + && apt-get install -y chromium \ + --no-install-recommends \ + && rm -rf /var/lib/apt/lists/*; \ + fi + +# Install Chrome +RUN if [ "$USE_BROWSER" = "chrome" ]; then \ + apt-get update \ + && apt-get install -y wget gnupg \ + && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ + && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ + && apt-get update \ + && apt-get install -y google-chrome-stable \ + --no-install-recommends \ + && rm -rf /var/lib/apt/lists/*; \ + fi + +# Attach sources, install packages +WORKDIR /app +COPY package.json ./ +COPY --from=build /src/node_modules ./node_modules +COPY --from=build /src/dist ./dist + +# Run command, etc +EXPOSE 7860 +CMD yarn start:prod diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..bd6867edc5b264fd004b8b2f46fa898888a6b768 --- /dev/null +++ b/Makefile @@ -0,0 +1,43 @@ +build: + docker build . -t devlikeapro/whatsapp-http-api + +build-chrome: + docker build . -t devlikeapro/whatsapp-http-api:chrome --build-arg USE_BROWSER=chrome + +build-noweb: + docker build . -t devlikeapro/whatsapp-http-api:noweb --build-arg USE_BROWSER=none + +build-all: build build-chrome build-noweb + +build-plus: + docker build . -t devlikeapro/whatsapp-http-api-plus + +build-ssh: + # check IMAGE provided + @[ "${IMAGE}" ] || ( echo "Add APP: make build-ssh image=devlikeapro/whatsapp-http-api"; exit 1 ); + eval $(ssh-agent) && \ + ssh-add ~/.ssh/id_rsa && \ + docker buildx build --ssh default=${SSH_AUTH_SOCK} . -t ${IMAGE} --build-arg USE_BROWSER=none + +stop: + docker stop whatsapp-http-api + +clean: stop + sudo rm -rf .sessions + +push: + docker push devlikeapro/whatsapp-http-api + +for-swagger: + WHATSAPP_SWAGGER_CONFIG_ADVANCED=true npm run start + +update-swagger: + wget http://localhost:3000/-json -O ./docs/site/static/swagger/openapi.json + +update-dependencies: + . ${NVM_DIR}/nvm.sh && nvm exec yarn up whatsapp-web.js@https://github.com/devlikeapro/whatsapp-web.js#main-fork + . ${NVM_DIR}/nvm.sh && nvm exec yarn up @adiwajshing/baileys@github:WhiskeySockets/Baileys + . ${NVM_DIR}/nvm.sh && nvm exec yarn up venom-bot + +start-proxy: + docker run --rm -d --name squid-container -e TZ=UTC -p 3128:3128 ubuntu/squid:5.2-22.04_beta diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..19a9e2394616222a8f65c8fc8bf8d16811c19927 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,64 @@ +version: '3' +services: + whatsapp-http-api: + image: devlikeapro/whatsapp-http-api + container_name: whatsapp-http-api + ports: + - '7860:7860/tcp' + environment: + # Environment variables from https://waha.devlike.pro/docs/how-to/config/ + - WHATSAPP_HOOK_URL=https://httpbin.org/post + - WHATSAPP_HOOK_EVENTS=message + - WHATSAPP_DEFAULT_ENGINE=WEBJS + restart: always + + whatsapp-http-api-plus: + image: devlikeapro/whatsapp-http-api-plus + container_name: whatsapp-http-api-plus + ports: + - '7860:7860/tcp' + volumes: + - './.sessions:/app/.sessions' + environment: + # Environment variables from https://waha.devlike.pro/docs/how-to/config/ + - WHATSAPP_RESTART_ALL_SESSIONS=True + - WHATSAPP_HOOK_URL=https://httpbin.org/post + - WHATSAPP_HOOK_EVENTS=message + - WHATSAPP_DEFAULT_ENGINE=WEBJS + - WHATSAPP_API_KEY=321 + - WHATSAPP_SWAGGER_USERNAME=admin + - WHATSAPP_SWAGGER_PASSWORD=123 + - WHATSAPP_API_HOSTNAME=localhost + restart: always + + whatsapp-http-api-plus--mongodb: + image: devlikeapro/whatsapp-http-api-plus + container_name: whatsapp-http-api-plus--mongodb + ports: + - '7860:7860/tcp' + volumes: + - './.sessions:/app/.sessions' + environment: + # Environment variables from https://waha.devlike.pro/docs/how-to/config/ + - WHATSAPP_RESTART_ALL_SESSIONS=True + - WHATSAPP_HOOK_URL=https://httpbin.org/post + - WHATSAPP_HOOK_EVENTS=message + - WHATSAPP_DEFAULT_ENGINE=WEBJS + - WHATSAPP_API_KEY=321 + - WHATSAPP_SWAGGER_USERNAME=admin + - WHATSAPP_SWAGGER_PASSWORD=123 + - WHATSAPP_API_HOSTNAME=localhost + - WHATSAPP_SESSIONS_MONGO_URL=mongodb://mongodb:27017 + restart: always + + mongodb: + image: mongo + container_name: mongodb + ports: + - '27017:27017/tcp' + volumes: + - mongodb_data:/data/db + restart: always + +volumes: + mongodb_data: {} diff --git a/docs/site/.editorconfig b/docs/site/.editorconfig new file mode 100644 index 0000000000000000000000000000000000000000..dad6b5822db81e45833ea4e0718902e32f6a4f6b --- /dev/null +++ b/docs/site/.editorconfig @@ -0,0 +1,11 @@ +# editorconfig.org + +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true \ No newline at end of file diff --git a/docs/site/.eslintignore b/docs/site/.eslintignore new file mode 100644 index 0000000000000000000000000000000000000000..57d0057999e64c467a8902d5c6c697283ca3307f --- /dev/null +++ b/docs/site/.eslintignore @@ -0,0 +1,4 @@ +assets/js/index.js +assets/js/katex.js +assets/js/vendor +node_modules \ No newline at end of file diff --git a/docs/site/.eslintrc.json b/docs/site/.eslintrc.json new file mode 100644 index 0000000000000000000000000000000000000000..c926994dc5eb360882f4cdac88238393c2a52e4a --- /dev/null +++ b/docs/site/.eslintrc.json @@ -0,0 +1,31 @@ +{ + "env": { + "browser": true, + "commonjs": true, + "es6": true, + "node": true + }, + "extends": "eslint:recommended", + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly" + }, + "parserOptions": { + "ecmaVersion": 2018, + "sourceType": "module" + }, + "rules": { + "no-console": 0, + "quotes": ["error", "single"], + "comma-dangle": [ + "error", + { + "arrays": "always-multiline", + "objects": "always-multiline", + "imports": "always-multiline", + "exports": "always-multiline", + "functions": "ignore" + } + ] + } +} \ No newline at end of file diff --git a/docs/site/.github/FUNDING.yml b/docs/site/.github/FUNDING.yml new file mode 100644 index 0000000000000000000000000000000000000000..b15c6e6b3797e36bf0f7eb7ccacc91f45a1aa306 --- /dev/null +++ b/docs/site/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: doks # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/docs/site/.github/ISSUE_TEMPLATE/bug-report---.md b/docs/site/.github/ISSUE_TEMPLATE/bug-report---.md new file mode 100644 index 0000000000000000000000000000000000000000..6a8b3a848dc9f04729a2773db3a1790f83ab220c --- /dev/null +++ b/docs/site/.github/ISSUE_TEMPLATE/bug-report---.md @@ -0,0 +1,25 @@ +--- +name: "Bug report \U0001F41E" +about: Create a report to help us improve + +--- + +## Description + +Describe the issue that you're seeing. + +### Steps to reproduce + +Clear steps describing how to reproduce the issue. Please please please link to a demo project if possible, this makes your issue _much_ easier to diagnose (seriously). + +### Expected result + +What should happen? + +### Actual result + +What happened. + +### Environment + +Paste the information here as shown by `npm run check` diff --git a/docs/site/.github/ISSUE_TEMPLATE/config.yml b/docs/site/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000000000000000000000000000000000000..e3766187de0f3dbae9511b3b7e3d3e9bd3ad6514 --- /dev/null +++ b/docs/site/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,4 @@ +contact_links: + - name: Question 🙋 + url: https://github.com/h-enk/doks/discussions/categories/q-a + about: Ask your question in Doks Discussions \ No newline at end of file diff --git a/docs/site/.github/ISSUE_TEMPLATE/feature-request---.md b/docs/site/.github/ISSUE_TEMPLATE/feature-request---.md new file mode 100644 index 0000000000000000000000000000000000000000..74da274c41f99415704c1b8a75e47e2f63e9f244 --- /dev/null +++ b/docs/site/.github/ISSUE_TEMPLATE/feature-request---.md @@ -0,0 +1,17 @@ +--- +name: "Feature request \U0001F680" +about: Suggest an idea for Doks + +--- + +## Summary + +Brief explanation of the feature. + +### Basic example + +Include a basic example or links here. + +### Motivation + +Why are we doing this? What use cases does it support? What is the expected outcome? diff --git a/docs/site/.github/dependabot.yml b/docs/site/.github/dependabot.yml new file mode 100644 index 0000000000000000000000000000000000000000..8abca405fb92c781e61658764199562f9fc06d4c --- /dev/null +++ b/docs/site/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "npm" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" diff --git a/docs/site/.github/workflows/codeql-analysis.yml b/docs/site/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000000000000000000000000000000000000..0f02f7c79b564f0390c0d0ee634d152ccc24f6bd --- /dev/null +++ b/docs/site/.github/workflows/codeql-analysis.yml @@ -0,0 +1,62 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +name: "CodeQL" + +on: + push: + branches: [master] + pull_request: + # The branches below must be a subset of the branches above + branches: [master] + schedule: + - cron: '0 11 * * 5' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + # Override automatic language detection by changing the below list + # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] + language: ['javascript'] + # Learn more... + # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/docs/site/.github/workflows/node.js-ci.yml b/docs/site/.github/workflows/node.js-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..ea43619bb31d56c470bc6e6d6567544df9bf1ed3 --- /dev/null +++ b/docs/site/.github/workflows/node.js-ci.yml @@ -0,0 +1,34 @@ +name: Hyas CI + +on: + push: + branches: master + pull_request: + branches: master + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + node: [16.x, 18.x] + + steps: + - name: Check out Hyas project + uses: actions/checkout@v2 + + - name: Set up Node.js ${{ matrix.node }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + + - name: Install dependencies + run: npm ci + + - name: Run Hyas test script + run: npm test + + - name: Build production website + run: npm run build \ No newline at end of file diff --git a/docs/site/.github/workflows/stale.yml b/docs/site/.github/workflows/stale.yml new file mode 100644 index 0000000000000000000000000000000000000000..8ca1010846f58de4b57973db6ca14df7af1e7509 --- /dev/null +++ b/docs/site/.github/workflows/stale.yml @@ -0,0 +1,19 @@ +name: 'Close stale issues and PRs' +on: + schedule: + - cron: '0 0 * * *' + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v4 + with: + stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' + stale-pr-message: 'This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' + close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.' + close-pr-message: 'This PR was closed because it has been stalled for 5 days with no activity.' + days-before-stale: 30 + days-before-close: 5 + days-before-pr-close: 5 + exempt-issue-labels: 'keep' \ No newline at end of file diff --git a/docs/site/.gitignore b/docs/site/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..85ea9156e2eb5447d3b884ad6dad2add7ab2b218 --- /dev/null +++ b/docs/site/.gitignore @@ -0,0 +1,5 @@ +node_modules +public +resources +.netlify +.hugo_build.lock \ No newline at end of file diff --git a/docs/site/.markdownlint-cli2.jsonc b/docs/site/.markdownlint-cli2.jsonc new file mode 100644 index 0000000000000000000000000000000000000000..3c7937443df591f2b5c33524ef9aead48e735506 --- /dev/null +++ b/docs/site/.markdownlint-cli2.jsonc @@ -0,0 +1,11 @@ +{ + "config": { + "default": true, + "MD013": false, + "MD024": false, + "MD026": false, + "MD033": false, + "MD034": false + }, + "ignores": ["node_modules", "CHANGELOG.md", "README.md"] +} \ No newline at end of file diff --git a/docs/site/.nvmrc b/docs/site/.nvmrc new file mode 100644 index 0000000000000000000000000000000000000000..9dfef472196f64b8c8865af57c1efde0d2d0b06b --- /dev/null +++ b/docs/site/.nvmrc @@ -0,0 +1 @@ +v18.12.0 diff --git a/docs/site/.stylelintignore b/docs/site/.stylelintignore new file mode 100644 index 0000000000000000000000000000000000000000..3972095a3ccf3644e3235f23c108034d1eedac82 --- /dev/null +++ b/docs/site/.stylelintignore @@ -0,0 +1,3 @@ +assets/scss/components/_syntax.scss +assets/scss/vendor +node_modules \ No newline at end of file diff --git a/docs/site/.stylelintrc.json b/docs/site/.stylelintrc.json new file mode 100644 index 0000000000000000000000000000000000000000..191d0938194c716eadea8204f1d1dc135e46e985 --- /dev/null +++ b/docs/site/.stylelintrc.json @@ -0,0 +1,48 @@ +{ + "extends": "stylelint-config-standard-scss", + "rules": { + "no-empty-source": null, + "string-quotes": "double", + "scss/comment-no-empty": null, + "max-line-length": null, + "scss/at-extend-no-missing-placeholder": null, + "scss/dollar-variable-colon-space-after": null, + "scss/dollar-variable-empty-line-before": null, + "color-function-notation": null, + "alpha-value-notation": null, + "selector-id-pattern": null, + "selector-class-pattern": null, + "scss/no-global-function-names": null, + "number-max-precision": null, + "hue-degree-notation": null, + "value-no-vendor-prefix": null, + "property-no-vendor-prefix": null, + "at-rule-no-unknown": [ + true, + { + "ignoreAtRules": [ + "extend", + "at-root", + "debug", + "warn", + "error", + "if", + "else", + "for", + "each", + "while", + "mixin", + "include", + "content", + "return", + "function", + "tailwind", + "apply", + "responsive", + "variants", + "screen" + ] + } + ] + } +} \ No newline at end of file diff --git a/docs/site/CHANGELOG.md b/docs/site/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..26975b03bc9d91a8300d8c5c07f7b75b29f40ad9 --- /dev/null +++ b/docs/site/CHANGELOG.md @@ -0,0 +1,112 @@ +### Changelog + +All notable changes to this project will be documented in this file. Dates are displayed in UTC. + +Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). + +#### [v0.5.0](https://github.com/h-enk/doks-child-theme/compare/v0.4.3...v0.5.0) + +- feat: update for Doks v0.5.0 [`0df89d5`](https://github.com/h-enk/doks-child-theme/commit/0df89d51fbf706aea17d68d07bcfaeba422a1b60) +- content: update content for Doks v0.5.0 [`63d4412`](https://github.com/h-enk/doks-child-theme/commit/63d4412ba65217ca21092565bf3e6bcc2706e575) +- meta: update README.md [`5a8fa90`](https://github.com/h-enk/doks-child-theme/commit/5a8fa9081ce203d594c4ad7b5193f87bd51f3d6e) + +#### [v0.4.3](https://github.com/h-enk/doks-child-theme/compare/v0.4.2...v0.4.3) + +> 18 May 2022 + +- deps: bump versions to latest [`8ee2cb6`](https://github.com/h-enk/doks-child-theme/commit/8ee2cb6b8f2a7b38562f266c7db9c028a24c4523) +- meta: update changelog [`48499b6`](https://github.com/h-enk/doks-child-theme/commit/48499b6e66bf9bf5bc3d27597b2840618882b16b) + +#### [v0.4.2](https://github.com/h-enk/doks-child-theme/compare/v0.4.1...v0.4.2) + +> 1 April 2022 + +- deps: bump @hyas/doks from 0.4.1 to 0.4.2 [`eda0e36`](https://github.com/h-enk/doks-child-theme/commit/eda0e360262707c7baa1af2b7d373865d5e534fd) +- meta: update changelog [`4e8f1a8`](https://github.com/h-enk/doks-child-theme/commit/4e8f1a8e51292c4010ee48a1f94b22db441d0998) +- meta: update sponsors + backers sections [`788e1e3`](https://github.com/h-enk/doks-child-theme/commit/788e1e3ab5b5447b4464018a0959e3cd1338a486) + +#### [v0.4.1](https://github.com/h-enk/doks-child-theme/compare/v0.4.0...v0.4.1) + +> 31 March 2022 + +- deps: bump versions to latest [`a85f35d`](https://github.com/h-enk/doks-child-theme/commit/a85f35dc3fe0ca5a3080d4fe7d567f7e8863566e) +- ops: add continuous integration + stale workflows [`8134f51`](https://github.com/h-enk/doks-child-theme/commit/8134f518b7873be39ff2cd6eb3472bf681fa3390) +- feat: add files for custom scss + js [`12bf689`](https://github.com/h-enk/doks-child-theme/commit/12bf689da853e90ed51f25b8103e7beca68c23b0) + +#### [v0.4.0](https://github.com/h-enk/doks-child-theme/compare/v0.3.5...v0.4.0) + +> 4 February 2022 + +- deps: bump versions to latest [`fe5bf72`](https://github.com/h-enk/doks-child-theme/commit/fe5bf729e6e6754f3b6957b5d6c657c84326d070) +- fix: comment out mount content [`477ed68`](https://github.com/h-enk/doks-child-theme/commit/477ed686336826296a8b8e83c90af45b7a904bf4) +- config: update for doks v0.4.0 [`d00d595`](https://github.com/h-enk/doks-child-theme/commit/d00d595bc6add83780cf577d58099bbcecfbbe40) + +#### [v0.3.5](https://github.com/h-enk/doks-child-theme/compare/v0.3.4...v0.3.5) + +> 5 October 2021 + +- chore(deps-dev): bump bootstrap from 5.1.0 to 5.1.1 [`#64`](https://github.com/h-enk/doks-child-theme/pull/64) +- chore(deps-dev): bump @babel/preset-env from 7.15.4 to 7.15.6 [`#65`](https://github.com/h-enk/doks-child-theme/pull/65) +- chore(deps-dev): bump autoprefixer from 10.3.4 to 10.3.7 [`#71`](https://github.com/h-enk/doks-child-theme/pull/71) +- feat: update for doks 0.3.5 [`3782cf5`](https://github.com/h-enk/doks-child-theme/commit/3782cf57ed43acadc426305dc64764048b78138a) +- meta: update changelog [`36436ff`](https://github.com/h-enk/doks-child-theme/commit/36436fff6fd1ba412fdc991f4acca35a2835d09c) +- meta: bump version doks-child-theme to 0.3.5 [`57eae76`](https://github.com/h-enk/doks-child-theme/commit/57eae76694755ab1b06691a3c5427f224b806661) + +#### [v0.3.4](https://github.com/h-enk/doks-child-theme/compare/v0.3.3...v0.3.4) + +> 7 September 2021 + +- feat: update for doks 0.3.4 [`b08cb80`](https://github.com/h-enk/doks-child-theme/commit/b08cb80fadc09f7ad7e7e960d09dc482666fa108) +- deps: bump versions to latest [`a790bbe`](https://github.com/h-enk/doks-child-theme/commit/a790bbe7fa9ac52d15270339bf1ec24be385a2a8) +- Create FUNDING.yml [`8613d4c`](https://github.com/h-enk/doks-child-theme/commit/8613d4caad869c0f1f80b5610f6e49b766935541) + +#### [v0.3.3](https://github.com/h-enk/doks-child-theme/compare/v0.3.0...v0.3.3) + +> 5 July 2021 + +- feat: update for doks v0.3.3 [`f7b5720`](https://github.com/h-enk/doks-child-theme/commit/f7b57204c9de70f14e17337a8baa44815beb2b50) +- content: update readme [`14f1a3f`](https://github.com/h-enk/doks-child-theme/commit/14f1a3fede35e7f4a88d8ea063416958c2900a56) +- Update for doks v0.3.3 [`babdd77`](https://github.com/h-enk/doks-child-theme/commit/babdd7791e6002fd2272b1bc3c95c58654933454) + +#### [v0.3.0](https://github.com/h-enk/doks-child-theme/compare/v0.2.3...v0.3.0) + +> 25 June 2021 + +- feat: update for doks v0.3.0 [`630c2a2`](https://github.com/h-enk/doks-child-theme/commit/630c2a2edd246f3fc26fbb799d2debb77857882c) +- fix: add data directory [`69cdc3c`](https://github.com/h-enk/doks-child-theme/commit/69cdc3cccea6a976552e654a86a85475a19ef448) + +#### [v0.2.3](https://github.com/h-enk/doks-child-theme/compare/v0.2.2...v0.2.3) + +> 2 April 2021 + +- feat: update for doks v0.2.3 [`e517462`](https://github.com/h-enk/doks-child-theme/commit/e517462127252a50d78cf34180ea10f898993585) +- chore(release): 0.2.3 [`1fcbc4e`](https://github.com/h-enk/doks-child-theme/commit/1fcbc4e2cb297f780004582612d904920044b181) + +#### v0.2.2 + +> 26 March 2021 + +- feat: add doks as a node module [`cfed05e`](https://github.com/h-enk/doks-child-theme/commit/cfed05efaf7b4191b2bdca4c91405c6cabc8396c) +- deps: bump versions to latest [`997a7dd`](https://github.com/h-enk/doks-child-theme/commit/997a7dd7250b3dc0fe23c92ebf83ed21c9ba2d6b) +- config: update for doks v0.2.2 [`03f51d5`](https://github.com/h-enk/doks-child-theme/commit/03f51d5fd1f66f7afa0957d92adf779d438a3946) + + + +### [0.2.3](https://github.com/h-enk/doks/compare/v0.2.2...v0.2.3) (2021-04-02) + + +### Features + +* update for doks v0.2.3 ([e517462](https://github.com/h-enk/doks/commit/e517462127252a50d78cf34180ea10f898993585)) + +### 0.2.2 (2021-03-26) + + +### Features + +* add doks as a node module ([cfed05e](https://github.com/h-enk/doks/commit/cfed05efaf7b4191b2bdca4c91405c6cabc8396c)) + + +### Dependencies + +* bump versions to latest ([997a7dd](https://github.com/h-enk/doks/commit/997a7dd7250b3dc0fe23c92ebf83ed21c9ba2d6b)) diff --git a/docs/site/CODE_OF_CONDUCT.md b/docs/site/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000000000000000000000000000000000..77366b2e2f3efec959144c8e931d04ae9f4a50f6 --- /dev/null +++ b/docs/site/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at hello@getdoks.org. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/docs/site/LICENSE b/docs/site/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..be44e1fc49eb2f4b23f2cd844854914009c544ee --- /dev/null +++ b/docs/site/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2018-present, Gridsome +Copyright (c) 2020-present, Henk Verlinde + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/docs/site/README.md b/docs/site/README.md new file mode 100644 index 0000000000000000000000000000000000000000..651bbba129e197d7bce98462c91071819e389a2b --- /dev/null +++ b/docs/site/README.md @@ -0,0 +1,156 @@ +

+ + Doks + +

+ +

+ Doks +

+ +

+ Doks Child Theme +

+ +

+ Doks is a Hugo theme for building secure, fast, and SEO-ready documentation websites, which you can easily update and customize. +

+ +

+ + GitHub + + + GitHub release (latest SemVer including pre-releases) + + + GitHub Workflow Status (branch) + + + Netlify + +

+ +![Doks — Modern Documentation Theme](https://raw.githubusercontent.com/h-enk/doks/master/images/doks.png) + +## Demo + +- [doks-child-theme.netlify.app](https://doks-child-theme.netlify.app/) + +## Why Doks? + +Nine main reasons why you should use Doks: + +1. __Security aware__. Get A+ scores on [Mozilla Observatory](https://observatory.mozilla.org/analyze/doks.netlify.app) out of the box. Easily change the default Security Headers to suit your needs. + +2. __Fast by default__. Get 100 scores on [Google Lighthouse](https://googlechrome.github.io/lighthouse/viewer/?gist=59aafe464a68f8bc30b8e9a636d5b053) by default. Doks removes unused css, prefetches links, and lazy loads images. + +3. __SEO-ready__. Use sensible defaults for structured data, open graph, and Twitter cards. Or easily change the SEO settings to your liking. + +4. __Development tools__. Code with confidence. Check styles, scripts, and markdown for errors and fix automatically or manually. + +5. __Bootstrap framework__. Build robust, flexible, and intuitive websites with Bootstrap 5. Easily customize your Doks site with the source Sass files. + +6. __Netlify-ready__. Deploy to Netlify with sensible defaults. Easily use Netlify Functions, Netlify Redirects, and Netlify Headers. + +7. __Full text search__. Search your Doks site with FlexSearch. Easily customize index settings and search options to your liking. + +8. __Page layouts__. Build pages with a landing page, blog, or documentation layout. Add custom sections and components to suit your needs. + +9. __Dark mode__. Switch to a low-light UI with the click of a button. Change colors with variables to match your branding. + +### Other features + +- __Multilingual and i18n__ support +- __Versioning__ documentation support +- __KaTeX__ math typesetting +- __Mermaid__ diagrams and visualization +- __highlight.js__ syntax highlighting + +## Requirements + +- [Git](https://git-scm.com/) — latest source release +- [Node.js](https://nodejs.org/) — latest LTS version or newer + +
+Why Node.js? + +Doks uses npm (included with Node.js) to centralize dependency management, making it [easy to update](https://getdoks.org/docs/help/how-to-update/) resources, build tooling, plugins, and build scripts. + +
+ +## Get started + +Start a new Doks project in three steps: + +### 1. Create a new site + +Doks is available as a child theme and a starter theme. + +#### Child theme + +- Intended for novice to intermediate users +- Intended for minor customizations +- [Easily update npm packages](https://getdoks.org/docs/help/how-to-update/) — __including__ [Doks](https://www.npmjs.com/package/@hyas/doks) + +```bash +git clone https://github.com/h-enk/doks-child-theme.git my-doks-site && cd my-doks-site +``` + +#### Starter theme + +- Intended for intermediate to advanced users +- Intended for major customizations +- [Easily update npm packages](https://getdoks.org/docs/help/how-to-update/) + +```bash +git clone https://github.com/h-enk/doks.git my-doks-site && cd my-doks-site +``` + +
+Help me choose + +Not sure which one is for you? Pick the child theme. + +
+ +### 2. Install dependencies + +```bash +npm install +``` + +### 3. Start development server + +```bash +npm run start +``` + +## Other commands + +Doks comes with [commands](https://getdoks.org/docs/prologue/commands/) for common tasks. + +## Documentation + +- [Netlify](https://docs.netlify.com/) +- [Hugo](https://gohugo.io/documentation/) +- [Doks](https://getdoks.org/) + +## Communities + +- [Netlify Community](https://community.netlify.com/) +- [Hugo Forums](https://discourse.gohugo.io/) +- [Doks Discussions](https://github.com/h-enk/doks/discussions) + +## Sponsors + +Support this project by becoming a sponsor. Your logo will show up here with a link to your website. + +[![OC sponsor 0](https://opencollective.com/doks/tiers/sponsor/0/avatar.svg)](https://opencollective.com/doks/tiers/sponsor/0/website) +[![OC sponsor 1](https://opencollective.com/doks/tiers/sponsor/1/avatar.svg)](https://opencollective.com/doks/tiers/sponsor/1/website) + +## Backers + +Support this project by becoming a backer. Your avatar will show up here. + +[![Backers](https://opencollective.com/doks/tiers/backer.svg?49741992)](https://opencollective.com/doks) diff --git a/docs/site/SECURITY.md b/docs/site/SECURITY.md new file mode 100644 index 0000000000000000000000000000000000000000..4ad3369f313ac5299405cb1777fbddd6f84d79e7 --- /dev/null +++ b/docs/site/SECURITY.md @@ -0,0 +1,7 @@ +# Reporting Security Issues + +The Doks team and community take security issues in Doks seriously. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions. + +To report a security issue, email [security@getdoks.org](mailto:security@getdoks.org) and include the word "SECURITY" in the subject line. + +We'll endeavor to respond quickly, and will keep you updated throughout the process. diff --git a/docs/site/assets/images/default-image.png b/docs/site/assets/images/default-image.png new file mode 100644 index 0000000000000000000000000000000000000000..a34ff9fcaabbd4b1a78b674908f9ac3c51fab13f Binary files /dev/null and b/docs/site/assets/images/default-image.png differ diff --git a/docs/site/assets/js/app.js b/docs/site/assets/js/app.js new file mode 100644 index 0000000000000000000000000000000000000000..9c6c6967edc266a040d9ebe3d7147a2e60a87b5c --- /dev/null +++ b/docs/site/assets/js/app.js @@ -0,0 +1 @@ +/** Custom scripts */ diff --git a/docs/site/assets/scss/app.scss b/docs/site/assets/scss/app.scss new file mode 100644 index 0000000000000000000000000000000000000000..03d19ca18c6053f4904eec3916c7df287948812d --- /dev/null +++ b/docs/site/assets/scss/app.scss @@ -0,0 +1,38 @@ +/** Import Bootstrap functions */ +@import "bootstrap/scss/functions"; + +/** Import theme variables */ +@import "common/variables"; + +/** Import Bootstrap */ +@import "bootstrap/scss/bootstrap"; + +/** Import highlight.js */ +// @import "highlight.js/scss/github-dark-dimmed"; + +/** Import KaTeX */ +@import "katex/dist/katex"; + +/** Import theme styles */ +@import "common/fonts"; +@import "common/global"; +@import "common/dark"; +@import "components/alerts"; +@import "components/buttons"; +@import "components/code"; +@import "components/details"; +@import "components/syntax"; +@import "components/comments"; +@import "components/forms"; +@import "components/images"; +@import "components/mermaid"; +@import "components/search"; +@import "components/tables"; +@import "layouts/footer"; +@import "layouts/header"; +@import "layouts/pages"; +@import "layouts/posts"; +@import "layouts/sidebar"; + +/** Import custom styles */ +@import "common/custom"; diff --git a/docs/site/assets/scss/common/_custom.scss b/docs/site/assets/scss/common/_custom.scss new file mode 100644 index 0000000000000000000000000000000000000000..c2aee2664c6c43d35dc0b6a5cd3bff5ec6fde553 --- /dev/null +++ b/docs/site/assets/scss/common/_custom.scss @@ -0,0 +1 @@ +/** Custom styles */ diff --git a/docs/site/babel.config.js b/docs/site/babel.config.js new file mode 100644 index 0000000000000000000000000000000000000000..ce9c9de024af884d8bbf2f17840248164629baa1 --- /dev/null +++ b/docs/site/babel.config.js @@ -0,0 +1,17 @@ +module.exports = { + presets: [ + [ + '@babel/preset-env', + { + targets: { + browsers: [ + // Best practice: https://github.com/babel/babel/issues/7789 + '>=1%', + 'not ie 11', + 'not op_mini all' + ] + } + } + ] + ] +}; \ No newline at end of file diff --git a/docs/site/config/_default/config.toml b/docs/site/config/_default/config.toml new file mode 100644 index 0000000000000000000000000000000000000000..6512f3fd4bf9b251e8e6b6ab74ea1431f59a0e80 --- /dev/null +++ b/docs/site/config/_default/config.toml @@ -0,0 +1,83 @@ +baseurl = "https://waha.devlike.pro/" +canonifyURLs = false +disableAliases = true +disableHugoGeneratorInject = true +enableEmoji = true +enableGitInfo = false +enableRobotsTXT = true +paginate = 7 +rssLimit = 10 + +# Multilingual +defaultContentLanguage = "en" +disableLanguages = ["de", "nl"] +# defaultContentLanguageInSubdir = true + +# add redirects/headers +[outputs] +home = ["HTML", "RSS", "REDIRECTS", "HEADERS"] +section = ["HTML", "RSS", "SITEMAP"] + +# remove .{ext} from text/netlify +[mediaTypes."text/netlify"] +suffixes = [""] +delimiter = "" + +# add output format for netlify _redirects +[outputFormats.REDIRECTS] +mediaType = "text/netlify" +baseName = "_redirects" +isPlainText = true +notAlternative = true + +# add output format for netlify _headers +[outputFormats.HEADERS] +mediaType = "text/netlify" +baseName = "_headers" +isPlainText = true +notAlternative = true + +# add output format for section sitemap.xml +[outputFormats.SITEMAP] +mediaType = "application/xml" +baseName = "sitemap" +isHTML = false +isPlainText = true +noUgly = true +rel = "sitemap" + +[caches] + [caches.getjson] + dir = ":cacheDir/:project" + maxAge = "10s" + +[sitemap] + changefreq = "weekly" + filename = "sitemap.xml" + priority = 0.5 + +[taxonomies] + contributor = "contributors" + category = "categories" + tag = "tags" + +[permalinks] + blog = "/blog/:title/" +# docs = "/docs/1.0/:sections[1:]/:title/" + +[minify.tdewolff.html] + keepWhitespace = false + +[related] + threshold = 80 + includeNewer = true + toLower = false + [[related.indices]] + name = "categories" + weight = 100 + [[related.indices]] + name = "tags" + weight = 80 + [[related.indices]] + name = "date" + weight = 10 diff --git a/docs/site/config/_default/languages.toml b/docs/site/config/_default/languages.toml new file mode 100644 index 0000000000000000000000000000000000000000..ffb15f94c63d3548483ebaad300554861f8adb46 --- /dev/null +++ b/docs/site/config/_default/languages.toml @@ -0,0 +1,28 @@ +[en] + languageName = "English" + contentDir = "content/en" + weight = 10 + [en.params] + languageISO = "EN" + languageTag = "en-US" + +[de] + languageName = "German" + contentDir = "content/de" + weight = 15 + [de.params] + languageISO = "DE" + languageTag = "de-DE" + +[nl] + languageName = "Nederlands" + contentDir = "content/nl" + weight = 20 + [nl.params] + languageISO = "NL" + languageTag = "nl-NL" + titleAddition = "Modern documentatie-thema" + description = "Doks is een Hugo-thema waarmee je moderne documentatie-websites kunt bouwen die veilig, snel en klaar voor SEO zijn — standaard." + titleHome = "Doks thema" + footer = "Mogelijk gemaakt door Netlify, Hugo, en Doks" + alertText = "Introductie van het Doks-kinderthema, verschillende DX + UX-updates en meer! Bekijk Doks v0.2" diff --git a/docs/site/config/_default/markup.toml b/docs/site/config/_default/markup.toml new file mode 100644 index 0000000000000000000000000000000000000000..2880e30562fa06035bfbf82356a44dfdc26ec75c --- /dev/null +++ b/docs/site/config/_default/markup.toml @@ -0,0 +1,29 @@ +defaultMarkdownHandler = "goldmark" + +[goldmark] + [goldmark.extensions] + linkify = false + [goldmark.parser] + autoHeadingID = true + autoHeadingIDType = "github" + [goldmark.parser.attribute] + block = true + title = true + [goldmark.renderer] + unsafe = true + +[highlight] + codeFences = false + guessSyntax = false + hl_Lines = "" + lineNoStart = 1 + lineNos = false + lineNumbersInTable = true + noClasses = false + style = "dracula" + tabWidth = 4 + +[tableOfContents] + endLevel = 3 + ordered = false + startLevel = 2 diff --git a/docs/site/config/_default/menus/menus.en.toml b/docs/site/config/_default/menus/menus.en.toml new file mode 100644 index 0000000000000000000000000000000000000000..8a06c782167a5105efccb127a36a91fb59746129 --- /dev/null +++ b/docs/site/config/_default/menus/menus.en.toml @@ -0,0 +1,132 @@ +[[docs]] + name = "Overview" + weight = 10 + identifier = "overview" + url = "/docs/overview/" + +[[docs]] + name = "Help" + weight = 60 + identifier = "help" + url = "/docs/help/" + +# [[docs]] +# name = "Lorem" +# weight = 70 +# identifier = "lorem" +# url = "/docs/lorem/" + + +[[main]] + name = "Documentation" + identifier = "docs" + url = "/docs/overview/introduction/" + weight = 10 + +[[main]] + name = "Introduction" + weight = 11 + url = "/docs/overview/introduction" + parent = "docs" + +[[main]] + name = "Quick Start" + weight = 12 + url = "/docs/overview/introduction" + parent = "docs" + + +[[main]] + name = "Send messages" + weight = 14 + url = "/docs/how-to/send-messages" + parent = "docs" + +[[main]] + name = "Receive Messages" + weight = 15 + url = "/docs/how-to/receive-messages" + parent = "docs" + +[[main]] + name = "How to guides" + weight = 20 + url = "/docs/how-to" + parent = "docs" + +[[main]] + name = "Swagger ->" + weight = 98 + url = "https://waha.devlike.pro/swagger" + parent = "docs" + +[[main]] + name = "OpenAPI JSON ->" + weight = 99 + url = "https://waha.devlike.pro/swagger/openapi.json" + parent = "docs" + +[[main]] + name = "WAHA Plus" + weight = 30 + identifier = "waha-plus" + +[[main]] + name = "About WAHA Plus" + weight = 10 + url = "/docs/how-to/plus-version" + parent = "waha-plus" + +[[main]] + name = "Patron Portal ->" + weight = 20 + url = "https://portal.devlike.pro/" + parent = "waha-plus" + +[[main]] + name = "Get on Patreon ->" + weight = 60 + url = "https://patreon.com/wa_http_api" + parent = "waha-plus" + +[[main]] + name = "Get on Boosty ->" + weight = 50 + url = "https://boosty.to/wa-http-api" + parent = "waha-plus" + + +[[main]] + name = "Examples" + weight = 20 + identifier = "examples" + +[[main]] + name = "Python ->" + weight = 21 + url = "/docs/examples/python" + parent = "examples" + +[[main]] + name = "Kotlin ->" + weight = 22 +url = "/docs/examples/kotlin" + parent = "examples" + +[[social]] + name = "GitHub" + pre = "" + url = "https://github.com/devlikeapro/whatsapp-http-api" + post = "v0.1.0" + weight = 10 + +#[[social]] +# name = "Twitter" +# pre = "" +# url = "https://twitter.com/getdoks" +# weight = 20 + +# [[footer]] +# name = "Privacy" +# url = "/privacy-policy/" +# weight = 10 diff --git a/docs/site/config/_default/menus/menus.nl.toml b/docs/site/config/_default/menus/menus.nl.toml new file mode 100644 index 0000000000000000000000000000000000000000..12665b13b72d77261d156ce444a12b15df039b6c --- /dev/null +++ b/docs/site/config/_default/menus/menus.nl.toml @@ -0,0 +1,39 @@ +[[docs]] + name = "Overview" + weight = 10 + identifier = "overview" + url = "/docs/overview/" + +[[docs]] + name = "Help" + weight = 60 + identifier = "help" + url = "/docs/help/" + +[[main]] + name = "Docs" + url = "/docs/overview/introduction/" + weight = 10 + +# [[main]] +# name = "Blog" +# url = "/blog/" +# weight = 20 + +[[social]] + name = "GitHub" + pre = "" + url = "https://github.com/h-enk/doks" + post = "v0.1.0" + weight = 10 + +[[social]] + name = "Twitter" + pre = "" + url = "https://twitter.com/getdoks" + weight = 20 + +# [[footer]] +# name = "Privacy" +# url = "/privacy-policy/" +# weight = 10 diff --git a/docs/site/config/_default/module.toml b/docs/site/config/_default/module.toml new file mode 100644 index 0000000000000000000000000000000000000000..ea4b46dd96829a4d3038be4a5e163373bc373392 --- /dev/null +++ b/docs/site/config/_default/module.toml @@ -0,0 +1,68 @@ +[hugoVersion] + extended = true + min = "0.80.0" + max = "" + +[[mounts]] + source = "node_modules/@hyas/doks/archetypes" + target = "archetypes" + +[[mounts]] + source = "node_modules/@hyas/doks/assets" + target = "assets" + +# [[mounts]] +# source = "node_modules/@hyas/doks/content" +# target = "content" + +[[mounts]] + source = "node_modules/@hyas/doks/data" + target = "data" + +[[mounts]] + source = "node_modules/@hyas/doks/layouts" + target = "layouts" + +[[mounts]] + source = "node_modules/@hyas/doks/static" + target = "static" + +[[mounts]] + source = "node_modules/flexsearch" + target = "assets/js/vendor/flexsearch" + +[[mounts]] + source = "node_modules/katex" + target = "assets/js/vendor/katex" + +[[mounts]] + source = "node_modules/mermaid" + target = "assets/js/vendor/mermaid" + +[[mounts]] + source = "assets" + target = "assets" + +[[mounts]] + source = "static" + target = "static" + +# [[mounts]] +# source = "content" +# target = "content" + +[[mounts]] + source = "layouts" + target = "layouts" + +[[mounts]] + source = "archetypes" + target = "archetypes" + +[[mounts]] + source = "data" + target = "data" + +[[mounts]] + source = "node_modules/@hyas/images/layouts" + target = "layouts" diff --git a/docs/site/config/_default/params.toml b/docs/site/config/_default/params.toml new file mode 100644 index 0000000000000000000000000000000000000000..788b27ba64520f10612a37e3572f6231559ff40d --- /dev/null +++ b/docs/site/config/_default/params.toml @@ -0,0 +1,113 @@ +# Meta Data for SEO + +## Homepage +title = "WAHA" +titleSeparator = "-" +titleAddition = "WhatsApp HTTP API" +description = "WAHA - WhatsApp HTTP API that you can run in a click!" + +## Documentation +# docsVersion = "0.3" + +## Open Graph +images = ["/images/logo.png"] +ogLocale = "en_US" +domainTLD = "waha.devlike.pro" +titleHome = "WAHA" + +## Twitter Cards +#twitterSite = "@getdoks" +#twitterCreator = "@henkverlinde" + +## JSON-LD +# schemaType = "Person" +#schemaType = "Organization" +#schemaName = "Doks" +#schemaAuthor = "Henk Verlinde" +#schemaAuthorTwitter = "https://twitter.com/henkverlinde" +#schemaAuthorLinkedIn = "https://www.linkedin.com/in/henkverlinde/" +#schemaAuthorGitHub = "https://github.com/h-enk" +#schemaLocale = "en-US" +#schemaLogo = "logo-doks.png" +#schemaLogoWidth = 512 +#schemaLogoHeight = 512 +#schemaImage = "doks.png" +#schemaImageWidth = 1280 +#schemaImageHeight = 640 +#schemaTwitter = "https://twitter.com/getdoks" +#schemaLinkedIn = "" +#schemaGitHub = "https://github.com/h-enk/doks" +#schemaSection = "blog" + +## Sitelinks Search Box +siteLinksSearchBox = false + +## Chrome Browser +themeColor = "#fff" + +# Images - Temporarily left in place for backward compatibility +quality = 85 +bgColor = "#fff" +landscapePhotoWidths = [900, 800, 700, 600, 500] +portraitPhotoWidths = [800, 700, 600, 500] +lqipWidth = "20x" +smallLimit = "300" + +# Images +imageResponsive = true +imageConvertTo = "webp" +imageImageSizes = ["480","720","1080","1280","1600","2048"] +singleSize = false +imageAddClass = "img-fluid lazyload blur-up" + +### Image template +defaultImage = "default-image.png" # put in `./assets/images/` +fillImage = "1270x740 Center" # normalize image size + +# Footer +footer = 'This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates.
The official WhatsApp website can be found at https://whatsapp.com/.
"WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners.' + +# Feed +copyRight = "Copyright (c) 2021-2023 Dev Like A Pro" + +# Alert +alert = true +alertDismissable = true +alertText = "Support the project and get WAHA Plus version! ->" + +# Edit Page +# repoHost [Github | Gitea | GitLab | Bitbucket | BitbucketServer ] is used for building the edit link based on git hoster +repoHost = "GitHub" +#repoHost = "Gitea" +docsRepo = "https://github.com/devlikeapro/whatsapp-http-api" +docsRepoBranch = "core" +docsRepoSubPath = "" +editPage = false +lastMod = false + +[sections] + sectionNav = ["docs", "guides"] + +[options] + lazySizes = true + clipBoard = true + instantPage = true + flexSearch = true + searchSectionsShow = [] + searchSectionsIndex = [] + darkMode = true + bootStrapJs = true + breadCrumb = false + highLight = true + kaTex = false + multilingualMode = false + docsVersioning = false + fullWidth = false + navbarSticky = true + toTopButton = false + scrollSpy = false # experimental; needs Bootstrap >= 5.2.0-beta1 + +[menu] + [menu.section] + auto = true + collapsibleSidebar = true diff --git a/docs/site/config/next/config.toml b/docs/site/config/next/config.toml new file mode 100644 index 0000000000000000000000000000000000000000..9c5e90da550bf1d9baa44ba849c9ce8ba5d888ed --- /dev/null +++ b/docs/site/config/next/config.toml @@ -0,0 +1 @@ +canonifyURLs = false diff --git a/docs/site/config/postcss.config.js b/docs/site/config/postcss.config.js new file mode 100644 index 0000000000000000000000000000000000000000..e8c3b39df787a4713a7938daf4e15f4d96762996 --- /dev/null +++ b/docs/site/config/postcss.config.js @@ -0,0 +1,40 @@ +const autoprefixer = require('autoprefixer'); +const purgecss = require('@fullhuman/postcss-purgecss'); +const whitelister = require('purgecss-whitelister'); + +module.exports = { + plugins: [ + autoprefixer(), + purgecss({ + content: [ + './node_modules/@hyas/doks/layouts/**/*.html', + './node_modules/@hyas/doks/content/**/*.md', + './layouts/**/*.html', + './content/**/*.md', + ], + safelist: [ + 'lazyloaded', + 'table', + 'thead', + 'tbody', + 'tr', + 'th', + 'td', + 'h5', + 'alert-link', + 'container-xxl', + 'container-fluid', + ...whitelister([ + './node_modules/@hyas/doks/assets/scss/common/_variables.scss', + './node_modules/@hyas/doks/assets/scss/components/_alerts.scss', + './node_modules/@hyas/doks/assets/scss/components/_buttons.scss', + './node_modules/@hyas/doks/assets/scss/components/_code.scss', + './node_modules/@hyas/doks/assets/scss/components/_syntax.scss', + './node_modules/@hyas/doks/assets/scss/components/_search.scss', + './node_modules/@hyas/doks/assets/scss/common/_dark.scss', + './node_modules/katex/dist/katex.css', + ]), + ], + }), + ], +} diff --git a/docs/site/config/production/config.toml b/docs/site/config/production/config.toml new file mode 100644 index 0000000000000000000000000000000000000000..9c5e90da550bf1d9baa44ba849c9ce8ba5d888ed --- /dev/null +++ b/docs/site/config/production/config.toml @@ -0,0 +1 @@ +canonifyURLs = false diff --git a/docs/site/content/en/_index.md b/docs/site/content/en/_index.md new file mode 100644 index 0000000000000000000000000000000000000000..a6350742d4ac9bb8f24b463bc181fb80f93bb9be --- /dev/null +++ b/docs/site/content/en/_index.md @@ -0,0 +1,9 @@ +--- +title : "WAHA" +description: "WAHA - WhatsApp HTTP API that you can run in a click!" +lead: "WAHA - WhatsApp HTTP API that you can run in a click!" +date: 2020-10-06T08:47:36+00:00 +lastmod: 2020-10-06T08:47:36+00:00 +draft: false +images: [] +--- diff --git a/docs/site/content/en/blog/_index.md b/docs/site/content/en/blog/_index.md new file mode 100644 index 0000000000000000000000000000000000000000..37cb611db79724683f638a49e7ec136f446e18a7 --- /dev/null +++ b/docs/site/content/en/blog/_index.md @@ -0,0 +1,8 @@ +--- +title: "Blog" +description: "The Doks Blog." +date: 2020-10-06T08:49:55+00:00 +lastmod: 2020-10-06T08:49:55+00:00 +draft: false +images: [] +--- diff --git a/docs/site/content/en/blog/say-hello-to-doks/index.md b/docs/site/content/en/blog/say-hello-to-doks/index.md new file mode 100644 index 0000000000000000000000000000000000000000..d14d357a191e7df80bcfb208348311c71e8f330a --- /dev/null +++ b/docs/site/content/en/blog/say-hello-to-doks/index.md @@ -0,0 +1,17 @@ +--- +title: "Say hello to Doks 👋" +description: "Introducing Doks, a Hugo theme helping you build modern documentation websites that are secure, fast, and SEO-ready — by default." +excerpt: "Introducing Doks, a Hugo theme helping you build modern documentation websites that are secure, fast, and SEO-ready — by default." +date: 2020-11-04T09:19:42+01:00 +lastmod: 2020-11-04T09:19:42+01:00 +draft: false +weight: 50 +images: [] +categories: ["News"] +tags: ["security", "performance", "SEO"] +contributors: ["Henk Verlinde"] +pinned: false +homepage: false +--- + +Introducing Doks, a Hugo theme helping you build modern documentation websites that are secure, fast, and SEO-ready — by default. diff --git a/docs/site/content/en/contact/index.md b/docs/site/content/en/contact/index.md new file mode 100644 index 0000000000000000000000000000000000000000..795089f6d7fc69d18d189dd50a20bc38e214d443 --- /dev/null +++ b/docs/site/content/en/contact/index.md @@ -0,0 +1,10 @@ +--- +title: "Contact" +description: "Drop us an email." +date: 2020-08-27T19:25:12+02:00 +lastmod: 2020-08-27T19:25:12+02:00 +draft: true +images: [] +--- + +{{< email user="hello" domain="getdoks.org" >}} diff --git a/docs/site/content/en/contributors/_index.md b/docs/site/content/en/contributors/_index.md new file mode 100644 index 0000000000000000000000000000000000000000..e225f34422c0a60a7013603eb8cfca580a9f2c62 --- /dev/null +++ b/docs/site/content/en/contributors/_index.md @@ -0,0 +1,10 @@ +--- +title: "Contributors" +description: "The Doks contributors." +date: 2020-10-06T08:50:29+00:00 +lastmod: 2020-10-06T08:50:29+00:00 +draft: false +images: [] +--- + +The Doks contributors. diff --git a/docs/site/content/en/contributors/henk-verlinde/_index.md b/docs/site/content/en/contributors/henk-verlinde/_index.md new file mode 100644 index 0000000000000000000000000000000000000000..f775534e020848e35c5b51bf4c75bbdc7f587f09 --- /dev/null +++ b/docs/site/content/en/contributors/henk-verlinde/_index.md @@ -0,0 +1,12 @@ +--- +title: "Henk Verlinde" +description: "Creator of Hyas." +date: 2020-10-06T08:50:45+00:00 +lastmod: 2020-10-06T08:50:45+00:00 +draft: false +images: [] +--- + +Creator of Hyas. + +[@HenkVerlinde](https://twitter.com/henkverlinde) diff --git a/docs/site/content/en/docs/_index.md b/docs/site/content/en/docs/_index.md new file mode 100644 index 0000000000000000000000000000000000000000..f807c65285e05d3039facf4ff20298b0dc69b9ba --- /dev/null +++ b/docs/site/content/en/docs/_index.md @@ -0,0 +1,9 @@ +--- +title : "Docs" +description: "Docs Doks." +lead: "" +date: 2020-10-06T08:48:23+00:00 +lastmod: 2020-10-06T08:48:23+00:00 +draft: false +images: [] +--- diff --git a/docs/site/content/en/docs/examples/_index.md b/docs/site/content/en/docs/examples/_index.md new file mode 100644 index 0000000000000000000000000000000000000000..0edf35fbc022dc5530cf74f53103021d967d5412 --- /dev/null +++ b/docs/site/content/en/docs/examples/_index.md @@ -0,0 +1,10 @@ +--- +title: "Examples" +description: "Examples for different languages." +lead: "Examples for different languages." +date: 2020-10-06T08:49:15+00:00 +lastmod: 2020-10-06T08:49:15+00:00 +draft: false +images: [] +weight: 900 +--- diff --git a/docs/site/content/en/docs/examples/kotlin/index.md b/docs/site/content/en/docs/examples/kotlin/index.md new file mode 100644 index 0000000000000000000000000000000000000000..ee1e11efd8ec2cd725807de5f9c1820e7b9ef3e6 --- /dev/null +++ b/docs/site/content/en/docs/examples/kotlin/index.md @@ -0,0 +1,115 @@ +--- +title: "Kotlin" +description: "WhatsApp HTTP API + Kotlin examples." +lead: "WhatsApp HTTP API + Kotlin examples." +date: 2020-10-06T08:49:31+00:00 +lastmod: 2020-10-06T08:49:31+00:00 +draft: false +images: ["/images/kotlin-whatsapp.png"] +menu: +docs: +parent: "help" +weight: 630 +toc: true +--- + +![](/images/kotlin-whatsapp.png) + +We've created a few examples on how to interact with WAHA WhatsApp HTTP API with Kotlin (ktor). + +You can find the examples in +[examples folder on GitHub with detailed instructions in README.md ->](https://github.com/devlikeapro/waha-kotlin) + +## Installation + +We assume that you have installed software: + +1. Kotlin + JVM +2. Docker + +### Download and start image + +First of all, you must run WhatsApp HTTP API locally (which under the hood it +runs real WhatsApp Web instance and expose HTTP API for interaction). + +Here are the steps from +[Quick Start](https://waha.devlike.pro/docs/overview/quick-start/): + +Download and start WhatsApp HTTP API docker container + +```bash +# Download the image +docker pull devlikeapro/whatsapp-http-api +# Run the docker container +docker run -it --rm --network=host -e WHATSAPP_HOOK_URL=http://localhost:5000/bot -e "WHATSAPP_HOOK_EVENTS=*" --name whatsapp-http-api devlikeapro/whatsapp-http-api + +# It prints logs and the last line must be +# WhatsApp HTTP API is running on: http://[::1]:3000 +``` + +#### Download image - ARM + +If you're using ARM (like Apple Silicon, Apple M1, etc.) - use following +commands to download the image + +![](/images/versions/core.png) For Core version the command is + +```bash +# Download the image +docker pull devlikeapro/whatsapp-http-api:arm +# Rename it, so you can use devlikeapro/whatsapp-http-api image in other place +docker tag devlikeapro/whatsapp-http-api:arm devlikeapro/whatsapp-http-api +# Run the docker container +docker run -it --rm --network=host -e WHATSAPP_HOOK_URL=http://localhost:5000/bot -e "WHATSAPP_HOOK_EVENTS=*" --name whatsapp-http-api devlikeapro/whatsapp-http-api + +# It prints logs and the last line must be +# WhatsApp HTTP API is running on: http://[::1]:3000 +``` + +### Start session and scan QR + +2. Open Swagger API in the browser http://localhost:3000/ +3. Start session and scan QR code in swagger + 1. Find `POST /api/session/start` request press **Try it out** and + **Execute** it with `default` session name + 2. Find `GET /api/screenshot` and execute it - it must show QR code + 3. Scan QR code on your mobile WhatsApp application (that installed on your + phone) + 4. Execute `GET /api/screenshot` once again - it must show the screenshot + from WhatsApp Web. +4. Send test text message - find `POST /api/sendText` and execute it with + payload (change `12132132130` in the `chatId` to phone number that is + registered in WhatsApp). + +```json +{ + "chatId": "12132132130@c.us", + "text": "Hi there!", + "session": "default" +} +``` + +If you see **Hi there!** message then you're ready to run bots! + +## WhatsApp Echo Bot + +The WhatsApp Echo Bot is a sample ktor webhook server application that echoes +back to you whatever you send it. It can serve as a basic reference for how to +set up webhooks and reply to incoming messages. + +```bash +# Clone the git repository with example +git clone https://github.com/devlikeapro/waha-kotlin.git + +# Build and run the app +./gradlew build +./gradlew run +``` + +Open http://127.0.0.1:5000/bot - if you see **WhatsApp Echo Bot is ready!** then +the bot is ready to receive message! + +Send message to the WhatsApp (that you used to scan QR code) and it'll echo text +back to you! + + diff --git a/docs/site/content/en/docs/examples/python/index.md b/docs/site/content/en/docs/examples/python/index.md new file mode 100644 index 0000000000000000000000000000000000000000..8641316f03cc7c15c45f90a503a2701d63fad8c8 --- /dev/null +++ b/docs/site/content/en/docs/examples/python/index.md @@ -0,0 +1,148 @@ +--- +title: "Python" +description: "WhatsApp HTTP API + Python examples." +lead: "WhatsApp HTTP API + Python examples." +date: 2020-10-06T08:49:31+00:00 +lastmod: 2020-10-06T08:49:31+00:00 +draft: false +images: ["/images/python-whatsapp.png"] +menu: +docs: +parent: "help" +weight: 630 +toc: true +--- + +![](/images/python-whatsapp.png) + +We've created a few examples on how to interact with WAHA WhatsApp HTTP API with Python. + +You can find the examples in [examples folder on GitHub with detailed instructions in README.md ->](https://github.com/devlikeapro/whatsapp-http-api/tree/core/examples/python) + +## Installation + +We assume that you have installed software: + +1. Python 3 +2. Docker + +### Download and start image + +First of all, you must run WhatsApp HTTP API locally (which under the hood it +runs real WhatsApp Web instance and expose HTTP API for interaction). + +Here are the steps from +[Quick Start](https://waha.devlike.pro/docs/overview/quick-start/): + +Download and start WhatsApp HTTP API docker container + +```bash +# Download the image +docker pull devlikeapro/whatsapp-http-api +# Run the docker container +docker run -it --rm --network=host -e WHATSAPP_HOOK_URL=http://localhost:5000/bot -e "WHATSAPP_HOOK_EVENTS=*" --name whatsapp-http-api devlikeapro/whatsapp-http-api + +# It prints logs and the last line must be +# WhatsApp HTTP API is running on: http://[::1]:3000 +``` + +#### Download image - ARM + +If you're using ARM (like Apple Silicon, Apple M1, etc.) - use following +commands to download the image + +![](/images/versions/core.png) For Core version the command is + +```bash +# Download the image +docker pull devlikeapro/whatsapp-http-api:arm +# Rename it, so you can use devlikeapro/whatsapp-http-api image in other place +docker tag devlikeapro/whatsapp-http-api:arm devlikeapro/whatsapp-http-api +# Run the docker container +docker run -it --rm --network=host -e WHATSAPP_HOOK_URL=http://localhost:5000/bot -e "WHATSAPP_HOOK_EVENTS=*" --name whatsapp-http-api devlikeapro/whatsapp-http-api + +# It prints logs and the last line must be +# WhatsApp HTTP API is running on: http://[::1]:3000 +``` + +### Start session and scan QR + +2. Open Swagger API in the browser http://localhost:3000/ +3. Start session and scan QR code in swagger + 1. Find `POST /api/session/start` request press **Try it out** and + **Execute** it with `default` session name + 2. Find `GET /api/screenshot` and execute it - it must show QR code + 3. Scan QR code on your mobile WhatsApp application (that installed on your + phone) + 4. Execute `GET /api/screenshot` once again - it must show the screenshot + from WhatsApp Web. +4. Send test text message - find `POST /api/sendText` and execute it with + payload (change `12132132130` in the `chatId` to phone number that is + registered in WhatsApp). + +```json +{ + "chatId": "12132132130@c.us", + "text": "Hi there!", + "session": "default" +} +``` + +If you see **Hi there!** message then you're ready to run bots! + +## WhatsApp Echo Bot + +The WhatsApp Echo Bot is a sample flask webhook server application that echoes +back to you whatever you send it. It can serve as a basic reference for how to +set up webhooks and reply to incoming messages. + +```bash +# Clone the git repository with example +git clone https://github.com/devlikeapro/whatsapp-http-api.git +# Open python example folder +cd whatsapp-http-api/examples/python +# Install requirements +python -mpip install -r requirements.txt +# Run the bot +FLASK_APP=whatsapp_echo_bot.py flask run +``` + +Open http://127.0.0.1:5000/bot - if you see **WhatsApp Echo Bot is ready!** then +the bot is ready to receive message! + +Send message to the WhatsApp (that you used to scan QR code) and it'll echo text +back to you! + +## WhatsApp Download Files Bot + +The WhatsApp Download Image Bot downloads all files people send to your WhatsApp +and log the path for the file. + +**The bot works only with WAHA Plus version** available with donations. Visit +[read more about difference between Core and Plus versions](https://waha.devlike.pro/docs/how-to/plus-version/). + +Download **WAHA Plus** version: + +```bash +# Download the image +docker pull devlikeapro/whatsapp-http-api-plus +# Run the docker container +docker run -it --rm --network=host -e WHATSAPP_HOOK_URL=http://localhost:5000/bot -e "WHATSAPP_HOOK_EVENTS=*" --name whatsapp-http-api devlikeapro/whatsapp-http-api-plus +``` + +Run the WhatsApp Download Files bot: + +```bash +# Clone the git repository with example +git clone https://github.com/devlikeapro/whatsapp-http-api.git +# Open python example folder +cd whatsapp-http-api/examples/python +# Install requirements +python -mpip install -r requirements.txt +# Run the bot +FLASK_APP=whatsapp_download_files_bot.py flask run +``` + +Open http://127.0.0.1:5000/bot - if you see **WhatsApp Download Files Bot!** +then the bot is ready to receive message with files! + diff --git a/docs/site/content/en/docs/how-to/_index.md b/docs/site/content/en/docs/how-to/_index.md new file mode 100644 index 0000000000000000000000000000000000000000..6d3982f3b10bb2bf9987dbc25c26ed4a552c7537 --- /dev/null +++ b/docs/site/content/en/docs/how-to/_index.md @@ -0,0 +1,10 @@ +--- +title: "How-to guides" +description: "How-to guides" +lead: "" +date: 2020-10-06T08:49:15+00:00 +lastmod: 2020-10-06T08:49:15+00:00 +draft: false +images: [] +weight: 200 +--- diff --git a/docs/site/content/en/docs/how-to/chats/index.md b/docs/site/content/en/docs/how-to/chats/index.md new file mode 100644 index 0000000000000000000000000000000000000000..9d3698cac10dfa9e07c0f22d0ef9235d36be942d --- /dev/null +++ b/docs/site/content/en/docs/how-to/chats/index.md @@ -0,0 +1,43 @@ +--- +title : "Chats" +description: "Chats" +lead: "" +date: 2020-10-06T08:48:45+00:00 +lastmod: 2020-10-06T08:48:45+00:00 +draft: false +images: [] +weight: 127 +--- + +Chats methods. + +Parameters in path that you can find in below endpoints: +- `{session}` - use the session name for Whatsapp instance that you created with `POST /api/session/start` endpoint +- `{chatId}` - chat id in format `123123123123@[c.us|g.us]`, `c.us` for direct chats and `g.us` for groups. + +## Endpoints +See the list of engines [**that support the feature ->**]({{< relref "/docs/how-to/engines#features" >}}). + +### Get all chats +Get all chats +`GET /api/{session}/chats` + +### Get messages from chat +Get 100 messages from the chat + +`GET /api/{session}/chats/{chatId}/messages?limit=100` + + +Get 100 messages from the chat, skip downloading media (images, files) + +`GET /api/{session}/chats/{chatId}/messages?limit=100&downloadMedia=false` + +### Delete chat +Use the method to delete chat + +`DELETE /api/{session}/chats/{chatId}` + +### Clear messages +Use the method to clear all messages from the chat + +`DELETE /api/{session}/chats/{chatId}/messages` diff --git a/docs/site/content/en/docs/how-to/config/index.md b/docs/site/content/en/docs/how-to/config/index.md new file mode 100644 index 0000000000000000000000000000000000000000..f4537c188659daf470de7a0b72582bc89b0ff56c --- /dev/null +++ b/docs/site/content/en/docs/how-to/config/index.md @@ -0,0 +1,207 @@ +--- +title: "Configuration" +description: "Configuration" +lead: "" +date: 2020-10-06T08:48:45+00:00 +lastmod: 2020-10-06T08:48:45+00:00 +draft: false +images: [ ] +weight: 800 +--- + +You can configure WhatsApp HTTP API behaviour via environment variables, by adding `-e WHATSAPP_VARNAME=value` at the +begging of the command line or by using [other options](https://docs.docker.com/engine/reference/commandline/run/) + +```bash +docker run -it -e "WHATSAPP_HOOK_EVENTS=*" -e WHATSAPP_HOOK_URL=https://httpbin.org/post devlikeapro/whatsapp-http-api +``` + +It's not necessary to always run such a long command - you can save all data in +[docker-compose.yaml](https://github.com/devlikeapro/whatsapp-http-api/blob/core/docker-compose.yaml) +file as described on [How to deploy page ->]({{< relref "/docs/how-to/deploy" >}}). + +## Environment variables + +The following environment variables can be used to configure the WAHA. + +### Common +- `DEBUG=1`: Set this variable to any value to enable debug and verbose logs. + - You can also do it for a **specific session** by setting `config.debug` field to `true` when starting a session. +- `WHATSAPP_API_PORT=3000`: The port number that the HTTP server will listen on. The default value is `3000`. +- `WHATSAPP_API_HOSTNAME=localhost`: The hostname for the HTTP server. The default value is `localhost`. + +### Sessions +- `WHATSAPP_RESTART_ALL_SESSIONS=True`: Set this variable to `True` to start all **STOPPED** sessions after container + restarts. By default, this variable is set to `False`. + - Please note that this will start all **STOPPED** sessions, not just the sessions that were working before the restart. You can maintain the session list by + using `POST /api/session/stop` with the `logout: True` parameter or by calling `POST /api/session/logout` to remove + **STOPPED** sessions. You can see all sessions, including **STOPPED** sessions, in the `GET /api/sessions/all=True` + response. +- `WHATSAPP_START_SESSION=session1,session2`: This variable can be used to start sessions with the specified names right + after launching the API. Separate session names with a comma. +- Also read more about [Sessions ->]({{< relref "/docs/how-to/sessions" >}}) +- Also read more about [Session Storages on the dedicated page ->]({{< relref "/docs/how-to/storages#sessions" >}}) + +### Swagger +- `WHATSAPP_SWAGGER_CONFIG_ADVANCED=true` - enables advanced configuration options for Swagger documentation - you can customize host, port and base URL for the requests. + Disabled by default. +- `WHATSAPP_SWAGGER_ENABLED=false` - disables Swagger documentation. Enabled by default. Available in **WAHA Plus** only. +- `WHATSAPP_SWAGGER_USERNAME=admin` and `WHATSAPP_SWAGGER_PASSWORD=admin` - these variables can be used to protect the Swagger panel + with `admin / admin` credentials. This does not affect API access. Available in **WAHA Plus** only. + +Read more about security settings for Swagger and API on [**Security page** ->]({{< relref "/docs/how-to/security" >}}). + +### Proxy +#### Global proxy configuration +If you need to use a proxy, you can set the following environment variables: + +- `WHATSAPP_PROXY_SERVER=localhost:3128`: Use this variable to set the proxy server in the format `host:port`, without http or https. +- `WHATSAPP_PROXY_SERVER_USERNAME=username` and `WHATSAPP_PROXY_SERVER_PASSWORD=password`: Use these variables to set up credentials for the proxy. +- `WHATSAPP_PROXY_SERVER_LIST=host1.example.com:3138,host2.example.com:3138`: Use this variable to set a comma-separated list of addresses to use, using a round-robin algorithm to choose the server for the session. +- `WHATSAPP_PROXY_SERVER_INDEX_PREFIX=proxy-`: Use this variable to parse the session name for the prefix and find the appropriate session. + For example, if you have set `WHATSAPP_PROXY_SERVER_LIST=host-first:80,host-second:80,host-third:80` and `WHATSAPP_PROXY_SERVER_INDEX_PREFIX=proxy-` and you run `proxy-3` session, the `host-third:80` proxy will be chosen for that session. + This is a way to select a proxy from while you start session. + +#### Session proxy configuration +You can configure proxy when you start session by setting `config.proxy` fields. +Read more about it on [**Session page** ->]({{< relref "/docs/how-to/sessions#configure-proxy" >}}). + +Keep in mind that session's proxy configuration takes precedence over proxy configuration set by environment variables! + + +### Security +Security is available in [WAHA Plus ![](/images/versions/plus.png)]({{< relref "/docs/how-to/plus-version" >}}) only. + +- `WHATSAPP_API_KEY=mysecret`: If you set this variable, you must include the `X-Api-Key: mysecret` header in all + requests to the API. This will protect the API with a secret code. +- `WHATSAPP_SWAGGER_USERNAME=admin` and `WHATSAPP_SWAGGER_PASSWORD=admin`: These variables can be used to protect the + Swagger panel with `admin / admin` credentials. This does not affect API access. + +Read more about security settings for Swagger and API on [**Security page** ->]({{< relref "/docs/how-to/security" >}}). + +### Files +Files configuration is available in [WAHA Plus ![](/images/versions/plus.png)]({{< relref "/docs/how-to/plus-version" >}}) only. + +The following environment variables can be used to configure the file storage options for the WAHA: + +- `WHATSAPP_FILES_MIMETYPES`: This variable can be used to download only specific mimetypes from messages. + By default, all files are downloaded. The mimetypes must be separated by a comma, without spaces. + For example: `audio,image/png,image/gif`. To choose a specific type, use a prefix (like `audio,image`). See usage below. +- `WHATSAPP_DOWNLOAD_MEDIA=true` - this variable can be used to **completely** disable downloading media files. By default, all files are downloaded. + Set this variable to `WHATSAPP_DOWNLOAD_MEDIA=false` to disable downloading media files. + - Under the hood, it sets `WHATSAPP_FILES_MIMETYPES=mimetype/ignore-all-media` to ignore all media files. +- `WHATSAPP_FILES_LIFETIME`: This variable can be used to set the time (in seconds) after which files will be removed to + free up space. The default value is `180`. + - Set this variable to `0` to disable the file lifetime. +- `WHATSAPP_FILES_FOLDER`: This variable can be used to set the folder where files from chats (images, voice messages) + will be stored. The default value is `/tmp/whatsapp-files`. + - The folder must be mounted to the host machine to keep the files between container restarts. [ Read more about how to persist files ->]({{< relref "/docs/how-to/storages#media" >}}) +- Also read more about [Media Storages on the dedicated page ->]({{< relref "/docs/how-to/storages#media" >}}) + +💡 Even if WAHA doesn't process the message media because of `WHATSAPP_FILES_MIMETYPES` or `WHATSAPP_DOWNLOAD_MEDIA` +you'll get a webhook event with `hasMedia: True` field, but with no `media.url`. +```json +{ + "event": "message", + "session": "default", + "payload": { + "hasMedia": true, + "media": { + "url": null, + "mimetype": "video/mp4", + "filename": null + } + } +} +``` + +### Health Check +Health check is available in [WAHA Plus ![](/images/versions/plus.png)]({{< relref "/docs/how-to/plus-version" >}}) only. + +The following environment variables can be used to configure the [Health Check ->]({{< relref "/docs/how-to/other" >}}): +- `WHATSAPP_HEALTH_MEDIA_FILES_THRESHOLD_MB` - the threshold in MB for the media files storage. The default value is `100`. +- `WHATSAPP_HEALTH_SESSIONS_FILES_THRESHOLD_MB` - the threshold in MB for the sessions files storage. The default value is `100`. +- `WHATSAPP_HEALTH_MONGODB_TIMEOUT` - the timeout in milliseconds for the MongoDB health check. The default value is `5000`. + +## Examples + +#### Debug Mode + +To enable debug mode, set the `DEBUG` environment variable to any value: + +``` +DEBUG=1 +``` + +#### Protecting the API with a Secret Code + +To protect the API with a secret code, set the `WHATSAPP_API_KEY` environment variable to your secret code: + +``` +WHATSAPP_API_KEY=mysecret +``` + +You must include the `X-Api-Key: mysecret` header in all requests to the API. + +#### Starting Sessions Automatically + +To start sessions automatically when the API is launched, set the `WHATSAPP_START_SESSION` environment variable to a +comma-separated list of session names: + +``` +WHATSAPP_START_SESSION=session1,session2 +``` + +#### Restarting All Sessions + +To start all **STOPPED** sessions after container restarts, set the `WHATSAPP_RESTART_ALL_SESSIONS` environment variable +to `True`: + +``` +WHATSAPP_RESTART_ALL_SESSIONS=True +``` + +#### Protecting the Swagger Panel + +To protect the Swagger panel with `admin / admin` credentials, set the `WHATSAPP_SWAGGER_USERNAME` +and `WHATSAPP_SWAGGER_PASSWORD` environment variables: + +``` +WHATSAPP_SWAGGER_USERNAME=admin +WHATSAPP_SWAGGER_PASSWORD=admin +``` + + +#### Downloading Specific Mimetypes + +To download only specific mimetypes from messages, set the `WHATSAPP_FILES_MIMETYPES` environment variable to a +comma-separated list of mimetypes: + +``` +WHATSAPP_FILES_MIMETYPES=audio,image/png,image/gif +``` + +#### Disable Downloading Media Files +To disable downloading media files, set the `WHATSAPP_DOWNLOAD_MEDIA` environment variable to `false`: + +``` +WHATSAPP_DOWNLOAD_MEDIA=false +``` + +#### Setting the File Lifetime + +To set the time (in seconds) after which files will be removed to free up space, set the `WHATSAPP_FILES_LIFETIME` +environment variable: + +``` +WHATSAPP_FILES_LIFETIME=300 +``` + +#### Setting the File Storage Folder + +To set the folder where files from chats (images, voice messages) will be stored, set the `WHATSAPP_FILES_FOLDER` +environment variable: + +``` +WHATSAPP_FILES_FOLDER=/home/user/whatsapp-files +``` diff --git a/docs/site/content/en/docs/how-to/contacts/index.md b/docs/site/content/en/docs/how-to/contacts/index.md new file mode 100644 index 0000000000000000000000000000000000000000..1e2842e2fe687075bf80d4dd3cc2f963b7222514 --- /dev/null +++ b/docs/site/content/en/docs/how-to/contacts/index.md @@ -0,0 +1,117 @@ +--- +title : "Contacts" +description: "Contacts" +lead: "" +date: 2020-10-06T08:48:45+00:00 +lastmod: 2020-10-06T08:48:45+00:00 +draft: false +images: [] +weight: 130 +--- + +Methods for contacts. + +{{< alert icon="👉" text="WhatsApp Web does not support adding contacts, so the API doesn't support it too." />}} + +## Endpoints +See the list of engines [**that support the feature ->**]({{< relref "/docs/how-to/engines#features" >}}). + +### Get all contacts + +Get your contacts - `GET /api/contacts/all` + +```json +[ + { + "id": "11231231231@c.us", + "number": "11231231231", + "name": "Contact Name", + "pushname": "Pushname", + "shortName": "Shortname", + "isMe": true, + "isGroup": false, + "isWAContact": true, + "isMyContact": true, + "isBlocked": false + } +] +``` + +### Get contact + +Get contact + +- `GET /api/contacts?contactId=11231231231&session=default` +- `GET /api/contacts?contactId=11231231231@c.us&session=default` + +```json +{ + "id": "11231231231@c.us", + "number": "11231231231", + "name": "Contact Name", + "pushname": "Pushname", + "shortName": "Shortname", + "isMe": true, + "isGroup": false, + "isWAContact": true, + "isMyContact": true, + "isBlocked": false +} +``` + +### Check phone number exists + +If you want to check if phone number is registered in WhatsApp (even if the number is not in your contact list) - use +this endpoint for that. +```bash +GET /api/contacts/check-exists?phone=11231231231&session=default +``` +It returns `numberExists` field with `true` or `false` value and `chatId` field with chat ID of the number (if exists). + +```json +{ + "numberExists": true, + "chatId": "123123123@c.us" +} +``` +**Note for Brazilian Phone Numbers** + +You should use the `GET /api/contacts/check-exists` endpoint **before sending a message to a new phone number** +to get the correct chatId because of the additional 9-digit number added after 2012. + +Read more about +[error sending text to half of Brazilian numbers (every number registered before 2012) ->](https://github.com/devlikeapro/whatsapp-http-api/issues/238) + +It's fine to send the response to `chatId` for incoming messages, though - the payload already has the correct `chatId`. + +### Get "about" contact + +- `GET /api/contacts/about?contactId=11231231231&session=default` + +```json +{ + "about": "Hi, I use WhatsApp!" +} +``` + +### Get contact profile picture + +- `GET /api/contacts/profile-picture?contactId=11231231231&session=default` + +```json +{ + "profilePictureURL": "https://example.com/profile.jpg" +} +``` + +### Block (unblock) contact +- To block contact - `POST /api/contacts/block` +- To unblock contact - `POST /api/contacts/unblock` + +Request: +```json +{ + "contactId": "11231231231", + "session": "default" +} +``` diff --git a/docs/site/content/en/docs/how-to/deploy/index.md b/docs/site/content/en/docs/how-to/deploy/index.md new file mode 100644 index 0000000000000000000000000000000000000000..ef6fcd393cfc6c0fc737bd7f005ca195d2c19abc --- /dev/null +++ b/docs/site/content/en/docs/how-to/deploy/index.md @@ -0,0 +1,90 @@ +--- +title: "Deploy" +description: "How to deploy WAHA" +lead: "" +date: 2020-10-06T08:48:45+00:00 +lastmod: 2020-10-06T08:48:45+00:00 +draft: false +images: [ ] +weight: 899 +--- + +This page provides useful information to assist you in deploying the project. +It includes tips on how to avoid running long command lines, how to view logs, and other helpful advice. + +## How to Use Docker Compose + +Docker Compose is a tool that allows you to define and run multi-container Docker applications. It simplifies the +process of managing multiple containers and their dependencies. In this topic, we will walk you through how to use +Docker Compose with the WhatsApp HTTP API. + +### Prerequisites + +Before you start, you need to have Docker and Docker Compose installed on your machine. You can download Docker from the +official website [here](https://www.docker.com/products/docker-desktop). Docker Compose is included with Docker Desktop +for Windows and macOS, but for Linux, you need to install it separately. You can find the installation +instructions [here](https://docs.docker.com/compose/install/). + +### Getting Started + +To get started, you need to clone the [docker-compose.yaml](https://github.com/devlikeapro/whatsapp-http-api/blob/core/docker-compose.yaml) file to your local machine. +Open your terminal and run the following command: + +``` +wget https://raw.githubusercontent.com/devlikeapro/whatsapp-http-api/core/docker-compose.yaml +``` + +### Running the WhatsApp HTTP API Service + +To start the `whatsapp-http-api` service, run the following command: + +``` +docker-compose up -d whatsapp-http-api +``` + +This will start the container in detached mode and map port 3000 to 3000 on the host machine. + +To stop the service, run the command: + +``` +docker-compose down +``` + +This will stop and remove the container. + +To restart the service, run the command: + +``` +docker-compose restart whtasapp-http-api +``` + +This will restart the container. + +### Viewing the Logs + +To view the logs for the `whatsapp-http-api` service, run the command: + +``` +docker-compose logs -f whatsapp-http-api +``` + +This will show the logs in real-time. To view the logs for the `whatsapp-http-api-plus` service, +replace `whatsapp-http-api` with `whatsapp-http-api-plus`. + +To view the logs for a specific period, run the command: + +``` +docker-compose logs --since