Compare commits

...

46 Commits

Author SHA1 Message Date
Nicolas Giard
85243e5284
docs: Update SECURITY.md 2025-02-11 20:46:07 -05:00
Nicolas Giard
403e98dced
feat: add git always namespace option 2025-02-02 16:16:52 -05:00
Vasily Fedoseyev
abc8dce9cc
fix: Allow HA_ACTIVE: True to enable HA mode (#7493)
---------

Co-authored-by: Nicolas Giard <github@ngpixel.com>
2025-01-01 00:18:42 -05:00
maarous
94d253bf59
chore(helm): add support for securityContext and resources in sideload container (#7350)
---------

Co-authored-by: Mohamed Amine Arous <“maarous-prestataire@ina.fr”>
Co-authored-by: Nicolas Giard <github@ngpixel.com>
2024-11-22 14:31:07 -05:00
Nicolas Giard
c7c20579fd
docs: Update README.md 2024-11-18 17:18:28 -05:00
Nicolas Giard
583ea44a72
docs: Update README 2024-11-18 17:13:52 -05:00
Nicolas Giard
ab5c620d50
chore: update yarn lock 2024-10-12 04:51:48 -04:00
Jacob Beneski
7757de3af7
feat: add elasticsearch 8.x support (#6904) 2024-10-12 04:38:43 -04:00
Nicolas Giard
ad37325773
docs: Update README.md 2024-10-04 16:07:10 -04:00
Nicolas Giard
55a63a3c5a
ci: fix docker manifest typo 2024-09-17 21:13:51 -04:00
Nicolas Giard
34de47cc10
ci: remove armv7 build target 2024-09-17 20:37:55 -04:00
Nicolas Giard
18ebf83f88
ci: update base docker image 2024-09-16 01:31:04 -04:00
Nicolas Giard
ef5ab0ecb8
ci: disable mssql test 2024-08-31 23:31:19 -04:00
Nicolas Giard
b9fb17d4d4
fix: prevent password reset on disabled account 2024-08-29 03:06:06 -04:00
Dominik
d1b4c8c407
chore(helm): add pod annotations (#7222) 2024-06-26 00:51:45 -04:00
Nicolas Giard
2e35ebf1dc
docs: Update README.md 2024-06-14 04:42:48 -04:00
Nicolas Giard
904260fd44
fix: set no-store cache control on jwt renew response 2024-05-23 23:01:38 -04:00
Ethan
1238d614e1
Merge pull request from GHSA-xjcj-p2qv-q3rf
* Update render.js

# Improved handling of mustache expressions and v-pre attribute assignment

## Changes Made:
- Ensured that the parent tag of such text nodes is explicitly set to a `<p>` tag with the `v-pre` attribute.
- Added debug messages for better understanding of the script execution flow [THIS SHOULD REMOVED WHEN PUSHING TO PRODUCTION].

## Why it Works:
- When a mustache expression is found, the script either wraps it in a new `<p>` tag with the `v-pre` attribute or adds the `v-pre` attribute to the existing parent `<p>` tag.
- This approach ensures that the template code is not removed but encapsulated within `<p>` tags with the `v-pre` attribute, as required.

## Test Cases Passed:
1. `<xyz>{{ constructor.constructor('alert(1)')() }}</xyz>`
2. `<xyz>{{ constructor.constructor('alert(1)')() }}</xyz>`
3. `<p><xyz>{{ constructor.constructor('alert(1)')() }}</p>`
4. `<p><xyz>{{ constructor.constructor('alert(1)')() }}</xyz></p>`
5. `<p>&lt;xyz&gt;{{constructor.constructor('alert("Test Case 8")')()}}&lt;xyz&gt;{{constructor.constructor('alert("Test Case 9")')()}}&lt;/xyz&gt;</p>`

This commit enhances the robustness and reliability of handling mustache expressions and ensures proper assignment of the `v-pre` attribute, to ensure that there is no room for the weaponization of the template code later in the rendering process.

* fix: move template expressions after dom-purify + handle text nodes without parent

---------

Co-authored-by: NGPixel <github@ngpixel.com>
2024-05-13 14:57:17 -04:00
Nicolas Giard
98c04fe18e
docs: Update README.md 2024-04-29 17:12:17 -04:00
Nicolas Giard
854ec230dd
ci: Update build.yml 2024-04-29 15:12:22 -04:00
Nicolas Giard
a28b525894
docs: Update SECURITY.md 2024-04-29 14:24:28 -04:00
CDN
f1161aed59
fix: make comment module "Artalk" work with newer versions (#6901)
* feat: update comment module "Artalk"
* fix: update code.yml

---------

Co-authored-by: Nicolas Giard <github@ngpixel.com>
2024-04-24 20:58:53 -04:00
Sukka
3a7ce75a1e
refactor(templates): replace polyfill.io (#7032) 2024-04-24 20:53:45 -04:00
Karol Rudnikowski (dxdroni)
f54551ee69
fix: page pagination in tags component (#7061) 2024-04-24 20:50:53 -04:00
Nicolas Giard
abdd2f0d17
fix: remove upper range node.js version check 2024-04-24 20:46:11 -04:00
Nicolas Giard
66ca18c499
docs: Update README.md 2024-03-16 01:15:24 -04:00
craph
d5af4cb068
chore: fix python issue for node18 in dev Dockerfile (#7029)
* Fix: email toLowerCase

* Fix python issue for node18 in Dockerfile
2024-02-28 16:07:19 -05:00
Nicolas Giard
ece5753ebb
docs: Update README.md 2024-02-07 15:31:49 -05:00
Nicolas Giard
b1e1759f25
fix: set securityTrustProxy to false by default 2024-01-28 20:03:06 -05:00
Jasmine Tai
99e74e8eb2
feat: upgrade markdown-it-emoji to 3.0.0 (#6945) 2024-01-22 20:20:01 -05:00
Nicolas Giard
34c037c68b
docs: Update README.md 2024-01-21 00:32:01 -05:00
aelgasser
38a46e68ea
feat: sync groups with SAML provider (#6299)
* feat: added implementation for group mapping in SAML strategies

---------

Co-authored-by: Abderraouf El Gasser <abderraouf.elgasser@iktos.com>
Co-authored-by: Nicolas Giard <github@ngpixel.com>
2023-11-20 16:59:33 -05:00
Nicolas Giard
fd91caff1d
docs: Update README.md 2023-10-27 17:15:21 -04:00
Nicolas Giard
16245caeff
docs: Update README.md 2023-10-18 21:35:12 -04:00
Pablo
8932d15c0c
fix: typo in kroki name (#6745) 2023-09-24 23:30:28 -04:00
Nicolas Giard
b19c4e4f23
docs: Update README.md 2023-09-20 16:42:49 -04:00
Nicolas Giard
4ce301d37c
docs: Update README.md 2023-09-19 20:48:55 -04:00
Jaeseo Park
c4c41be81a
chore: upgrade markdown-it-pivot-table version (#6707) 2023-09-07 19:30:34 -04:00
Nicolas Giard
ef174143ae
docs: Update README.md 2023-09-04 00:14:56 -04:00
Nicolas Giard
2180592ade
ci: fix build.yml 2023-09-01 19:09:16 -04:00
Nicolas Giard
7312de7332
ci: fix build.yml 2023-09-01 18:43:10 -04:00
Nicolas Giard
c66bc1c7c1
ci: fix build.yml 2023-09-01 18:26:28 -04:00
Nicolas Giard
c18a832a3a
docs: Update README.md 2023-08-23 19:18:22 -04:00
Nicolas Giard
cd390ec544
docs: update README.md 2023-08-22 15:53:27 -04:00
Nicolas Giard
8259f0dee6
ci: manually patch extract-files package for windows build 2023-08-18 00:04:23 -04:00
Nicolas Giard
095f8cec7a
ci: fix missing patch-package in windows build 2023-08-17 19:47:07 -04:00
32 changed files with 386 additions and 184 deletions

View File

@ -19,7 +19,7 @@ jobs:
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set Build Variables
run: |
@ -42,20 +42,20 @@ jobs:
cat package.json
- name: Login to DockerHub
uses: docker/login-action@v2.1.0
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2.1.0
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@v4.0.0
uses: docker/build-push-action@v5
with:
context: .
file: dev/build/Dockerfile
@ -77,7 +77,7 @@ jobs:
find _dist/wiki/ -printf "%P\n" | tar -czf wiki-js.tar.gz --no-recursion -C _dist/wiki/ -T -
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3.1.2
uses: actions/upload-artifact@v4
with:
name: drop
path: wiki-js.tar.gz
@ -89,10 +89,10 @@ jobs:
strategy:
matrix:
dbtype: [postgres, mysql, mariadb, mssql, sqlite]
dbtype: [postgres, mysql, mariadb, sqlite]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set Test Variables
run: |
@ -125,11 +125,11 @@ jobs:
include:
- platform: linux/arm64
docker: arm64
- platform: linux/arm/v7
docker: armv7
# - platform: linux/arm/v7
# docker: armv7
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set Version Variables
run: |
@ -142,26 +142,26 @@ jobs:
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v2.1.0
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.4.0
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v2.1.0
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2.1.0
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download a Build Artifact
uses: actions/download-artifact@v3.0.2
uses: actions/download-artifact@v4
with:
name: drop
path: drop
@ -172,7 +172,7 @@ jobs:
tar -xzf $GITHUB_WORKSPACE/drop/wiki-js.tar.gz -C $GITHUB_WORKSPACE/build --exclude=node_modules
- name: Build and push Docker images
uses: docker/build-push-action@v4.0.0
uses: docker/build-push-action@v5
with:
context: .
file: dev/build-arm/Dockerfile
@ -190,12 +190,12 @@ jobs:
steps:
- name: Setup Node.js environment
uses: actions/setup-node@v3.6.0
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x
- name: Download a Build Artifact
uses: actions/download-artifact@v3.0.2
uses: actions/download-artifact@v4
with:
name: drop
path: drop
@ -203,17 +203,25 @@ jobs:
- name: Extract Build
run: |
mkdir -p win
tar -xzf $env:GITHUB_WORKSPACE\drop\wiki-js.tar.gz -C $env:GITHUB_WORKSPACE\win --exclude=node_modules
tar -xzf $env:GITHUB_WORKSPACE\drop\wiki-js.tar.gz -C $env:GITHUB_WORKSPACE\win
Copy-Item win\node_modules\extract-files\package.json patch-extractfile.json -Force
Remove-Item -Path win\node_modules -Force -Recurse
- name: Install Dependencies
run: yarn --production --frozen-lockfile --non-interactive
run: |
yarn --production --frozen-lockfile --non-interactive
yarn patch-package
working-directory: win
- name: Fix patched packages
run: |
Copy-Item patch-extractfile.json win\node_modules\extract-files\package.json -Force
- name: Create Bundle
run: tar -czf wiki-js-windows.tar.gz -C $env:GITHUB_WORKSPACE\win .
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3.1.2
uses: actions/upload-artifact@v4
with:
name: drop-win
path: wiki-js-windows.tar.gz
@ -233,13 +241,13 @@ jobs:
echo "REL_VERSION_STRICT=${GITHUB_REF_NAME#?}" >> $GITHUB_ENV
- name: Login to DockerHub
uses: docker/login-action@v2.1.0
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2.1.0
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
@ -249,8 +257,8 @@ jobs:
run: |
echo "Creating the manifests..."
docker manifest create requarks/wiki:beta-$REL_VERSION_STRICT requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT requarks/wiki:canary-armv7-$REL_VERSION_STRICT
docker manifest create ghcr.io/requarks/wiki:beta-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-arm64-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-armv7-$REL_VERSION_STRICT
docker manifest create requarks/wiki:beta-$REL_VERSION_STRICT requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT
docker manifest create ghcr.io/requarks/wiki:beta-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-arm64-$REL_VERSION_STRICT
echo "Pushing the manifests..."
@ -274,13 +282,13 @@ jobs:
echo "REL_VERSION_STRICT=${GITHUB_REF_NAME#?}" >> $GITHUB_ENV
- name: Login to DockerHub
uses: docker/login-action@v2.1.0
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2.1.0
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
@ -299,14 +307,14 @@ jobs:
echo "Using major $MAJOR and minor $MINOR..."
echo "Creating the manifests..."
docker manifest create requarks/wiki:$REL_VERSION_STRICT requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT requarks/wiki:canary-armv7-$REL_VERSION_STRICT
docker manifest create requarks/wiki:$MAJOR requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT requarks/wiki:canary-armv7-$REL_VERSION_STRICT
docker manifest create requarks/wiki:$MAJORMINOR requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT requarks/wiki:canary-armv7-$REL_VERSION_STRICT
docker manifest create requarks/wiki:latest requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT requarks/wiki:canary-armv7-$REL_VERSION_STRICT
docker manifest create ghcr.io/requarks/wiki:$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-arm64-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-armv7-$REL_VERSION_STRICT
docker manifest create ghcr.io/requarks/wiki:$MAJOR ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-arm64-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-armv7-$REL_VERSION_STRICT
docker manifest create ghcr.io/requarks/wiki:$MAJORMINOR ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-arm64-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-armv7-$REL_VERSION_STRICT
docker manifest create ghcr.io/requarks/wiki:latest ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-arm64-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-armv7-$REL_VERSION_STRICT
docker manifest create requarks/wiki:$REL_VERSION_STRICT requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT
docker manifest create requarks/wiki:$MAJOR requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT
docker manifest create requarks/wiki:$MAJORMINOR requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT
docker manifest create requarks/wiki:latest requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT
docker manifest create ghcr.io/requarks/wiki:$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-arm64-$REL_VERSION_STRICT
docker manifest create ghcr.io/requarks/wiki:$MAJOR ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-arm64-$REL_VERSION_STRICT
docker manifest create ghcr.io/requarks/wiki:$MAJORMINOR ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-arm64-$REL_VERSION_STRICT
docker manifest create ghcr.io/requarks/wiki:latest ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-arm64-$REL_VERSION_STRICT
echo "Pushing the manifests..."
@ -320,13 +328,13 @@ jobs:
docker manifest push -p ghcr.io/requarks/wiki:latest
- name: Download Linux Build
uses: actions/download-artifact@v3.0.2
uses: actions/download-artifact@v4
with:
name: drop
path: drop
- name: Download Windows Build
uses: actions/download-artifact@v3.0.2
uses: actions/download-artifact@v4
with:
name: drop-win
path: drop-win
@ -351,7 +359,7 @@ jobs:
artifacts: 'drop/wiki-js.tar.gz,drop-win/wiki-js-windows.tar.gz'
- name: Notify Slack Releases Channel
uses: slackapi/slack-github-action@v1.18.0
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{
@ -373,34 +381,34 @@ jobs:
See [release notes](https://github.com/requarks/wiki/releases) for details.
- name: Notify Discord Channel
uses: sebastianpopp/discord-action@v1.0
uses: sebastianpopp/discord-action@v2.0
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
message: Wiki.js ${{ github.ref_name }} has been released! See https://github.com/requarks/wiki/releases for details.
build-do-image:
name: Build DigitalOcean Image
runs-on: ubuntu-latest
needs: [release]
# build-do-image:
# name: Build DigitalOcean Image
# runs-on: ubuntu-latest
# needs: [release]
steps:
- uses: actions/checkout@v3
# steps:
# - uses: actions/checkout@v4
- name: Set Version Variables
run: |
echo "Using TAG mode: $GITHUB_REF_NAME"
echo "REL_VERSION_STRICT=${GITHUB_REF_NAME#?}" >> $GITHUB_ENV
# - name: Set Version Variables
# run: |
# echo "Using TAG mode: $GITHUB_REF_NAME"
# echo "REL_VERSION_STRICT=${GITHUB_REF_NAME#?}" >> $GITHUB_ENV
- name: Install Packer
run: |
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install packer
# - name: Install Packer
# run: |
# curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
# sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
# sudo apt-get update && sudo apt-get install packer
- name: Build Droplet Image
env:
DIGITALOCEAN_API_TOKEN: ${{ secrets.DO_TOKEN }}
WIKI_APP_VERSION: ${{ env.REL_VERSION_STRICT }}
working-directory: dev/packer
run: |
packer build digitalocean.json
# - name: Build Droplet Image
# env:
# DIGITALOCEAN_API_TOKEN: ${{ secrets.DO_TOKEN }}
# WIKI_APP_VERSION: ${{ env.REL_VERSION_STRICT }}
# working-directory: dev/packer
# run: |
# packer build digitalocean.json

View File

@ -8,17 +8,15 @@
[![Release](https://img.shields.io/github/release/Requarks/wiki.svg?style=flat&maxAge=3600)](https://github.com/Requarks/wiki/releases)
[![License](https://img.shields.io/badge/license-AGPLv3-blue.svg?style=flat)](https://github.com/requarks/wiki/blob/master/LICENSE)
[![Standard - JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-green.svg?style=flat&logo=javascript&logoColor=white)](http://standardjs.com/)
[![Downloads](https://img.shields.io/github/downloads/Requarks/wiki/total.svg?style=flat&logo=github)](https://github.com/Requarks/wiki/releases)
[![Docker Pulls](https://img.shields.io/docker/pulls/requarks/wiki.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/requarks/wiki/)
[![Build + Publish](https://github.com/Requarks/wiki/actions/workflows/build.yml/badge.svg)](https://github.com/Requarks/wiki/actions/workflows/build.yml)
[![Huntr](https://img.shields.io/badge/security%20bounty-disclose-brightgreen.svg?style=flat&logo=cachet&logoColor=white)](https://huntr.dev/bounties/disclose)
[![Build + Publish](https://github.com/Requarks/wiki/actions/workflows/build.yml/badge.svg)](https://github.com/Requarks/wiki/actions/workflows/build.yml)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/ngpixel?logo=github&color=ea4aaa)](https://github.com/users/NGPixel/sponsorship)
[![Open Collective backers and sponsors](https://img.shields.io/opencollective/all/wikijs?label=backers&color=218bff&logo=opencollective&logoColor=white)](https://opencollective.com/wikijs)
[![Subscribe to Newsletter](https://img.shields.io/badge/newsletter-subscribe-yellow.svg?style=flat&logo=mailchimp&logoColor=white)](https://blog.js.wiki/subscribe)
[![Chat on Slack](https://img.shields.io/badge/slack-requarks-CC2B5E.svg?style=flat&logo=slack)](https://wiki.requarks.io/slack)
[![Follow on Twitter](https://img.shields.io/badge/twitter-%40requarks-blue.svg?style=flat&logo=twitter&logoColor=white)](https://twitter.com/requarks)
[![Follow on Telegram](https://img.shields.io/badge/telegram-%40wiki__js-blue.svg?style=flat&logo=telegram)](https://t.me/wiki_js)
[![Downloads](https://img.shields.io/github/downloads/Requarks/wiki/total.svg?style=flat&logo=github)](https://github.com/Requarks/wiki/releases)
[![Docker Pulls](https://img.shields.io/docker/pulls/requarks/wiki.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/requarks/wiki/)
[![Chat on Discord](https://img.shields.io/badge/discord-join-8D96F6.svg?style=flat&logo=discord&logoColor=white)](https://discord.gg/rcxt9QS2jd)
[![Chat on Slack](https://img.shields.io/badge/slack-requarks-CC2B5E.svg?style=flat&logo=slack)](https://wiki.requarks.io/slack)
[![Follow on Bluesky](https://img.shields.io/badge/bluesky-%40js.wiki-blue.svg?style=flat&logo=bluesky&logoColor=white)](https://bsky.app/profile/js.wiki)
[![Follow on Telegram](https://img.shields.io/badge/telegram-%40wiki__js-blue.svg?style=flat&logo=telegram)](https://t.me/wiki_js)
[![Reddit](https://img.shields.io/badge/reddit-%2Fr%2Fwikijs-orange?logo=reddit&logoColor=white)](https://www.reddit.com/r/wikijs/)
##### A modern, lightweight and powerful wiki app built on NodeJS
@ -32,7 +30,7 @@
- [Demo](https://docs.requarks.io/demo)
- [Changelog](https://github.com/requarks/wiki/releases)
- [Feature Requests](https://feedback.js.wiki/wiki)
- [Chat with us on Slack](https://wiki.requarks.io/slack)
- Chat with us on [Discord](https://discord.gg/rcxt9QS2jd) / [Slack](https://wiki.requarks.io/slack)
- [Translations](https://docs.requarks.io/dev/translations) *(We need your help!)*
- [E2E Testing Results](https://dashboard.cypress.io/projects/r7qxah/runs)
- [Special Thanks](#special-thanks)
@ -85,11 +83,6 @@ Support this project by becoming a sponsor. Your name will show up in the Contri
<img src="https://cdn.js.wiki/images/sponsors/stellarhosted.png">
</a>
</td>
<td align="center" valign="middle" width="444">
<a href="https://www.hostwiki.com/" target="_blank">
<img src="https://cdn.js.wiki/images/sponsors/hostwiki.png">
</a>
</td>
</tr>
</tbody>
</table>
@ -99,6 +92,11 @@ Support this project by becoming a sponsor. Your name will show up in the Contri
<table>
<tbody>
<tr>
<td align="center" valign="middle" width="148">
<a href="https://acceleanation.com/" target="_blank">
<img src="https://avatars.githubusercontent.com/u/41210718?s=200&v=4">
</a>
</td>
<td align="center" valign="middle" width="148">
<a href="https://github.com/alexksso" target="_blank">
Alexander Casassovici<br />(@alexksso)
@ -119,6 +117,13 @@ Support this project by becoming a sponsor. Your name will show up in the Contri
<img src="https://static.requarks.io/sponsors/gigabitelabs-148x129.png">
</a>
</td>
<td align="center" valign="middle" width="148">
<a href="https://www.hostwiki.com/" target="_blank">
<img src="https://cdn.js.wiki/images/sponsors/hostwiki.png">
</a>
</td>
</tr>
<tr>
<td align="center" valign="middle" width="148">
<a href="https://github.com/JayDaley" target="_blank">
Jay Daley<br />(@JayDaley)
@ -129,8 +134,6 @@ Support this project by becoming a sponsor. Your name will show up in the Contri
Oleksii<br />(@idokka)
</a>
</td>
</tr>
<tr>
<td align="center" valign="middle" width="148">
<a href="https://www.openhost-network.com/" target="_blank">
<img src="https://avatars.githubusercontent.com/u/114218287?s=200&v=4">
@ -142,11 +145,11 @@ Support this project by becoming a sponsor. Your name will show up in the Contri
</a>
</td>
<td align="center" valign="middle" width="148">
<a href="https://acceleanation.com/" target="_blank">
<img src="https://avatars.githubusercontent.com/u/41210718?s=200&v=4">
<a href="http://www.taicep.org/" target="_blank">
<img src="https://avatars.githubusercontent.com/u/160072306?v=4">
</a>
</td>
<td align="center" valign="middle" colspan="3">
<td align="center" valign="middle" colspan="1">
<a href="https://github.com/sponsors/NGPixel" target="_blank">
<img src="https://static.requarks.io/sponsors/become-148x72.png">
</a>
@ -168,6 +171,7 @@ Support this project by becoming a sponsor. Your name will show up in the Contri
- Cloud Data Hosting LLC ([@CloudDataHostingLLC](https://github.com/CloudDataHostingLLC))
- Cole Manning ([@RVRX](https://github.com/RVRX))
- CrazyMarvin ([@CrazyMarvin](https://github.com/CrazyMarvin))
- Daniel Horner ([@danhorner](https://github.com/danhorner))
- David Christian Holin ([@SirGibihm](https://github.com/SirGibihm))
- Dragan Espenschied ([@despens](https://github.com/despens))
- Elijah Zobenko ([@he110](https://github.com/he110))
@ -187,13 +191,13 @@ Support this project by becoming a sponsor. Your name will show up in the Contri
- MaFarine ([@MaFarine](https://github.com/MaFarine))
- Marcilio Leite Neto ([@marclneto](https://github.com/marclneto))
- Mattias Johnson ([@mattiasJohnson](https://github.com/mattiasJohnson))
</td><td>
<img width="441" height="1" />
- Max Ricketts-Uy ([@MaxRickettsUy](https://github.com/MaxRickettsUy))
- Mickael Asseline ([@PAPAMICA](https://github.com/PAPAMICA))
- Mitchell Rowton ([@mrowton](https://github.com/mrowton))
</td><td>
<img width="441" height="1" />
- M. Scott Ford ([@mscottford](https://github.com/mscottford))
- Nick Halase ([@nhalase](https://github.com/nhalase))
- Nick Price ([@DominoTree](https://github.com/DominoTree))
@ -206,15 +210,21 @@ Support this project by becoming a sponsor. Your name will show up in the Contri
- Ruizhe Li ([@liruizhe1995](https://github.com/liruizhe1995))
- Sam Martin ([@ABitMoreDepth](https://github.com/ABitMoreDepth))
- Sean Coffey ([@seanecoffey](https://github.com/seanecoffey))
- Simon Ott ([@ottsimon](https://github.com/ottsimon))
- Stephan Kristyn ([@stevek-pro](https://github.com/stevek-pro))
- Theodore Chu ([@TheodoreChu](https://github.com/TheodoreChu))
- Tim Elmer ([@tim-elmer](https://github.com/tim-elmer))
- Tyler Denman ([@tylerguy](https://github.com/tylerguy))
- Victor Bilgin ([@vbilgin](https://github.com/vbilgin))
- VMO Solutions ([@vmosolutions](https://github.com/vmosolutions))
- YazMogg35 ([@YazMogg35](https://github.com/YazMogg35))
- Yu Yongwoo ([@uyu423](https://github.com/uyu423))
- ameyrakheja ([@ameyrakheja](https://github.com/ameyrakheja))
- aniketpanjwani ([@aniketpanjwani](https://github.com/aniketpanjwani))
- aytaa ([@aytaa](https://github.com/aytaa))
- cesar ([@cesarnr21](https://github.com/cesarnr21))
- chaee ([@chaee](https://github.com/chaee))
- lwileczek ([@lwileczek](https://github.com/lwileczek))
- magicpotato ([@fortheday](https://github.com/fortheday))
- motoacs ([@motoacs](https://github.com/motoacs))
- muzian666 ([@muzian666](https://github.com/muzian666))
@ -385,6 +395,23 @@ Support this project by becoming a sponsor. Your logo will show up in the Contri
<a href="https://opencollective.com/wikijs/sponsor/44/website" target="_blank"><img src="https://opencollective.com/wikijs/sponsor/44/avatar.svg"></a>
</td>
</tr>
<tr>
<td align="center" valign="middle">
<a href="https://opencollective.com/wikijs/sponsor/40/website" target="_blank"><img src="https://opencollective.com/wikijs/sponsor/45/avatar.svg"></a>
</td>
<td align="center" valign="middle">
<a href="https://opencollective.com/wikijs/sponsor/41/website" target="_blank"><img src="https://opencollective.com/wikijs/sponsor/46/avatar.svg"></a>
</td>
<td align="center" valign="middle">
<a href="https://opencollective.com/wikijs/sponsor/42/website" target="_blank"><img src="https://opencollective.com/wikijs/sponsor/47/avatar.svg"></a>
</td>
<td align="center" valign="middle">
<a href="https://opencollective.com/wikijs/sponsor/43/website" target="_blank"><img src="https://opencollective.com/wikijs/sponsor/48/avatar.svg"></a>
</td>
<td align="center" valign="middle">
<a href="https://opencollective.com/wikijs/sponsor/44/website" target="_blank"><img src="https://opencollective.com/wikijs/sponsor/49/avatar.svg"></a>
</td>
</tr>
</tbody>
</table>
</div>
@ -397,6 +424,7 @@ Thank you to all our patrons! 🙏 [[Become a patron](https://www.patreon.com/re
<table><tbody><tr><td>
<img width="441" height="1" />
- Aeternum
- Al Romano
- Alex Balabanov
- Alex Milanov
@ -421,11 +449,11 @@ Thank you to all our patrons! 🙏 [[Become a patron](https://www.patreon.com/re
- Ian
- Imari Childress
- Iskander Callos
- Josh Stewart
</td><td>
<img width="441" height="1" />
- Josh Stewart
- Justin Dunsworth
- Keir
- Loïc CRAMPON

View File

@ -13,15 +13,9 @@ If you find such vulnerability, it's important to disclose it in a quick and sec
## Reporting a Vulnerability
**DO NOT CREATE AN ISSUE ON GITHUB** to report a potential vulnerability / security problem. Instead, choose one of these options:
**DO NOT CREATE A GITHUB ISSUE / DISCUSSION** to report a potential vulnerability / security problem. Instead, choose one of these options:
### A) Disclose on Huntr.dev
Disclose the vulnerability on [Huntr.dev](https://huntr.dev/bounties/disclose) for the repository `https://github.com/Requarks/wiki`.
### B) Send an email
Send an email to security@requarks.io.
Submit a Vulnerability Report by filling in the form on https://github.com/requarks/wiki/security/advisories/new
Include as much details as possible, such as:
- The version(s) of Wiki.js that are impacted

View File

@ -265,7 +265,7 @@ export default {
securityOpenRedirect: true,
securityIframe: true,
securityReferrerPolicy: true,
securityTrustProxy: true,
securityTrustProxy: false,
securitySRI: true,
securityHSTS: false,
securityHSTSDuration: 0,

View File

@ -200,7 +200,7 @@ import 'codemirror/addon/fold/foldgutter.css'
import MarkdownIt from 'markdown-it'
import mdAttrs from 'markdown-it-attrs'
import mdDecorate from 'markdown-it-decorate'
import mdEmoji from 'markdown-it-emoji'
import { full as mdEmoji } from 'markdown-it-emoji'
import mdTaskLists from 'markdown-it-task-lists'
import mdExpandTabs from 'markdown-it-expand-tabs'
import mdAbbr from 'markdown-it-abbr'

View File

@ -98,6 +98,7 @@
:search='innerSearch'
:loading='isLoading'
:options.sync='pagination'
@page-count='pageTotal = $event'
hide-default-footer
ref='dude'
)
@ -183,6 +184,7 @@ export default {
sortDesc: [false]
},
pages: [],
pageTotal: 0,
isLoading: true,
scrollStyle: {
vuescroll: {},
@ -214,9 +216,6 @@ export default {
tagsSelected () {
return _.filter(this.tags, t => _.includes(this.selection, t.tag))
},
pageTotal () {
return Math.ceil(this.pages.length / this.pagination.itemsPerPage)
},
orderByItems () {
return [
{ text: this.$t('tags:orderByField.creationDate'), value: 'createdAt' },

View File

@ -1,7 +1,7 @@
# =========================
# --- BUILD NPM MODULES ---
# =========================
FROM node:18-alpine AS build
FROM node:20-alpine AS build
RUN apk add yarn g++ make cmake python3 --no-cache
@ -16,7 +16,7 @@ RUN yarn patch-package
# ===============
# --- Release ---
# ===============
FROM node:18-alpine
FROM node:20-alpine
LABEL maintainer="requarks.io"
RUN apk add bash curl git openssh gnupg sqlite --no-cache && \

View File

@ -1,7 +1,7 @@
# ====================
# --- Build Assets ---
# ====================
FROM node:18-alpine AS assets
FROM node:20-alpine AS assets
RUN apk add yarn g++ make cmake python3 --no-cache
@ -25,7 +25,7 @@ RUN yarn patch-package
# ===============
# --- Release ---
# ===============
FROM node:18-alpine
FROM node:20-alpine
LABEL maintainer="requarks.io"
RUN apk add bash curl git openssh gnupg sqlite --no-cache && \

View File

@ -5,7 +5,7 @@ FROM node:18
LABEL maintainer "requarks.io"
RUN apt-get update && \
apt-get install -y bash curl git python make g++ nano openssh-server gnupg && \
apt-get install -y bash curl git python3 make g++ nano openssh-server gnupg && \
mkdir -p /wiki
WORKDIR /wiki

View File

@ -2,7 +2,7 @@ apiVersion: v2
name: wiki
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 2.2.0
version: 2.3.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
AppVersion: latest

View File

@ -97,16 +97,16 @@ The following table lists the configurable parameters of the Wiki.js chart and t
| `image.repository` | Wiki.js image | `requarks/wiki` |
| `image.tag` | Wiki.js image tag | `latest` |
| `imagePullPolicy` | Image pull policy | `IfNotPresent` |
| `replicacount` | Amount of wiki.js service pods to run | `1` |
| `revisionHistoryLimit` | Total amount of revision history points | `10` |
| `resources.limits` | wiki.js service resource limits | `nil` |
| `resources.requests` | wiki.js service resource requests | `nil` |
| `nodeSelector` | Node labels for wiki.js pod assignment | `{}` |
| `affinity` | Affinity settings for wiki.js pod assignment | `{}` |
| `schedulerName` | Name of an alternate scheduler for wiki.js pod | `nil` |
| `tolerations` | Toleration labels for wiki.jsk pod assignment | `[]` |
| `volumeMounts` | Volume mounts for Wiki.js container | `[]` |
| `volumes` | Volumes for Wiki.js Pod | `[]` |
| `replicacount` | Number of Wiki.js pods to run | `1` |
| `revisionHistoryLimit` | Total number of revision history points | `10` |
| `resources.limits` | Wiki.js service resource limits | `nil` |
| `resources.requests` | Wiki.js service resource requests | `nil` |
| `nodeSelector` | Node labels for the Wiki.js pod assignment | `{}` |
| `affinity` | Affinity settings for the Wiki.js pod assignment | `{}` |
| `schedulerName` | Name of an alternate scheduler for the Wiki.js pod | `nil` |
| `tolerations` | Toleration labels for the Wiki.js pod assignment | `[]` |
| `volumeMounts` | Volume mounts for the Wiki.js container | `[]` |
| `volumes` | Volumes for the Wiki.js pod | `[]` |
| `ingress.enabled` | Enable ingress controller resource | `false` |
| `ingress.className` | Ingress class name | `""` |
| `ingress.annotations` | Ingress annotations | `{}` |
@ -114,7 +114,10 @@ The following table lists the configurable parameters of the Wiki.js chart and t
| `ingress.tls` | Ingress TLS configuration | `[]` |
| `sideload.enabled` | Enable sideloading of locale files from git | `false` |
| `sideload.repoURL` | Git repository URL containing locale files | `https://github.com/Requarks/wiki-localization` |
| `sideload.env` | Environment variables for sideload Container | `{}` |
| `sideload.env` | Environment variables for the sideload container | `{}` |
| `sideload.securityContext` | Security context for the sideload container | `nil` |
| `sideload.resources.limits` | Resource limits for the sideload container | `nil` |
| `sideload.resources.requests` | Resource requests for the sideload container | `nil` |
| `nodeExtraCaCerts` | Trusted certificates path | `nil` |
| `postgresql.enabled` | Deploy postgres server (see below) | `true` |
| `postgresql.postgresqlDatabase` | Postgres database name | `wiki` |
@ -122,7 +125,7 @@ The following table lists the configurable parameters of the Wiki.js chart and t
| `postgresql.postgresqlHost` | External postgres host | `nil` |
| `postgresql.postgresqlPassword` | External postgres password | `nil` |
| `postgresql.existingSecret` | Provide an existing `Secret` for postgres | `nil` |
| `postgresql.existingSecretKey` | The postgres password key in the existing `Secret` | `postgresql-password` |
| `postgresql.existingSecretKey` | The postgres password key in the existing `Secret` | `postgresql-password` |
| `postgresql.postgresqlPort` | External postgres port | `5432` |
| `postgresql.ssl` | Enable external postgres SSL connection | `false` |
| `postgresql.ca` | Certificate of Authority content for postgres | `nil` |

View File

@ -14,6 +14,8 @@ spec:
metadata:
labels:
{{- include "wiki.selectorLabels" . | nindent 8 }}
annotations:
{{- toYaml .Values.podAnnotations | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
@ -25,12 +27,16 @@ spec:
{{- if .Values.sideload.enabled }}
initContainers:
- name: {{ .Chart.Name }}-sideload
securityContext:
{{- toYaml .Values.sideload.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ default "latest" .Values.image.tag }}"
imagePullPolicy: {{ default "IfNotPresent" .Values.image.imagePullPolicy }}
env:
{{- toYaml .Values.sideload.env | nindent 12 }}
command: [ "sh", "-c" ]
args: [ "mkdir -p /wiki/data/sideload && git clone --depth=1 {{ .Values.sideload.repoURL }} /wiki/data/sideload/" ]
resources:
{{- toYaml .Values.sideload.resources | nindent 12 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}

View File

@ -42,6 +42,8 @@ startupProbe:
path: /healthz
port: http
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
@ -113,6 +115,26 @@ sideload:
# - name: HTTPS_PROXY
# value: http://my.proxy.com:3128
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
## Append extra trusted certificates for node process from extra volume via NODE_EXTRA_CA_CERTS variable
# nodeExtraCaCerts: "/path/to/certs.pem"

View File

@ -52,7 +52,7 @@ html
script(
crossorigin='anonymous'
src='https://polyfill.io/v3/polyfill.min.js?features=EventSource'
src='https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=EventSource'
)
//- JS

View File

@ -75,6 +75,7 @@
"dotize": "0.3.0",
"elasticsearch6": "npm:@elastic/elasticsearch@6",
"elasticsearch7": "npm:@elastic/elasticsearch@7",
"elasticsearch8": "npm:@elastic/elasticsearch@8",
"emoji-regex": "10.2.1",
"eventemitter2": "6.4.9",
"express": "4.18.2",
@ -109,7 +110,7 @@
"markdown-it-abbr": "1.0.4",
"markdown-it-attrs": "3.0.3",
"markdown-it-decorate": "1.2.2",
"markdown-it-emoji": "1.4.0",
"markdown-it-emoji": "3.0.0",
"markdown-it-expand-tabs": "1.0.13",
"markdown-it-external-links": "0.0.6",
"markdown-it-footnote": "3.0.3",
@ -117,7 +118,7 @@
"markdown-it-mark": "3.0.1",
"markdown-it-mathjax": "2.0.0",
"markdown-it-multimd-table": "4.0.3",
"markdown-it-pivot-table": "1.0.1",
"markdown-it-pivot-table": "1.0.5",
"markdown-it-sub": "1.0.0",
"markdown-it-sup": "1.0.0",
"markdown-it-task-lists": "2.1.1",

View File

@ -85,7 +85,7 @@ defaults:
securityOpenRedirect: true
securityIframe: true
securityReferrerPolicy: true
securityTrustProxy: true
securityTrustProxy: false
securitySRI: true
securityHSTS: false
securityHSTSDuration: 300

View File

@ -156,6 +156,9 @@ module.exports = {
} else {
res.cookie('jwt', newToken.token, { expires: DateTime.utc().plus({ days: 365 }).toJSDate() })
}
// Avoid caching this response
res.set('Cache-Control', 'no-store')
} catch (errc) {
WIKI.logger.warn(errc)
return next()

View File

@ -222,7 +222,7 @@ module.exports = {
* Subscribe to database LISTEN / NOTIFY for multi-instances events
*/
async subscribeToNotifications () {
const useHA = (WIKI.config.ha === true || WIKI.config.ha === 'true' || WIKI.config.ha === 1 || WIKI.config.ha === '1')
const useHA = (WIKI.config.ha === true || (typeof WIKI.config.ha === 'string' && WIKI.config.ha.toLowerCase() === 'true') || WIKI.config.ha === 1 || WIKI.config.ha === '1')
if (!useHA) {
return
} else if (WIKI.config.db.type !== 'postgres') {

View File

@ -8,14 +8,6 @@ const { nanoid } = require('nanoid')
const { DateTime } = require('luxon')
const { gte } = require('semver')
// ----------------------------------------
// Check Node.js version
// ----------------------------------------
if (gte(process.version, '21.0.0')) {
console.error('You\'re using an unsupported Node.js version. Please read the requirements.')
process.exit(1)
}
// ----------------------------------------
// Init WIKI instance
// ----------------------------------------

View File

@ -499,6 +499,10 @@ module.exports = class User extends Model {
})
if (usr) {
if (!usr.isActive) {
throw new WIKI.Error.AuthAccountBanned()
}
await WIKI.models.users.query().patch({
password: newPassword,
mustChangePwd: false
@ -527,6 +531,9 @@ module.exports = class User extends Model {
if (!usr) {
WIKI.logger.debug(`Password reset attempt on nonexistant local account ${email}: [DISCARDED]`)
return
} else if (!usr.isActive) {
WIKI.logger.debug(`Password reset attempt on disabled local account ${email}: [DISCARDED]`)
return
}
const resetToken = await WIKI.models.userKeys.generateToken({
userId: usr.id,

View File

@ -56,6 +56,26 @@ module.exports = {
picture: _.get(profile, conf.mappingPicture, '')
}
})
// map users provider groups to wiki groups with the same name, and remove any groups that don't match
// Code copied from the LDAP implementation with a slight variation on the field we extract the value from
// In SAML v2 groups come in profile.attributes and can be 1 string or an array of strings
if (conf.mapGroups) {
const maybeArrayOfGroups = _.get(profile.attributes, conf.mappingGroups)
const groups = (maybeArrayOfGroups && !_.isArray(maybeArrayOfGroups)) ? [maybeArrayOfGroups] : maybeArrayOfGroups
if (groups && _.isArray(groups)) {
const currentGroups = (await user.$relatedQuery('groups').select('groups.id')).map(g => g.id)
const expectedGroups = Object.values(WIKI.auth.groups).filter(g => groups.includes(g.name)).map(g => g.id)
for (const groupId of _.difference(expectedGroups, currentGroups)) {
await user.$relatedQuery('groups').relate(groupId)
}
for (const groupId of _.difference(currentGroups, expectedGroups)) {
await user.$relatedQuery('groups').unrelate().where('groupId', groupId)
}
}
}
cb(null, user)
} catch (err) {
cb(err, null)

View File

@ -162,3 +162,15 @@ props:
default: 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/picture'
hint: The field storing the user avatar picture. Can be a variable name or a URI-formatted string.
order: 43
mapGroups:
type: Boolean
title: Map Groups
hint: Map groups matching names from the provider user groups. User Groups Field Mapping must also be defined for this to work. Note this will remove any groups the user has that doesn't match any group from the provider.
default: false
order: 44
mappingGroups:
title: User Groups Field Mapping
type: String
default: 'memberOf'
hint: The field storing the user groups attribute (when Map Groups is enabled). Can be a variable name or a URI-formatted string.
order: 45

View File

@ -6,7 +6,7 @@ head: |
body: |
<script>
window.onload = function() {
new Artalk({
Artalk.init({
el: '#artalk-container',
pageKey: '{{pageId}}',
pageTitle: '',

View File

@ -1,5 +1,5 @@
const md = require('markdown-it')
const mdEmoji = require('markdown-it-emoji')
const { full: mdEmoji } = require('markdown-it-emoji')
const { JSDOM } = require('jsdom')
const createDOMPurify = require('dompurify')
const _ = require('lodash')

View File

@ -10,7 +10,7 @@ const mustacheRegExp = /(\{|&#x7b;?){2}(.+?)(\}|&#x7d;?){2}/i
module.exports = {
async render() {
const $ = cheerio.load(this.input, {
let $ = cheerio.load(this.input, {
decodeEntities: true
})
@ -253,17 +253,35 @@ module.exports = {
}
})
// --------------------------------
// STEP: POST
// --------------------------------
let output = decodeEscape($.html('body').replace('<body>', '').replace('</body>', ''))
for (let child of _.sortBy(_.filter(this.children, ['step', 'post']), ['order'])) {
const renderer = require(`../${_.kebabCase(child.key)}/renderer.js`)
output = await renderer.init(output, child.config)
}
// --------------------------------
// Escape mustache expresions
// --------------------------------
$ = cheerio.load(output, {
decodeEntities: true
})
function iterateMustacheNode (node) {
const list = $(node).contents().toArray()
list.forEach(item => {
$(node).contents().each((idx, item) => {
if (item && item.type === 'text') {
const rawText = $(item).text().replace(/\r?\n|\r/g, '')
if (mustacheRegExp.test(rawText)) {
$(item).parent().attr('v-pre', true)
if (!item.parent || item.parent.name === 'body') {
$(item).wrap($('<p>').attr('v-pre', true))
} else {
$(item).parent().attr('v-pre', true)
}
}
} else {
iterateMustacheNode(item)
@ -276,18 +294,7 @@ module.exports = {
$(elm).attr('v-pre', true)
})
// --------------------------------
// STEP: POST
// --------------------------------
let output = decodeEscape($.html('body').replace('<body>', '').replace('</body>', ''))
for (let child of _.sortBy(_.filter(this.children, ['step', 'post']), ['order'])) {
const renderer = require(`../${_.kebabCase(child.key)}/renderer.js`)
output = await renderer.init(output, child.config)
}
return output
return decodeEscape($.html('body').replace('<body>', '').replace('</body>', ''))
}
}

View File

@ -1,6 +1,6 @@
key: htmlImagePrefetch
title: Image Prefetch
description: Prefetch remotely rendered images (korki/plantuml)
description: Prefetch remotely rendered images (kroki/plantuml)
author: requarks.io
icon: mdi-cloud-download-outline
enabledDefault: false

View File

@ -1,4 +1,4 @@
const mdEmoji = require('markdown-it-emoji')
const { full: mdEmoji } = require('markdown-it-emoji')
const twemoji = require('twemoji')
// ------------------------------------

View File

@ -12,9 +12,10 @@ props:
hint: Should match the version of the Elasticsearch nodes you are connecting to
order: 1
enum:
- '8.x'
- '7.x'
- '6.x'
default: '6.x'
default: '7.x'
hosts:
type: String
title: Host(s)

View File

@ -19,6 +19,16 @@ module.exports = {
async init() {
WIKI.logger.info(`(SEARCH/ELASTICSEARCH) Initializing...`)
switch (this.config.apiVersion) {
case '8.x':
const { Client: Client8 } = require('elasticsearch8')
this.client = new Client8({
nodes: this.config.hosts.split(',').map(_.trim),
sniffOnStart: this.config.sniffOnStart,
sniffInterval: (this.config.sniffInterval > 0) ? this.config.sniffInterval : false,
tls: getTlsOptions(this.config),
name: 'wiki-js'
})
break
case '7.x':
const { Client: Client7 } = require('elasticsearch7')
this.client = new Client7({
@ -54,7 +64,8 @@ module.exports = {
async createIndex() {
try {
const indexExists = await this.client.indices.exists({ index: this.config.indexName })
if (!indexExists.body) {
// Elasticsearch 6.x / 7.x
if (this.config.apiVersion !== '8.x' && !indexExists.body) {
WIKI.logger.info(`(SEARCH/ELASTICSEARCH) Creating index...`)
try {
const idxBody = {
@ -68,6 +79,7 @@ module.exports = {
tags: { type: 'text', boost: 8.0 }
}
}
await this.client.indices.create({
index: this.config.indexName,
body: {
@ -88,7 +100,42 @@ module.exports = {
} catch (err) {
WIKI.logger.error(`(SEARCH/ELASTICSEARCH) Create Index Error: `, _.get(err, 'meta.body.error', err))
}
}
// Elasticsearch 8.x
} else if (this.config.apiVersion === '8.x' && !indexExists) {
WIKI.logger.info(`(SEARCH/ELASTICSEARCH) Creating index...`)
try {
// 8.x Doesn't support boost in mappings, so we will need to boost at query time.
const idxBody = {
properties: {
suggest: { type: 'completion' },
title: { type: 'text' },
description: { type: 'text' },
content: { type: 'text' },
locale: { type: 'keyword' },
path: { type: 'text' },
tags: { type: 'text' }
}
}
await this.client.indices.create({
index: this.config.indexName,
body: {
mappings: idxBody,
settings: {
analysis: {
analyzer: {
default: {
type: this.config.analyzer
}
}
}
}
}
})
} catch (err) {
WIKI.logger.error(`(SEARCH/ELASTICSEARCH) Create Index Error: `, _.get(err, 'meta.body.error', err))
}
}
} catch (err) {
WIKI.logger.error(`(SEARCH/ELASTICSEARCH) Index Check Error: `, _.get(err, 'meta.body.error', err))
}
@ -129,7 +176,7 @@ module.exports = {
}
})
return {
results: _.get(results, 'body.hits.hits', []).map(r => ({
results: _.get(results, this.config.apiVersion === '8.x' ? 'hits.hits' : 'body.hits.hits', []).map(r => ({
id: r._id,
locale: r._source.locale,
path: r._source.path,
@ -137,7 +184,7 @@ module.exports = {
description: r._source.description
})),
suggestions: _.reject(_.get(results, 'suggest.suggestions', []).map(s => _.get(s, 'options[0].text', false)), s => !s),
totalHits: _.get(results, 'body.hits.total.value', _.get(results, 'body.hits.total', 0))
totalHits: _.get(results, this.config.apiVersion === '8.x' ? 'hits.total.value' : 'body.hits.total.value', _.get(results, this.config.apiVersion === '8.x' ? 'hits.total' : 'body.hits.total', 0))
}
} catch (err) {
WIKI.logger.warn('Search Engine Error: ', _.get(err, 'meta.body.error', err))
@ -182,7 +229,7 @@ module.exports = {
async created(page) {
await this.client.index({
index: this.config.indexName,
type: '_doc',
...(this.config.apiVersion !== '8.x' && { type: '_doc' }),
id: page.hash,
body: {
suggest: this.buildSuggest(page),
@ -204,7 +251,7 @@ module.exports = {
async updated(page) {
await this.client.index({
index: this.config.indexName,
type: '_doc',
...(this.config.apiVersion !== '8.x' && { type: '_doc' }),
id: page.hash,
body: {
suggest: this.buildSuggest(page),
@ -226,7 +273,7 @@ module.exports = {
async deleted(page) {
await this.client.delete({
index: this.config.indexName,
type: '_doc',
...(this.config.apiVersion !== '8.x' && { type: '_doc' }),
id: page.hash,
refresh: true
})
@ -239,13 +286,13 @@ module.exports = {
async renamed(page) {
await this.client.delete({
index: this.config.indexName,
type: '_doc',
...(this.config.apiVersion !== '8.x' && { type: '_doc' }),
id: page.hash,
refresh: true
})
await this.client.index({
index: this.config.indexName,
type: '_doc',
...(this.config.apiVersion !== '8.x' && { type: '_doc' }),
id: page.destinationHash,
body: {
suggest: this.buildSuggest(page),
@ -314,8 +361,8 @@ module.exports = {
result.push({
index: {
_index: this.config.indexName,
_type: '_doc',
_id: doc.id
_id: doc.id,
...(this.config.apiVersion !== '8.x' && { _type: '_doc' })
}
})
doc.safeContent = WIKI.models.pages.cleanHTML(doc.render)

View File

@ -87,6 +87,12 @@ props:
default: './data/repo'
hint: 'Path where the local git repository will be created.'
order: 30
alwaysNamespace:
type: Boolean
title: Always Locale Namespace
default: false
hint: 'Whether to put content from the primary language into a subfolder.'
order: 40
gitBinaryPath:
type: String
title: Git Binary Path

View File

@ -298,7 +298,7 @@ module.exports = {
async created(page) {
WIKI.logger.info(`(STORAGE/GIT) Committing new file [${page.localeCode}] ${page.path}...`)
let fileName = `${page.path}.${pageHelper.getFileExtension(page.contentType)}`
if (WIKI.config.lang.namespacing && WIKI.config.lang.code !== page.localeCode) {
if (this.config.alwaysNamespace || (WIKI.config.lang.namespacing && WIKI.config.lang.code !== page.localeCode)) {
fileName = `${page.localeCode}/${fileName}`
}
const filePath = path.join(this.repoPath, fileName)
@ -320,7 +320,7 @@ module.exports = {
async updated(page) {
WIKI.logger.info(`(STORAGE/GIT) Committing updated file [${page.localeCode}] ${page.path}...`)
let fileName = `${page.path}.${pageHelper.getFileExtension(page.contentType)}`
if (WIKI.config.lang.namespacing && WIKI.config.lang.code !== page.localeCode) {
if (this.config.alwaysNamespace || (WIKI.config.lang.namespacing && WIKI.config.lang.code !== page.localeCode)) {
fileName = `${page.localeCode}/${fileName}`
}
const filePath = path.join(this.repoPath, fileName)
@ -342,7 +342,7 @@ module.exports = {
async deleted(page) {
WIKI.logger.info(`(STORAGE/GIT) Committing removed file [${page.localeCode}] ${page.path}...`)
let fileName = `${page.path}.${pageHelper.getFileExtension(page.contentType)}`
if (WIKI.config.lang.namespacing && WIKI.config.lang.code !== page.localeCode) {
if (this.config.alwaysNamespace || (WIKI.config.lang.namespacing && WIKI.config.lang.code !== page.localeCode)) {
fileName = `${page.localeCode}/${fileName}`
}
@ -364,11 +364,11 @@ module.exports = {
let sourceFileName = `${page.path}.${pageHelper.getFileExtension(page.contentType)}`
let destinationFileName = `${page.destinationPath}.${pageHelper.getFileExtension(page.contentType)}`
if (WIKI.config.lang.namespacing) {
if (WIKI.config.lang.code !== page.localeCode) {
if (this.config.alwaysNamespace || WIKI.config.lang.namespacing) {
if (this.config.alwaysNamespace || WIKI.config.lang.code !== page.localeCode) {
sourceFileName = `${page.localeCode}/${sourceFileName}`
}
if (WIKI.config.lang.code !== page.destinationLocaleCode) {
if (this.config.alwaysNamespace || WIKI.config.lang.code !== page.destinationLocaleCode) {
destinationFileName = `${page.destinationLocaleCode}/${destinationFileName}`
}
}
@ -483,7 +483,7 @@ module.exports = {
page.tags = await pageObject.$relatedQuery('tags')
let fileName = `${page.path}.${pageHelper.getFileExtension(page.contentType)}`
if (WIKI.config.lang.namespacing && WIKI.config.lang.code !== page.localeCode) {
if (this.config.alwaysNamespace || (WIKI.config.lang.namespacing && WIKI.config.lang.code !== page.localeCode)) {
fileName = `${page.localeCode}/${fileName}`
}
WIKI.logger.info(`(STORAGE/GIT) Adding page ${fileName}...`)

View File

@ -2782,6 +2782,19 @@
enabled "2.0.x"
kuler "^2.0.0"
"@elastic/transport@^8.7.0":
version "8.8.1"
resolved "https://registry.yarnpkg.com/@elastic/transport/-/transport-8.8.1.tgz#d64244907bccdad5626c860b492faeef12194b1f"
integrity sha512-4RQIiChwNIx3B0O+2JdmTq/Qobj6+1g2RQnSv1gt4V2SVfAYjGwOKu0ZMKEHQOXYNG6+j/Chero2G9k3/wXLEw==
dependencies:
"@opentelemetry/api" "1.x"
debug "^4.3.4"
hpagent "^1.0.0"
ms "^2.1.3"
secure-json-parse "^2.4.0"
tslib "^2.4.0"
undici "^6.12.0"
"@eslint/eslintrc@^0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.2.0.tgz#bc7e3c4304d4c8720968ccaee793087dfb5fe6b4"
@ -3339,6 +3352,11 @@
dependencies:
mkdirp "^1.0.4"
"@opentelemetry/api@1.x":
version "1.9.0"
resolved "https://registry.yarnpkg.com/@opentelemetry/api/-/api-1.9.0.tgz#d03eba68273dc0f7509e2a3d5cba21eae10379fe"
integrity sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==
"@opentelemetry/api@^1.0.1":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@opentelemetry/api/-/api-1.1.0.tgz#563539048255bbe1a5f4f586a4a10a1bb737f44a"
@ -7618,11 +7636,6 @@ cssstyle@^2.2.0:
dependencies:
cssom "~0.3.6"
csv-to-markdown-table@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/csv-to-markdown-table/-/csv-to-markdown-table-1.3.1.tgz#a102137dd060726d94802e2bfa5c2d6992311cc6"
integrity sha512-ocr1MXWLFrc7la7fE4/2876XsBc9ajCeYZnXJrszSdyyIWMSVOYTg/Ol9W1xku8SZxBNsFhNECNmiZqo6OPsEg==
cuint@0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/cuint/-/cuint-0.2.2.tgz#408086d409550c2631155619e9fa7bcadc3b991b"
@ -8758,6 +8771,14 @@ ejs@^2.3.4, ejs@^2.6.1:
pump "^3.0.0"
secure-json-parse "^2.1.0"
"elasticsearch8@npm:@elastic/elasticsearch@8":
version "8.15.0"
resolved "https://registry.yarnpkg.com/@elastic/elasticsearch/-/elasticsearch-8.15.0.tgz#cb29b3ae33203c545d435cf3dc4b557c8b4961d5"
integrity sha512-mG90EMdTDoT6GFSdqpUAhWK9LGuiJo6tOWqs0Usd/t15mPQDj7ZqHXfCBqNkASZpwPZpbAYVjd57S6nbUBINCg==
dependencies:
"@elastic/transport" "^8.7.0"
tslib "^2.4.0"
electron-to-chromium@^1.3.247, electron-to-chromium@^1.3.30:
version "1.3.255"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.255.tgz#9f4b4f9ffd559dd7a81fef962186fc918d118b66"
@ -10847,6 +10868,11 @@ hosted-git-info@^2.1.4:
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.4.tgz#44119abaf4bc64692a16ace34700fed9c03e2546"
integrity sha512-pzXIvANXEFrc5oFFXRMkbLPQ2rXRoDERwDLyrcUxGhaZhgP54BBSl9Oheh7Vv0T090cszWBxPjkQQ5Sq1PbBRQ==
hpagent@^1.0.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/hpagent/-/hpagent-1.2.0.tgz#0ae417895430eb3770c03443456b8d90ca464903"
integrity sha512-A91dYTeIB6NoXG+PxTQpCCDDnfHsW9kc06Lvpu1TEe9gnd6ZFeiBoRO9JvzEv6xK7EX97/dUE8g/vBMTqTS3CA==
hsl-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/hsl-regex/-/hsl-regex-1.0.0.tgz#d49330c789ed819e276a4c0d272dffa30b18fe6e"
@ -13151,10 +13177,10 @@ markdown-it-decorate@1.2.2:
resolved "https://registry.yarnpkg.com/markdown-it-decorate/-/markdown-it-decorate-1.2.2.tgz#f1e11d11d837ae78906198f8a2c974f0e646acb7"
integrity sha512-7BFWJ97KBXgkaPVjKHISQnhSW8RWQ7yRNXpr8pPUV2Rw4GHvGrgb6CelKCM+GSijP0uSLCAVfc/knWIz+2v/Sw==
markdown-it-emoji@1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/markdown-it-emoji/-/markdown-it-emoji-1.4.0.tgz#9bee0e9a990a963ba96df6980c4fddb05dfb4dcc"
integrity sha512-QCz3Hkd+r5gDYtS2xsFXmBYrgw6KuWcJZLCEkdfAuwzZbShCmCfta+hwAMq4NX/4xPzkSHduMKgMkkPUJxSXNg==
markdown-it-emoji@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/markdown-it-emoji/-/markdown-it-emoji-3.0.0.tgz#8475a04d671d7c93f931b76fb90c582768b7f0b5"
integrity sha512-+rUD93bXHubA4arpEZO3q80so0qgoFJEKRkRbjKX8RTdca89v2kfyF+xR3i2sQTwql9tpPZPOQN5B+PunspXRg==
markdown-it-expand-tabs@1.0.13:
version "1.0.13"
@ -13195,13 +13221,13 @@ markdown-it-multimd-table@4.0.3:
dependencies:
markdown-it "^11.0.0"
markdown-it-pivot-table@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/markdown-it-pivot-table/-/markdown-it-pivot-table-1.0.1.tgz#bdab793d59160b7c4fa0dffcff4b75b42aac246a"
integrity sha512-oqpwXfqtupZnDfZOL3S3Pmf+nr01Qhg3f97CIbURwcPDsrNTxOHn+kXANv1oe1ZEczQ8bEHe0Xw+1q+EKDmgEQ==
markdown-it-pivot-table@1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/markdown-it-pivot-table/-/markdown-it-pivot-table-1.0.5.tgz#53a9f5032d3ef1e5e9f7a8f94495b8ce113a6ac8"
integrity sha512-LJzfG7BuyW6STQ1pFpnoNHPlf3qfVqWVUqV9zJWwENCyEH0aSgGqnE5bcfZ5rc4aG9z1XTu7d4kppxhQBqlRag==
dependencies:
csv-to-markdown-table "^1.3.1"
group-by "^0.0.1"
nd-table "^1.2.2"
string-math "^1.2.2"
markdown-it-sub@1.0.0:
@ -13758,7 +13784,7 @@ ms@2.1.2, ms@^2.1.1:
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
ms@2.1.3, ms@^2.0.0:
ms@2.1.3, ms@^2.0.0, ms@^2.1.3:
version "2.1.3"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
@ -13868,6 +13894,11 @@ ncp@~2.0.0:
resolved "https://registry.yarnpkg.com/ncp/-/ncp-2.0.0.tgz#195a21d6c46e361d2fb1281ba38b91e9df7bdbb3"
integrity sha1-GVoh1sRuNh0vsSgbo4uR6d9727M=
nd-table@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/nd-table/-/nd-table-1.2.2.tgz#9bfcf424fdd865544b27dd6761a8ab65810e3168"
integrity sha512-T/ALZyo4g15iRJ9TK7mo9Ny0CQvYcDGSZ8k9/6/CpGIisfITm91skQzXYas2ALyhIafxV4bmcL2gzCFh1cJCpQ==
needle@^2.2.1:
version "2.4.0"
resolved "https://registry.yarnpkg.com/needle/-/needle-2.4.0.tgz#6833e74975c444642590e15a750288c5f939b57c"
@ -17907,6 +17938,11 @@ secure-json-parse@^2.1.0:
resolved "https://registry.yarnpkg.com/secure-json-parse/-/secure-json-parse-2.1.0.tgz#ae76f5624256b5c497af887090a5d9e156c9fb20"
integrity sha512-GckO+MS/wT4UogDyoI/H/S1L0MCcKS1XX/vp48wfmU7Nw4woBmb8mIpu4zPBQjKlRT88/bt9xdoV4111jPpNJA==
secure-json-parse@^2.4.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/secure-json-parse/-/secure-json-parse-2.7.0.tgz#5a5f9cd6ae47df23dba3151edd06855d47e09862"
integrity sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==
select@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/select/-/select-1.1.2.tgz#0e7350acdec80b1108528786ec1d4418d11b396d"
@ -19382,6 +19418,11 @@ tslib@^2.2.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3"
integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==
tslib@^2.4.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01"
integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==
tslib@~2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.1.tgz#410eb0d113e5b6356490eec749603725b021b43e"
@ -19550,6 +19591,11 @@ underscore@~1.8.3:
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.8.3.tgz#4f3fb53b106e6097fcf9cb4109f2a5e9bdfa5022"
integrity sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=
undici@^6.12.0:
version "6.20.0"
resolved "https://registry.yarnpkg.com/undici/-/undici-6.20.0.tgz#3b94d967693759ea625a3b78b2097213f30405a1"
integrity sha512-AITZfPuxubm31Sx0vr8bteSalEbs9wQb/BOBi9FPlD9Qpd6HxZ4Q0+hI742jBhkPb4RT2v5MQzaW5VhRVyj+9A==
unicode-canonical-property-names-ecmascript@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz#2619800c4c825800efdd8343af7dd9933cbe2818"