Compare commits
No commits in common. "develop" and "2.0.1" have entirely different histories.
|
@ -25,5 +25,3 @@ Dockerfile
|
|||
settings.json
|
||||
src/node_modules
|
||||
admin/node_modules
|
||||
ui/node_modules
|
||||
node_modules
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
end_of_line = lf
|
||||
# editorconfig-tools is unable to ignore longs strings or urls
|
||||
max_line_length = off
|
||||
|
||||
[CHANGELOG.md]
|
||||
indent_size = 4
|
||||
|
||||
[*.bat]
|
||||
end_of_line = crlf
|
12
.env.default
|
@ -4,15 +4,15 @@
|
|||
# Always ensure to load the env variables in every terminal session.
|
||||
# Otherwise the env variables will not be available
|
||||
|
||||
DOCKER_COMPOSE_APP_PORT_PUBLISHED=9001
|
||||
DOCKER_COMPOSE_APP_PORT_TARGET=9001
|
||||
DOCKER_COMPOSE_APP_DEV_PORT_PUBLISHED=9001
|
||||
DOCKER_COMPOSE_APP_DEV_PORT_TARGET=9001
|
||||
|
||||
# IMPORTANT: When the env var DEFAULT_PAD_TEXT is unset or empty, then the pad is not established (not the landing page).
|
||||
# The env var DEFAULT_PAD_TEXT seems to be mandatory in the latest version of etherpad.
|
||||
DOCKER_COMPOSE_APP_DEV_ENV_DEFAULT_PAD_TEXT="Welcome to etherpad"
|
||||
|
||||
DOCKER_COMPOSE_APP_ADMIN_PASSWORD=
|
||||
DOCKER_COMPOSE_APP_DEV_ADMIN_PASSWORD=
|
||||
|
||||
DOCKER_COMPOSE_POSTGRES_DATABASE=db
|
||||
DOCKER_COMPOSE_POSTGRES_PASSWORD=etherpad-lite-password
|
||||
DOCKER_COMPOSE_POSTGRES_USER=etherpad-lite-user
|
||||
DOCKER_COMPOSE_POSTGRES_DEV_ENV_POSTGRES_DATABASE=db
|
||||
DOCKER_COMPOSE_POSTGRES_DEV_ENV_POSTGRES_PASSWORD=etherpad-lite-password
|
||||
DOCKER_COMPOSE_POSTGRES_DEV_ENV_POSTGRES_USER=etherpad-lite-user
|
|
@ -1,18 +0,0 @@
|
|||
# Please copy and rename this file.
|
||||
#
|
||||
# !Attention!
|
||||
# Always ensure to load the env variables in every terminal session.
|
||||
# Otherwise the env variables will not be available
|
||||
|
||||
DOCKER_COMPOSE_APP_DEV_PORT_PUBLISHED=9001
|
||||
DOCKER_COMPOSE_APP_DEV_PORT_TARGET=9001
|
||||
|
||||
# IMPORTANT: When the env var DEFAULT_PAD_TEXT is unset or empty, then the pad is not established (not the landing page).
|
||||
# The env var DEFAULT_PAD_TEXT seems to be mandatory in the latest version of etherpad.
|
||||
DOCKER_COMPOSE_APP_DEV_ENV_DEFAULT_PAD_TEXT="Welcome to etherpad"
|
||||
|
||||
DOCKER_COMPOSE_APP_DEV_ADMIN_PASSWORD=
|
||||
|
||||
DOCKER_COMPOSE_POSTGRES_DEV_ENV_POSTGRES_DATABASE=db
|
||||
DOCKER_COMPOSE_POSTGRES_DEV_ENV_POSTGRES_PASSWORD=etherpad-lite-password
|
||||
DOCKER_COMPOSE_POSTGRES_DEV_ENV_POSTGRES_USER=etherpad-lite-user
|
6
.github/dependabot.yml
vendored
|
@ -10,11 +10,7 @@ updates:
|
|||
schedule:
|
||||
interval: "daily"
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/"
|
||||
directory: "/src"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
versioning-strategy: "increase"
|
||||
open-pull-requests-limit: 30
|
||||
groups:
|
||||
dev-dependencies:
|
||||
dependency-type: "development"
|
54
.github/workflows/backend-tests.yml
vendored
|
@ -1,13 +1,7 @@
|
|||
name: "Backend tests"
|
||||
|
||||
# any branch is useful for testing before a PR is submitted
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- "doc/**"
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- "doc/**"
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
@ -24,7 +18,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node: [20, 22, 23]
|
||||
node: [18, 20, 21]
|
||||
steps:
|
||||
-
|
||||
name: Checkout repository
|
||||
|
@ -33,10 +27,10 @@ jobs:
|
|||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: pnpm/action-setup@v3
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 9.0.4
|
||||
version: 8
|
||||
run_install: false
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
|
@ -53,7 +47,7 @@ jobs:
|
|||
run: pnpm config set auto-install-peers false
|
||||
-
|
||||
name: Install libreoffice
|
||||
uses: awalsh128/cache-apt-pkgs-action@v1.5.0
|
||||
uses: awalsh128/cache-apt-pkgs-action@v1.4.2
|
||||
with:
|
||||
packages: libreoffice libreoffice-pdfimport
|
||||
version: 1.0
|
||||
|
@ -69,9 +63,6 @@ jobs:
|
|||
-
|
||||
name: Run the backend tests
|
||||
run: pnpm test
|
||||
- name: Run the new vitest tests
|
||||
working-directory: src
|
||||
run: pnpm run test:vitest
|
||||
|
||||
withpluginsLinux:
|
||||
# run on pushes to any branch
|
||||
|
@ -84,7 +75,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node: [20, 22, 23]
|
||||
node: [18, 20, 21]
|
||||
steps:
|
||||
-
|
||||
name: Checkout repository
|
||||
|
@ -93,10 +84,10 @@ jobs:
|
|||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: pnpm/action-setup@v3
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 9.0.4
|
||||
version: 8
|
||||
run_install: false
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
|
@ -113,7 +104,7 @@ jobs:
|
|||
run: pnpm config set auto-install-peers false
|
||||
-
|
||||
name: Install libreoffice
|
||||
uses: awalsh128/cache-apt-pkgs-action@v1.5.0
|
||||
uses: awalsh128/cache-apt-pkgs-action@v1.4.2
|
||||
with:
|
||||
packages: libreoffice libreoffice-pdfimport
|
||||
version: 1.0
|
||||
|
@ -136,6 +127,7 @@ jobs:
|
|||
ep_font_size
|
||||
ep_hash_auth
|
||||
ep_headings2
|
||||
ep_image_upload
|
||||
ep_markdown
|
||||
ep_readonly_guest
|
||||
ep_set_title_on_pad
|
||||
|
@ -145,9 +137,6 @@ jobs:
|
|||
-
|
||||
name: Run the backend tests
|
||||
run: pnpm test
|
||||
- name: Run the new vitest tests
|
||||
working-directory: src
|
||||
run: pnpm run test:vitest
|
||||
|
||||
withoutpluginsWindows:
|
||||
# run on pushes to any branch
|
||||
|
@ -165,10 +154,10 @@ jobs:
|
|||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: pnpm/action-setup@v3
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 9.0.4
|
||||
version: 8
|
||||
run_install: false
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
|
@ -199,11 +188,7 @@ jobs:
|
|||
powershell -Command "(gc settings.json.holder) -replace '\"points\": 10', '\"points\": 1000' | Out-File -encoding ASCII settings.json"
|
||||
-
|
||||
name: Run the backend tests
|
||||
working-directory: src
|
||||
run: pnpm test
|
||||
- name: Run the new vitest tests
|
||||
working-directory: src
|
||||
run: pnpm run test:vitest
|
||||
run: cd src && pnpm test
|
||||
|
||||
withpluginsWindows:
|
||||
# run on pushes to any branch
|
||||
|
@ -221,11 +206,11 @@ jobs:
|
|||
-
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
- uses: pnpm/action-setup@v4
|
||||
node-version: 21
|
||||
- uses: pnpm/action-setup@v3
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 9.0.4
|
||||
version: 8
|
||||
run_install: false
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
|
@ -258,6 +243,7 @@ jobs:
|
|||
ep_font_size
|
||||
ep_hash_auth
|
||||
ep_headings2
|
||||
ep_image_upload
|
||||
ep_markdown
|
||||
ep_readonly_guest
|
||||
ep_set_title_on_pad
|
||||
|
@ -283,8 +269,4 @@ jobs:
|
|||
powershell -Command "(gc settings.json.holder) -replace '\"points\": 10', '\"points\": 1000' | Out-File -encoding ASCII settings.json"
|
||||
-
|
||||
name: Run the backend tests
|
||||
working-directory: src
|
||||
run: pnpm test
|
||||
- name: Run the new vitest tests
|
||||
working-directory: src
|
||||
run: pnpm run test:vitest
|
||||
run: cd src && pnpm test
|
||||
|
|
70
.github/workflows/build-and-deploy-docs.yml
vendored
|
@ -1,70 +0,0 @@
|
|||
# Workflow for deploying static content to GitHub Pages
|
||||
name: Deploy Docs to GitHub Pages
|
||||
|
||||
on:
|
||||
# Runs on pushes targeting the default branch
|
||||
push:
|
||||
branches: ["develop"]
|
||||
paths:
|
||||
- doc/** # Only run workflow when changes are made to the doc directory
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
packages: read
|
||||
|
||||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
||||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
||||
concurrency:
|
||||
group: "pages"
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
# Single deploy job since we're just deploying
|
||||
deploy:
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v5
|
||||
- uses: pnpm/action-setup@v4
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 9.0.4
|
||||
run_install: false
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
- uses: actions/cache@v4
|
||||
name: Setup pnpm cache
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
- name: Only install direct dependencies
|
||||
run: pnpm config set auto-install-peers false
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
- name: Build app
|
||||
working-directory: doc
|
||||
run: pnpm run docs:build
|
||||
env:
|
||||
COMMIT_REF: ${{ github.sha }}
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
# Upload entire repository
|
||||
path: './doc/.vitepress/dist'
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
2
.github/workflows/codeql-analysis.yml
vendored
|
@ -6,8 +6,6 @@ on:
|
|||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [develop]
|
||||
paths-ignore:
|
||||
- 'doc/**'
|
||||
schedule:
|
||||
- cron: '0 13 * * 1'
|
||||
|
||||
|
|
43
.github/workflows/docker.yml
vendored
|
@ -1,13 +1,9 @@
|
|||
name: Docker
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- 'doc/**'
|
||||
push:
|
||||
branches:
|
||||
- 'develop'
|
||||
paths-ignore:
|
||||
- 'doc/**'
|
||||
tags:
|
||||
- 'v?[0-9]+.[0-9]+.[0-9]+'
|
||||
env:
|
||||
|
@ -22,9 +18,6 @@ jobs:
|
|||
-
|
||||
name: Check out
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: etherpad
|
||||
|
||||
-
|
||||
name: Set up QEMU
|
||||
if: github.event_name == 'push'
|
||||
|
@ -34,9 +27,9 @@ jobs:
|
|||
uses: docker/setup-buildx-action@v3
|
||||
-
|
||||
name: Build and export to Docker
|
||||
uses: docker/build-push-action@v6
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./etherpad
|
||||
context: .
|
||||
target: production
|
||||
load: true
|
||||
tags: ${{ env.TEST_TAG }}
|
||||
|
@ -47,10 +40,10 @@ jobs:
|
|||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: pnpm/action-setup@v3
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 9.0.4
|
||||
version: 8
|
||||
run_install: false
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
|
@ -65,7 +58,6 @@ jobs:
|
|||
${{ runner.os }}-pnpm-store-
|
||||
-
|
||||
name: Test
|
||||
working-directory: etherpad
|
||||
run: |
|
||||
docker run --rm -d -p 9001:9001 --name test ${{ env.TEST_TAG }}
|
||||
./bin/installDeps.sh
|
||||
|
@ -102,11 +94,10 @@ jobs:
|
|||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
-
|
||||
name: Build and push
|
||||
id: build-docker
|
||||
if: github.event_name == 'push'
|
||||
uses: docker/build-push-action@v6
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./etherpad
|
||||
context: .
|
||||
target: production
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
|
@ -116,29 +107,7 @@ jobs:
|
|||
uses: peter-evans/dockerhub-description@v4
|
||||
if: github.ref == 'refs/heads/master'
|
||||
with:
|
||||
readme-filepath: ./etherpad/README.md
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
repository: etherpad/etherpad
|
||||
enable-url-completion: true
|
||||
- name: Check out
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: ether-charts
|
||||
repository: ether/ether-charts
|
||||
token: ${{ secrets.ETHER_CHART_TOKEN }}
|
||||
- name: Update tag in values-dev.yaml
|
||||
if: success() && github.ref == 'refs/heads/develop'
|
||||
working-directory: ether-charts
|
||||
run: |
|
||||
sed -i 's/tag: ".*"/tag: "${{ steps.build-docker.outputs.digest }}"/' values-dev.yaml
|
||||
- name: Commit and push changes
|
||||
working-directory: ether-charts
|
||||
if: success() && github.ref == 'refs/heads/develop'
|
||||
run: |
|
||||
git config --global user.name 'github-actions[bot]'
|
||||
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
||||
git add values-dev.yaml
|
||||
git commit -m 'Update develop image tag'
|
||||
git push
|
||||
|
|
26
.github/workflows/frontend-admin-tests.yml
vendored
|
@ -1,23 +1,21 @@
|
|||
# Leave the powered by Sauce Labs bit in as this means we get additional concurrency
|
||||
name: "Frontend admin tests powered by Sauce Labs"
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- 'doc/**'
|
||||
on: [push]
|
||||
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
|
||||
jobs:
|
||||
withplugins:
|
||||
if: ${{ github.actor != 'dependabot[bot]' }}
|
||||
name: with plugins
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node: [20, 22, 23]
|
||||
node: [20, 21]
|
||||
|
||||
steps:
|
||||
-
|
||||
|
@ -33,10 +31,10 @@ jobs:
|
|||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: pnpm/action-setup@v3
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 9.0.4
|
||||
version: 8
|
||||
run_install: false
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
|
@ -49,13 +47,6 @@ jobs:
|
|||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
- name: Cache playwright binaries
|
||||
uses: actions/cache@v4
|
||||
id: playwright-cache
|
||||
with:
|
||||
path: |
|
||||
~/.cache/ms-playwright
|
||||
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
|
||||
- name: Only install direct dependencies
|
||||
run: pnpm config set auto-install-peers false
|
||||
#-
|
||||
|
@ -75,7 +66,7 @@ jobs:
|
|||
# rules.
|
||||
-
|
||||
name: Install all dependencies and symlink for ep_etherpad-lite
|
||||
run: pnpm i
|
||||
run: bin/installDeps.sh
|
||||
#-
|
||||
# name: Install etherpad plugins
|
||||
# run: rm -Rf node_modules/ep_align/static/tests/*
|
||||
|
@ -91,7 +82,7 @@ jobs:
|
|||
run: "sed -i 's/\"enableAdminUITests\": false/\"enableAdminUITests\": true,\\n\"users\":{\"admin\":{\"password\":\"changeme1\",\"is_admin\":true}}/' settings.json"
|
||||
-
|
||||
name: increase maxHttpBufferSize
|
||||
run: "sed -i 's/\"maxHttpBufferSize\": 50000/\"maxHttpBufferSize\": 10000000/' settings.json"
|
||||
run: "sed -i 's/\"maxHttpBufferSize\": 10000/\"maxHttpBufferSize\": 10000000/' settings.json"
|
||||
-
|
||||
name: Disable import/export rate limiting
|
||||
run: |
|
||||
|
@ -99,6 +90,7 @@ jobs:
|
|||
- name: Build admin frontend
|
||||
working-directory: admin
|
||||
run: |
|
||||
pnpm install
|
||||
pnpm run build
|
||||
# name: Run the frontend admin tests
|
||||
# shell: bash
|
||||
|
@ -130,7 +122,7 @@ jobs:
|
|||
- name: Run the frontend admin tests
|
||||
shell: bash
|
||||
run: |
|
||||
pnpm run prod &
|
||||
pnpm run dev &
|
||||
connected=false
|
||||
can_connect() {
|
||||
curl -sSfo /dev/null http://localhost:9001/ || return 1
|
||||
|
|
50
.github/workflows/frontend-tests.yml
vendored
|
@ -1,10 +1,7 @@
|
|||
# Leave the powered by Sauce Labs bit in as this means we get additional concurrency
|
||||
name: "Frontend tests powered by Sauce Labs"
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- 'doc/**'
|
||||
on: [push]
|
||||
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
|
@ -26,11 +23,11 @@ jobs:
|
|||
-
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
- uses: pnpm/action-setup@v4
|
||||
node-version: 21
|
||||
- uses: pnpm/action-setup@v3
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 9.0.4
|
||||
version: 8
|
||||
run_install: false
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
|
@ -56,17 +53,10 @@ jobs:
|
|||
-
|
||||
name: Create settings.json
|
||||
run: cp ./src/tests/settings.json settings.json
|
||||
- name: Cache playwright binaries
|
||||
uses: actions/cache@v4
|
||||
id: playwright-cache
|
||||
with:
|
||||
path: |
|
||||
~/.cache/ms-playwright
|
||||
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
|
||||
- name: Run the frontend tests
|
||||
shell: bash
|
||||
run: |
|
||||
pnpm run prod &
|
||||
pnpm run dev &
|
||||
connected=false
|
||||
can_connect() {
|
||||
curl -sSfo /dev/null http://localhost:9001/ || return 1
|
||||
|
@ -99,11 +89,11 @@ jobs:
|
|||
uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
- uses: pnpm/action-setup@v4
|
||||
node-version: 21
|
||||
- uses: pnpm/action-setup@v3
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 9.0.4
|
||||
version: 8
|
||||
run_install: false
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
|
@ -126,17 +116,10 @@ jobs:
|
|||
run: echo "::set-output name=sha_short::$(git rev-parse --short ${{ github.sha }})"
|
||||
- name: Create settings.json
|
||||
run: cp ./src/tests/settings.json settings.json
|
||||
- name: Cache playwright binaries
|
||||
uses: actions/cache@v4
|
||||
id: playwright-cache
|
||||
with:
|
||||
path: |
|
||||
~/.cache/ms-playwright
|
||||
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
|
||||
- name: Run the frontend tests
|
||||
shell: bash
|
||||
run: |
|
||||
pnpm run prod &
|
||||
pnpm run dev &
|
||||
connected=false
|
||||
can_connect() {
|
||||
curl -sSfo /dev/null http://localhost:9001/ || return 1
|
||||
|
@ -173,18 +156,11 @@ jobs:
|
|||
-
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
- name: Cache playwright binaries
|
||||
uses: actions/cache@v4
|
||||
id: playwright-cache
|
||||
with:
|
||||
path: |
|
||||
~/.cache/ms-playwright
|
||||
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
|
||||
- uses: pnpm/action-setup@v4
|
||||
node-version: 21
|
||||
- uses: pnpm/action-setup@v3
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 9.0.4
|
||||
version: 8
|
||||
run_install: false
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
|
@ -213,7 +189,7 @@ jobs:
|
|||
- name: Run the frontend tests
|
||||
shell: bash
|
||||
run: |
|
||||
pnpm run prod &
|
||||
pnpm run dev &
|
||||
connected=false
|
||||
can_connect() {
|
||||
curl -sSfo /dev/null http://localhost:9001/ || return 1
|
||||
|
|
34
.github/workflows/lint-package-lock.yml
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
name: "Lint"
|
||||
|
||||
# any branch is useful for testing before a PR is submitted
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
lint-package-lock:
|
||||
# run on pushes to any branch
|
||||
# run on PRs from external forks
|
||||
if: |
|
||||
(github.event_name != 'pull_request')
|
||||
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
|
||||
name: package-lock.json
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
-
|
||||
name: Run lockfile-lint on package-lock.json
|
||||
run: >
|
||||
npx lockfile-lint
|
||||
--path src/package-lock.json
|
||||
--allowed-hosts npm
|
||||
--allowed-schemes https:
|
||||
--allowed-schemes github:
|
||||
--allowed-urls github:mapbox/node-sqlite3#593c9d498be2510d286349134537e3bf89401c4a
|
20
.github/workflows/load-test.yml
vendored
|
@ -1,13 +1,7 @@
|
|||
name: "Loadtest"
|
||||
|
||||
# any branch is useful for testing before a PR is submitted
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- "doc/**"
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- "doc/**"
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
@ -29,10 +23,10 @@ jobs:
|
|||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: pnpm/action-setup@v3
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 9.0.4
|
||||
version: 8
|
||||
run_install: false
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
|
@ -73,10 +67,10 @@ jobs:
|
|||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: pnpm/action-setup@v3
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 9.0.4
|
||||
version: 8
|
||||
run_install: false
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
|
@ -144,10 +138,10 @@ jobs:
|
|||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: pnpm/action-setup@v3
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 9.0.4
|
||||
version: 8
|
||||
run_install: false
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
|
|
12
.github/workflows/perform-type-check.yml
vendored
|
@ -1,13 +1,7 @@
|
|||
name: "Perform type checks"
|
||||
|
||||
# any branch is useful for testing before a PR is submitted
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- "doc/**"
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- "doc/**"
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
@ -26,10 +20,10 @@ jobs:
|
|||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: pnpm/action-setup@v3
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 9.0.4
|
||||
version: 8
|
||||
run_install: false
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
|
|
14
.github/workflows/rate-limit.yml
vendored
|
@ -1,13 +1,7 @@
|
|||
name: "rate limit"
|
||||
|
||||
# any branch is useful for testing before a PR is submitted
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- "doc/**"
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- "doc/**"
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
@ -29,10 +23,10 @@ jobs:
|
|||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: pnpm/action-setup@v3
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 9.0.4
|
||||
version: 8
|
||||
run_install: false
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
|
@ -48,7 +42,7 @@ jobs:
|
|||
|
||||
-
|
||||
name: docker network
|
||||
run: docker network create --subnet=172.23.0.0/16 ep_net
|
||||
run: docker network create --subnet=172.23.42.0/16 ep_net
|
||||
-
|
||||
name: build docker image
|
||||
run: |
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
name: "Upgrade from latest release"
|
||||
|
||||
# any branch is useful for testing before a PR is submitted
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- "doc/**"
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- "doc/**"
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
@ -24,26 +18,26 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node: [20, 22, 23]
|
||||
node: [18, 20, 21]
|
||||
steps:
|
||||
-
|
||||
name: Check out latest release
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: develop #FIXME change to master when doing release
|
||||
ref: master
|
||||
-
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: pnpm/action-setup@v3
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 9.0.4
|
||||
version: 8
|
||||
run_install: false
|
||||
- name: Only install direct dependencies
|
||||
run: pnpm config set auto-install-peers false
|
||||
- name: Install libreoffice
|
||||
uses: awalsh128/cache-apt-pkgs-action@v1.5.0
|
||||
uses: awalsh128/cache-apt-pkgs-action@v1.4.2
|
||||
with:
|
||||
packages: libreoffice libreoffice-pdfimport
|
||||
version: 1.0
|
||||
|
@ -62,7 +56,7 @@ jobs:
|
|||
run: pnpm config set auto-install-peers false
|
||||
-
|
||||
name: Install libreoffice
|
||||
uses: awalsh128/cache-apt-pkgs-action@v1.5.0
|
||||
uses: awalsh128/cache-apt-pkgs-action@v1.4.2
|
||||
with:
|
||||
packages: libreoffice libreoffice-pdfimport
|
||||
version: 1.0
|
||||
|
@ -85,6 +79,7 @@ jobs:
|
|||
ep_font_size
|
||||
ep_hash_auth
|
||||
ep_headings2
|
||||
ep_image_upload
|
||||
ep_markdown
|
||||
ep_readonly_guest
|
||||
ep_set_title_on_pad
|
||||
|
|
131
.github/workflows/windows.yml
vendored
|
@ -1,20 +1,13 @@
|
|||
name: "Windows Build"
|
||||
|
||||
# any branch is useful for testing before a PR is submitted
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- "doc/**"
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- "doc/**"
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-zip:
|
||||
permissions: write-all
|
||||
# run on pushes to any branch
|
||||
# run on PRs from external forks
|
||||
if: |
|
||||
|
@ -35,11 +28,11 @@ jobs:
|
|||
-
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
- uses: pnpm/action-setup@v4
|
||||
node-version: 21
|
||||
- uses: pnpm/action-setup@v3
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 9.0.4
|
||||
version: 8
|
||||
run_install: false
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
|
@ -61,26 +54,112 @@ jobs:
|
|||
-
|
||||
name: Run the backend tests
|
||||
shell: msys2 {0}
|
||||
working-directory: src
|
||||
run: pnpm test
|
||||
run: cd src && pnpm test
|
||||
-
|
||||
name: Build the .zip
|
||||
shell: msys2 {0}
|
||||
run: bin/buildForWindows.sh
|
||||
-
|
||||
name: Archive production artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: etherpad-win.zip
|
||||
path: etherpad-win.zip
|
||||
|
||||
build-exe:
|
||||
if: |
|
||||
(github.event_name != 'pull_request')
|
||||
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
|
||||
name: Build .exe
|
||||
needs: build-zip
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Download .zip
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: etherpad-win.zip
|
||||
path: ..
|
||||
-
|
||||
name: Extract .zip
|
||||
working-directory: ..
|
||||
run: 7z x etherpad-win.zip -oetherpad-zip
|
||||
-
|
||||
name: Create installer
|
||||
uses: joncloud/makensis-action@v4.1
|
||||
with:
|
||||
script-file: 'bin/nsis/etherpad.nsi'
|
||||
-
|
||||
name: Archive production artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: etherpad-win.exe
|
||||
path: etherpad-win.exe
|
||||
|
||||
deploy-zip:
|
||||
# run on pushes to any branch
|
||||
# run on PRs from external forks
|
||||
permissions:
|
||||
contents: write
|
||||
if: |
|
||||
(github.event_name != 'pull_request')
|
||||
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
|
||||
name: Deploy
|
||||
needs: build-zip
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
-
|
||||
name: Download zip
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: etherpad-win.zip
|
||||
-
|
||||
name: Extract Etherpad
|
||||
run: 7z x etherpad-win.zip -oetherpad
|
||||
-
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: pnpm/action-setup@v3
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 8
|
||||
run_install: false
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
- uses: actions/cache@v4
|
||||
name: Setup pnpm cache
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
- name: Only install direct dependencies
|
||||
run: pnpm config set auto-install-peers false
|
||||
- name: Install all dependencies and symlink for ep_etherpad-lite
|
||||
run: .\bin\installOnWindows.bat
|
||||
working-directory: etherpad
|
||||
-
|
||||
name: Run Etherpad
|
||||
working-directory: src
|
||||
working-directory: etherpad/src
|
||||
run: |
|
||||
pnpm i
|
||||
pnpm exec playwright install --with-deps
|
||||
pnpm install cypress
|
||||
.\node_modules\.bin\cypress.cmd install --force
|
||||
pnpm run prod &
|
||||
curl --connect-timeout 10 --max-time 20 --retry 5 --retry-delay 10 --retry-max-time 60 --retry-connrefused http://127.0.0.1:9001/p/test
|
||||
pnpm exec playwright install chromium --with-deps
|
||||
pnpm run test-ui --project=chromium
|
||||
# On release, create release
|
||||
- name: Generate Changelog
|
||||
if: ${{startsWith(github.ref, 'refs/tags/v') }}
|
||||
working-directory: bin
|
||||
run: pnpm run generateChangelog ${{ github.ref }} > ${{ github.workspace }}-CHANGELOG.txt
|
||||
- name: Release
|
||||
pnpm exec cypress run --config-file ./tests/frontend/cypress/cypress.config.js
|
||||
# On release, upload windows zip to GitHub release tab
|
||||
-
|
||||
name: Rename to etherpad-lite-win.zip
|
||||
shell: powershell
|
||||
run: mv etherpad-win.zip etherpad-lite-win.zip
|
||||
- name: upload binaries to release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: ${{startsWith(github.ref, 'refs/tags/v') }}
|
||||
with:
|
||||
body_path: ${{ github.workspace }}-CHANGELOG.txt
|
||||
make_latest: true
|
||||
files: etherpad-lite-win.zip
|
||||
|
|
1
.gitignore
vendored
|
@ -27,4 +27,3 @@ plugin_packages
|
|||
/src/test-results
|
||||
playwright-report
|
||||
state.json
|
||||
/src/static/oidc
|
||||
|
|
145
CHANGELOG.md
|
@ -1,120 +1,3 @@
|
|||
# 2.3.0
|
||||
|
||||
### Notable enhancements and fixes
|
||||
|
||||
- Added possibility to cluster Etherpads behind reverse proxy. There is now a new reverse proxy designed for Etherpads that handles multiple Etherpads and the created pads in them. It will assign the pad assignement to an Etherpad at random but once the choice was made it will always reverse proxy the same backend. This allows to host multiple concurrent Etherpads and benefit from multi core systems even though one Etherpad is singlethreaded.
|
||||
- Added reverse proxy configuration for replacing Nginx. In the past there were some issues with nginx and its configuration. This reverse proxy allows you to handle your configuration with ease.
|
||||
|
||||
If you want to find out more about the reverse proxy method check out the repository https://github.com/ether/etherpad-proxy . It also contains a sample docker-compose file with three Etherpads and one etherpad-proxy. Of course you need to adapt the settings.json.template to your liking and map it into the reverse proxy image before you are ready :).
|
||||
|
||||
|
||||
- Added client authorization to work with Etherpad. Before it would get blocked because it doesn't have the required claim. As this is now fixed etherpad-proxy can also work with your new OAuth2 configuration and retrieve a token via client credentials flow.
|
||||
|
||||
|
||||
|
||||
|
||||
# 2.2.7
|
||||
|
||||
|
||||
### Notable enhancements and fixes
|
||||
|
||||
- We migrated all important pages to React 19 and React Router v7
|
||||
|
||||
Besides that only dependency updates.
|
||||
|
||||
|
||||
-> Have a merry Christmas and a happy new year. 🎄 🎁
|
||||
|
||||
|
||||
# 2.2.6
|
||||
|
||||
### Notable enhancements and fixes
|
||||
|
||||
- Added option to delete a pad by the creator. This option can be found in the settings menu. When you click on it you get a confirm dialog and after that you have the chance to completely erase the pad.
|
||||
|
||||
|
||||
# 2.2.5
|
||||
|
||||
### Notable enhancements and fixes
|
||||
|
||||
- Fixed timeslider not scrolling when the revision count is a multiple of 100
|
||||
- Added new Restful API for version 2 of Etherpad. It is available at /api-docs
|
||||
|
||||
|
||||
# 2.2.4
|
||||
|
||||
### Notable enhancements and fixes
|
||||
|
||||
- Switched to new SQLite backend
|
||||
- Fixed rusty-store-kv module not found
|
||||
|
||||
|
||||
# 2.2.3
|
||||
|
||||
### Notable enhancements and fixes
|
||||
|
||||
- Introduced a new in process database `rustydb` that represents a fast key value store written in Rust.
|
||||
- Readded window._ as a shortcut for getting text
|
||||
- Added support for migrating any ueberdb database to another. You can now switch as you please. See here: https://docs.etherpad.org/cli.html
|
||||
- Further Typescript movements
|
||||
- A lot of security issues fixed and reviewed in this release. Please update.
|
||||
|
||||
|
||||
# 2.2.2
|
||||
|
||||
### Notable enhancements and fixes
|
||||
|
||||
- Removal of Etherpad require kernel: We finally managed to include esbuild to bundle our frontend code together. So no matter how many plugins your server has it is always one JavaScript file. This boosts performance dramatically.
|
||||
- Added log layoutType: This lets you print the log in either colored or basic (black and white text)
|
||||
- Introduced esbuild for bundling CSS files
|
||||
- Cache all files to be bundled in memory for faster load speed
|
||||
|
||||
|
||||
# 2.1.1
|
||||
|
||||
|
||||
### Notable enhancements and fixes
|
||||
|
||||
- Fixed failing Docker build when checked out as git submodule. Thanks to @neurolabs
|
||||
- Fixed: Fallback to websocket and polling when unknown(old) config is present for socket io
|
||||
- Fixed: Next page disabled if zero page by @samyakj023
|
||||
- On CTRL+CLICK bring the window back to focus by Helder Sepulveda
|
||||
|
||||
# 2.1.0
|
||||
|
||||
### Notable enhancements and fixes
|
||||
|
||||
- Added PWA support. You can now add your Etherpad instance to your home screen on your mobile device or desktop.
|
||||
- Fixed live plugin manager versions clashing. Thanks to @yacchin1205
|
||||
- Fixed a bug in the pad panel where pagination was not working correctly when sorting by pad name
|
||||
|
||||
### Compatibility changes
|
||||
|
||||
- Reintroduced APIKey.txt support. You can now switch between APIKey and OAuth2.0 authentication. This can be toggled with the setting authenticationMethod. The default is OAuth2. If you want to use the APIKey method you can set that to `apikey`.
|
||||
|
||||
|
||||
# 2.0.3
|
||||
|
||||
### Notable enhancements and fixes
|
||||
|
||||
- Added documentation for replacing apikeys with oauth2
|
||||
- Bumped live plugin manager to 0.20.0. Thanks to @fgreinacher
|
||||
- Added better documentation for using docker-compose with Etherpad
|
||||
|
||||
|
||||
|
||||
# 2.0.2
|
||||
|
||||
### Notable enhancements and fixes
|
||||
|
||||
- Fixed the locale loading in the admin panel
|
||||
- Added OAuth2.0 support for the Etherpad API. You can now log in into the Etherpad API with your admin user using OAuth2
|
||||
|
||||
### Compatibility changes
|
||||
|
||||
- The tests now require generating a token from the OAuth secret. You can find the `generateJWTToken` in the common.ts script for plugin endpoint updates.
|
||||
|
||||
|
||||
# 2.0.1
|
||||
|
||||
### Notable enhancements and fixes
|
||||
|
@ -130,7 +13,7 @@ Besides that only dependency updates.
|
|||
- Socket io has been updated to 4.7.5. This means that the json.send function won't work anymore and needs to be changed to .emit('message', myObj)
|
||||
- Deprecating npm version 6 in favor of pnpm: We have made the decision to switch to the well established pnpm (https://pnpm.io/). It works by symlinking dependencies into a global directory allowing you to have a cleaner and more reliable environment.
|
||||
- Introducing Typescript to the Etherpad core: Etherpad core logic has been rewritten in Typescript allowing for compiler checking of errors.
|
||||
- Rewritten Admin Panel: The Admin panel has been rewritten in React and now features a more pleasant user experience. It now also features an integrated pad searching with sorting functionality.
|
||||
- Rewritten Admin Panel: The Admin panel has been rewritten in React and now features a more pleasant user experience. It now also features an integrated pad searching with sorting functionality.
|
||||
|
||||
### Notable enhancements and fixes
|
||||
|
||||
|
@ -140,17 +23,17 @@ Besides that only dependency updates.
|
|||
* Enhancements
|
||||
- pnpm Workspaces: In addition to pnpm we introduced workspaces. A clean way to manage multiple bounded contexts like the admin panel or the bin folder.
|
||||
- Bin folder: The bin folder has been moved from the src folder to the root folder. This change was necessary as the contained scripts do not represent core functionality of the user.
|
||||
- Starting Etherpad: Etherpad can now be started with a single command: `pnpm run prod` in the root directory.
|
||||
- Starting Etherpad: Etherpad can now be started with a single command: `pnpm run prod` in the root directory.
|
||||
- Installing Etherpad: Etherpad no longer symlinks itself in the root directory. This is now also taken care by pnpm, and it just creates a node_modules folder with the src directory`s ep_etherpad-lite folder
|
||||
- Plugins can now be installed simply via the command: `pnpm run plugins i first-plugin second-plugin` or if you want to install from path you can do:
|
||||
`pnpm run plugins i --path ../path-to-plugin`
|
||||
- Plugins can now be installed simply via the command: `pnpm run install-plugins first-plugin second-plugin` or if you want to install from path you can do:
|
||||
`pnpm run install-plugins --path ../path-to-plugin`
|
||||
|
||||
|
||||
# 1.9.7
|
||||
|
||||
### Notable enhancements and fixes
|
||||
|
||||
* Added Live Plugin Manager: Plugins are now installed into a separate folder on the host system. This folder is called `plugin_packages`.
|
||||
* Added Live Plugin Manager: Plugins are now installed into a separate folder on the host system. This folder is called `plugin_packages`.
|
||||
That way the plugins are separated from the normal etherpad installation.
|
||||
* Make repairPad.js more verbose
|
||||
* Fixed favicon not being loaded correctly
|
||||
|
@ -173,19 +56,19 @@ That way the plugins are separated from the normal etherpad installation.
|
|||
|
||||
### Notable enhancements and fixes
|
||||
|
||||
* The support for the tidy program to tidy up HTML files has been removed. This decision was made because it hasn't been updated for years and also caused an incompability when exporting a pad with Abiword.
|
||||
* The support for the tidy program to tidy up HTML files has been removed. This decision was made because it hasn't been updated for years and also caused an incompability when exporting a pad with Abiword.
|
||||
|
||||
|
||||
# 1.9.4
|
||||
|
||||
### Compatibility changes
|
||||
|
||||
* Log4js has been updated to the latest version. As it involved a bump of 6 major version.
|
||||
* Log4js has been updated to the latest version. As it involved a bump of 6 major version.
|
||||
A lot has changed since then. Most notably the console appender has been deprecated. You can find out more about it [here](https://github.com/log4js-node/log4js-node)
|
||||
|
||||
### Notable enhancements and fixes
|
||||
|
||||
* Fix for MySQL: The logger calls were incorrectly configured leading to a crash when e.g. somebody uses a different encoding than standard MySQL encoding.
|
||||
* Fix for MySQL: The logger calls were incorrectly configured leading to a crash when e.g. somebody uses a different encoding than standard MySQL encoding.
|
||||
|
||||
# 1.9.3
|
||||
|
||||
|
@ -193,7 +76,7 @@ That way the plugins are separated from the normal etherpad installation.
|
|||
|
||||
* express-rate-limit has been bumped to 7.0.0: This involves the breaking change that "max: 0"
|
||||
in the importExportRateLimiting is set to always trigger. So set it to your desired value.
|
||||
If you haven't changed that value in the settings.json you are all set.
|
||||
If you haven't changed that value in the settings.json you are all set.
|
||||
|
||||
### Notable enhancements and fixes
|
||||
|
||||
|
@ -212,7 +95,7 @@ If you haven't changed that value in the settings.json you are all set.
|
|||
* Enable session key rotation: This setting can be enabled in the settings.json. It changes the signing key for the cookie authentication in a fixed interval.
|
||||
|
||||
* Bugfixes
|
||||
* Fix appendRevision when creating a new pad via the API without a text.
|
||||
* Fix appendRevision when creating a new pad via the API without a text.
|
||||
|
||||
|
||||
* Enhancements
|
||||
|
@ -221,11 +104,11 @@ If you haven't changed that value in the settings.json you are all set.
|
|||
|
||||
### Compatibility changes
|
||||
|
||||
* No compability changes as JQuery maintains excellent backwards compatibility.
|
||||
* No compability changes as JQuery maintains excellent backwards compatibility.
|
||||
|
||||
#### For plugin authors
|
||||
|
||||
* Please update to JQuery 3.7. There is an excellent deprecation guide over [here](https://api.jquery.com/category/deprecated/). Version 3.1 to 3.7 are relevant for the upgrade.
|
||||
* Please update to JQuery 3.7. There is an excellent deprecation guide over [here](https://api.jquery.com/category/deprecated/). Version 3.1 to 3.7 are relevant for the upgrade.
|
||||
|
||||
# 1.9.1
|
||||
|
||||
|
@ -233,7 +116,7 @@ If you haven't changed that value in the settings.json you are all set.
|
|||
|
||||
* Security
|
||||
* Limit requested revisions in timeslider and export to head revision. (affects v1.9.0)
|
||||
|
||||
|
||||
* Bugfixes
|
||||
* revisions in `CHANGESET_REQ` (timeslider) and export (txt, html, custom)
|
||||
are now checked to be numbers.
|
||||
|
@ -247,7 +130,7 @@ If you haven't changed that value in the settings.json you are all set.
|
|||
* tests: drop windows 7 test coverage & use chrome latest for admin tests
|
||||
* Require Node 16 for Etherpad and target Node 20 for testing
|
||||
|
||||
|
||||
|
||||
# 1.9.0
|
||||
|
||||
### Notable enhancements and fixes
|
||||
|
|
87
Dockerfile
|
@ -3,17 +3,15 @@
|
|||
# https://github.com/ether/etherpad-lite
|
||||
#
|
||||
# Author: muxator
|
||||
ARG BUILD_ENV=git
|
||||
|
||||
FROM node:alpine AS adminbuild
|
||||
RUN npm install -g pnpm@latest
|
||||
FROM node:alpine as adminBuild
|
||||
|
||||
WORKDIR /opt/etherpad-lite
|
||||
COPY . .
|
||||
RUN pnpm install
|
||||
RUN pnpm run build:ui
|
||||
COPY ./admin ./admin
|
||||
RUN cd ./admin && npm install -g pnpm && pnpm install && pnpm run build --outDir ./dist
|
||||
|
||||
|
||||
FROM node:alpine AS build
|
||||
FROM node:alpine as build
|
||||
LABEL maintainer="Etherpad team, https://github.com/ether/etherpad-lite"
|
||||
|
||||
# Set these arguments when building the image from behind a proxy
|
||||
|
@ -42,22 +40,6 @@ ARG SETTINGS=./settings.json.docker
|
|||
# ETHERPAD_PLUGINS="ep_codepad ep_author_neat"
|
||||
ARG ETHERPAD_PLUGINS=
|
||||
|
||||
# local plugins to install while building the container. By default no plugins are
|
||||
# installed.
|
||||
# If given a value, it has to be a space-separated, quoted list of plugin names.
|
||||
#
|
||||
# EXAMPLE:
|
||||
# ETHERPAD_LOCAL_PLUGINS="../ep_my_plugin ../ep_another_plugin"
|
||||
ARG ETHERPAD_LOCAL_PLUGINS=
|
||||
|
||||
# github plugins to install while building the container. By default no plugins are
|
||||
# installed.
|
||||
# If given a value, it has to be a space-separated, quoted list of plugin names.
|
||||
#
|
||||
# EXAMPLE:
|
||||
# ETHERPAD_GITHUB_PLUGINS="ether/ep_plugin"
|
||||
ARG ETHERPAD_GITHUB_PLUGINS=
|
||||
|
||||
# Control whether abiword will be installed, enabling exports to DOC/PDF/ODT formats.
|
||||
# By default, it is not installed.
|
||||
# If given any value, abiword will be installed.
|
||||
|
@ -75,7 +57,7 @@ ARG INSTALL_ABIWORD=
|
|||
ARG INSTALL_SOFFICE=
|
||||
|
||||
# Install dependencies required for modifying access.
|
||||
RUN apk add --no-cache shadow bash
|
||||
RUN apk add shadow bash
|
||||
# Follow the principle of least privilege: run as unprivileged user.
|
||||
#
|
||||
# Running as non-root enables running this image in platforms like OpenShift
|
||||
|
@ -100,9 +82,9 @@ RUN mkdir -p "${EP_DIR}" && chown etherpad:etherpad "${EP_DIR}"
|
|||
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863199
|
||||
RUN \
|
||||
mkdir -p /usr/share/man/man1 && \
|
||||
npm install pnpm@latest -g && \
|
||||
npm install pnpm -g && \
|
||||
apk update && apk upgrade && \
|
||||
apk add --no-cache \
|
||||
apk add \
|
||||
ca-certificates \
|
||||
curl \
|
||||
git \
|
||||
|
@ -114,65 +96,32 @@ USER etherpad
|
|||
WORKDIR "${EP_DIR}"
|
||||
|
||||
# etherpads version feature requires this. Only copy what is really needed
|
||||
COPY --chown=etherpad:etherpad ./.git/HEAD ./.git/HEAD
|
||||
COPY --chown=etherpad:etherpad ./.git/refs ./.git/refs
|
||||
COPY --chown=etherpad:etherpad ${SETTINGS} ./settings.json
|
||||
COPY --chown=etherpad:etherpad ./var ./var
|
||||
COPY --chown=etherpad:etherpad ./bin ./bin
|
||||
COPY --chown=etherpad:etherpad ./pnpm-workspace.yaml ./package.json ./
|
||||
|
||||
FROM build as development
|
||||
|
||||
|
||||
FROM build AS build_git
|
||||
ONBUILD COPY --chown=etherpad:etherpad ./.git/HEA[D] ./.git/HEAD
|
||||
ONBUILD COPY --chown=etherpad:etherpad ./.git/ref[s] ./.git/refs
|
||||
|
||||
FROM build AS build_copy
|
||||
|
||||
|
||||
|
||||
|
||||
FROM build_${BUILD_ENV} AS development
|
||||
|
||||
ARG ETHERPAD_PLUGINS=
|
||||
ARG ETHERPAD_LOCAL_PLUGINS=
|
||||
ARG ETHERPAD_LOCAL_PLUGINS_ENV=
|
||||
ARG ETHERPAD_GITHUB_PLUGINS=
|
||||
|
||||
COPY --chown=etherpad:etherpad ./src/ ./src/
|
||||
COPY --chown=etherpad:etherpad --from=adminbuild /opt/etherpad-lite/src/ templates/admin./src/templates/admin
|
||||
COPY --chown=etherpad:etherpad --from=adminbuild /opt/etherpad-lite/src/static/oidc ./src/static/oidc
|
||||
|
||||
COPY --chown=etherpad:etherpad ./local_plugin[s] ./local_plugins/
|
||||
|
||||
RUN bash -c ./bin/installLocalPlugins.sh
|
||||
COPY --chown=etherpad:etherpad ./src/package.json .npmrc ./src/pnpm-lock.yaml ./src/
|
||||
COPY --chown=etherpad:etherpad --from=adminBuild /opt/etherpad-lite/admin/dist ./src/templates/admin
|
||||
|
||||
RUN bin/installDeps.sh && \
|
||||
if [ ! -z "${ETHERPAD_PLUGINS}" ] || [ ! -z "${ETHERPAD_GITHUB_PLUGINS}" ]; then \
|
||||
pnpm run plugins i ${ETHERPAD_PLUGINS} ${ETHERPAD_GITHUB_PLUGINS:+--github ${ETHERPAD_GITHUB_PLUGINS}}; \
|
||||
fi
|
||||
{ [ -z "${ETHERPAD_PLUGINS}" ] || pnpm run install-plugins ${ETHERPAD_PLUGINS}; }
|
||||
|
||||
|
||||
FROM build_${BUILD_ENV} AS production
|
||||
|
||||
ARG ETHERPAD_PLUGINS=
|
||||
ARG ETHERPAD_LOCAL_PLUGINS=
|
||||
ARG ETHERPAD_LOCAL_PLUGINS_ENV=
|
||||
ARG ETHERPAD_GITHUB_PLUGINS=
|
||||
FROM build as production
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV ETHERPAD_PRODUCTION=true
|
||||
|
||||
COPY --chown=etherpad:etherpad ./src ./src
|
||||
COPY --chown=etherpad:etherpad --from=adminbuild /opt/etherpad-lite/src/templates/admin ./src/templates/admin
|
||||
COPY --chown=etherpad:etherpad --from=adminbuild /opt/etherpad-lite/src/static/oidc ./src/static/oidc
|
||||
COPY --chown=etherpad:etherpad --from=adminBuild /opt/etherpad-lite/admin/dist ./src/templates/admin
|
||||
|
||||
COPY --chown=etherpad:etherpad ./local_plugin[s] ./local_plugins/
|
||||
RUN bin/installDeps.sh && rm -rf ~/.npm && \
|
||||
{ [ -z "${ETHERPAD_PLUGINS}" ] || pnpm run install-plugins ${ETHERPAD_PLUGINS}; }
|
||||
|
||||
RUN bash -c ./bin/installLocalPlugins.sh
|
||||
|
||||
RUN bin/installDeps.sh && \
|
||||
if [ ! -z "${ETHERPAD_PLUGINS}" ] || [ ! -z "${ETHERPAD_GITHUB_PLUGINS}" ]; then \
|
||||
pnpm run plugins i ${ETHERPAD_PLUGINS} ${ETHERPAD_GITHUB_PLUGINS:+--github ${ETHERPAD_GITHUB_PLUGINS}}; \
|
||||
fi
|
||||
|
||||
# Copy the configuration file.
|
||||
COPY --chown=etherpad:etherpad ${SETTINGS} "${EP_DIR}"/settings.json
|
||||
|
|
164
README.md
|
@ -1,6 +1,6 @@
|
|||
# Etherpad: A real-time collaborative editor for the web
|
||||
|
||||

|
||||

|
||||
|
||||
## About
|
||||
|
||||
|
@ -21,6 +21,7 @@ We're looking for maintainers and have some funding available. Please contact J
|
|||
### Code Quality
|
||||
|
||||
[](https://github.com/ether/etherpad-lite/actions/workflows/codeql-analysis.yml)
|
||||
[](https://github.com/ether/etherpad-lite/actions/workflows/lint-package-lock.yml)
|
||||
|
||||
### Testing
|
||||
|
||||
|
@ -43,74 +44,74 @@ We're looking for maintainers and have some funding available. Please contact J
|
|||
|
||||
## Installation
|
||||
|
||||
### Docker-Compose
|
||||
|
||||
```yaml
|
||||
services:
|
||||
app:
|
||||
user: "0:0"
|
||||
image: etherpad/etherpad:latest
|
||||
tty: true
|
||||
stdin_open: true
|
||||
volumes:
|
||||
- plugins:/opt/etherpad-lite/src/plugin_packages
|
||||
- etherpad-var:/opt/etherpad-lite/var
|
||||
depends_on:
|
||||
- postgres
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
ADMIN_PASSWORD: ${DOCKER_COMPOSE_APP_ADMIN_PASSWORD:-admin}
|
||||
DB_CHARSET: ${DOCKER_COMPOSE_APP_DB_CHARSET:-utf8mb4}
|
||||
DB_HOST: postgres
|
||||
DB_NAME: ${DOCKER_COMPOSE_POSTGRES_DATABASE:-etherpad}
|
||||
DB_PASS: ${DOCKER_COMPOSE_POSTGRES_PASSWORD:-admin}
|
||||
DB_PORT: ${DOCKER_COMPOSE_POSTGRES_PORT:-5432}
|
||||
DB_TYPE: "postgres"
|
||||
DB_USER: ${DOCKER_COMPOSE_POSTGRES_USER:-admin}
|
||||
# For now, the env var DEFAULT_PAD_TEXT cannot be unset or empty; it seems to be mandatory in the latest version of etherpad
|
||||
DEFAULT_PAD_TEXT: ${DOCKER_COMPOSE_APP_DEFAULT_PAD_TEXT:- }
|
||||
DISABLE_IP_LOGGING: ${DOCKER_COMPOSE_APP_DISABLE_IP_LOGGING:-false}
|
||||
SOFFICE: ${DOCKER_COMPOSE_APP_SOFFICE:-null}
|
||||
TRUST_PROXY: ${DOCKER_COMPOSE_APP_TRUST_PROXY:-true}
|
||||
restart: always
|
||||
ports:
|
||||
- "${DOCKER_COMPOSE_APP_PORT_PUBLISHED:-9001}:${DOCKER_COMPOSE_APP_PORT_TARGET:-9001}"
|
||||
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
environment:
|
||||
POSTGRES_DB: ${DOCKER_COMPOSE_POSTGRES_DATABASE:-etherpad}
|
||||
POSTGRES_PASSWORD: ${DOCKER_COMPOSE_POSTGRES_PASSWORD:-admin}
|
||||
POSTGRES_PORT: ${DOCKER_COMPOSE_POSTGRES_PORT:-5432}
|
||||
POSTGRES_USER: ${DOCKER_COMPOSE_POSTGRES_USER:-admin}
|
||||
PGDATA: /var/lib/postgresql/data/pgdata
|
||||
restart: always
|
||||
# Exposing the port is not needed unless you want to access this database instance from the host.
|
||||
# Be careful when other postgres docker container are running on the same port
|
||||
# ports:
|
||||
# - "5432:5432"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
plugins:
|
||||
etherpad-var:
|
||||
```
|
||||
|
||||
### Requirements
|
||||
|
||||
[Node.js](https://nodejs.org/) >= **18.18.2**.
|
||||
|
||||
### Windows, macOS, Linux
|
||||
### GNU/Linux and other UNIX-like systems
|
||||
|
||||
1. Download the latest Node.js runtime from [nodejs.org](https://nodejs.org/).
|
||||
2. Install pnpm: `npm install -g pnpm` (Administrator privileges may be required).
|
||||
3. Clone the repository: `git clone -b master`
|
||||
4. Run `pnpm i`
|
||||
5. Run `pnpm run build:etherpad`
|
||||
6. Run `pnpm run prod`
|
||||
7. Visit `http://localhost:9001` in your browser.
|
||||
#### Quick install on Debian/Ubuntu
|
||||
|
||||
Install the latest Node.js LTS per [official install instructions](https://github.com/nodesource/distributions#installation-instructions), then:
|
||||
```sh
|
||||
git clone --branch master https://github.com/ether/etherpad-lite.git &&
|
||||
cd etherpad-lite &&
|
||||
bin/run.sh
|
||||
```
|
||||
|
||||
#### Manual install
|
||||
|
||||
You'll need Git and [Node.js](https://nodejs.org/) installed.
|
||||
|
||||
**As any user (we recommend creating a separate user called etherpad):**
|
||||
|
||||
1. Move to a folder where you want to install Etherpad.
|
||||
2. Clone the Git repository: `git clone --branch master
|
||||
https://github.com/ether/etherpad-lite.git`
|
||||
3. Change into the new directory containing the cloned source code: `cd
|
||||
etherpad-lite`
|
||||
4. Run `bin/run.sh` and open http://127.0.0.1:9001 in your browser.
|
||||
|
||||
To update to the latest released version, execute `git pull origin`. The next
|
||||
start with `bin/run.sh` will update the dependencies.
|
||||
|
||||
### Windows
|
||||
|
||||
#### Prebuilt Windows package
|
||||
|
||||
This package runs on any Windows machine. You can perform a manual installation
|
||||
via git for development purposes, but as this uses symlinks which performs
|
||||
unreliably on Windows, please stick to the prebuilt package if possible.
|
||||
|
||||
1. [Download the latest Windows package](https://etherpad.org/#download)
|
||||
2. Extract the folder
|
||||
|
||||
Run `start.bat` and open <http://localhost:9001> in your browser.
|
||||
|
||||
#### Manually install on Windows
|
||||
|
||||
You'll need [Node.js](https://nodejs.org) and (optionally, though recommended)
|
||||
git.
|
||||
|
||||
1. Grab the source, either:
|
||||
* download <https://github.com/ether/etherpad-lite/zipball/master>
|
||||
* or `git clone --branch master
|
||||
https://github.com/ether/etherpad-lite.git`
|
||||
2. With a "Run as administrator" command prompt execute
|
||||
`bin\installOnWindows.bat`
|
||||
|
||||
Now, run `start.bat` and open http://localhost:9001 in your browser.
|
||||
|
||||
Update to the latest version with `git pull origin`, then run
|
||||
`bin\installOnWindows.bat`, again.
|
||||
|
||||
If cloning to a subdirectory within another project, you may need to do the
|
||||
following:
|
||||
|
||||
1. Start the server manually (e.g. `node src/node/server.ts`)
|
||||
2. Edit the db `filename` in `settings.json` to the relative directory with
|
||||
the file (e.g. `application/lib/etherpad-lite/var/dirty.db`)
|
||||
3. Add auto-generated files to the main project `.gitignore`
|
||||
|
||||
### Docker container
|
||||
|
||||
|
@ -120,9 +121,9 @@ Find [here](doc/docker.adoc) information on running Etherpad in a container.
|
|||
|
||||
Etherpad is very customizable through plugins.
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
### Available Plugins
|
||||
|
||||
|
@ -138,7 +139,7 @@ Alternatively, you can install plugins from the command line:
|
|||
|
||||
```sh
|
||||
cd /path/to/etherpad-lite
|
||||
pnpm run plugins i ep_${plugin_name}
|
||||
pnpm run install-plugins ep_${plugin_name}
|
||||
```
|
||||
|
||||
Also see [the plugin wiki
|
||||
|
@ -150,7 +151,7 @@ Run the following command in your Etherpad folder to get all of the features
|
|||
visible in the above demo gif:
|
||||
|
||||
```sh
|
||||
pnpm run plugins i \
|
||||
pnpm run install-plugins \
|
||||
ep_align \
|
||||
ep_comments_page \
|
||||
ep_embedded_hyperlinks2 \
|
||||
|
@ -174,31 +175,6 @@ following plugins:
|
|||
that each user's chosen color, display name, comment ownership, etc. is
|
||||
strongly linked to their account.
|
||||
|
||||
### Upgrade Etherpad
|
||||
|
||||
Run the following command in your Etherpad folder to upgrade
|
||||
|
||||
1. Stop any running Etherpad (manual, systemd ...)
|
||||
2. Get present version
|
||||
```sh
|
||||
git -P tag --contains
|
||||
```
|
||||
3. List versions available
|
||||
```sh
|
||||
git -P tag --list "v*" --merged
|
||||
```
|
||||
4. Select the version
|
||||
```sh
|
||||
git checkout v2.2.5
|
||||
git switch -c v2.2.5
|
||||
```
|
||||
5. Upgrade Etherpad
|
||||
```sh
|
||||
./bin/run.sh
|
||||
```
|
||||
6. Stop with [CTRL-C]
|
||||
7. Restart your Etherpad service
|
||||
|
||||
## Next Steps
|
||||
|
||||
### Tweak the settings
|
||||
|
@ -235,7 +211,7 @@ edit `settings.json` and restart Etherpad each time.
|
|||
Open http://127.0.0.1:9001/p/test#skinvariantsbuilder in your browser and start
|
||||
playing!
|
||||
|
||||

|
||||

|
||||
|
||||
## Helpful resources
|
||||
|
||||
|
|
|
@ -1,42 +1,39 @@
|
|||
{
|
||||
"name": "admin",
|
||||
"private": true,
|
||||
"version": "2.3.0",
|
||||
"version": "2.0.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc && vite build",
|
||||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||
"build-copy": "tsc && vite build --outDir ../src/templates/admin --emptyOutDir",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@radix-ui/react-switch": "^1.2.5"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@radix-ui/react-dialog": "^1.1.14",
|
||||
"@radix-ui/react-toast": "^1.2.14",
|
||||
"@types/react": "^19.1.8",
|
||||
"@types/react-dom": "^19.1.6",
|
||||
"@typescript-eslint/eslint-plugin": "^8.34.0",
|
||||
"@typescript-eslint/parser": "^8.34.0",
|
||||
"@vitejs/plugin-react-swc": "^3.10.2",
|
||||
"eslint": "^9.28.0",
|
||||
"eslint-plugin-react-hooks": "^5.2.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.20",
|
||||
"i18next": "^25.2.1",
|
||||
"i18next-browser-languagedetector": "^8.2.0",
|
||||
"lucide-react": "^0.515.0",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"react-hook-form": "^7.57.0",
|
||||
"react-i18next": "^15.5.3",
|
||||
"react-router-dom": "^7.6.2",
|
||||
"socket.io-client": "^4.8.1",
|
||||
"typescript": "^5.8.2",
|
||||
"vite": "^6.3.5",
|
||||
"vite-plugin-static-copy": "^3.0.0",
|
||||
"vite-plugin-svgr": "^4.3.0",
|
||||
"zustand": "^5.0.5"
|
||||
"@radix-ui/react-dialog": "^1.0.5",
|
||||
"@radix-ui/react-toast": "^1.1.5",
|
||||
"i18next": "^23.10.1",
|
||||
"i18next-browser-languagedetector": "^7.2.0",
|
||||
"lucide-react": "^0.356.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-hook-form": "^7.51.0",
|
||||
"react-i18next": "^14.1.0",
|
||||
"react-router-dom": "^6.22.3",
|
||||
"zustand": "^4.5.2",
|
||||
"@types/react": "^18.2.56",
|
||||
"@types/react-dom": "^18.2.19",
|
||||
"@typescript-eslint/eslint-plugin": "^7.0.2",
|
||||
"@typescript-eslint/parser": "^7.0.2",
|
||||
"@vitejs/plugin-react-swc": "^3.5.0",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.5",
|
||||
"socket.io-client": "^4.7.4",
|
||||
"typescript": "^5.2.2",
|
||||
"vite": "^5.1.4",
|
||||
"vite-plugin-static-copy": "^1.0.1",
|
||||
"vite-plugin-svgr": "^4.2.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
"ep_adminpads2_autoupdate.title": "Aktiviert oder deaktiviert automatische Aktualisierungen für die aktuelle Abfrage.",
|
||||
"ep_adminpads2_confirm": "Willst du das Pad {{padID}} wirklich löschen?",
|
||||
"ep_adminpads2_delete.value": "Löschen",
|
||||
"ep_adminpads2_cleanup": "Historie aufräumen",
|
||||
"ep_adminpads2_last-edited": "Zuletzt bearbeitet",
|
||||
"ep_adminpads2_loading": "Lädt...",
|
||||
"ep_adminpads2_manage-pads": "Pads verwalten",
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
"ep_adminpads2_autoupdate.title": "Enables or disables automatic updates for the current query.",
|
||||
"ep_adminpads2_confirm": "Do you really want to delete the pad {{padID}}?",
|
||||
"ep_adminpads2_delete.value": "Delete",
|
||||
"ep_adminpads2_cleanup": "Cleanup revisions",
|
||||
"ep_adminpads2_last-edited": "Last edited",
|
||||
"ep_adminpads2_loading": "Loading…",
|
||||
"ep_adminpads2_manage-pads": "Manage pads",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {useEffect, useState} from 'react'
|
||||
import {useEffect} from 'react'
|
||||
import './App.css'
|
||||
import {connect} from 'socket.io-client'
|
||||
import {isJSONClean} from './utils/utils.ts'
|
||||
|
@ -6,115 +6,105 @@ import {NavLink, Outlet, useNavigate} from "react-router-dom";
|
|||
import {useStore} from "./store/store.ts";
|
||||
import {LoadingScreen} from "./utils/LoadingScreen.tsx";
|
||||
import {Trans, useTranslation} from "react-i18next";
|
||||
import {Cable, Construction, Crown, NotepadText, Wrench, PhoneCall, LucideMenu} from "lucide-react";
|
||||
import {Cable, Construction, Crown, NotepadText, Wrench} from "lucide-react";
|
||||
|
||||
const WS_URL = import.meta.env.DEV ? 'http://localhost:9001' : ''
|
||||
export const App = () => {
|
||||
const setSettings = useStore(state => state.setSettings);
|
||||
const {t} = useTranslation()
|
||||
const navigate = useNavigate()
|
||||
const [sidebarOpen, setSidebarOpen] = useState<boolean>(true)
|
||||
const WS_URL = import.meta.env.DEV? 'http://localhost:9001' : ''
|
||||
export const App = ()=> {
|
||||
const setSettings = useStore(state => state.setSettings);
|
||||
const {t} = useTranslation()
|
||||
const navigate = useNavigate()
|
||||
|
||||
useEffect(() => {
|
||||
fetch('/admin-auth/', {
|
||||
method: 'POST'
|
||||
}).then((value) => {
|
||||
if (!value.ok) {
|
||||
navigate('/login')
|
||||
}
|
||||
}).catch(() => {
|
||||
navigate('/login')
|
||||
})
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
fetch('/admin-auth/', {
|
||||
method: 'POST'
|
||||
}).then((value)=>{
|
||||
if(!value.ok){
|
||||
navigate('/login')
|
||||
}
|
||||
}).catch(()=>{
|
||||
navigate('/login')
|
||||
})
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
document.title = t('admin.page-title')
|
||||
useEffect(() => {
|
||||
document.title = t('admin.page-title')
|
||||
|
||||
useStore.getState().setShowLoading(true);
|
||||
const settingSocket = connect(`${WS_URL}/settings`, {
|
||||
transports: ['websocket'],
|
||||
});
|
||||
useStore.getState().setShowLoading(true);
|
||||
const settingSocket = connect(`${WS_URL}/settings`, {
|
||||
transports: ['websocket'],
|
||||
});
|
||||
|
||||
const pluginsSocket = connect(`${WS_URL}/pluginfw/installer`, {
|
||||
transports: ['websocket'],
|
||||
})
|
||||
const pluginsSocket = connect(`${WS_URL}/pluginfw/installer`, {
|
||||
transports: ['websocket'],
|
||||
})
|
||||
|
||||
pluginsSocket.on('connect', () => {
|
||||
useStore.getState().setPluginsSocket(pluginsSocket);
|
||||
});
|
||||
pluginsSocket.on('connect', () => {
|
||||
useStore.getState().setPluginsSocket(pluginsSocket);
|
||||
});
|
||||
|
||||
|
||||
settingSocket.on('connect', () => {
|
||||
useStore.getState().setSettingsSocket(settingSocket);
|
||||
useStore.getState().setShowLoading(false)
|
||||
settingSocket.emit('load');
|
||||
console.log('connected');
|
||||
});
|
||||
settingSocket.on('connect', () => {
|
||||
useStore.getState().setSettingsSocket(settingSocket);
|
||||
useStore.getState().setShowLoading(false)
|
||||
settingSocket.emit('load');
|
||||
console.log('connected');
|
||||
});
|
||||
|
||||
settingSocket.on('disconnect', (reason) => {
|
||||
// The settingSocket.io client will automatically try to reconnect for all reasons other than "io
|
||||
// server disconnect".
|
||||
useStore.getState().setShowLoading(true)
|
||||
if (reason === 'io server disconnect') {
|
||||
settingSocket.connect();
|
||||
}
|
||||
});
|
||||
settingSocket.on('disconnect', (reason) => {
|
||||
// The settingSocket.io client will automatically try to reconnect for all reasons other than "io
|
||||
// server disconnect".
|
||||
useStore.getState().setShowLoading(true)
|
||||
if (reason === 'io server disconnect') {
|
||||
settingSocket.connect();
|
||||
}
|
||||
});
|
||||
|
||||
settingSocket.on('settings', (settings) => {
|
||||
/* Check whether the settings.json is authorized to be viewed */
|
||||
if (settings.results === 'NOT_ALLOWED') {
|
||||
console.log('Not allowed to view settings.json')
|
||||
return;
|
||||
}
|
||||
settingSocket.on('settings', (settings) => {
|
||||
/* Check whether the settings.json is authorized to be viewed */
|
||||
if (settings.results === 'NOT_ALLOWED') {
|
||||
console.log('Not allowed to view settings.json')
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check to make sure the JSON is clean before proceeding */
|
||||
if (isJSONClean(settings.results)) {
|
||||
setSettings(settings.results);
|
||||
} else {
|
||||
alert('Invalid JSON');
|
||||
}
|
||||
useStore.getState().setShowLoading(false);
|
||||
});
|
||||
/* Check to make sure the JSON is clean before proceeding */
|
||||
if (isJSONClean(settings.results)) {
|
||||
setSettings(settings.results);
|
||||
} else {
|
||||
alert('Invalid JSON');
|
||||
}
|
||||
useStore.getState().setShowLoading(false);
|
||||
});
|
||||
|
||||
settingSocket.on('saveprogress', (status) => {
|
||||
console.log(status)
|
||||
})
|
||||
settingSocket.on('saveprogress', (status)=>{
|
||||
console.log(status)
|
||||
})
|
||||
|
||||
return () => {
|
||||
settingSocket.disconnect();
|
||||
pluginsSocket.disconnect()
|
||||
}
|
||||
}, []);
|
||||
return () => {
|
||||
settingSocket.disconnect();
|
||||
pluginsSocket.disconnect()
|
||||
}
|
||||
}, []);
|
||||
|
||||
return <div id="wrapper" className={`${sidebarOpen ? '': 'closed' }`}>
|
||||
<LoadingScreen/>
|
||||
<div className="menu">
|
||||
<div className="inner-menu">
|
||||
<span>
|
||||
return <div id="wrapper">
|
||||
<LoadingScreen/>
|
||||
<div className="menu">
|
||||
<div className="inner-menu">
|
||||
<span>
|
||||
<Crown width={40} height={40}/>
|
||||
<h1>Etherpad</h1>
|
||||
</span>
|
||||
<ul onClick={()=>{
|
||||
if (window.innerWidth < 768) {
|
||||
setSidebarOpen(false)
|
||||
}
|
||||
}}>
|
||||
<li><NavLink to="/plugins"><Cable/><Trans i18nKey="admin_plugins"/></NavLink></li>
|
||||
<li><NavLink to={"/settings"}><Wrench/><Trans i18nKey="admin_settings"/></NavLink></li>
|
||||
<li><NavLink to={"/help"}> <Construction/> <Trans i18nKey="admin_plugins_info"/></NavLink></li>
|
||||
<li><NavLink to={"/pads"}><NotepadText/><Trans
|
||||
i18nKey="ep_admin_pads:ep_adminpads2_manage-pads"/></NavLink></li>
|
||||
<li><NavLink to={"/shout"}><PhoneCall/>Communication</NavLink></li>
|
||||
</ul>
|
||||
</div>
|
||||
<ul>
|
||||
<li><NavLink to="/plugins"><Cable/><Trans i18nKey="admin_plugins"/></NavLink></li>
|
||||
<li><NavLink to={"/settings"}><Wrench/><Trans i18nKey="admin_settings"/></NavLink></li>
|
||||
<li> <NavLink to={"/help"}> <Construction/> <Trans i18nKey="admin_plugins_info"/></NavLink></li>
|
||||
<li><NavLink to={"/pads"}><NotepadText/><Trans i18nKey="ep_admin_pads:ep_adminpads2_manage-pads"/></NavLink></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div className="innerwrapper">
|
||||
<Outlet/>
|
||||
</div>
|
||||
</div>
|
||||
<button id="icon-button" onClick={() => {
|
||||
setSidebarOpen(!sidebarOpen)
|
||||
}}><LucideMenu/></button>
|
||||
<div className="innerwrapper">
|
||||
<Outlet/>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
export default App
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {FC, JSX, ReactElement} from "react";
|
||||
import {FC, ReactElement} from "react";
|
||||
|
||||
export type IconButtonProps = {
|
||||
icon: JSX.Element,
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
export type ShoutType = {
|
||||
type: string,
|
||||
data:{
|
||||
type: string,
|
||||
payload: {
|
||||
message: {
|
||||
message: string,
|
||||
sticky: boolean
|
||||
},
|
||||
timestamp: number
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,7 +12,6 @@ import {I18nextProvider} from "react-i18next";
|
|||
import i18n from "./localization/i18n.ts";
|
||||
import {PadPage} from "./pages/PadPage.tsx";
|
||||
import {ToastDialog} from "./utils/Toast.tsx";
|
||||
import {ShoutPage} from "./pages/ShoutPage.tsx";
|
||||
|
||||
const router = createBrowserRouter(createRoutesFromElements(
|
||||
<><Route element={<App/>}>
|
||||
|
@ -21,7 +20,6 @@ const router = createBrowserRouter(createRoutesFromElements(
|
|||
<Route path="/settings" element={<SettingsPage/>}/>
|
||||
<Route path="/help" element={<HelpPage/>}/>
|
||||
<Route path="/pads" element={<PadPage/>}/>
|
||||
<Route path="/shout" element={<ShoutPage/>}/>
|
||||
</Route><Route path="/login">
|
||||
<Route index element={<LoginScreen/>}/>
|
||||
</Route></>
|
||||
|
|
|
@ -21,7 +21,7 @@ export const HelpPage = () => {
|
|||
return <div key={hookName+i}>
|
||||
<h3>{hookName}</h3>
|
||||
<ul>
|
||||
{Object.keys(hooks[hookName]).map((hook, i) => <li key={hook+i}>{hook}
|
||||
{Object.keys(hooks[hookName]).map((hook, i) => <li>{hook}
|
||||
<ul key={hookName+hook+i}>
|
||||
{Object.keys(hooks[hookName][hook]).map((subHook, i) => <li key={i}>{subHook}</li>)}
|
||||
</ul>
|
||||
|
@ -46,12 +46,12 @@ export const HelpPage = () => {
|
|||
</div>
|
||||
<h2><Trans i18nKey="admin_plugins.installed"/></h2>
|
||||
<ul>
|
||||
{helpData.installedPlugins.map((plugin, i) => <li key={plugin+i}>{plugin}</li>)}
|
||||
{helpData.installedPlugins.map((plugin, i) => <li key={i}>{plugin}</li>)}
|
||||
</ul>
|
||||
|
||||
<h2><Trans i18nKey="admin_plugins_info.parts"/></h2>
|
||||
<ul>
|
||||
{helpData.installedParts.map((part, i) => <li key={part+i}>{part}</li>)}
|
||||
{helpData.installedParts.map((part, i) => <li key={i}>{part}</li>)}
|
||||
</ul>
|
||||
|
||||
<h2><Trans i18nKey="admin_plugins_info.hooks"/></h2>
|
||||
|
|
|
@ -4,54 +4,16 @@ import {InstalledPlugin, PluginDef, SearchParams} from "./Plugin.ts";
|
|||
import {useDebounce} from "../utils/useDebounce.ts";
|
||||
import {Trans, useTranslation} from "react-i18next";
|
||||
import {SearchField} from "../components/SearchField.tsx";
|
||||
import {ArrowUpFromDot, Download, Trash} from "lucide-react";
|
||||
import {Download, Trash} from "lucide-react";
|
||||
import {IconButton} from "../components/IconButton.tsx";
|
||||
import {determineSorting} from "../utils/sorting.ts";
|
||||
|
||||
|
||||
export const HomePage = () => {
|
||||
const pluginsSocket = useStore(state=>state.pluginsSocket)
|
||||
const [plugins,setPlugins] = useState<PluginDef[]>([])
|
||||
const installedPlugins = useStore(state=>state.installedPlugins)
|
||||
const setInstalledPlugins = useStore(state=>state.setInstalledPlugins)
|
||||
const [searchParams, setSearchParams] = useState<SearchParams>({
|
||||
offset: 0,
|
||||
limit: 99999,
|
||||
sortBy: 'name',
|
||||
sortDir: 'asc',
|
||||
searchTerm: ''
|
||||
})
|
||||
|
||||
const filteredInstallablePlugins = useMemo(()=>{
|
||||
return plugins.sort((a, b)=>{
|
||||
if(searchParams.sortBy === "version"){
|
||||
if(searchParams.sortDir === "asc"){
|
||||
return a.version.localeCompare(b.version)
|
||||
}
|
||||
return b.version.localeCompare(a.version)
|
||||
}
|
||||
|
||||
if(searchParams.sortBy === "last-updated"){
|
||||
if(searchParams.sortDir === "asc"){
|
||||
return a.time.localeCompare(b.time)
|
||||
}
|
||||
return b.time.localeCompare(a.time)
|
||||
}
|
||||
|
||||
|
||||
if (searchParams.sortBy === "name") {
|
||||
if(searchParams.sortDir === "asc"){
|
||||
return a.name.localeCompare(b.name)
|
||||
}
|
||||
return b.name.localeCompare(a.name)
|
||||
}
|
||||
return 0
|
||||
})
|
||||
}, [plugins, searchParams])
|
||||
|
||||
const [installedPlugins, setInstalledPlugins] = useState<InstalledPlugin[]>([])
|
||||
const sortedInstalledPlugins = useMemo(()=>{
|
||||
return useStore.getState().installedPlugins.sort((a, b)=>{
|
||||
|
||||
return installedPlugins.sort((a, b)=>{
|
||||
if(a.name < b.name){
|
||||
return -1
|
||||
}
|
||||
|
@ -61,8 +23,14 @@ export const HomePage = () => {
|
|||
return 0
|
||||
})
|
||||
|
||||
} ,[installedPlugins, searchParams])
|
||||
|
||||
} ,[installedPlugins])
|
||||
const [searchParams, setSearchParams] = useState<SearchParams>({
|
||||
offset: 0,
|
||||
limit: 99999,
|
||||
sortBy: 'name',
|
||||
sortDir: 'asc',
|
||||
searchTerm: ''
|
||||
})
|
||||
const [searchTerm, setSearchTerm] = useState<string>('')
|
||||
const {t} = useTranslation()
|
||||
|
||||
|
@ -79,16 +47,17 @@ export const HomePage = () => {
|
|||
})
|
||||
|
||||
pluginsSocket.on('results:updatable', (data) => {
|
||||
const newInstalledPlugins = useStore.getState().installedPlugins.map(plugin => {
|
||||
if (data.updatable.includes(plugin.name)) {
|
||||
return {
|
||||
...plugin,
|
||||
updatable: true
|
||||
}
|
||||
}
|
||||
return plugin
|
||||
})
|
||||
setInstalledPlugins(newInstalledPlugins)
|
||||
data.updatable.forEach((pluginName: string) => {
|
||||
setInstalledPlugins(installedPlugins.map(plugin => {
|
||||
if (plugin.name === pluginName) {
|
||||
return {
|
||||
...plugin,
|
||||
updatable: true
|
||||
}
|
||||
}
|
||||
return plugin
|
||||
}))
|
||||
})
|
||||
})
|
||||
|
||||
pluginsSocket.on('finished:install', () => {
|
||||
|
@ -124,20 +93,17 @@ export const HomePage = () => {
|
|||
if (!pluginsSocket) {
|
||||
return
|
||||
}
|
||||
|
||||
pluginsSocket?.emit('search', searchParams)
|
||||
|
||||
|
||||
pluginsSocket!.on('results:search', (data: {
|
||||
results: PluginDef[]
|
||||
}) => {
|
||||
setPlugins(data.results)
|
||||
})
|
||||
pluginsSocket!.on('results:searcherror', (data: {error: string}) => {
|
||||
console.log(data.error)
|
||||
useStore.getState().setToastState({
|
||||
open: true,
|
||||
title: "Error retrieving plugins",
|
||||
success: false
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
}, [searchParams, pluginsSocket]);
|
||||
|
||||
const uninstallPlugin = (pluginName: string)=>{
|
||||
|
@ -151,6 +117,7 @@ export const HomePage = () => {
|
|||
setPlugins(plugins.filter(plugin=>plugin.name !== pluginName))
|
||||
}
|
||||
|
||||
|
||||
useDebounce(()=>{
|
||||
setSearchParams({
|
||||
...searchParams,
|
||||
|
@ -159,7 +126,6 @@ export const HomePage = () => {
|
|||
})
|
||||
}, 500, [searchTerm])
|
||||
|
||||
|
||||
return <div>
|
||||
<h1><Trans i18nKey="admin_plugins"/></h1>
|
||||
|
||||
|
@ -176,72 +142,47 @@ export const HomePage = () => {
|
|||
<tbody style={{overflow: 'auto'}}>
|
||||
{sortedInstalledPlugins.map((plugin, index) => {
|
||||
return <tr key={index}>
|
||||
<td><a rel="noopener noreferrer" href={`https://npmjs.com/${plugin.name}`} target="_blank">{plugin.name}</a></td>
|
||||
<td>{plugin.name}</td>
|
||||
<td>{plugin.version}</td>
|
||||
<td>
|
||||
{
|
||||
plugin.updatable ?
|
||||
<IconButton onClick={() => installPlugin(plugin.name)} icon={<ArrowUpFromDot/>} title="Update"></IconButton>
|
||||
<button onClick={() => installPlugin(plugin.name)}>Update</button>
|
||||
: <IconButton disabled={plugin.name == "ep_etherpad-lite"} icon={<Trash/>} title={<Trans i18nKey="admin_plugins.installed_uninstall.value"/>} onClick={() => uninstallPlugin(plugin.name)}/>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<h2><Trans i18nKey="admin_plugins.available"/></h2>
|
||||
<SearchField onChange={v=>{setSearchTerm(v.target.value)}} placeholder={t('admin_plugins.available_search.placeholder')} value={searchTerm}/>
|
||||
<h2><Trans i18nKey="admin_plugins.available"/></h2>
|
||||
<SearchField onChange={v=>{setSearchTerm(v.target.value)}} placeholder={t('admin_plugins.available_search.placeholder')} value={searchTerm}/>
|
||||
|
||||
<div className="table-container">
|
||||
<table id="available-plugins">
|
||||
<thead>
|
||||
<tr>
|
||||
<th className={determineSorting(searchParams.sortBy, searchParams.sortDir == "asc", 'name')} onClick={()=>{
|
||||
setSearchParams({
|
||||
...searchParams,
|
||||
sortBy: 'name',
|
||||
sortDir: searchParams.sortDir === "asc"? "desc": "asc"
|
||||
})
|
||||
}}>
|
||||
<Trans i18nKey="admin_plugins.name" /></th>
|
||||
<th><Trans i18nKey="admin_plugins.name"/></th>
|
||||
<th style={{width: '30%'}}><Trans i18nKey="admin_plugins.description"/></th>
|
||||
<th className={determineSorting(searchParams.sortBy, searchParams.sortDir == "asc", 'version')} onClick={()=>{
|
||||
setSearchParams({
|
||||
...searchParams,
|
||||
sortBy: 'version',
|
||||
sortDir: searchParams.sortDir === "asc"? "desc": "asc"
|
||||
})
|
||||
}}><Trans i18nKey="admin_plugins.version"/></th>
|
||||
<th className={determineSorting(searchParams.sortBy, searchParams.sortDir == "asc", 'last-updated')} onClick={()=>{
|
||||
setSearchParams({
|
||||
...searchParams,
|
||||
sortBy: 'last-updated',
|
||||
sortDir: searchParams.sortDir === "asc"? "desc": "asc"
|
||||
})
|
||||
}}><Trans i18nKey="admin_plugins.last-update"/></th>
|
||||
<th><Trans i18nKey="admin_plugins.version"/></th>
|
||||
<th><Trans i18nKey="admin_plugins.last-update"/></th>
|
||||
<th><Trans i18nKey="ep_admin_pads:ep_adminpads2_action"/></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody style={{overflow: 'auto'}}>
|
||||
{(filteredInstallablePlugins.length > 0) ?
|
||||
filteredInstallablePlugins.map((plugin) => {
|
||||
return <tr key={plugin.name}>
|
||||
<td><a rel="noopener noreferrer" href={`https://npmjs.com/${plugin.name}`} target="_blank">{plugin.name}</a></td>
|
||||
<td>{plugin.description}</td>
|
||||
<td>{plugin.version}</td>
|
||||
<td>{plugin.time}</td>
|
||||
<td>
|
||||
<IconButton icon={<Download/>} onClick={() => installPlugin(plugin.name)} title={<Trans i18nKey="admin_plugins.available_install.value"/>}/>
|
||||
</td>
|
||||
</tr>
|
||||
})
|
||||
:
|
||||
<tr><td colSpan={5}>{searchTerm == '' ? <Trans i18nKey="pad.loading"/>: <Trans i18nKey="admin_plugins.available_not-found"/>}</td></tr>
|
||||
}
|
||||
{plugins.map((plugin) => {
|
||||
return <tr key={plugin.name}>
|
||||
<td><a rel="noopener noreferrer" href={`https://npmjs.com/${plugin.name}`} target="_blank">{plugin.name}</a></td>
|
||||
<td>{plugin.description}</td>
|
||||
<td>{plugin.version}</td>
|
||||
<td>{plugin.time}</td>
|
||||
<td>
|
||||
<IconButton icon={<Download/>} onClick={() => installPlugin(plugin.name)} title={<Trans i18nKey="admin_plugins.available_install.value"/>}/>
|
||||
</td>
|
||||
</tr>
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ export const LoginScreen = ()=>{
|
|||
<input {...register('username', {
|
||||
required: true
|
||||
})} className="login-textinput input-control" type="text" placeholder="Username"/>
|
||||
<div>Password</div>
|
||||
<div>Passwort</div>
|
||||
<span className="icon-input">
|
||||
<input {...register('password', {
|
||||
required: true
|
||||
|
|
|
@ -6,7 +6,7 @@ import {useDebounce} from "../utils/useDebounce.ts";
|
|||
import {determineSorting} from "../utils/sorting.ts";
|
||||
import * as Dialog from "@radix-ui/react-dialog";
|
||||
import {IconButton} from "../components/IconButton.tsx";
|
||||
import {ChevronLeft, ChevronRight, Eye, Trash2, FileStack} from "lucide-react";
|
||||
import {ChevronLeft, ChevronRight, Eye, Trash2} from "lucide-react";
|
||||
import {SearchField} from "../components/SearchField.tsx";
|
||||
|
||||
export const PadPage = ()=>{
|
||||
|
@ -23,11 +23,10 @@ export const PadPage = ()=>{
|
|||
const pads = useStore(state=>state.pads)
|
||||
const [currentPage, setCurrentPage] = useState<number>(0)
|
||||
const [deleteDialog, setDeleteDialog] = useState<boolean>(false)
|
||||
const [errorText, setErrorText] = useState<string|null>(null)
|
||||
const [padToDelete, setPadToDelete] = useState<string>('')
|
||||
const pages = useMemo(()=>{
|
||||
if(!pads){
|
||||
return 0;
|
||||
return [0]
|
||||
}
|
||||
|
||||
return Math.ceil(pads!.total / searchParams.limit)
|
||||
|
@ -69,35 +68,12 @@ export const PadPage = ()=>{
|
|||
results: newPads
|
||||
})
|
||||
})
|
||||
|
||||
settingsSocket.on('results:cleanupPadRevisions', (data)=>{
|
||||
let newPads = useStore.getState().pads?.results ?? []
|
||||
|
||||
if (data.error) {
|
||||
setErrorText(data.error)
|
||||
return
|
||||
}
|
||||
|
||||
newPads.forEach((pad)=>{
|
||||
if (pad.padName === data.padId) {
|
||||
pad.revisionNumber = data.keepRevisions
|
||||
}
|
||||
})
|
||||
|
||||
useStore.getState().setPads({
|
||||
results: newPads,
|
||||
total: useStore.getState().pads!.total
|
||||
})
|
||||
})
|
||||
}, [settingsSocket, pads]);
|
||||
|
||||
const deletePad = (padID: string)=>{
|
||||
settingsSocket?.emit('deletePad', padID)
|
||||
}
|
||||
|
||||
const cleanupPad = (padID: string)=>{
|
||||
settingsSocket?.emit('cleanupPadRevisions', padID)
|
||||
}
|
||||
|
||||
|
||||
return <div>
|
||||
|
@ -124,26 +100,11 @@ export const PadPage = ()=>{
|
|||
</Dialog.Content>
|
||||
</Dialog.Portal>
|
||||
</Dialog.Root>
|
||||
<Dialog.Root open={errorText !== null}>
|
||||
<Dialog.Portal>
|
||||
<Dialog.Overlay className="dialog-confirm-overlay"/>
|
||||
<Dialog.Content className="dialog-confirm-content">
|
||||
<div>
|
||||
<div>Error occured: {errorText}</div>
|
||||
<div className="settings-button-bar">
|
||||
<button onClick={() => {
|
||||
setErrorText(null)
|
||||
}}>OK</button>
|
||||
</div>
|
||||
</div>
|
||||
</Dialog.Content>
|
||||
</Dialog.Portal>
|
||||
</Dialog.Root>
|
||||
<h1><Trans i18nKey="ep_admin_pads:ep_adminpads2_manage-pads"/></h1>
|
||||
<SearchField value={searchTerm} onChange={v=>setSearchTerm(v.target.value)} placeholder={t('ep_admin_pads:ep_adminpads2_search-heading')}/>
|
||||
<table>
|
||||
<thead>
|
||||
<tr className="search-pads">
|
||||
<tr>
|
||||
<th className={determineSorting(searchParams.sortBy, searchParams.ascending, 'padName')} onClick={()=>{
|
||||
setSearchParams({
|
||||
...searchParams,
|
||||
|
@ -151,19 +112,19 @@ export const PadPage = ()=>{
|
|||
ascending: !searchParams.ascending
|
||||
})
|
||||
}}><Trans i18nKey="ep_admin_pads:ep_adminpads2_padname"/></th>
|
||||
<th className={determineSorting(searchParams.sortBy, searchParams.ascending, 'userCount')} onClick={()=>{
|
||||
setSearchParams({
|
||||
...searchParams,
|
||||
sortBy: 'userCount',
|
||||
ascending: !searchParams.ascending
|
||||
})
|
||||
}}><Trans i18nKey="ep_admin_pads:ep_adminpads2_pad-user-count"/></th>
|
||||
<th className={determineSorting(searchParams.sortBy, searchParams.ascending, 'lastEdited')} onClick={()=>{
|
||||
setSearchParams({
|
||||
...searchParams,
|
||||
sortBy: 'lastEdited',
|
||||
ascending: !searchParams.ascending
|
||||
})
|
||||
}}><Trans i18nKey="ep_admin_pads:ep_adminpads2_pad-user-count"/></th>
|
||||
<th className={determineSorting(searchParams.sortBy, searchParams.ascending, 'userCount')} onClick={()=>{
|
||||
setSearchParams({
|
||||
...searchParams,
|
||||
sortBy: 'userCount',
|
||||
ascending: !searchParams.ascending
|
||||
})
|
||||
}}><Trans i18nKey="ep_admin_pads:ep_adminpads2_last-edited"/></th>
|
||||
<th className={determineSorting(searchParams.sortBy, searchParams.ascending, 'revisionNumber')} onClick={()=>{
|
||||
setSearchParams({
|
||||
|
@ -175,7 +136,7 @@ export const PadPage = ()=>{
|
|||
<th><Trans i18nKey="ep_admin_pads:ep_adminpads2_action"/></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="search-pads-body">
|
||||
<tbody>
|
||||
{
|
||||
pads?.results?.map((pad)=>{
|
||||
return <tr key={pad.padName}>
|
||||
|
@ -189,9 +150,6 @@ export const PadPage = ()=>{
|
|||
setPadToDelete(pad.padName)
|
||||
setDeleteDialog(true)
|
||||
}}/>
|
||||
<IconButton icon={<FileStack/>} title={<Trans i18nKey="ep_admin_pads:ep_adminpads2_cleanup"/>} onClick={()=>{
|
||||
cleanupPad(pad.padName)
|
||||
}}/>
|
||||
<IconButton icon={<Eye/>} title="view" onClick={()=>window.open(`/p/${pad.padName}`, '_blank')}/>
|
||||
</div>
|
||||
</td>
|
||||
|
@ -208,12 +166,11 @@ export const PadPage = ()=>{
|
|||
offset: (Number(currentPage)-1)*searchParams.limit})
|
||||
}}><ChevronLeft/><span>Previous Page</span></button>
|
||||
<span>{currentPage+1} out of {pages}</span>
|
||||
<button disabled={pages == 0 || pages == currentPage+1} onClick={()=>{
|
||||
const newCurrentPage = currentPage+1
|
||||
setCurrentPage(newCurrentPage)
|
||||
<button disabled={pages == currentPage+1} onClick={()=>{
|
||||
setCurrentPage(currentPage+1)
|
||||
setSearchParams({
|
||||
...searchParams,
|
||||
offset: (Number(newCurrentPage))*searchParams.limit
|
||||
offset: (Number(currentPage)-1)*searchParams.limit
|
||||
})
|
||||
}}><span>Next Page</span><ChevronRight/></button>
|
||||
</div>
|
||||
|
|
|
@ -20,7 +20,7 @@ export type SearchParams = {
|
|||
searchTerm: string,
|
||||
offset: number,
|
||||
limit: number,
|
||||
sortBy: 'name'|'version'|'last-updated',
|
||||
sortBy: 'name'|'version',
|
||||
sortDir: 'asc'|'desc'
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import {useStore} from "../store/store.ts";
|
||||
import {isJSONClean, cleanComments} from "../utils/utils.ts";
|
||||
import {isJSONClean} from "../utils/utils.ts";
|
||||
import {Trans} from "react-i18next";
|
||||
import {IconButton} from "../components/IconButton.tsx";
|
||||
import {RotateCw, Save} from "lucide-react";
|
||||
|
||||
export const SettingsPage = ()=>{
|
||||
const settingsSocket = useStore(state=>state.settingsSocket)
|
||||
const settings = cleanComments(useStore(state=>state.settings))
|
||||
const settings = useStore(state=>state.settings)
|
||||
|
||||
return <div className="settings-page">
|
||||
return <div>
|
||||
<h1><Trans i18nKey="admin_settings.current"/></h1>
|
||||
<textarea value={settings} className="settings" onChange={v => {
|
||||
useStore.getState().setSettings(v.target.value)
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
import {useEffect, useState} from "react";
|
||||
import {SendHorizonal} from 'lucide-react'
|
||||
import {useStore} from "../store/store.ts";
|
||||
import * as Switch from '@radix-ui/react-switch';
|
||||
import {ShoutType} from "../components/ShoutType.ts";
|
||||
|
||||
export const ShoutPage = ()=>{
|
||||
const [totalUsers, setTotalUsers] = useState(0);
|
||||
const [message, setMessage] = useState<string>("");
|
||||
const [sticky, setSticky] = useState<boolean>(false);
|
||||
const socket = useStore(state => state.settingsSocket);
|
||||
const [shouts, setShouts] = useState<ShoutType[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
fetch('/stats')
|
||||
.then(response => response.json())
|
||||
.then(data => setTotalUsers(data.totalUsers));
|
||||
}, []);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if(socket) {
|
||||
socket.on('shout', (shout) => {
|
||||
setShouts([...shouts, shout])
|
||||
})
|
||||
}
|
||||
}, [socket, shouts])
|
||||
|
||||
const sendMessage = () => {
|
||||
socket?.emit('shout', {
|
||||
message,
|
||||
sticky
|
||||
});
|
||||
setMessage('')
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>Communication</h1>
|
||||
{totalUsers > 0 && <p>There {totalUsers>1?"are":"is"} currently {totalUsers} user{totalUsers>1?"s":""} online</p>}
|
||||
<div style={{height: '80vh', display: 'flex', flexDirection: 'column'}}>
|
||||
<div style={{flexGrow: 1, backgroundColor: 'white', overflowY: "auto"}}>
|
||||
{
|
||||
shouts.map((shout) => {
|
||||
return (
|
||||
<div key={shout.data.payload.timestamp} className="message">
|
||||
<div>{shout.data.payload.message.message}</div>
|
||||
<div style={{display: 'flex'}}>
|
||||
<div style={{flexGrow: 1}}></div>
|
||||
<div
|
||||
style={{color: "lightgray"}}>{new Date(shout.data.payload.timestamp).toLocaleTimeString()
|
||||
+ " " + new Date(shout.data.payload.timestamp).toLocaleDateString()}</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
</div>
|
||||
<form onSubmit={(e) => {
|
||||
e.preventDefault()
|
||||
sendMessage()
|
||||
}} className="send-message search-field" style={{display: 'flex', gap: '10px'}}>
|
||||
<Switch.Root title="Change sticky message" className="SwitchRoot" checked={sticky}
|
||||
onCheckedChange={() => {
|
||||
setSticky(!sticky);
|
||||
}}>
|
||||
<Switch.Thumb className="SwitchThumb"/>
|
||||
</Switch.Root>
|
||||
<input required value={message} onChange={v=>setMessage(v.target.value)}
|
||||
style={{width: '100%', paddingRight: '55px', backgroundColor: '#e0e0e0', flexGrow: 1}}/>
|
||||
<SendHorizonal style={{bottom: '5px', right: '9px', color: '#0f775b'}} onClick={()=>sendMessage()}/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
import {create} from "zustand";
|
||||
import {Socket} from "socket.io-client";
|
||||
import {PadSearchResult} from "../utils/PadSearch.ts";
|
||||
import {InstalledPlugin} from "../pages/Plugin.ts";
|
||||
|
||||
type ToastState = {
|
||||
description?:string,
|
||||
|
@ -23,9 +22,7 @@ type StoreState = {
|
|||
toastState: ToastState,
|
||||
setToastState: (val: ToastState)=>void,
|
||||
pads: PadSearchResult|undefined,
|
||||
setPads: (pads: PadSearchResult)=>void,
|
||||
installedPlugins: InstalledPlugin[],
|
||||
setInstalledPlugins: (plugins: InstalledPlugin[])=>void
|
||||
setPads: (pads: PadSearchResult)=>void
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,7 +43,5 @@ export const useStore = create<StoreState>()((set) => ({
|
|||
success: false
|
||||
},
|
||||
pads: undefined,
|
||||
setPads: (pads)=>set({pads}),
|
||||
installedPlugins: [],
|
||||
setInstalledPlugins: (plugins)=>set({installedPlugins: plugins})
|
||||
setPads: (pads)=>set({pads})
|
||||
}));
|
||||
|
|
|
@ -1,14 +1,5 @@
|
|||
export const cleanComments = (json: string|undefined)=>{
|
||||
if (json !== undefined){
|
||||
json = json.replace(/\/\*.*?\*\//g, ""); // remove single line comments
|
||||
json = json.replace(/ *\/\*.*(.|\n)*?\*\//g, ""); // remove multi line comments
|
||||
json = json.replace(/[ \t]+$/gm, ""); // trim trailing spaces
|
||||
json = json.replace(/^(\n)/gm, ""); // remove empty lines
|
||||
}
|
||||
return json;
|
||||
}
|
||||
const minify = (json: string)=>{
|
||||
|
||||
export const minify = (json: string)=>{
|
||||
let tokenizer = /"|(\/\*)|(\*\/)|(\/\/)|\n|\r/g,
|
||||
in_string = false,
|
||||
in_multiline_comment = false,
|
||||
|
@ -58,6 +49,9 @@ export const minify = (json: string)=>{
|
|||
return new_str.join("");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export const isJSONClean = (data: string) => {
|
||||
let cleanSettings = minify(data);
|
||||
// this is a bit naive. In theory some key/value might contain the sequences ',]' or ',}'
|
||||
|
|
|
@ -15,8 +15,7 @@ export default defineConfig({
|
|||
})],
|
||||
base: '/admin',
|
||||
build:{
|
||||
outDir: '../src/templates/admin',
|
||||
emptyOutDir: true,
|
||||
outDir: '../src/templates/admin'
|
||||
},
|
||||
server:{
|
||||
proxy: {
|
||||
|
@ -28,11 +27,8 @@ export default defineConfig({
|
|||
'/admin-auth/': {
|
||||
target: 'http://localhost:9001',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/stats': {
|
||||
target: 'http://localhost:9001',
|
||||
changeOrigin: true,
|
||||
}
|
||||
rewrite: (path) => path.replace(/^\/admin-prox/, '/admin/')
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -50,13 +50,21 @@ rm -rf src/node_modules || true
|
|||
#$(try cd ./bin/installDeps.sh)
|
||||
|
||||
# Install admin frontend
|
||||
cd admin
|
||||
try pnpm install
|
||||
try pnpm run build:etherpad
|
||||
try pnpm run build
|
||||
cd ..
|
||||
|
||||
|
||||
|
||||
|
||||
# Nuke the admin folder as it is not needed anymore :D
|
||||
rm -rf admin
|
||||
rm -rf oidc
|
||||
rm -rf src/node_modules
|
||||
|
||||
export NODE_ENV=production
|
||||
try pnpm install --production
|
||||
|
||||
|
||||
|
||||
log "copy the windows settings template..."
|
||||
try cp settings.json.template settings.json
|
||||
|
|
|
@ -25,5 +25,4 @@ if (process.argv.length !== 2) throw new Error('Use: node bin/checkAllPads.js');
|
|||
console.log(`Pad ${padId}: OK`);
|
||||
}));
|
||||
console.log('Finished.');
|
||||
process.exit(0)
|
||||
})();
|
||||
|
|
|
@ -11,19 +11,12 @@ process.on('unhandledRejection', (err) => { throw err; });
|
|||
if (process.argv.length !== 3) throw new Error('Use: node bin/checkPad.js $PADID');
|
||||
// @ts-ignore
|
||||
const padId = process.argv[2];
|
||||
|
||||
const performCheck = async () => {
|
||||
(async () => {
|
||||
const db = require('ep_etherpad-lite/node/db/DB');
|
||||
await db.init();
|
||||
console.log("Checking if " + padId + " exists")
|
||||
const padManager = require('ep_etherpad-lite/node/db/PadManager');
|
||||
if (!await padManager.doesPadExists(padId)) throw new Error('Pad does not exist');
|
||||
const pad = await padManager.getPad(padId);
|
||||
await pad.check();
|
||||
console.log('Finished checking pad.');
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
performCheck()
|
||||
.then(e=>console.log("Finished"))
|
||||
.catch(e=>console.log("Finished with errors"))
|
||||
console.log('Finished.');
|
||||
})();
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
import {PackageData} from "ep_etherpad-lite/node/types/PackageInfo";
|
||||
import {writeFileSync} from "fs";
|
||||
import {installedPluginsPath} from "ep_etherpad-lite/static/js/pluginfw/installer";
|
||||
const pluginsModule = require('ep_etherpad-lite/static/js/pluginfw/plugins');
|
||||
|
||||
export const persistInstalledPlugins = async () => {
|
||||
const plugins:PackageData[] = []
|
||||
const installedPlugins = {plugins: plugins};
|
||||
for (const pkg of Object.values(await pluginsModule.getPackages()) as PackageData[]) {
|
||||
installedPlugins.plugins.push({
|
||||
name: pkg.name,
|
||||
version: pkg.version,
|
||||
});
|
||||
}
|
||||
installedPlugins.plugins = [...new Set(installedPlugins.plugins)];
|
||||
writeFileSync(installedPluginsPath, JSON.stringify(installedPlugins));
|
||||
};
|
|
@ -14,7 +14,6 @@ import path from "node:path";
|
|||
import querystring from "node:querystring";
|
||||
|
||||
import axios from 'axios'
|
||||
import process from "node:process";
|
||||
|
||||
|
||||
process.on('unhandledRejection', (err) => { throw err; });
|
||||
|
@ -54,5 +53,4 @@ const settings = require('ep_etherpad-lite/node/utils/Settings');
|
|||
if (res.data.code === 1) throw new Error(`Error creating session: ${JSON.stringify(res.data)}`);
|
||||
console.log('Session made: ====> create a cookie named sessionID and set the value to',
|
||||
res.data.data.sessionID);
|
||||
process.exit(0)
|
||||
})();
|
||||
|
|
|
@ -49,5 +49,4 @@ const settings = require('ep_etherpad-lite/tests/container/loadSettings').loadSe
|
|||
}
|
||||
}
|
||||
console.log(`Deleted ${deleteCount} sessions`);
|
||||
process.exit(0)
|
||||
})();
|
||||
|
|
|
@ -38,5 +38,4 @@ const apikey = fs.readFileSync(filePath, {encoding: 'utf-8'});
|
|||
const deleteAttempt = await axios.post(uri);
|
||||
if (deleteAttempt.data.code === 1) throw new Error(`Error deleting pad ${deleteAttempt.data}`);
|
||||
console.log('Deleted pad', deleteAttempt.data);
|
||||
process.exit(0)
|
||||
})();
|
||||
|
|
|
@ -60,5 +60,4 @@ const padId = process.argv[2];
|
|||
}
|
||||
|
||||
console.log('finished');
|
||||
process.exit(0)
|
||||
})();
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
import {readFileSync} from "node:fs";
|
||||
|
||||
const changelog = readFileSync('../changelog.md')
|
||||
const changelogText = changelog.toString()
|
||||
const changelogLines = changelogText.split('\n')
|
||||
|
||||
|
||||
let cliArgs = process.argv.slice(2)
|
||||
|
||||
let tagVar = cliArgs[0]
|
||||
|
||||
if (!tagVar) {
|
||||
console.error("No tag provided")
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
tagVar = tagVar.replace("refs/tags/v", "")
|
||||
|
||||
let startNum = -1
|
||||
let endline = 0
|
||||
|
||||
let counter = 0
|
||||
for (const line of changelogLines) {
|
||||
if (line.trim().startsWith("#") && (line.match(new RegExp("#", "g"))||[]).length === 1) {
|
||||
if (startNum !== -1) {
|
||||
endline = counter-1
|
||||
break
|
||||
}
|
||||
|
||||
const sanitizedLine = line.replace("#","").trim()
|
||||
if(sanitizedLine.includes(tagVar)) {
|
||||
startNum = counter
|
||||
}
|
||||
}
|
||||
counter++
|
||||
}
|
||||
|
||||
let currentReleaseNotes = changelogLines.slice(startNum, endline).join('\n')
|
||||
console.log(currentReleaseNotes)
|
|
@ -6,8 +6,7 @@ import util from "node:util";
|
|||
const fs = require('fs');
|
||||
import log4js from 'log4js';
|
||||
import readline from 'readline';
|
||||
import {Database} from "ueberdb2";
|
||||
import process from "node:process";
|
||||
import ueberDB from "ueberdb2";
|
||||
|
||||
const settings = require('ep_etherpad-lite/node/utils/Settings');
|
||||
process.on('unhandledRejection', (err) => { throw err; });
|
||||
|
@ -57,7 +56,7 @@ const unescape = (val: string) => {
|
|||
writeInterval: 100,
|
||||
json: false, // data is already json encoded
|
||||
};
|
||||
const db = new Database( // eslint-disable-line new-cap
|
||||
const db = new ueberDB.Database( // eslint-disable-line new-cap
|
||||
settings.dbType,
|
||||
settings.dbSettings,
|
||||
dbWrapperSettings,
|
||||
|
@ -97,8 +96,6 @@ const unescape = (val: string) => {
|
|||
'depended on dbms this may take some time..\n');
|
||||
|
||||
const closeDB = util.promisify(db.close.bind(db));
|
||||
// @ts-ignore
|
||||
await closeDB(null);
|
||||
log(`finished, imported ${keyNo} keys.`);
|
||||
process.exit(0)
|
||||
})();
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
trim() {
|
||||
local var="$*"
|
||||
# remove leading whitespace characters
|
||||
var="${var#"${var%%[![:space:]]*}"}"
|
||||
# remove trailing whitespace characters
|
||||
var="${var%"${var##*[![:space:]]}"}"
|
||||
printf '%s' "$var"
|
||||
}
|
||||
|
||||
# Move to the Etherpad base directory.
|
||||
MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1
|
||||
cd "${MY_DIR}/.." || exit 1
|
||||
|
||||
# Source constants and useful functions
|
||||
. bin/functions.sh
|
||||
|
||||
PNPM_OPTIONS=
|
||||
if [ ! -z "${NODE_ENV-}" ]; then
|
||||
if [ "$NODE_ENV" == 'production' ]; then
|
||||
PNPM_OPTIONS='--prod'
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -z "${ETHERPAD_LOCAL_PLUGINS_ENV-}" ]; then
|
||||
if [ "$ETHERPAD_LOCAL_PLUGINS_ENV" == 'production' ]; then
|
||||
PNPM_OPTIONS='--prod'
|
||||
elif [ "$ETHERPAD_LOCAL_PLUGINS_ENV" == 'development' ]; then
|
||||
PNPM_OPTIONS='-D'
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -z "${ETHERPAD_LOCAL_PLUGINS}" ]; then
|
||||
readarray -d ' ' plugins <<< "${ETHERPAD_LOCAL_PLUGINS}"
|
||||
for plugin in "${plugins[@]}"; do
|
||||
plugin=$(trim "$plugin")
|
||||
if [ -d "local_plugins/${plugin}" ]; then
|
||||
echo "Installing plugin: '${plugin}'"
|
||||
pnpm install -w ${PNPM_OPTIONS:-} "local_plugins/${plugin}/"
|
||||
else
|
||||
( echo "Error. Directory 'local_plugins/${plugin}' for local plugin " \
|
||||
"'${plugin}' missing" >&2 )
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo 'No local plugings to install.'
|
||||
fi
|
|
@ -19,15 +19,6 @@ IF EXIST admin (
|
|||
cd /D ..
|
||||
)
|
||||
|
||||
:: Install ui only if available
|
||||
IF EXIST ui (
|
||||
cd /D .\ui
|
||||
dir
|
||||
cmd /C pnpm i || exit /B 1
|
||||
cmd /C pnpm run build || exit /B 1
|
||||
cd /D ..
|
||||
)
|
||||
|
||||
|
||||
cmd /C pnpm i || exit /B 1
|
||||
|
||||
|
|
53
bin/installPlugins.ts
Normal file
|
@ -0,0 +1,53 @@
|
|||
'use strict';
|
||||
|
||||
import {writeFileSync} from 'fs'
|
||||
import {linkInstaller, installedPluginsPath} from "ep_etherpad-lite/static/js/pluginfw/installer";
|
||||
import {PackageData} from "ep_etherpad-lite/node/types/PackageInfo";
|
||||
|
||||
const pluginsModule = require('ep_etherpad-lite/static/js/pluginfw/plugins');
|
||||
if (process.argv.length === 2) {
|
||||
console.error('Expected at least one argument!');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
let plugins = process.argv.slice(2)
|
||||
let installFromPath = false;
|
||||
|
||||
const thirdOptPlug = plugins[0]
|
||||
|
||||
console.log("Third option: ", thirdOptPlug)
|
||||
if (thirdOptPlug && thirdOptPlug.includes('path')) {
|
||||
installFromPath = true
|
||||
plugins.splice(plugins.indexOf('--path'), 1);
|
||||
}
|
||||
|
||||
|
||||
const persistInstalledPlugins = async () => {
|
||||
const plugins:PackageData[] = []
|
||||
const installedPlugins = {plugins: plugins};
|
||||
for (const pkg of Object.values(await pluginsModule.getPackages()) as PackageData[]) {
|
||||
installedPlugins.plugins.push({
|
||||
name: pkg.name,
|
||||
version: pkg.version,
|
||||
});
|
||||
}
|
||||
installedPlugins.plugins = [...new Set(installedPlugins.plugins)];
|
||||
writeFileSync(installedPluginsPath, JSON.stringify(installedPlugins));
|
||||
};
|
||||
|
||||
async function run() {
|
||||
for (const plugin of plugins) {
|
||||
if(installFromPath) {
|
||||
console.log(`Installing plugin from path: ${plugin}`);
|
||||
await linkInstaller.installFromPath(plugin);
|
||||
continue;
|
||||
}
|
||||
console.log(`Installing plugin from registry: ${plugin}`)
|
||||
await linkInstaller.installPlugin(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
(async () => {
|
||||
await run();
|
||||
await persistInstalledPlugins();
|
||||
})();
|
|
@ -1,63 +0,0 @@
|
|||
import {exec} from 'child_process'
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
import pjson from '../src/package.json'
|
||||
|
||||
const VERSION=pjson.version
|
||||
console.log(`Building docs for version ${VERSION}`)
|
||||
|
||||
const createDirIfNotExists = (dir: fs.PathLike) => {
|
||||
if (!fs.existsSync(dir)){
|
||||
fs.mkdirSync(dir)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function copyFolderSync(from: fs.PathLike, to: fs.PathLike) {
|
||||
if(fs.existsSync(to)){
|
||||
const stat = fs.lstatSync(to)
|
||||
if (stat.isDirectory()){
|
||||
fs.rmSync(to, { recursive: true })
|
||||
}
|
||||
else{
|
||||
fs.rmSync(to)
|
||||
}
|
||||
}
|
||||
fs.mkdirSync(to);
|
||||
fs.readdirSync(from).forEach(element => {
|
||||
if (fs.lstatSync(path.join(<string>from, element)).isFile()) {
|
||||
if (typeof from === "string") {
|
||||
if (typeof to === "string") {
|
||||
fs.copyFileSync(path.join(from, element), path.join(to, element))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (typeof from === "string") {
|
||||
if (typeof to === "string") {
|
||||
copyFolderSync(path.join(from, element), path.join(to, element))
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
exec('asciidoctor -v', (err,stdout)=>{
|
||||
if (err){
|
||||
console.log('Please install asciidoctor')
|
||||
console.log('https://asciidoctor.org/docs/install-toolchain/')
|
||||
process.exit(1)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
createDirIfNotExists('../out')
|
||||
createDirIfNotExists('../out/doc')
|
||||
createDirIfNotExists('../out/doc/api')
|
||||
|
||||
|
||||
|
||||
exec(`asciidoctor -D ../out/doc ../doc/index.adoc ../*/**.adoc -a VERSION=${VERSION}`)
|
||||
exec(`asciidoctor -D ../out/doc/api ../doc/api/*.adoc -a VERSION=${VERSION}`)
|
||||
|
||||
copyFolderSync('../doc/public/', '../out/doc/')
|
|
@ -1,83 +0,0 @@
|
|||
// DB migration
|
||||
import {readFileSync} from 'node:fs'
|
||||
import {Database, DatabaseType} from "ueberdb2";
|
||||
import path from "node:path";
|
||||
const settings = require('ep_etherpad-lite/node/utils/Settings');
|
||||
|
||||
|
||||
// file1 = source, file2 = target
|
||||
// pnpm run migrateDB --file1 <db1.json> --file2 <db2.json>
|
||||
const arg = process.argv.slice(2);
|
||||
|
||||
if (arg.length != 4) {
|
||||
console.error('Wrong number of arguments!. Call with pnpm run migrateDB --file1 source.json target.json')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
type SettingsConfig = {
|
||||
dbType: string,
|
||||
dbSettings: any
|
||||
}
|
||||
|
||||
/*
|
||||
{
|
||||
"dbType": "<your-db-type>",
|
||||
"dbSettings": {
|
||||
<your-db-settings>
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
let firstDBSettingsFile: string
|
||||
let secondDBSettingsFile: string
|
||||
|
||||
|
||||
if (arg[0] == "--file1") {
|
||||
firstDBSettingsFile = arg[1]
|
||||
} else if (arg[0] === "--file2") {
|
||||
secondDBSettingsFile = arg[1]
|
||||
}
|
||||
|
||||
if (arg[2] == "--file1") {
|
||||
firstDBSettingsFile = arg[3]
|
||||
} else if (arg[2] === "--file2") {
|
||||
secondDBSettingsFile = arg[3]
|
||||
}
|
||||
|
||||
|
||||
|
||||
const settingsfile = JSON.parse(readFileSync(path.join(settings.root,firstDBSettingsFile!)).toString()) as SettingsConfig
|
||||
const settingsfile2 = JSON.parse(readFileSync(path.join(settings.root,secondDBSettingsFile!)).toString()) as SettingsConfig
|
||||
|
||||
console.log(settingsfile2)
|
||||
if ("filename" in settingsfile.dbSettings) {
|
||||
settingsfile.dbSettings.filename = path.join(settings.root, settingsfile.dbSettings.filename)
|
||||
console.log(settingsfile.dbType + " location is "+ settingsfile.dbSettings.filename)
|
||||
}
|
||||
|
||||
if ("filename" in settingsfile2.dbSettings) {
|
||||
settingsfile2.dbSettings.filename = path.join(settings.root, settingsfile2.dbSettings.filename)
|
||||
console.log(settingsfile2.dbType + " location is "+ settingsfile2.dbSettings.filename)
|
||||
}
|
||||
|
||||
const ueberdb1 = new Database(settingsfile.dbType as DatabaseType, settingsfile.dbSettings)
|
||||
const ueberdb2 = new Database(settingsfile2.dbType as DatabaseType, settingsfile2.dbSettings)
|
||||
|
||||
const handleSync = async ()=>{
|
||||
await ueberdb1.init()
|
||||
await ueberdb2.init()
|
||||
|
||||
const allKeys = await ueberdb1.findKeys('*','')
|
||||
for (const key of allKeys) {
|
||||
const foundVal = await ueberdb1.get(key)!
|
||||
await ueberdb2.set(key, foundVal)
|
||||
}
|
||||
}
|
||||
|
||||
handleSync().then(()=>{
|
||||
console.log("Done syncing dbs")
|
||||
}).catch(e=>{
|
||||
console.log(`Error syncing db ${e}`)
|
||||
})
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
import process from 'node:process';
|
||||
import {Database} from "ueberdb2";
|
||||
import ueberDB from "ueberdb2";
|
||||
import log4js from 'log4js';
|
||||
import util from 'util';
|
||||
const settings = require('ep_etherpad-lite/node/utils/Settings');
|
||||
|
@ -23,7 +23,7 @@ process.on('unhandledRejection', (err) => { throw err; });
|
|||
cache: '0', // The cache slows things down when you're mostly writing.
|
||||
writeInterval: 0, // Write directly to the database, don't buffer
|
||||
};
|
||||
const db = new Database( // eslint-disable-line new-cap
|
||||
const db = new ueberDB.Database( // eslint-disable-line new-cap
|
||||
settings.dbType,
|
||||
settings.dbSettings,
|
||||
dbWrapperSettings,
|
||||
|
@ -31,7 +31,7 @@ process.on('unhandledRejection', (err) => { throw err; });
|
|||
await db.init();
|
||||
|
||||
console.log('Waiting for dirtyDB to parse its file.');
|
||||
const dirty = new Database('dirty', `${__dirname}/../var/dirty.db`);
|
||||
const dirty = await new ueberDB.Database('dirty',`${__dirname}/../var/dirty.db`);
|
||||
await dirty.init();
|
||||
const keys = await dirty.findKeys('*', '')
|
||||
|
||||
|
@ -57,5 +57,4 @@ process.on('unhandledRejection', (err) => { throw err; });
|
|||
await db.close(null);
|
||||
await dirty.close(null);
|
||||
console.log('Finished.');
|
||||
process.exit(0)
|
||||
})();
|
||||
|
|
|
@ -1,26 +1,25 @@
|
|||
{
|
||||
"name": "bin",
|
||||
"version": "2.3.0",
|
||||
"version": "2.0.1",
|
||||
"description": "",
|
||||
"main": "checkAllPads.js",
|
||||
"directories": {
|
||||
"doc": "doc"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.8.4",
|
||||
"axios": "^1.6.8",
|
||||
"ep_etherpad-lite": "workspace:../src",
|
||||
"log4js": "^6.9.1",
|
||||
"semver": "^7.7.2",
|
||||
"tsx": "^4.20.3",
|
||||
"ueberdb2": "^5.0.14"
|
||||
"semver": "^7.6.0",
|
||||
"tsx": "^4.7.1",
|
||||
"ueberdb2": "^4.2.63"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.0.1",
|
||||
"@types/semver": "^7.7.0",
|
||||
"typescript": "^5.8.2"
|
||||
"@types/node": "^20.11.27",
|
||||
"@types/semver": "^7.5.8",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"scripts": {
|
||||
"makeDocs": "node --import tsx make_docs.ts",
|
||||
"checkPad": "node --import tsx checkPad.ts",
|
||||
"checkAllPads": "node --import tsx checkAllPads.ts",
|
||||
"createUserSession": "node --import tsx createUserSession.ts",
|
||||
|
@ -33,9 +32,7 @@
|
|||
"rebuildPad": "node --import tsx rebuildPad.ts",
|
||||
"stalePlugins": "node --import tsx ./plugins/stalePlugins.ts",
|
||||
"checkPlugin": "node --import tsx ./plugins/checkPlugin.ts",
|
||||
"plugins": "node --import tsx ./plugins.ts",
|
||||
"generateChangelog": "node --import tsx generateReleaseNotes.ts",
|
||||
"migrateDB": "node --import tsx migrateDB.ts"
|
||||
"install-plugins": "node --import tsx ./installPlugins.ts"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
|
|
117
bin/plugins.ts
|
@ -1,117 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
import {linkInstaller, checkForMigration} from "ep_etherpad-lite/static/js/pluginfw/installer";
|
||||
import {persistInstalledPlugins} from "./commonPlugins";
|
||||
import fs from "node:fs";
|
||||
const settings = require('ep_etherpad-lite/node/utils/Settings');
|
||||
|
||||
if (process.argv.length === 2) {
|
||||
console.error('Expected at least one argument!');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
let args = process.argv.slice(2)
|
||||
|
||||
|
||||
const possibleActions = [
|
||||
"i",
|
||||
"install",
|
||||
"rm",
|
||||
"remove",
|
||||
"ls",
|
||||
"list"
|
||||
]
|
||||
|
||||
const install = ()=> {
|
||||
const argsAsString: string = args.join(" ");
|
||||
const regexRegistryPlugins = /(?<=i\s)(.*?)(?=--github|--path|$)/;
|
||||
const regexLocalPlugins = /(?<=--path\s)(.*?)(?=--github|$)/;
|
||||
const regexGithubPlugins = /(?<=--github\s)(.*?)(?=--path|$)/;
|
||||
const registryPlugins = argsAsString.match(regexRegistryPlugins)?.[0]?.split(" ")?.filter(s => s) || [];
|
||||
const localPlugins = argsAsString.match(regexLocalPlugins)?.[0]?.split(" ")?.filter(s => s) || [];
|
||||
const githubPlugins = argsAsString.match(regexGithubPlugins)?.[0]?.split(" ")?.filter(s => s) || [];
|
||||
|
||||
async function run() {
|
||||
for (const plugin of registryPlugins) {
|
||||
if (possibleActions.includes(plugin)){
|
||||
continue
|
||||
}
|
||||
console.log(`Installing plugin from registry: ${plugin}`)
|
||||
if (plugin.includes('@')) {
|
||||
const [name, version] = plugin.split('@');
|
||||
await linkInstaller.installPlugin(name, version);
|
||||
continue;
|
||||
}
|
||||
await linkInstaller.installPlugin(plugin);
|
||||
}
|
||||
|
||||
for (const plugin of localPlugins) {
|
||||
console.log(`Installing plugin from path: ${plugin}`);
|
||||
await linkInstaller.installFromPath(plugin);
|
||||
}
|
||||
|
||||
for (const plugin of githubPlugins) {
|
||||
console.log(`Installing plugin from github: ${plugin}`);
|
||||
await linkInstaller.installFromGitHub(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
(async () => {
|
||||
await checkForMigration();
|
||||
await run();
|
||||
await persistInstalledPlugins();
|
||||
})();
|
||||
}
|
||||
|
||||
const list = ()=>{
|
||||
const walk = async () => {
|
||||
const plugins = fs.readFileSync(settings.root+"/var/installed_plugins.json", "utf-8")
|
||||
const pluginNames = JSON.parse(plugins).plugins.map((plugin: any) => plugin.name).join(", ")
|
||||
|
||||
console.log("Installed plugins are:", pluginNames)
|
||||
}
|
||||
|
||||
(async () => {
|
||||
await walk();
|
||||
})();
|
||||
}
|
||||
|
||||
const remove = (plugins: string[])=>{
|
||||
const walk = async () => {
|
||||
for (const plugin of plugins) {
|
||||
console.log(`Uninstalling plugin: ${plugin}`)
|
||||
await linkInstaller.uninstallPlugin(plugin);
|
||||
}
|
||||
await persistInstalledPlugins();
|
||||
}
|
||||
|
||||
(async () => {
|
||||
await checkForMigration();
|
||||
await walk();
|
||||
})();
|
||||
}
|
||||
|
||||
let action = args[0];
|
||||
|
||||
switch (action) {
|
||||
case "install":
|
||||
install();
|
||||
break;
|
||||
case "i":
|
||||
install();
|
||||
break;
|
||||
case "ls":
|
||||
list();
|
||||
break;
|
||||
case "list":
|
||||
list();
|
||||
break;
|
||||
case "rm":
|
||||
remove(args.slice(1));
|
||||
break;
|
||||
default:
|
||||
console.error('Expected at least one argument!');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
|
@ -474,6 +474,6 @@ log4js.configure({
|
|||
logger.info('No changes.');
|
||||
}
|
||||
}
|
||||
|
||||
logger.info('Finished');
|
||||
process.exit(0)
|
||||
})();
|
||||
|
|
|
@ -69,7 +69,7 @@ jobs:
|
|||
working-directory: ./etherpad-lite
|
||||
run: |
|
||||
pnpm link --global $PLUGIN_NAME
|
||||
pnpm run plugins i --path ../../plugin
|
||||
pnpm run install-plugins --path ../../plugin
|
||||
env:
|
||||
PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }}
|
||||
- name: Link ep_etherpad-lite
|
||||
|
|
|
@ -78,7 +78,7 @@ jobs:
|
|||
- name: Run the frontend tests
|
||||
shell: bash
|
||||
run: |
|
||||
pnpm run prod &
|
||||
pnpm run dev &
|
||||
connected=false
|
||||
can_connect() {
|
||||
curl -sSfo /dev/null http://localhost:9001/ || return 1
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// Returns a list of stale plugins and their authors email
|
||||
|
||||
import axios from 'axios'
|
||||
import process from "node:process";
|
||||
const currentTime = new Date();
|
||||
|
||||
(async () => {
|
||||
|
@ -20,5 +19,4 @@ const currentTime = new Date();
|
|||
console.log(`${name}, ${res.data[plugin].data.maintainers[0].email}`);
|
||||
}
|
||||
}
|
||||
process.exit(0)
|
||||
})();
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
|
||||
// As of v14, Node.js does not exit when there is an unhandled Promise rejection. Convert an
|
||||
// unhandled rejection into an uncaught exception, which does cause Node.js to exit.
|
||||
import process from "node:process";
|
||||
|
||||
process.on('unhandledRejection', (err) => { throw err; });
|
||||
|
||||
if (process.argv.length !== 4 && process.argv.length !== 5) {
|
||||
|
@ -84,5 +82,4 @@ const newPadId = process.argv[4] || `${padId}-rebuilt`;
|
|||
|
||||
await db.shutdown();
|
||||
console.info('finished');
|
||||
process.exit(0)
|
||||
})();
|
||||
|
|
|
@ -197,7 +197,7 @@ try {
|
|||
|
||||
try {
|
||||
console.log('Building documentation...');
|
||||
run('pnpm run makeDocs');
|
||||
run('node ./make_docs.js');
|
||||
console.log('Updating ether.github.com master branch...');
|
||||
run('git pull --ff-only', {cwd: '../ether.github.com/'});
|
||||
console.log('Committing documentation...');
|
||||
|
|
|
@ -57,5 +57,4 @@ let valueCount = 0;
|
|||
}
|
||||
|
||||
console.info(`Finished: Replaced ${valueCount} values in the database`);
|
||||
process.exit(0)
|
||||
})();
|
||||
|
|
10
bin/run.sh
|
@ -22,7 +22,7 @@ Please type 'Etherpad rocks my socks' (or restart with the '--root'
|
|||
argument) if you still want to start it as root:
|
||||
EOF
|
||||
printf "> " >&2
|
||||
read -r rocks
|
||||
read rocks
|
||||
[ "$rocks" = "Etherpad rocks my socks" ] || fatal "Your input was incorrect"
|
||||
fi
|
||||
|
||||
|
@ -32,11 +32,9 @@ bin/installDeps.sh "$@" || exit 1
|
|||
|
||||
## Create the admin ui
|
||||
if [ -z "$NODE_ENV" ] || [ "$NODE_ENV" = "development" ]; then
|
||||
ADMIN_UI_PATH="$(dirname "$0")/../admin"
|
||||
UI_PATH="$(dirname "$0")/../ui"
|
||||
ADMIN_UI_PATH="$(dirname $0)/../admin"
|
||||
log "Creating the admin UI..."
|
||||
(cd "$ADMIN_UI_PATH" && pnpm run build)
|
||||
(cd "$UI_PATH" && pnpm run build)
|
||||
(cd $ADMIN_UI_PATH && pnpm run build)
|
||||
else
|
||||
log "Cannot create the admin UI in production mode"
|
||||
fi
|
||||
|
@ -45,4 +43,4 @@ fi
|
|||
log "Starting Etherpad..."
|
||||
|
||||
# cd src
|
||||
exec pnpm run prod "$@"
|
||||
exec pnpm run dev "$@"
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
||||
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
||||
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
||||
"resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
|
|
2
doc/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
.vitepress/cache
|
||||
dist
|
|
@ -1,79 +0,0 @@
|
|||
import { defineConfig } from 'vitepress'
|
||||
import {version} from '../../package.json'
|
||||
// https://vitepress.dev/reference/site-config
|
||||
const commitRef = process.env.COMMIT_REF?.slice(0, 8) || 'dev'
|
||||
|
||||
|
||||
export default defineConfig({
|
||||
title: "Etherpad Documentation",
|
||||
description: "Next Generation Collaborative Document Editing",
|
||||
base: '/',
|
||||
themeConfig: {
|
||||
search: {
|
||||
provider: 'local'
|
||||
},
|
||||
// https://vitepress.dev/reference/default-theme-config
|
||||
nav: [
|
||||
{ text: 'Home', link: '/' },
|
||||
{ text: 'Getting started', link: '/docker.md' }
|
||||
],
|
||||
logo:'/favicon.ico',
|
||||
|
||||
sidebar: {
|
||||
'/': [
|
||||
{
|
||||
link: '/',
|
||||
text: 'About',
|
||||
items: [
|
||||
{ text: 'Docker', link: '/docker.md' },
|
||||
{ text: 'Localization', link: '/localization.md' },
|
||||
{ text: 'Cookies', link: '/cookies.md' },
|
||||
{ text: 'Plugins', link: '/plugins.md' },
|
||||
{ text: 'Stats', link: '/stats.md' },
|
||||
{text: 'Skins', link: '/skins.md' },
|
||||
{text: 'Demo', link: '/demo.md' },
|
||||
{text: 'CLI', link: '/cli.md'},
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'API',
|
||||
link: '/api/',
|
||||
items: [
|
||||
{ text: 'Changeset', link: '/api/changeset_library.md' },
|
||||
{text: 'Editbar', link: '/api/editbar.md' },
|
||||
{text: 'EditorInfo', link: '/api/editorInfo.md' },
|
||||
{text: 'Embed Parameters', link: '/api/embed_parameters.md' },
|
||||
{text: 'Hooks Client Side', link: '/api/hooks_client-side.md' },
|
||||
{text: 'Hooks Server Side', link: '/api/hooks_server-side.md' },
|
||||
{text: 'Plugins', link: '/api/pluginfw.md' },
|
||||
{text: 'Toolbar', link: '/api/toolbar.md' },
|
||||
{text: 'HTTP API', link: '/api/http_api.md' },
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'Old Docs',
|
||||
items: [
|
||||
{ text: 'Easysync description', link: '/etherpad-lite/easysync/easysync-full-description.pdf' },
|
||||
{ text: 'Easysync notes', link: '/etherpad-lite/easysync/easysync-notes.pdf' }
|
||||
]
|
||||
}
|
||||
],
|
||||
'/stats': [
|
||||
{
|
||||
text: 'Stats',
|
||||
items:[
|
||||
{ text: 'Stats', link: '/stats/' }
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
footer: {
|
||||
message: `Published under Apache License`,
|
||||
copyright: `(${commitRef}) v${version} by Etherpad Foundation`
|
||||
},
|
||||
|
||||
socialLinks: [
|
||||
{ icon: 'github', link: 'https://github.com/ether/etherpad-lite' }
|
||||
]
|
||||
}
|
||||
})
|
|
@ -1,22 +0,0 @@
|
|||
<script setup lang="ts">
|
||||
defineProps<{ svg: string }>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<figure class="svg-image-root" v-html="svg" />
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.svg-image-root {
|
||||
background-color: #eee;
|
||||
border-radius: 8px;
|
||||
padding: 1ch;
|
||||
margin: 1ch 0;
|
||||
}
|
||||
html.dark .svg-image-root {
|
||||
background-color: #313641;
|
||||
}
|
||||
.svg-image-root svg text {
|
||||
font-family: var(--vp-font-family-base);
|
||||
}
|
||||
</style>
|
|
@ -1,12 +0,0 @@
|
|||
import { h } from 'vue'
|
||||
import type { Theme } from 'vitepress'
|
||||
import DefaultTheme from 'vitepress/theme'
|
||||
import './styles/vars.css'
|
||||
import SvgImage from './components/SvgImage.vue'
|
||||
|
||||
export default {
|
||||
extends: DefaultTheme,
|
||||
enhanceApp({ app }) {
|
||||
app.component('SvgImage', SvgImage)
|
||||
},
|
||||
} satisfies Theme
|
|
@ -1,77 +0,0 @@
|
|||
/**
|
||||
* Colors
|
||||
* -------------------------------------------------------------------------- */
|
||||
|
||||
:root {
|
||||
--vp-c-brand: #646cff;
|
||||
--vp-c-brand-light: #747bff;
|
||||
--vp-c-brand-lighter: #9499ff;
|
||||
--vp-c-brand-lightest: #bcc0ff;
|
||||
--vp-c-brand-dark: #535bf2;
|
||||
--vp-c-brand-darker: #454ce1;
|
||||
--vp-c-brand-dimm: rgba(100, 108, 255, 0.08);
|
||||
}
|
||||
|
||||
/**
|
||||
* Component: Button
|
||||
* -------------------------------------------------------------------------- */
|
||||
|
||||
:root {
|
||||
--vp-button-brand-border: var(--vp-c-brand-light);
|
||||
--vp-button-brand-text: var(--vp-c-white);
|
||||
--vp-button-brand-bg: var(--vp-c-brand);
|
||||
--vp-button-brand-hover-border: var(--vp-c-brand-light);
|
||||
--vp-button-brand-hover-text: var(--vp-c-white);
|
||||
--vp-button-brand-hover-bg: var(--vp-c-brand-light);
|
||||
--vp-button-brand-active-border: var(--vp-c-brand-light);
|
||||
--vp-button-brand-active-text: var(--vp-c-white);
|
||||
--vp-button-brand-active-bg: var(--vp-button-brand-bg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Component: Home
|
||||
* -------------------------------------------------------------------------- */
|
||||
|
||||
:root {
|
||||
--vp-home-hero-name-color: transparent;
|
||||
--vp-home-hero-name-background: -webkit-linear-gradient(
|
||||
120deg,
|
||||
#0f775b 30%,
|
||||
#0f775b
|
||||
);
|
||||
|
||||
--vp-home-hero-image-background-image: linear-gradient(
|
||||
-45deg,
|
||||
#0f775b 50%,
|
||||
#0f775b 50%
|
||||
);
|
||||
--vp-home-hero-image-filter: blur(40px);
|
||||
}
|
||||
|
||||
@media (min-width: 640px) {
|
||||
:root {
|
||||
--vp-home-hero-image-filter: blur(56px);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 960px) {
|
||||
:root {
|
||||
--vp-home-hero-image-filter: blur(72px);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Component: Custom Block
|
||||
* -------------------------------------------------------------------------- */
|
||||
|
||||
:root {
|
||||
--vp-custom-block-tip-border: var(--vp-c-brand);
|
||||
--vp-custom-block-tip-text: var(--vp-c-brand-darker);
|
||||
--vp-custom-block-tip-bg: var(--vp-c-brand-dimm);
|
||||
}
|
||||
|
||||
.dark {
|
||||
--vp-custom-block-tip-border: var(--vp-c-brand);
|
||||
--vp-custom-block-tip-text: var(--vp-c-brand-lightest);
|
||||
--vp-custom-block-tip-bg: var(--vp-c-brand-dimm);
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
# Changeset Library
|
||||
|
||||
The [changeset
|
||||
library](https://github.com/ether/etherpad-lite/blob/develop/src/static/js/Changeset.ts)
|
||||
provides tools to create, read, and apply changesets.
|
||||
|
||||
## Changeset
|
||||
|
||||
```javascript
|
||||
const Changeset = require('ep_etherpad-lite/static/js/Changeset');
|
||||
```
|
||||
|
||||
A changeset describes the difference between two revisions of a document. When a
|
||||
user edits a pad, the browser generates and sends a changeset to the server,
|
||||
which relays it to the other users and saves a copy (so that every past revision
|
||||
is accessible).
|
||||
|
||||
A transmitted changeset looks like this:
|
||||
|
||||
```
|
||||
'Z:z>1|2=m=b*0|1+1$\n'
|
||||
```
|
||||
|
||||
## Attribute Pool
|
||||
|
||||
```javascript
|
||||
const AttributePool = require('ep_etherpad-lite/static/js/AttributePool');
|
||||
```
|
||||
|
||||
Changesets do not include any attribute key–value pairs. Instead, they use
|
||||
numeric identifiers that reference attributes kept in an [attribute
|
||||
pool](https://github.com/ether/etherpad-lite/blob/develop/src/static/js/AttributePool.js).
|
||||
This attribute interning reduces the transmission overhead of attributes that
|
||||
are used many times.
|
||||
|
||||
There is one attribute pool per pad, and it includes every current and
|
||||
historical attribute used in the pad.
|
||||
|
||||
## Further Reading
|
||||
|
||||
Detailed information about the changesets & Easysync protocol:
|
||||
|
||||
* [Easysync Protocol](https://github.com/ether/etherpad-lite/blob/develop/doc/easysync/easysync-notes.pdf)
|
||||
* [Etherpad and EasySync Technical Manual](https://github.com/ether/etherpad-lite/blob/develop/doc/easysync/easysync-full-description.pdf)
|
|
@ -1,36 +0,0 @@
|
|||
# Editbar
|
||||
|
||||
Located in `src/static/js/pad_editbar.js`
|
||||
|
||||
## isEnabled()
|
||||
|
||||
If the editorbar contains the class `enabledtoolbar`, it is enabled.
|
||||
|
||||
|
||||
## disable()
|
||||
|
||||
Disables the editorbar. This is done by adding the class `disabledtoolbar` and removing the enabledtoolbar
|
||||
|
||||
## toggleDropDown(dropdown)
|
||||
|
||||
Shows the dropdown `div.popup` whose `id` equals `dropdown`.
|
||||
|
||||
## registerCommand(cmd, callback)
|
||||
|
||||
Register a handler for a specific command. Commands are fired if the corresponding button is clicked or the corresponding select is changed.
|
||||
|
||||
## registerAceCommand(cmd, callback)
|
||||
Creates an ace callstack and calls the callback with an ace instance (and a toolbar item, if applicable): `callback(cmd, ace, item)`.
|
||||
|
||||
Example:
|
||||
```
|
||||
toolbar.registerAceCommand("insertorderedlist", function (cmd, ace) {
|
||||
ace.ace_doInsertOrderedList();
|
||||
});
|
||||
```
|
||||
|
||||
## registerDropdownCommand(cmd, dropdown)
|
||||
Ties a `div.popup` where `id` equals `dropdown` to a `command` fired by clicking a button.
|
||||
|
||||
## triggerCommand(cmd[, item])
|
||||
Triggers a command (optionally with some internal representation of the toolbar item that triggered it).
|
|
@ -1,208 +0,0 @@
|
|||
# EditorInfo
|
||||
|
||||
Location: `src/static/js/ace2_inner.js`
|
||||
|
||||
## editorInfo.ace_replaceRange(start, end, text)
|
||||
This function replaces a range (from `start` to `end`) with `text`.
|
||||
|
||||
## editorInfo.ace_getRep()
|
||||
|
||||
Returns the `rep` object. The rep object consists of the following properties:
|
||||
|
||||
- `lines`: Implemented as a skip list
|
||||
- `selStart`: The start of the selection
|
||||
- `selEnd`: The end of the selection
|
||||
- `selFocusAtStart`: Whether the selection is focused at the start
|
||||
- `alltext`: The entire text of the document
|
||||
- `alines`: The entire text of the document, split into lines
|
||||
- `apool`: The pool of attributes
|
||||
|
||||
## editorInfo.ace_getAuthor()
|
||||
|
||||
Returns the authors of the pad. If the pad has no authors, it returns an empty object.
|
||||
|
||||
|
||||
## editorInfo.ace_inCallStack()
|
||||
|
||||
Returns true if the editor is in the call stack.
|
||||
|
||||
## editorInfo.ace_inCallStackIfNecessary(?)
|
||||
|
||||
Executes the function if the editor is in the call stack.
|
||||
|
||||
## editorInfo.ace_focus(?)
|
||||
|
||||
Focuses the editor.
|
||||
|
||||
## editorInfo.ace_importText(?)
|
||||
|
||||
Imports text into the editor.
|
||||
|
||||
## editorInfo.ace_importAText(?)
|
||||
|
||||
Imports text and attributes into the editor.
|
||||
|
||||
## editorInfo.ace_exportText(?)
|
||||
|
||||
Exports the text from the editor.
|
||||
|
||||
## editorInfo.ace_editorChangedSize(?)
|
||||
|
||||
Changes the size of the editor.
|
||||
|
||||
## editorInfo.ace_setOnKeyPress(?)
|
||||
|
||||
Sets the key press event.
|
||||
|
||||
## editorInfo.ace_setOnKeyDown(?)
|
||||
|
||||
Sets the key down event.
|
||||
|
||||
## editorInfo.ace_setNotifyDirty(?)
|
||||
|
||||
Sets the dirty notification.
|
||||
|
||||
## editorInfo.ace_dispose(?)
|
||||
|
||||
Disposes the editor.
|
||||
|
||||
## editorInfo.ace_setEditable(bool)
|
||||
|
||||
Sets the editor to be editable or not.
|
||||
|
||||
## editorInfo.ace_execCommand(?)
|
||||
|
||||
Executes a command.
|
||||
|
||||
## editorInfo.ace_callWithAce(fn, callStack, normalize)
|
||||
|
||||
Calls a function with the ace instance.
|
||||
|
||||
## editorInfo.ace_setProperty(key, value)
|
||||
|
||||
Sets a property.
|
||||
|
||||
## editorInfo.ace_setBaseText(txt)
|
||||
|
||||
Sets the base text.
|
||||
|
||||
## editorInfo.ace_setBaseAttributedText(atxt, apoolJsonObj)
|
||||
|
||||
Sets the base attributed text.
|
||||
|
||||
## editorInfo.ace_applyChangesToBase(c, optAuthor, apoolJsonObj)
|
||||
|
||||
Applies changes to the base.
|
||||
|
||||
## editorInfo.ace_prepareUserChangeset()
|
||||
|
||||
Prepares the user changeset.
|
||||
|
||||
## editorInfo.ace_applyPreparedChangesetToBase()
|
||||
|
||||
Applies the prepared changeset to the base.
|
||||
|
||||
## editorInfo.ace_setUserChangeNotificationCallback(f)
|
||||
|
||||
Sets the user change notification callback.
|
||||
|
||||
## editorInfo.ace_setAuthorInfo(author, info)
|
||||
|
||||
Sets the author info.
|
||||
|
||||
## editorInfo.ace_fastIncorp(?)
|
||||
|
||||
Incorporates changes quickly.
|
||||
|
||||
## editorInfo.ace_isCaret(?)
|
||||
|
||||
Returns true if the caret is at the specified position.
|
||||
|
||||
## editorInfo.ace_getLineAndCharForPoint(?)
|
||||
|
||||
Returns the line and character for a point.
|
||||
|
||||
## editorInfo.ace_performDocumentApplyAttributesToCharRange(?)
|
||||
|
||||
Applies attributes to a character range.
|
||||
|
||||
## editorInfo.ace_setAttributeOnSelection(attribute, enabled)
|
||||
|
||||
Sets an attribute on current range.
|
||||
Example: `call.editorInfo.ace_setAttributeOnSelection("turkey::balls", true); // turkey is the attribute here, balls is the value
|
||||
Notes: to remove the attribute pass enabled as false
|
||||
|
||||
## editorInfo.ace_toggleAttributeOnSelection(?)
|
||||
|
||||
Toggles an attribute on the current range.
|
||||
|
||||
## editorInfo.ace_getAttributeOnSelection(attribute, prevChar)
|
||||
Returns a boolean if an attribute exists on a selected range.
|
||||
prevChar value should be true if you want to get the previous Character attribute instead of the current selection for example
|
||||
if the caret is at position 0,1 (after first character) it's probable you want the attributes on the character at 0,0
|
||||
The attribute should be the string name of the attribute applied to the selection IE subscript
|
||||
Example usage: Apply the activeButton Class to a button if an attribute is on a highlighted/selected caret position or range.
|
||||
Example `var isItThere = documentAttributeManager.getAttributeOnSelection("turkey::balls", true);`
|
||||
|
||||
See the ep_subscript plugin for an example of this function in action.
|
||||
Notes: Does not work on first or last character of a line. Suffers from a race condition if called with aceEditEvent.
|
||||
|
||||
## editorInfo.ace_performSelectionChange(?)
|
||||
|
||||
Performs a selection change.
|
||||
|
||||
## editorInfo.ace_doIndentOutdent(?)
|
||||
|
||||
Indents or outdents the selection.
|
||||
|
||||
## editorInfo.ace_doUndoRedo(?)
|
||||
|
||||
Undoes or redoes the last action.
|
||||
|
||||
## editorInfo.ace_doInsertUnorderedList(?)
|
||||
|
||||
Inserts an unordered list.
|
||||
|
||||
## editorInfo.ace_doInsertOrderedList(?)
|
||||
|
||||
Inserts an ordered list.
|
||||
|
||||
## editorInfo.ace_performDocumentApplyAttributesToRange()
|
||||
|
||||
Applies attributes to a range.
|
||||
|
||||
## editorInfo.ace_getAuthorInfos()
|
||||
Returns an info object about the author. Object key = author_id and info includes author's bg color value.
|
||||
Use to define your own authorship.
|
||||
|
||||
## editorInfo.ace_performDocumentReplaceRange(start, end, newText)
|
||||
This function replaces a range (from [x1,y1] to [x2,y2]) with `newText`.
|
||||
|
||||
## editorInfo.ace_performDocumentReplaceCharRange(startChar, endChar, newText)
|
||||
This function replaces a range (from y1 to y2) with `newText`.
|
||||
|
||||
## editorInfo.ace_renumberList(lineNum)
|
||||
If you delete a line, calling this method will fix the line numbering.
|
||||
|
||||
## editorInfo.ace_doReturnKey()
|
||||
Forces a return key at the current caret position.
|
||||
|
||||
## editorInfo.ace_isBlockElement(element)
|
||||
Returns true if your passed element is registered as a block element.
|
||||
|
||||
## editorInfo.ace_getLineListType(lineNum)
|
||||
Returns the line's html list type.
|
||||
|
||||
## editorInfo.ace_caretLine()
|
||||
Returns X position of the caret.
|
||||
|
||||
## editorInfo.ace_caretColumn()
|
||||
Returns Y position of the caret.
|
||||
|
||||
## editorInfo.ace_caretDocChar()
|
||||
|
||||
Returns the Y offset starting from [x=0,y=0]
|
||||
|
||||
## editorInfo.ace_isWordChar(?)
|
||||
|
||||
Returns true if the character is a word character.
|
|
@ -1,75 +0,0 @@
|
|||
# Embed parameters
|
||||
You can easily embed your etherpad-lite into any webpage by using iframes. You can configure the embedded pad using embed parameters.
|
||||
|
||||
Example:
|
||||
|
||||
Cut and paste the following code into any webpage to embed a pad. The parameters below will hide the chat and the line numbers and will auto-focus on Line 4.
|
||||
|
||||
```
|
||||
<iframe src='http://pad.test.de/p/PAD_NAME#L4?showChat=false&showLineNumbers=false' width=600 height=400></iframe>
|
||||
```
|
||||
|
||||
## showLineNumbers
|
||||
* Boolean
|
||||
|
||||
Default: true
|
||||
|
||||
## showControls
|
||||
* Boolean
|
||||
|
||||
Default: true
|
||||
|
||||
## showChat
|
||||
* Boolean
|
||||
|
||||
Default: true
|
||||
|
||||
## useMonospaceFont
|
||||
* Boolean
|
||||
|
||||
Default: false
|
||||
|
||||
## userName
|
||||
* String
|
||||
|
||||
Default: "unnamed"
|
||||
|
||||
Example: `userName=Etherpad%20User`
|
||||
|
||||
## userColor
|
||||
* String (css hex color value)
|
||||
|
||||
Default: randomly chosen by pad server
|
||||
|
||||
Example: `userColor=%23ff9900`
|
||||
|
||||
## noColors
|
||||
* Boolean
|
||||
|
||||
Default: false
|
||||
|
||||
## alwaysShowChat
|
||||
* Boolean
|
||||
|
||||
Default: false
|
||||
|
||||
## lang
|
||||
* String
|
||||
|
||||
Default: en
|
||||
|
||||
Example: `lang=ar` (translates the interface into Arabic)
|
||||
|
||||
## rtl
|
||||
* Boolean
|
||||
|
||||
Default: true
|
||||
Displays pad text from right to left.
|
||||
|
||||
## #L
|
||||
* Int
|
||||
|
||||
Default: 0
|
||||
Focuses pad at specific line number and places caret at beginning of this line
|
||||
Special note: Is not a URL parameter but instead of a Hash value
|
||||
|
|
@ -4,7 +4,7 @@ Most of these hooks are called during or in order to set up the formatting
|
|||
process.
|
||||
|
||||
=== documentReady
|
||||
Called from: `src/templates/pad.html`
|
||||
Called from: src/templates/pad.html
|
||||
|
||||
Things in context:
|
||||
|
||||
|
@ -14,7 +14,7 @@ This hook proxies the functionality of jQuery's `$(document).ready` event.
|
|||
|
||||
=== aceDomLinePreProcessLineAttributes
|
||||
|
||||
Called from: `src/static/js/domline.js`
|
||||
Called from: src/static/js/domline.js
|
||||
|
||||
Things in context:
|
||||
|
||||
|
@ -36,7 +36,7 @@ more.
|
|||
|
||||
=== aceDomLineProcessLineAttributes
|
||||
|
||||
Called from: `src/static/js/domline.js`
|
||||
Called from: src/static/js/domline.js
|
||||
|
||||
Things in context:
|
||||
|
||||
|
@ -58,7 +58,7 @@ more.
|
|||
|
||||
=== aceCreateDomLine
|
||||
|
||||
Called from: `src/static/js/domline.js`
|
||||
Called from: src/static/js/domline.js
|
||||
|
||||
Things in context:
|
||||
|
||||
|
@ -78,7 +78,7 @@ question, and cls will be the new class of the element going forward.
|
|||
|
||||
=== acePostWriteDomLineHTML
|
||||
|
||||
Called from: `src/static/js/domline.js`
|
||||
Called from: src/static/js/domline.js
|
||||
|
||||
Things in context:
|
||||
|
||||
|
@ -89,7 +89,7 @@ page.
|
|||
|
||||
=== aceAttribsToClasses
|
||||
|
||||
Called from: `src/static/js/linestylefilter.js`
|
||||
Called from: src/static/js/linestylefilter.js
|
||||
|
||||
Things in context:
|
||||
|
||||
|
@ -107,7 +107,7 @@ be parsed into a valid class string.
|
|||
|
||||
=== aceAttribClasses
|
||||
|
||||
Called from: `src/static/js/linestylefilter.js`
|
||||
Called from: src/static/js/linestylefilter.js
|
||||
|
||||
Things in context:
|
||||
1. Attributes - Object of Attributes
|
||||
|
@ -127,7 +127,7 @@ exports.aceAttribClasses = function(hook_name, attr, cb){
|
|||
|
||||
=== aceGetFilterStack
|
||||
|
||||
Called from: `src/static/js/linestylefilter.js`
|
||||
Called from: src/static/js/linestylefilter.js
|
||||
|
||||
Things in context:
|
||||
|
||||
|
@ -143,7 +143,7 @@ later used by the aceCreateDomLine hook (documented above).
|
|||
|
||||
=== aceEditorCSS
|
||||
|
||||
Called from: `src/static/js/ace.js`
|
||||
Called from: src/static/js/ace.js
|
||||
|
||||
Things in context: None
|
||||
|
||||
|
@ -152,7 +152,7 @@ should be an array of resource urls or paths relative to the plugins directory.
|
|||
|
||||
=== aceInitInnerdocbodyHead
|
||||
|
||||
Called from: `src/static/js/ace.js`
|
||||
Called from: src/static/js/ace.js
|
||||
|
||||
Things in context:
|
||||
|
||||
|
@ -165,7 +165,7 @@ editor HTML document.
|
|||
|
||||
=== aceEditEvent
|
||||
|
||||
Called from: `src/static/js/ace2_inner.js`
|
||||
Called from: src/static/js/ace2_inner.js
|
||||
|
||||
Things in context:
|
||||
|
||||
|
@ -182,7 +182,7 @@ your plugin) that use the information provided by the edit event.
|
|||
|
||||
=== aceRegisterNonScrollableEditEvents
|
||||
|
||||
Called from: `src/static/js/ace2_inner.js`
|
||||
Called from: src/static/js/ace2_inner.js
|
||||
|
||||
Things in context: None
|
||||
|
||||
|
@ -203,7 +203,7 @@ exports.aceRegisterNonScrollableEditEvents = function(){
|
|||
|
||||
=== aceRegisterBlockElements
|
||||
|
||||
Called from: `src/static/js/ace2_inner.js`
|
||||
Called from: src/static/js/ace2_inner.js
|
||||
|
||||
Things in context: None
|
||||
|
||||
|
@ -213,7 +213,7 @@ call for those elements.
|
|||
|
||||
=== aceInitialized
|
||||
|
||||
Called from: `src/static/js/ace2_inner.js`
|
||||
Called from: src/static/js/ace2_inner.js
|
||||
|
||||
Things in context:
|
||||
|
||||
|
@ -228,7 +228,7 @@ use in formatting hooks.
|
|||
|
||||
=== postAceInit
|
||||
|
||||
Called from: `src/static/js/pad.js`
|
||||
Called from: src/static/js/pad.js
|
||||
|
||||
Things in context:
|
||||
|
||||
|
@ -240,7 +240,7 @@ Things in context:
|
|||
|
||||
=== postToolbarInit
|
||||
|
||||
Called from: `src/static/js/pad_editbar.js`
|
||||
Called from: src/static/js/pad_editbar.js
|
||||
|
||||
Things in context:
|
||||
|
||||
|
@ -255,14 +255,14 @@ Usage examples:
|
|||
|
||||
=== postTimesliderInit
|
||||
|
||||
Called from: `src/static/js/timeslider.js`
|
||||
Called from: src/static/js/timeslider.js
|
||||
|
||||
There doesn't appear to be any example available of this particular hook being
|
||||
used, but it gets fired after the timeslider is all set up.
|
||||
|
||||
=== goToRevisionEvent
|
||||
|
||||
Called from: `src/static/js/broadcast.js`
|
||||
Called from: src/static/js/broadcast.js
|
||||
|
||||
Things in context:
|
||||
|
||||
|
@ -274,7 +274,7 @@ be any example available of this particular hook being used.
|
|||
|
||||
=== userJoinOrUpdate
|
||||
|
||||
Called from: `src/static/js/pad_userlist.js`
|
||||
Called from: src/static/js/pad_userlist.js
|
||||
|
||||
Things in context:
|
||||
|
||||
|
|
|
@ -1,527 +0,0 @@
|
|||
# Client-side hooks
|
||||
|
||||
Most of these hooks are called during or in order to set up the formatting
|
||||
process.
|
||||
|
||||
## documentReady
|
||||
Called from: `src/templates/pad.html`
|
||||
|
||||
Things in context:
|
||||
|
||||
nothing
|
||||
|
||||
This hook proxies the functionality of jQuery's `$(document).ready` event.
|
||||
|
||||
## aceDomLinePreProcessLineAttributes
|
||||
|
||||
Called from: `src/static/js/domline.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. domline - The current DOM line being processed
|
||||
2. cls - The class of the current block element (useful for styling)
|
||||
|
||||
This hook is called for elements in the DOM that have the "lineMarkerAttribute"
|
||||
set. You can add elements into this category with the aceRegisterBlockElements
|
||||
hook above. This hook is run BEFORE the numbered and ordered lists logic is
|
||||
applied.
|
||||
|
||||
The return value of this hook should have the following structure:
|
||||
|
||||
`{ preHtml: String, postHtml: String, processedMarker: Boolean }`
|
||||
|
||||
The preHtml and postHtml values will be added to the HTML display of the
|
||||
element, and if processedMarker is true, the engine won't try to process it any
|
||||
more.
|
||||
|
||||
## aceDomLineProcessLineAttributes
|
||||
|
||||
Called from: `src/static/js/domline.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. domline - The current DOM line being processed
|
||||
2. cls - The class of the current block element (useful for styling)
|
||||
|
||||
This hook is called for elements in the DOM that have the "lineMarkerAttribute"
|
||||
set. You can add elements into this category with the aceRegisterBlockElements
|
||||
hook above. This hook is run AFTER the ordered and numbered lists logic is
|
||||
applied.
|
||||
|
||||
The return value of this hook should have the following structure:
|
||||
|
||||
`{ preHtml: String, postHtml: String, processedMarker: Boolean }`
|
||||
|
||||
The preHtml and postHtml values will be added to the HTML display of the
|
||||
element, and if processedMarker is true, the engine won't try to process it any
|
||||
more.
|
||||
|
||||
## aceCreateDomLine
|
||||
|
||||
Called from: `src/static/js/domline.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. domline - the current DOM line being processed
|
||||
2. cls - The class of the current element (useful for styling)
|
||||
|
||||
This hook is called for any line being processed by the formatting engine,
|
||||
unless the aceDomLineProcessLineAttributes hook from above returned true, in
|
||||
which case this hook is skipped.
|
||||
|
||||
The return value of this hook should have the following structure:
|
||||
|
||||
`{ extraOpenTags: String, extraCloseTags: String, cls: String }`
|
||||
|
||||
extraOpenTags and extraCloseTags will be added before and after the element in
|
||||
question, and cls will be the new class of the element going forward.
|
||||
|
||||
## acePostWriteDomLineHTML
|
||||
|
||||
Called from: `src/static/js/domline.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. node - the DOM node that just got written to the page
|
||||
|
||||
This hook is for right after a node has been fully formatted and written to the
|
||||
page.
|
||||
|
||||
## aceAttribsToClasses
|
||||
|
||||
Called from: `src/static/js/linestylefilter.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. linestylefilter - the JavaScript object that's currently processing the ace
|
||||
attributes
|
||||
2. key - the current attribute being processed
|
||||
3. value - the value of the attribute being processed
|
||||
|
||||
This hook is called during the attribute processing procedure, and should be
|
||||
used to translate key, value pairs into valid HTML classes that can be inserted
|
||||
into the DOM.
|
||||
|
||||
The return value for this function should be a list of classes, which will then
|
||||
be parsed into a valid class string.
|
||||
|
||||
## aceAttribClasses
|
||||
|
||||
Called from: `src/static/js/linestylefilter.js`
|
||||
|
||||
Things in context:
|
||||
1. Attributes - Object of Attributes
|
||||
|
||||
This hook is called when attributes are investigated on a line. It is useful if
|
||||
you want to add another attribute type or property type to a pad.
|
||||
|
||||
Example:
|
||||
```
|
||||
exports.aceAttribClasses = function(hook_name, attr, cb){
|
||||
attr.sub = 'tag:sub';
|
||||
cb(attr);
|
||||
}
|
||||
```
|
||||
|
||||
## aceGetFilterStack
|
||||
|
||||
Called from: `src/static/js/linestylefilter.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. linestylefilter - the JavaScript object that's currently processing the ace
|
||||
attributes
|
||||
2. browser - an object indicating which browser is accessing the page
|
||||
|
||||
This hook is called to apply custom regular expression filters to a set of
|
||||
styles. The one example available is the ep_linkify plugin, which adds internal
|
||||
links. They use it to find the telltale `[[ ]]` syntax that signifies internal
|
||||
links, and finding that syntax, they add in the internalHref attribute to be
|
||||
later used by the aceCreateDomLine hook (documented above).
|
||||
|
||||
## aceEditorCSS
|
||||
|
||||
Called from: `src/static/js/ace.js`
|
||||
|
||||
Things in context: None
|
||||
|
||||
This hook is provided to allow custom CSS files to be loaded. The return value
|
||||
should be an array of resource urls or paths relative to the plugins directory.
|
||||
|
||||
## aceInitInnerdocbodyHead
|
||||
|
||||
Called from: `src/static/js/ace.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. iframeHTML - the HTML of the editor iframe up to this point, in array format
|
||||
|
||||
This hook is called during the creation of the editor HTML. The array should
|
||||
have lines of HTML added to it, giving the plugin author a chance to add in
|
||||
meta, script, link, and other tags that go into the `<head>` element of the
|
||||
editor HTML document.
|
||||
|
||||
## aceEditEvent
|
||||
|
||||
Called from: `src/static/js/ace2_inner.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. callstack - a bunch of information about the current action
|
||||
2. editorInfo - information about the user who is making the change
|
||||
3. rep - information about where the change is being made
|
||||
4. documentAttributeManager - information about attributes in the document (this
|
||||
is a mystery to me)
|
||||
|
||||
This hook is made available to edit the edit events that might occur when
|
||||
changes are made. Currently you can change the editor information, some of the
|
||||
meanings of the edit, and so on. You can also make internal changes (internal to
|
||||
your plugin) that use the information provided by the edit event.
|
||||
|
||||
## aceRegisterNonScrollableEditEvents
|
||||
|
||||
Called from: `src/static/js/ace2_inner.js`
|
||||
|
||||
Things in context: None
|
||||
|
||||
When aceEditEvent (documented above) finishes processing the event, it scrolls
|
||||
the viewport to make caret visible to the user, but if you don't want that
|
||||
behavior to happen you can use this hook to register which edit events should
|
||||
not scroll viewport. The return value of this hook should be a list of event
|
||||
names.
|
||||
|
||||
Example:
|
||||
```
|
||||
exports.aceRegisterNonScrollableEditEvents = function(){
|
||||
return [ 'repaginate', 'updatePageCount' ];
|
||||
}
|
||||
```
|
||||
|
||||
## aceRegisterBlockElements
|
||||
|
||||
Called from: `src/static/js/ace2_inner.js`
|
||||
|
||||
Things in context: None
|
||||
|
||||
The return value of this hook will add elements into the "lineMarkerAttribute"
|
||||
category, making the aceDomLineProcessLineAttributes hook (documented below)
|
||||
call for those elements.
|
||||
|
||||
## aceInitialized
|
||||
|
||||
Called from: `src/static/js/ace2_inner.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. editorInfo - information about the user who will be making changes through
|
||||
the interface, and a way to insert functions into the main ace object (see
|
||||
ep_headings)
|
||||
2. rep - information about where the user's cursor is
|
||||
3. documentAttributeManager - some kind of magic
|
||||
|
||||
This hook is for inserting further information into the ace engine, for later
|
||||
use in formatting hooks.
|
||||
|
||||
## postAceInit
|
||||
|
||||
Called from: `src/static/js/pad.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. ace - the ace object that is applied to this editor.
|
||||
2. clientVars - Object containing client-side configuration such as author ID
|
||||
and plugin settings. Your plugin can manipulate this object via the
|
||||
`clientVars` server-side hook.
|
||||
3. pad - the pad object of the current pad.
|
||||
|
||||
## postToolbarInit
|
||||
|
||||
Called from: `src/static/js/pad_editbar.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. ace - the ace object that is applied to this editor.
|
||||
2. toolbar - Editbar instance. See below for the Editbar documentation.
|
||||
|
||||
Can be used to register custom actions to the toolbar.
|
||||
|
||||
Usage examples:
|
||||
|
||||
* [https://github.com/tiblu/ep_authorship_toggle]()
|
||||
|
||||
## postTimesliderInit
|
||||
|
||||
Called from: `src/static/js/timeslider.js`
|
||||
|
||||
There doesn't appear to be any example available of this particular hook being
|
||||
used, but it gets fired after the timeslider is all set up.
|
||||
|
||||
## goToRevisionEvent
|
||||
|
||||
Called from: `src/static/js/broadcast.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. rev - The newRevision
|
||||
|
||||
This hook gets fired both on timeslider load (as timeslider shows a new
|
||||
revision) and when the new revision is showed to a user. There doesn't appear to
|
||||
be any example available of this particular hook being used.
|
||||
|
||||
## userJoinOrUpdate
|
||||
|
||||
Called from: `src/static/js/pad_userlist.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. info - the user information
|
||||
|
||||
This hook is called on the client side whenever a user joins or changes. This
|
||||
can be used to create notifications or an alternate user list.
|
||||
|
||||
## `chatNewMessage`
|
||||
|
||||
Called from: `src/static/js/chat.js`
|
||||
|
||||
This hook runs on the client side whenever a chat message is received from the
|
||||
server. It can be used to create different notifications for chat messages. Hook
|
||||
functions can modify the `author`, `authorName`, `duration`, `rendered`,
|
||||
`sticky`, `text`, and `timeStr` context properties to change how the message is
|
||||
processed. The `text` and `timeStr` properties may contain HTML and come
|
||||
pre-sanitized; plugins should be careful to sanitize any added user input to
|
||||
avoid introducing an XSS vulnerability.
|
||||
|
||||
Context properties:
|
||||
|
||||
* `authorName`: The display name of the user that wrote the message.
|
||||
* `author`: The author ID of the user that wrote the message.
|
||||
* `text`: Sanitized message HTML, with URLs wrapped like `<a
|
||||
href="url">url</a>`. (Note that `message.text` is not sanitized or processed
|
||||
in any way.)
|
||||
* `message`: The raw message object as received from the server, except with
|
||||
time correction and a default `authorId` property if missing. Plugins must not
|
||||
modify this object. Warning: Unlike `text`, `message.text` is not
|
||||
pre-sanitized or processed in any way.
|
||||
* `rendered` - Used to override the default message rendering. Initially set to
|
||||
`null`. If the hook function sets this to a DOM element object or a jQuery
|
||||
object, then that object will be used as the rendered message UI. Otherwise,
|
||||
if this is set to `null`, then Etherpad will render a default UI for the
|
||||
message using the other context properties.
|
||||
* `sticky` (boolean): Whether the gritter notification should fade out on its
|
||||
own or just sit there until manually closed.
|
||||
* `timestamp`: When the chat message was sent (milliseconds since epoch),
|
||||
corrected using the difference between the local clock and the server's clock.
|
||||
* `timeStr`: The message timestamp as a formatted string.
|
||||
* `duration`: How long (in milliseconds) to display the gritter notification (0
|
||||
to disable).
|
||||
|
||||
## `chatSendMessage`
|
||||
|
||||
Called from: `src/static/js/chat.js`
|
||||
|
||||
This hook runs on the client side whenever the user sends a new chat message.
|
||||
Plugins can mutate the message object to change the message text or add metadata
|
||||
to control how the message will be rendered by the `chatNewMessage` hook.
|
||||
|
||||
Context properties:
|
||||
|
||||
* `message`: The message object that will be sent to the Etherpad server.
|
||||
|
||||
## collectContentPre
|
||||
|
||||
Called from: `src/static/js/contentcollector.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. cc - the contentcollector object
|
||||
2. state - the current state of the change being made
|
||||
3. tname - the tag name of this node currently being processed
|
||||
4. styl - the style applied to the node (probably CSS) -- Note the typo
|
||||
5. cls - the HTML class string of the node
|
||||
|
||||
This hook is called before the content of a node is collected by the usual
|
||||
methods. The cc object can be used to do a bunch of things that modify the
|
||||
content of the pad. See, for example, the heading1 plugin for etherpad original.
|
||||
|
||||
E.g. if you need to apply an attribute to newly inserted characters, call
|
||||
cc.doAttrib(state, "attributeName") which results in an attribute
|
||||
attributeName=true.
|
||||
|
||||
If you want to specify also a value, call cc.doAttrib(state,
|
||||
"attributeName::value") which results in an attribute attributeName=value.
|
||||
|
||||
|
||||
## collectContentImage
|
||||
|
||||
Called from: `src/static/js/contentcollector.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. cc - the contentcollector object
|
||||
2. state - the current state of the change being made
|
||||
3. tname - the tag name of this node currently being processed
|
||||
4. style - the style applied to the node (probably CSS)
|
||||
5. cls - the HTML class string of the node
|
||||
6. node - the node being modified
|
||||
|
||||
This hook is called before the content of an image node is collected by the
|
||||
usual methods. The cc object can be used to do a bunch of things that modify the
|
||||
content of the pad.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
exports.collectContentImage = function(name, context){
|
||||
context.state.lineAttributes.img = context.node.outerHTML;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## collectContentPost
|
||||
|
||||
Called from: `src/static/js/contentcollector.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. cc - the contentcollector object
|
||||
2. state - the current state of the change being made
|
||||
3. tname - the tag name of this node currently being processed
|
||||
4. style - the style applied to the node (probably CSS)
|
||||
5. cls - the HTML class string of the node
|
||||
|
||||
This hook is called after the content of a node is collected by the usual
|
||||
methods. The cc object can be used to do a bunch of things that modify the
|
||||
content of the pad. See, for example, the heading1 plugin for etherpad original.
|
||||
|
||||
## handleClientMessage_`name`
|
||||
|
||||
Called from: `src/static/js/collab_client.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. payload - the data that got sent with the message (use it for custom message
|
||||
content)
|
||||
|
||||
This hook gets called every time the client receives a message of type `name`.
|
||||
This can most notably be used with the new HTTP API call, "sendClientsMessage",
|
||||
which sends a custom message type to all clients connected to a pad. You can
|
||||
also use this to handle existing types.
|
||||
|
||||
`collab_client.js` has a pretty extensive list of message types, if you want to
|
||||
take a look.
|
||||
|
||||
## aceStartLineAndCharForPoint-aceEndLineAndCharForPoint
|
||||
|
||||
Called from: src/static/js/ace2_inner.js
|
||||
|
||||
Things in context:
|
||||
|
||||
1. callstack - a bunch of information about the current action
|
||||
2. editorInfo - information about the user who is making the change
|
||||
3. rep - information about where the change is being made
|
||||
4. root - the span element of the current line
|
||||
5. point - the starting/ending element where the cursor highlights
|
||||
6. documentAttributeManager - information about attributes in the document
|
||||
|
||||
This hook is provided to allow a plugin to turn DOM node selection into
|
||||
[line,char] selection. The return value should be an array of [line,char]
|
||||
|
||||
## aceKeyEvent
|
||||
|
||||
Called from: `src/static/js/ace2_inner.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. callstack - a bunch of information about the current action
|
||||
2. editorInfo - information about the user who is making the change
|
||||
3. rep - information about where the change is being made
|
||||
4. documentAttributeManager - information about attributes in the document
|
||||
5. evt - the fired event
|
||||
|
||||
This hook is provided to allow a plugin to handle key events.
|
||||
The return value should be true if you have handled the event.
|
||||
|
||||
## collectContentLineText
|
||||
|
||||
Called from: `src/static/js/contentcollector.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. cc - the contentcollector object
|
||||
2. state - the current state of the change being made
|
||||
3. tname - the tag name of this node currently being processed
|
||||
4. text - the text for that line
|
||||
|
||||
This hook allows you to validate/manipulate the text before it's sent to the
|
||||
server side. To change the text, either:
|
||||
|
||||
* Set the `text` context property to the desired value and return `undefined`.
|
||||
* (Deprecated) Return a string. If a hook function changes the `text` context
|
||||
property, the return value is ignored. If no hook function changes `text` but
|
||||
multiple hook functions return a string, the first one wins.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
exports.collectContentLineText = (hookName, context) => {
|
||||
context.text = tweakText(context.text);
|
||||
};
|
||||
```
|
||||
|
||||
## collectContentLineBreak
|
||||
|
||||
Called from: `src/static/js/contentcollector.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. cc - the contentcollector object
|
||||
2. state - the current state of the change being made
|
||||
3. tname - the tag name of this node currently being processed
|
||||
|
||||
This hook is provided to allow whether the br tag should induce a new magic
|
||||
domline or not. The return value should be either true(break the line) or false.
|
||||
|
||||
## disableAuthorColorsForThisLine
|
||||
|
||||
Called from: `src/static/js/linestylefilter.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. linestylefilter - the JavaScript object that's currently processing the ace
|
||||
attributes
|
||||
2. text - the line text
|
||||
3. class - line class
|
||||
|
||||
This hook is provided to allow whether a given line should be deliniated with
|
||||
multiple authors. Multiple authors in one line cause the creation of magic span
|
||||
lines. This might not suit you and now you can disable it and handle your own
|
||||
deliniation. The return value should be either true(disable) or false.
|
||||
|
||||
## aceSetAuthorStyle
|
||||
|
||||
Called from: `src/static/js/ace2_inner.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. dynamicCSS - css manager for inner ace
|
||||
2. outerDynamicCSS - css manager for outer ace
|
||||
3. parentDynamicCSS - css manager for parent document
|
||||
4. info - author style info
|
||||
5. author - author info
|
||||
6. authorSelector - css selector for author span in inner ace
|
||||
|
||||
This hook is provided to allow author highlight style to be modified. Registered
|
||||
hooks should return 1 if the plugin handles highlighting. If no plugin returns
|
||||
1, the core will use the default background-based highlighting.
|
||||
|
||||
## aceSelectionChanged
|
||||
|
||||
Called from: `src/static/js/ace2_inner.js`
|
||||
|
||||
Things in context:
|
||||
|
||||
1. rep - information about where the user's cursor is
|
||||
2. documentAttributeManager - information about attributes in the document
|
||||
|
||||
This hook allows a plugin to react to a cursor or selection change,
|
||||
perhaps to update a UI element based on the style at the cursor location.
|
|
@ -1,117 +0,0 @@
|
|||
# Hooks
|
||||
|
||||
A hook function is registered with a hook via the plugin's `ep.json` file. See
|
||||
the Plugins section for details. A hook may have many registered functions from
|
||||
different plugins.
|
||||
|
||||
Some hooks call their registered functions one at a time until one of them
|
||||
returns a value. Others always call all of their registered functions and
|
||||
combine the results (if applicable).
|
||||
|
||||
## Registered hook functions
|
||||
|
||||
Note: The documentation in this section applies to every hook unless the
|
||||
hook-specific documentation says otherwise.
|
||||
|
||||
### Arguments
|
||||
|
||||
Hook functions are called with three arguments:
|
||||
|
||||
1. `hookName` - The name of the hook being invoked.
|
||||
2. `context` - An object with some relevant information about the context of the
|
||||
call. See the hook-specific documentation for details.
|
||||
3. `cb` - For asynchronous operations this callback can be called to signal
|
||||
completion and optionally provide a return value. The callback takes a single
|
||||
argument, the meaning of which depends on the hook (see the "Return values"
|
||||
section for general information that applies to most hooks). This callback
|
||||
always returns `undefined`.
|
||||
|
||||
### Expected behavior
|
||||
|
||||
The presence of a callback parameter suggests that every hook function can run
|
||||
asynchronously. While that is the eventual goal, there are some legacy hooks
|
||||
that expect their hook functions to provide a value synchronously. For such
|
||||
hooks, the hook functions must do one of the following:
|
||||
|
||||
* Call the callback with a non-Promise value (`undefined` is acceptable) and
|
||||
return `undefined`, in that order.
|
||||
* Return a non-Promise value other than `undefined` (`null` is acceptable) and
|
||||
never call the callback. Note that `async` functions *always* return a
|
||||
Promise, so they must never be used for synchronous hooks.
|
||||
* Only have two parameters (`hookName` and `context`) and return any non-Promise
|
||||
value (`undefined` is acceptable).
|
||||
|
||||
For hooks that permit asynchronous behavior, the hook functions must do one or
|
||||
more of the following:
|
||||
|
||||
* Return `undefined` and call the callback, in either order.
|
||||
* Return something other than `undefined` (`null` is acceptable) and never call
|
||||
the callback. Note that `async` functions *always* return a Promise, so they
|
||||
must never call the callback.
|
||||
* Only have two parameters (`hookName` and `context`).
|
||||
|
||||
Note that the acceptable behaviors for asynchronous hook functions is a superset
|
||||
of the acceptable behaviors for synchronous hook functions.
|
||||
|
||||
WARNING: The number of parameters is determined by examining
|
||||
[Function.length](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/length),
|
||||
which does not count [default
|
||||
parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters)
|
||||
or ["rest"
|
||||
parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters).
|
||||
To avoid problems, do not use default or rest parameters when defining hook
|
||||
functions.
|
||||
|
||||
### Return values
|
||||
|
||||
A hook function can provide a value to Etherpad in one of the following ways:
|
||||
|
||||
* Pass the desired value as the first argument to the callback.
|
||||
* Return the desired value directly. The value must not be `undefined` unless
|
||||
the hook function only has two parameters. (Hook functions with three
|
||||
parameters that want to provide `undefined` should instead use the callback.)
|
||||
* For hooks that permit asynchronous behavior, return a Promise that resolves to
|
||||
the desired value.
|
||||
* For hooks that permit asynchronous behavior, pass a Promise that resolves to
|
||||
the desired value as the first argument to the callback.
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
exports.exampleOne = (hookName, context, callback) => {
|
||||
return 'valueOne';
|
||||
};
|
||||
|
||||
exports.exampleTwo = (hookName, context, callback) => {
|
||||
callback('valueTwo');
|
||||
return;
|
||||
};
|
||||
|
||||
// ONLY FOR HOOKS THAT PERMIT ASYNCHRONOUS BEHAVIOR
|
||||
exports.exampleThree = (hookName, context, callback) => {
|
||||
return new Promise('valueThree');
|
||||
};
|
||||
|
||||
// ONLY FOR HOOKS THAT PERMIT ASYNCHRONOUS BEHAVIOR
|
||||
exports.exampleFour = (hookName, context, callback) => {
|
||||
callback(new Promise('valueFour'));
|
||||
return;
|
||||
};
|
||||
|
||||
// ONLY FOR HOOKS THAT PERMIT ASYNCHRONOUS BEHAVIOR
|
||||
exports.exampleFive = async (hookName, context) => {
|
||||
// Note that this function is async, so it actually returns a Promise that
|
||||
// is resolved to 'valueFive'.
|
||||
return 'valueFive';
|
||||
};
|
||||
```
|
||||
|
||||
Etherpad collects the values provided by the hook functions into an array,
|
||||
filters out all `undefined` values, then flattens the array one level.
|
||||
Flattening one level makes it possible for a hook function to behave as if it
|
||||
were multiple separate hook functions.
|
||||
|
||||
For example: Suppose a hook has eight registered functions that return the
|
||||
following values: `1`, `[2]`, `['3a', '3b']` `[[4]]`, `undefined`,
|
||||
`[undefined]`, `[]`, and `null`. The value returned to the caller of the hook is
|
||||
`[1, 2, '3a', '3b', [4], undefined, null]`.
|
|
@ -2,7 +2,7 @@
|
|||
These hooks are called on server-side.
|
||||
|
||||
=== loadSettings
|
||||
Called from: `src/node/server.ts`
|
||||
Called from: src/node/server.ts
|
||||
|
||||
Things in context:
|
||||
|
||||
|
@ -11,7 +11,7 @@ Things in context:
|
|||
Use this hook to receive the global settings in your plugin.
|
||||
|
||||
=== shutdown
|
||||
Called from: `src/node/server.ts`
|
||||
Called from: src/node/server.ts
|
||||
|
||||
Things in context: None
|
||||
|
||||
|
@ -34,7 +34,7 @@ exports.shutdown = async (hookName, context) => {
|
|||
----
|
||||
|
||||
=== pluginUninstall
|
||||
Called from: `src/static/js/pluginfw/installer.js`
|
||||
Called from: src/static/js/pluginfw/installer.js
|
||||
|
||||
Things in context:
|
||||
|
||||
|
@ -43,7 +43,7 @@ Things in context:
|
|||
If this hook returns an error, the callback to the uninstall function gets an error as well. This mostly seems useful for handling additional features added in based on the installation of other plugins, which is pretty cool!
|
||||
|
||||
=== pluginInstall
|
||||
Called from: `src/static/js/pluginfw/installer.js`
|
||||
Called from: src/static/js/pluginfw/installer.js
|
||||
|
||||
Things in context:
|
||||
|
||||
|
@ -123,7 +123,7 @@ Context properties:
|
|||
|
||||
=== expressCloseServer
|
||||
|
||||
Called from: `src/node/hooks/express.js`
|
||||
Called from: src/node/hooks/express.js
|
||||
|
||||
Things in context: Nothing
|
||||
|
||||
|
@ -142,7 +142,7 @@ exports.expressCloseServer = async () => {
|
|||
----
|
||||
|
||||
=== eejsBlock_`<name>`
|
||||
Called from: `src/node/eejs/index.js`
|
||||
Called from: src/node/eejs/index.js
|
||||
|
||||
Things in context:
|
||||
|
||||
|
|
|
@ -1,728 +0,0 @@
|
|||
# HTTP API
|
||||
|
||||
## What can I do with this API?
|
||||
|
||||
The API gives another web application control of the pads. The basic functions are
|
||||
|
||||
* create/delete pads
|
||||
* grant/forbid access to pads
|
||||
* get/set pad content
|
||||
|
||||
The API is designed in a way, so you can reuse your existing user system with their permissions, and map it to Etherpad. Means: Your web application still has to do authentication, but you can tell Etherpad via the api, which visitors should get which permissions. This allows Etherpad to fit into any web application and extend it with real-time functionality. You can embed the pads via an iframe into your website.
|
||||
|
||||
Take a look at [HTTP API client libraries](https://github.com/ether/etherpad-lite/wiki/HTTP-API-client-libraries) to check if a library in your favorite programming language is available.
|
||||
|
||||
### OpenAPI
|
||||
|
||||
OpenAPI (formerly swagger) definitions are exposed under `/api/openapi.json` (latest) and `/api/{version}/openapi.json`. You can use official tools like [Swagger Editor](https://editor.swagger.io/) to view and explore them.
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1
|
||||
|
||||
A portal (such as WordPress) wants to give a user access to a new pad. Let's assume the user have the internal id 7 and his name is michael.
|
||||
|
||||
Portal maps the internal userid to an etherpad author.
|
||||
|
||||
|
||||
#### Request
|
||||
|
||||
```http
|
||||
GET /api/1/createAuthorIfNotExistsFor?name=Michael&authorMapper=7
|
||||
```
|
||||
|
||||
|
||||
### Response
|
||||
|
||||
```json
|
||||
{"code": 0, "message":"ok", "data": {"authorID": "a.s8oes9dhwrvt0zif"}}
|
||||
```
|
||||
|
||||
#### Request
|
||||
> Portal maps the internal userid to an etherpad group:
|
||||
|
||||
```http
|
||||
GET http://pad.domain/api/1/createGroupIfNotExistsFor?groupMapper=7
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```json
|
||||
{"code": 0, "message":"ok", "data": {"groupID": "g.s8oes9dhwrvt0zif"}}
|
||||
```
|
||||
|
||||
> Portal creates a pad in the userGroup
|
||||
|
||||
#### Request
|
||||
|
||||
```http
|
||||
GET http://pad.domain/api/1/createGroupPad?groupID=g.s8oes9dhwrvt0zif&padName=samplePad&text=This is the first sentence in the pad
|
||||
```
|
||||
|
||||
#### Response
|
||||
|
||||
```json
|
||||
{"code": 0, "message":"ok", "data": null}
|
||||
```
|
||||
|
||||
> Portal starts the session for the user on the group:
|
||||
|
||||
#### Request
|
||||
|
||||
```http
|
||||
GET http://pad.domain/api/1/createSession?groupID=g.s8oes9dhwrvt0zif&authorID=a.s8oes9dhwrvt0zif&validUntil=1312201246
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```json
|
||||
{"code": 0, "message":"ok", "data": {"sessionID": "s.s8oes9dhwrvt0zif"}}
|
||||
```
|
||||
|
||||
Portal places the cookie "sessionID" with the given value on the client and creates an iframe including the pad.
|
||||
|
||||
### Example 2
|
||||
|
||||
A portal (such as WordPress) wants to transform the contents of a pad that multiple admins edited into a blog post.
|
||||
|
||||
Portal retrieves the contents of the pad for entry into the db as a blog post:
|
||||
|
||||
> Request: `http://pad.domain/api/1/getText?&padID=g.s8oes9dhwrvt0zif$123`
|
||||
>
|
||||
> Response: `{code: 0, message:"ok", data: {text:"Welcome Text"}}`
|
||||
|
||||
Portal submits content into new blog post
|
||||
|
||||
> Portal.AddNewBlog(content)
|
||||
|
||||
## Usage
|
||||
|
||||
### API version
|
||||
The latest version is `1.2.15`
|
||||
|
||||
The current version can be queried via /api.
|
||||
|
||||
### Request Format
|
||||
|
||||
The API is accessible via HTTP. Starting from **1.8**, API endpoints can be invoked indifferently via GET or POST.
|
||||
|
||||
The URL of the HTTP request is of the form: `/api/$APIVERSION/$FUNCTIONNAME`. $APIVERSION depends on the endpoint you want to use. Depending on the verb you use (GET or POST) **parameters** can be passed differently.
|
||||
|
||||
When invoking via GET (mandatory until **1.7.5** included), parameters must be included in the query string (example: `/api/$APIVERSION/$FUNCTIONNAME?param1=value1`). Please note that starting with nodejs 8.14+ the total size of HTTP request headers has been capped to 8192 bytes. This limits the quantity of data that can be sent in an API request.
|
||||
|
||||
Starting from Etherpad **1.8** it is also possible to invoke the HTTP API via POST. In this case, querystring parameters will still be accepted, but **any parameter with the same name sent via POST will take precedence**. If you need to send large chunks of text (for example, for `setText()`) it is advisable to invoke via POST.
|
||||
|
||||
Example with cURL using GET (toy example, no encoding):
|
||||
```
|
||||
curl "http://pad.domain/api/1/setText?padID=padname&text=this_text_will_NOT_be_encoded_by_curl_use_next_example"
|
||||
```
|
||||
|
||||
Example with cURL using GET (better example, encodes text):
|
||||
```
|
||||
curl "http://pad.domain/api/1/setText?padID=padname" --get --data-urlencode "text=Text sent via GET with proper encoding. For big documents, please use POST"
|
||||
```
|
||||
|
||||
Example with cURL using POST:
|
||||
```
|
||||
curl "http://pad.domain/api/1/setText?padID=padname" --data-urlencode "text=Text sent via POST with proper encoding. For big texts (>8 KB), use this method"
|
||||
```
|
||||
|
||||
### Response Format
|
||||
Responses are valid JSON in the following format:
|
||||
|
||||
```json
|
||||
{
|
||||
"code": number,
|
||||
"message": string,
|
||||
"data": obj
|
||||
}
|
||||
```
|
||||
|
||||
* **code** a return code
|
||||
* **0** everything ok
|
||||
* **1** wrong parameters
|
||||
* **2** internal error
|
||||
* **3** no such function
|
||||
* **4** no or wrong API Key
|
||||
* **message** a status message. It's ok if everything is fine, else it contains an error message
|
||||
* **data** the payload
|
||||
|
||||
### Overview
|
||||
|
||||

|
||||
|
||||
## Data Types
|
||||
|
||||
* **groupID** a string, the unique id of a group. Format is g.16RANDOMCHARS, for example g.s8oes9dhwrvt0zif
|
||||
* **sessionID** a string, the unique id of a session. Format is s.16RANDOMCHARS, for example s.s8oes9dhwrvt0zif
|
||||
* **authorID** a string, the unique id of an author. Format is a.16RANDOMCHARS, for example a.s8oes9dhwrvt0zif
|
||||
* **readOnlyID** a string, the unique id of a readonly relation to a pad. Format is r.16RANDOMCHARS, for example r.s8oes9dhwrvt0zif
|
||||
* **padID** a string, format is GROUPID$PADNAME, for example the pad test of group g.s8oes9dhwrvt0zif has padID g.s8oes9dhwrvt0zif$test
|
||||
|
||||
### Authentication
|
||||
|
||||
Authentication works via an OAuth token that is sent with each request as an Authorization header, i.e. `Authorization: Bearer YOUR_TOKEN`. You can add new clients that can sign in via the API by adding new entries to the sso section in the settings.json.
|
||||
|
||||
|
||||
#### Example for browser login clients
|
||||
|
||||
This example illustrates how to add a new client that can sign in via the API using the browser login method. This method is used for users trying to sign in to the API via the browser. You can log in with the users in the settings.json file. The redirect URI is the URL where the user is redirected after the login. This is normally your etherpad instance url.
|
||||
|
||||
```json
|
||||
{
|
||||
"client_id": "admin_client",
|
||||
"client_secret": "admin",
|
||||
"grant_types": ["authorization_code"],
|
||||
"response_types": ["code"],
|
||||
"redirect_uris": ["http://my-etherpad-instance.com"],
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### Example for services
|
||||
|
||||
This example illustrates how to add a new client that can sign in via the API using the client credentials method. This method is used for services trying to sign in to the API where there is no browser.
|
||||
E.g. a service that creates a pad for a user or a service that inserts a text into a pad. Just make sure that the secret is complex enough as anybody who knows the secret can access the API.
|
||||
|
||||
```json
|
||||
{
|
||||
"client_id": "client_credentials",
|
||||
"redirect_uris": [],
|
||||
"response_types": [],
|
||||
"grant_types": ["code"],
|
||||
"client_secret": "client_credentials",
|
||||
"extraParams": [
|
||||
{
|
||||
"name": "admin",
|
||||
"value": "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Obtain a Bearer token:
|
||||
|
||||
`curl --request POST --url 'https://your.server.tld/oidc/token' --header 'content-type: application/x-www-form-urlencoded' --data grant_type=client_credentials --data client_id=client_credentials --data client_secret=client_credentials`
|
||||
|
||||
|
||||
### Node Interoperability
|
||||
|
||||
All functions will also be available through a node module accessible from other node.js applications.
|
||||
|
||||
## API Methods
|
||||
|
||||
### Groups
|
||||
Pads can belong to a group. The padID of grouppads is starting with a groupID like `g.asdfasdfasdfasdf$test`
|
||||
|
||||
#### createGroup()
|
||||
* API >= 1
|
||||
|
||||
creates a new group
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {groupID: g.s8oes9dhwrvt0zif}}`
|
||||
|
||||
#### createGroupIfNotExistsFor(groupMapper)
|
||||
* API >= 1
|
||||
|
||||
this functions helps you to map your application group ids to Etherpad group ids
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {groupID: g.s8oes9dhwrvt0zif}}`
|
||||
|
||||
#### deleteGroup(groupID)
|
||||
* API >= 1
|
||||
|
||||
deletes a group
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: null}`
|
||||
* `{code: 1, message:"groupID does not exist", data: null}`
|
||||
|
||||
#### listPads(groupID)
|
||||
* API >= 1
|
||||
|
||||
returns all pads of this group
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {padIDs : ["g.s8oes9dhwrvt0zif$test", "g.s8oes9dhwrvt0zif$test2"]}`
|
||||
* `{code: 1, message:"groupID does not exist", data: null}`
|
||||
|
||||
#### createGroupPad(groupID, padName, [text], [authorId])
|
||||
* API >= 1
|
||||
* `authorId` in API >= 1.3.0
|
||||
|
||||
creates a new pad in this group
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {padID: "g.s8oes9dhwrvt0zif$test"}`
|
||||
* `{code: 1, message:"padName does already exist", data: null}`
|
||||
* `{code: 1, message:"groupID does not exist", data: null}`
|
||||
|
||||
#### listAllGroups()
|
||||
* API >= 1.1
|
||||
|
||||
lists all existing groups
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {groupIDs: ["g.mKjkmnAbSMtCt8eL", "g.3ADWx6sbGuAiUmCy"]}}`
|
||||
* `{code: 0, message:"ok", data: {groupIDs: []}}`
|
||||
|
||||
### Author
|
||||
These authors are bound to the attributes the users choose (color and name).
|
||||
|
||||
#### createAuthor([name])
|
||||
* API >= 1
|
||||
|
||||
creates a new author
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {authorID: "a.s8oes9dhwrvt0zif"}}`
|
||||
|
||||
#### createAuthorIfNotExistsFor(authorMapper [, name])
|
||||
* API >= 1
|
||||
|
||||
this functions helps you to map your application author ids to Etherpad author ids
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {authorID: "a.s8oes9dhwrvt0zif"}}`
|
||||
|
||||
#### listPadsOfAuthor(authorID)
|
||||
* API >= 1
|
||||
|
||||
returns an array of all pads this author contributed to
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {padIDs: ["g.s8oes9dhwrvt0zif$test", "g.s8oejklhwrvt0zif$foo"]}}`
|
||||
* `{code: 1, message:"authorID does not exist", data: null}`
|
||||
|
||||
#### getAuthorName(authorID)
|
||||
* API >= 1.1
|
||||
|
||||
Returns the Author Name of the author
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {authorName: "John McLear"}}`
|
||||
|
||||
-> can't be deleted cause this would involve scanning all the pads where this author was
|
||||
|
||||
### Session
|
||||
Sessions can be created between a group and an author. This allows an author to access more than one group. The sessionID will be set as a cookie to the client and is valid until a certain date. The session cookie can also contain multiple comma-separated sessionIDs, allowing a user to edit pads in different groups at the same time. Only users with a valid session for this group, can access group pads. You can create a session after you authenticated the user at your web application, to give them access to the pads. You should save the sessionID of this session and delete it after the user logged out.
|
||||
|
||||
#### createSession(groupID, authorID, validUntil)
|
||||
* API >= 1
|
||||
|
||||
creates a new session. validUntil is an unix timestamp in seconds
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {sessionID: "s.s8oes9dhwrvt0zif"}}`
|
||||
* `{code: 1, message:"groupID doesn't exist", data: null}`
|
||||
* `{code: 1, message:"authorID doesn't exist", data: null}`
|
||||
* `{code: 1, message:"validUntil is in the past", data: null}`
|
||||
|
||||
|
||||
#### deleteSession(sessionID)
|
||||
* API >= 1
|
||||
|
||||
deletes a session
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: null}`
|
||||
* `{code: 1, message:"sessionID does not exist", data: null}`
|
||||
|
||||
#### getSessionInfo(sessionID)
|
||||
* API >= 1
|
||||
|
||||
returns information about a session
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {authorID: "a.s8oes9dhwrvt0zif", groupID: g.s8oes9dhwrvt0zif, validUntil: 1312201246}}`
|
||||
* `{code: 1, message:"sessionID does not exist", data: null}`
|
||||
|
||||
#### listSessionsOfGroup(groupID)
|
||||
* API >= 1
|
||||
|
||||
returns all sessions of a group
|
||||
|
||||
*Example returns:*
|
||||
* `{"code":0,"message":"ok","data":{"s.oxf2ras6lvhv2132":{"groupID":"g.s8oes9dhwrvt0zif","authorID":"a.akf8finncvomlqva","validUntil":2312905480}}}`
|
||||
* `{code: 1, message:"groupID does not exist", data: null}`
|
||||
|
||||
#### listSessionsOfAuthor(authorID)
|
||||
* API >= 1
|
||||
|
||||
returns all sessions of an author
|
||||
|
||||
*Example returns:*
|
||||
* `{"code":0,"message":"ok","data":{"s.oxf2ras6lvhv2132":{"groupID":"g.s8oes9dhwrvt0zif","authorID":"a.akf8finncvomlqva","validUntil":2312905480}}}`
|
||||
* `{code: 1, message:"authorID does not exist", data: null}`
|
||||
|
||||
### Pad Content
|
||||
|
||||
Pad content can be updated and retrieved through the API
|
||||
|
||||
#### getText(padID, [rev])
|
||||
* API >= 1
|
||||
|
||||
returns the text of a pad
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {text:"Welcome Text"}}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
|
||||
#### setText(padID, text, [authorId])
|
||||
* API >= 1
|
||||
* `authorId` in API >= 1.3.0
|
||||
|
||||
Sets the text of a pad.
|
||||
|
||||
If your text is long (>8 KB), please invoke via POST and include `text` parameter in the body of the request, not in the URL (since Etherpad **1.8**).
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: null}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
* `{code: 1, message:"text too long", data: null}`
|
||||
|
||||
#### appendText(padID, text, [authorId])
|
||||
* API >= 1.2.13
|
||||
* `authorId` in API >= 1.3.0
|
||||
|
||||
|
||||
Appends text to a pad.
|
||||
|
||||
If your text is long (>8 KB), please invoke via POST and include `text` parameter in the body of the request, not in the URL (since Etherpad **1.8**).
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: null}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
* `{code: 1, message:"text too long", data: null}`
|
||||
|
||||
#### getHTML(padID, [rev])
|
||||
* API >= 1
|
||||
|
||||
returns the text of a pad formatted as HTML
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {html:"Welcome Text<br>More Text"}}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
|
||||
#### setHTML(padID, html, [authorId])
|
||||
* API >= 1
|
||||
* `authorId` in API >= 1.3.0
|
||||
|
||||
sets the text of a pad based on HTML, HTML must be well-formed. Malformed HTML will send a warning to the API log.
|
||||
|
||||
If `html` is long (>8 KB), please invoke via POST and include `html` parameter in the body of the request, not in the URL (since Etherpad **1.8**).
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: null}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
|
||||
#### getAttributePool(padID)
|
||||
* API >= 1.2.8
|
||||
|
||||
returns the attribute pool of a pad
|
||||
|
||||
*Example returns:*
|
||||
* `{ "code":0,
|
||||
"message":"ok",
|
||||
"data": {
|
||||
"pool":{
|
||||
"numToAttrib":{
|
||||
"0":["author","a.X4m8bBWJBZJnWGSh"],
|
||||
"1":["author","a.TotfBPzov54ihMdH"],
|
||||
"2":["author","a.StiblqrzgeNTbK05"],
|
||||
"3":["bold","true"]
|
||||
},
|
||||
"attribToNum":{
|
||||
"author,a.X4m8bBWJBZJnWGSh":0,
|
||||
"author,a.TotfBPzov54ihMdH":1,
|
||||
"author,a.StiblqrzgeNTbK05":2,
|
||||
"bold,true":3
|
||||
},
|
||||
"nextNum":4
|
||||
}
|
||||
}
|
||||
}`
|
||||
* `{"code":1,"message":"padID does not exist","data":null}`
|
||||
|
||||
#### getRevisionChangeset(padID, [rev])
|
||||
* API >= 1.2.8
|
||||
|
||||
get the changeset at a given revision, or last revision if 'rev' is not defined.
|
||||
|
||||
*Example returns:*
|
||||
* `{ "code" : 0,
|
||||
"message" : "ok",
|
||||
"data" : "Z:1>6b|5+6b$Welcome to Etherpad!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n\nGet involved with Etherpad at https://etherpad.org\n"
|
||||
}`
|
||||
* `{"code":1,"message":"padID does not exist","data":null}`
|
||||
* `{"code":1,"message":"rev is higher than the head revision of the pad","data":null}`
|
||||
|
||||
#### createDiffHTML(padID, startRev, endRev)
|
||||
* API >= 1.2.7
|
||||
|
||||
returns an object of diffs from 2 points in a pad
|
||||
|
||||
*Example returns:*
|
||||
* `{"code":0,"message":"ok","data":{"html":"<style>\n.authora_HKIv23mEbachFYfH {background-color: #a979d9}\n.authora_n4gEeMLsv1GivNeh {background-color: #a9b5d9}\n.removed {text-decoration: line-through; -ms-filter:'progid:DXImageTransform.Microsoft.Alpha(Opacity=80)'; filter: alpha(opacity=80); opacity: 0.8; }\n</style>Welcome to Etherpad!<br><br>This pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!<br><br>Get involved with Etherpad at <a href=\"http://etherpad.org\">http://etherpad.org</a><br><span class=\"authora_HKIv23mEbachFYfH\">aw</span><br><br>","authors":["a.HKIv23mEbachFYfH",""]}}`
|
||||
* `{"code":4,"message":"no or wrong API Key","data":null}`
|
||||
|
||||
#### restoreRevision(padId, rev, [authorId])
|
||||
* API >= 1.2.11
|
||||
* `authorId` in API >= 1.3.0
|
||||
|
||||
* Example returns:*
|
||||
* `{code:0, message:"ok", data:null}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
|
||||
### Chat
|
||||
#### getChatHistory(padID, [start, end])
|
||||
* API >= 1.2.7
|
||||
|
||||
returns
|
||||
|
||||
* a part of the chat history, when `start` and `end` are given
|
||||
* the whole chat history, when no extra parameters are given
|
||||
|
||||
|
||||
*Example returns:*
|
||||
|
||||
* `{"code":0,"message":"ok","data":{"messages":[{"text":"foo","userId":"a.foo","time":1359199533759,"userName":"test"},{"text":"bar","userId":"a.foo","time":1359199534622,"userName":"test"}]}}`
|
||||
* `{code: 1, message:"start is higher or equal to the current chatHead", data: null}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
|
||||
#### getChatHead(padID)
|
||||
* API >= 1.2.7
|
||||
|
||||
returns the chatHead (last number of the last chat-message) of the pad
|
||||
|
||||
|
||||
*Example returns:*
|
||||
|
||||
* `{code: 0, message:"ok", data: {chatHead: 42}}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
|
||||
#### appendChatMessage(padID, text, authorID [, time])
|
||||
* API >= 1.2.12
|
||||
|
||||
creates a chat message, saves it to the database and sends it to all connected clients of this pad
|
||||
|
||||
*Example returns:*
|
||||
|
||||
* `{code: 0, message:"ok", data: null}`
|
||||
* `{code: 1, message:"text is no string", data: null}`
|
||||
|
||||
### Pad
|
||||
Group pads are normal pads, but with the name schema GROUPID$PADNAME. A security manager controls access of them and it's forbidden for normal pads to include a $ in the name.
|
||||
|
||||
#### createPad(padID, [text], [authorId])
|
||||
* API >= 1
|
||||
* `authorId` in API >= 1.3.0
|
||||
|
||||
creates a new (non-group) pad. Note that if you need to create a group Pad, you should call **createGroupPad**.
|
||||
You get an error message if you use one of the following characters in the padID: "/", "?", "&" or "#".
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: null}`
|
||||
* `{code: 1, message:"padID does already exist", data: null}`
|
||||
* `{code: 1, message:"malformed padID: Remove special characters", data: null}`
|
||||
|
||||
#### getRevisionsCount(padID)
|
||||
* API >= 1
|
||||
|
||||
returns the number of revisions of this pad
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {revisions: 56}}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
|
||||
#### getSavedRevisionsCount(padID)
|
||||
* API >= 1.2.11
|
||||
|
||||
returns the number of saved revisions of this pad
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {savedRevisions: 42}}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
|
||||
#### listSavedRevisions(padID)
|
||||
* API >= 1.2.11
|
||||
|
||||
returns the list of saved revisions of this pad
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {savedRevisions: [2, 42, 1337]}}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
|
||||
#### saveRevision(padID [, rev])
|
||||
* API >= 1.2.11
|
||||
|
||||
saves a revision
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: null}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
|
||||
#### padUsersCount(padID)
|
||||
* API >= 1
|
||||
|
||||
returns the number of user that are currently editing this pad
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {padUsersCount: 5}}`
|
||||
|
||||
#### padUsers(padID)
|
||||
* API >= 1.1
|
||||
|
||||
returns the list of users that are currently editing this pad
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {padUsers: [{colorId:"#c1a9d9","name":"username1","timestamp":1345228793126,"id":"a.n4gEeMLsvg12452n"},{"colorId":"#d9a9cd","name":"Hmmm","timestamp":1345228796042,"id":"a.n4gEeMLsvg12452n"}]}}`
|
||||
* `{code: 0, message:"ok", data: {padUsers: []}}`
|
||||
|
||||
#### deletePad(padID)
|
||||
* API >= 1
|
||||
|
||||
deletes a pad
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: null}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
|
||||
#### copyPad(sourceID, destinationID[, force=false])
|
||||
* API >= 1.2.8
|
||||
|
||||
copies a pad with full history and chat. If force is true and the destination pad exists, it will be overwritten.
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: null}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
|
||||
#### copyPadWithoutHistory(sourceID, destinationID, [force=false], [authorId])
|
||||
* API >= 1.2.15
|
||||
* `authorId` in API >= 1.3.0
|
||||
|
||||
copies a pad without copying the history and chat. If force is true and the destination pad exists, it will be overwritten.
|
||||
Note that all the revisions will be lost! In most of the cases one should use `copyPad` API instead.
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: null}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
|
||||
#### movePad(sourceID, destinationID[, force=false])
|
||||
* API >= 1.2.8
|
||||
|
||||
moves a pad. If force is true and the destination pad exists, it will be overwritten.
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: null}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
|
||||
#### getReadOnlyID(padID)
|
||||
* API >= 1
|
||||
|
||||
returns the read only link of a pad
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {readOnlyID: "r.s8oes9dhwrvt0zif"}}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
|
||||
#### getPadID(readOnlyID)
|
||||
* API >= 1.2.10
|
||||
|
||||
returns the id of a pad which is assigned to the readOnlyID
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {padID: "p.s8oes9dhwrvt0zif"}}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
|
||||
#### setPublicStatus(padID, publicStatus)
|
||||
* API >= 1
|
||||
|
||||
sets a boolean for the public status of a group pad
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: null}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
* `{code: 1, message:"You can only get/set the publicStatus of pads that belong to a group", data: null}`
|
||||
|
||||
#### getPublicStatus(padID)
|
||||
* API >= 1
|
||||
|
||||
return true of false
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {publicStatus: true}}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
* `{code: 1, message:"You can only get/set the publicStatus of pads that belong to a group", data: null}`
|
||||
|
||||
#### listAuthorsOfPad(padID)
|
||||
* API >= 1
|
||||
|
||||
returns an array of authors who contributed to this pad
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {authorIDs : ["a.s8oes9dhwrvt0zif", "a.akf8finncvomlqva"]}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
|
||||
#### getLastEdited(padID)
|
||||
* API >= 1
|
||||
|
||||
returns the timestamp of the last revision of the pad
|
||||
|
||||
*Example returns:*
|
||||
* `{code: 0, message:"ok", data: {lastEdited: 1340815946602}}`
|
||||
* `{code: 1, message:"padID does not exist", data: null}`
|
||||
|
||||
#### sendClientsMessage(padID, msg)
|
||||
* API >= 1.1
|
||||
|
||||
sends a custom message of type `msg` to the pad
|
||||
|
||||
*Example returns:*
|
||||
```json
|
||||
{"code": 0, "message":"ok", "data": {}}
|
||||
```
|
||||
|
||||
```json
|
||||
{"code": 1, "message":"padID does not exist", "data": null}
|
||||
```
|
||||
|
||||
#### checkToken()
|
||||
* API >= 1.2
|
||||
|
||||
returns ok when the current api token is valid
|
||||
|
||||
*Example returns:*
|
||||
```json
|
||||
{"code":0,"message":"ok","data":null}
|
||||
```
|
||||
```json
|
||||
{"code":4,"message":"no or wrong API Key","data":null}
|
||||
```
|
||||
|
||||
### Pads
|
||||
|
||||
#### listAllPads()
|
||||
* API >= 1.2.1
|
||||
|
||||
lists all pads on this epl instance
|
||||
|
||||
*Example returns:*
|
||||
```json
|
||||
{"code": 0, "message":"ok", "data": {"padIDs": ["testPad", "thePadsOfTheOthers"]}}
|
||||
```
|
||||
|
||||
### Global
|
||||
|
||||
#### getStats()
|
||||
* API >= 1.2.14
|
||||
|
||||
get stats of the etherpad instance
|
||||
|
||||
*Example returns*
|
||||
```json
|
||||
{"code":0,"message":"ok","data":{"totalPads":3,"totalSessions": 2,"totalActivePads": 1}}
|
||||
```
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
# API documentation
|
||||
|
||||
This part of the documentation is about the API of Etherpad. It is intended for developers who want to write applications that interact with Etherpad instances or plugins.
|
|
@ -1,22 +0,0 @@
|
|||
# Plugin Framework
|
||||
|
||||
`require("ep_etherpad-lite/static/js/plugingfw/plugins")`
|
||||
|
||||
## plugins.update
|
||||
|
||||
`require("ep_etherpad-lite/static/js/plugingfw/plugins").update()` will use npm
|
||||
to list all installed modules and read their ep.json files, registering the
|
||||
contained hooks. A hook registration is a pair of a hook name and a function
|
||||
reference (filename for require() plus function name)
|
||||
|
||||
## hooks.callAll
|
||||
|
||||
`require("ep_etherpad-lite/static/js/plugingfw/hooks").callAll("hook_name",
|
||||
{argname:value})` will call all hook functions registered for `hook_name` with
|
||||
`{argname:value}`.
|
||||
|
||||
## hooks.aCallAll
|
||||
|
||||
?
|
||||
|
||||
## ...
|
|
@ -1,46 +0,0 @@
|
|||
# Toolbar controller
|
||||
src/node/utils/toolbar.js
|
||||
|
||||
## button(opts)
|
||||
* {Object} `opts`
|
||||
* `command` - this command fill be fired on the editbar on click
|
||||
* `localizationId` - will be set as `data-l10-id`
|
||||
* `class` - here you can add additional classes to the button
|
||||
|
||||
Returns: {Button}
|
||||
|
||||
Example:
|
||||
```
|
||||
var orderedlist = toolbar.button({
|
||||
command: "insertorderedlist",
|
||||
localizationId: "pad.toolbar.ol.title",
|
||||
class: "buttonicon buttonicon-insertorderedlist"
|
||||
})
|
||||
```
|
||||
|
||||
You can also create buttons with text:
|
||||
|
||||
```
|
||||
var myButton = toolbar.button({
|
||||
command: "myButton",
|
||||
localizationId: "myPlugin.toolbar.myButton",
|
||||
class: "buttontext"
|
||||
})
|
||||
```
|
||||
|
||||
## selectButton(opts)
|
||||
* {Object} `opts`
|
||||
* `id` - id of the menu item
|
||||
* `selectId` - id of the select element
|
||||
* `command` - this command fill be fired on the editbar on change
|
||||
|
||||
Returns: {SelectButton}
|
||||
|
||||
## SelectButton.addOption(value, text, attributes)
|
||||
* {String} value - The value of this option
|
||||
* {String} text - the label text used for this option
|
||||
* {Object} attributes - any additional html attributes go here (e.g. `data-l10n-id`)
|
||||
|
||||
## registerButton(name, item)
|
||||
* {String} name - used to reference the item in the toolbar config in settings.json
|
||||
* {Button|SelectButton} item - the button to add
|
29
doc/cli.md
|
@ -1,29 +0,0 @@
|
|||
# CLI
|
||||
|
||||
You can find different tools for migrating things, checking your Etherpad health in the bin directory.
|
||||
One of these is the migrateDB command. It takes two settings.json files and copies data from one source to another one.
|
||||
In this example we migrate from the old dirty db to the new rustydb engine. So we copy these files to the root of the etherpad-directory.
|
||||
|
||||
````json
|
||||
{
|
||||
"dbType": "dirty",
|
||||
"dbSettings": {
|
||||
"filename": "./var/rusty.db"
|
||||
}
|
||||
}
|
||||
````
|
||||
|
||||
|
||||
|
||||
````json
|
||||
{
|
||||
"dbType": "rustydb",
|
||||
"dbSettings": {
|
||||
"filename": "./var/rusty2.db"
|
||||
}
|
||||
}
|
||||
````
|
||||
|
||||
|
||||
After that we need to move the data from dirty to rustydb.
|
||||
Therefore, we call `pnpm run migrateDB --file1 test1.json --file2 test2.json` with these two files in our root directories. After some time the data should be copied over to the new database.
|
|
@ -1,18 +0,0 @@
|
|||
# Cookies
|
||||
|
||||
Cookies used by Etherpad.
|
||||
|
||||
| Name | Sample value | Domain | Path | Expires/max-age | Http-only | Secure | Usage description |
|
||||
|-------------------|----------------------------------|-------------|------|-----------------|-----------|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| express_sid | s%3A7yCNjRmTW8ylGQ53I2IhOwYF9... | example.org | / | Session | true | true | Session ID of the [Express web framework](https://expressjs.com). When Etherpad is behind a reverse proxy, and an administrator wants to use session stickiness, he may use this cookie. If you are behind a reverse proxy, please remember to set `trustProxy: true` in `settings.json`. Set in [webaccess.js#L131](https://github.com/ether/etherpad-lite/blob/01497aa399690e44393e91c19917d11d025df71b/src/node/hooks/express/webaccess.js#L131). |
|
||||
| language | en | example.org | / | Session | false | true | The language of the UI (e.g.: `en-GB`, `it`). Set in [pad_editor.js#L111](https://github.com/ether/etherpad-lite/blob/01497aa399690e44393e91c19917d11d025df71b/src/static/js/pad_editor.js#L111). |
|
||||
| prefs / prefsHttp | %7B%22epThemesExtTheme%22... | example.org | /p | year 3000 | false | true | Client-side preferences (e.g.: font family, chat always visible, show authorship colors, ...). Set in [pad_cookie.js#L49](https://github.com/ether/etherpad-lite/blob/01497aa399690e44393e91c19917d11d025df71b/src/static/js/pad_cookie.js#L49). `prefs` is used if Etherpad is accessed over HTTPS, `prefsHttp` if accessed over HTTP. For more info see https://github.com/ether/etherpad-lite/issues/3179. |
|
||||
| token | t.tFzkihhhBf4xKEpCK3PU | example.org | / | 60 days | false | true | A random token representing the author, of the form `t.randomstring_of_lenght_20`. The random string is generated by the client, at ([pad.js#L55-L66](https://github.com/ether/etherpad-lite/blob/01497aa399690e44393e91c19917d11d025df71b/src/static/js/pad.js#L55-L66)). This cookie is always set by the client (at [pad.js#L153-L158](https://github.com/ether/etherpad-lite/blob/01497aa399690e44393e91c19917d11d025df71b/src/static/js/pad.js#L153-L158)) without any solicitation from the server. It is used for all the pads accessed via the web UI (not used for the HTTP API). On the server side, its value is accessed at [SecurityManager.js#L33](https://github.com/ether/etherpad-lite/blob/01497aa399690e44393e91c19917d11d025df71b/src/node/db/SecurityManager.js#L33). |
|
||||
|
||||
For more info, visit the related discussion at https://github.com/ether/etherpad-lite/issues/3563.
|
||||
|
||||
Etherpad HTTP API clients may make use (if they choose so) to send another cookie:
|
||||
|
||||
| Name | Sample value | Domain | Usage description |
|
||||
|-----------|------------------------------------|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| sessionID | s.1c70968b333b25476a2c7bdd0e0bed17 | example.org | Sessions can be created between a group and an author. This allows an author to access more than one group. The sessionID will be set as a cookie to the client and is valid until a certain date. The session cookie can also contain multiple comma-separated sessionIDs, allowing a user to edit pads in different groups at the same time. More info - https://github.com/ether/etherpad-lite/blob/develop/doc/api/http_api.md#session |
|
19
doc/demo.md
|
@ -1,19 +0,0 @@
|
|||
# Demo of Etherpad
|
||||
|
||||
This is a demo of Etherpad. It shows how to use Etherpad and what it can do.
|
||||
|
||||
## The toolbar
|
||||
|
||||

|
||||
|
||||
## The pad
|
||||
|
||||

|
||||
|
||||
## Etherpad with a virtual webcam
|
||||
|
||||

|
||||
|
||||
## Etherpad skin variants
|
||||
|
||||

|
|
@ -510,7 +510,7 @@ For the editor container, you can also make it full width by adding `full-width-
|
|||
|
||||
| `SOCKETIO_MAX_HTTP_BUFFER_SIZE`
|
||||
| The maximum size (in bytes) of a single message accepted via Socket.IO. If a client sends a larger message, its connection gets closed to prevent DoS (memory exhaustion) attacks.
|
||||
| `50000`
|
||||
| `10000`
|
||||
|
||||
| `LOAD_TEST`
|
||||
| Allow Load Testing tools to hit the Etherpad Instance. WARNING: this will disable security on the instance.
|
||||
|
|
331
doc/docker.md
|
@ -1,331 +0,0 @@
|
|||
# Docker
|
||||
|
||||
The official Docker image is available on https://hub.docker.com/r/etherpad/etherpad.
|
||||
|
||||
## Downloading from Docker Hub
|
||||
If you are ok downloading a [prebuilt image from Docker Hub](https://hub.docker.com/r/etherpad/etherpad), these are the commands:
|
||||
```bash
|
||||
# gets the latest published version
|
||||
docker pull etherpad/etherpad
|
||||
|
||||
# gets a specific version
|
||||
docker pull etherpad/etherpad:1.8.0
|
||||
```
|
||||
|
||||
## Build a personalized container
|
||||
|
||||
If you want to use a personalized settings file, **you will have to rebuild your image**.
|
||||
All of the following instructions are as a member of the `docker` group.
|
||||
By default, the Etherpad Docker image is built and run in `production` mode: no development dependencies are installed, and asset bundling speeds up page load time.
|
||||
|
||||
### Rebuilding with custom settings
|
||||
Edit `<BASEDIR>/settings.json.docker` at your will. When rebuilding the image, this file will be copied inside your image and renamed to `settings.json`.
|
||||
|
||||
**Each configuration parameter can also be set via an environment variable**, using the syntax `"${ENV_VAR}"` or `"${ENV_VAR:default_value}"`. For details, refer to `settings.json.template`.
|
||||
|
||||
### Rebuilding including some plugins
|
||||
If you want to install some plugins in your container, it is sufficient to list them in the ETHERPAD_PLUGINS build variable.
|
||||
The variable value has to be a space separated, double quoted list of plugin names (see examples).
|
||||
|
||||
Some plugins will need personalized settings. Just refer to the previous section, and include them in your custom `settings.json.docker`.
|
||||
|
||||
### Rebuilding including export functionality for DOC/PDF/ODT
|
||||
|
||||
If you want to be able to export your pads to DOC/PDF/ODT files, you can install
|
||||
either Abiword or Libreoffice via setting a build variable.
|
||||
|
||||
#### Via Abiword
|
||||
|
||||
For installing Abiword, set the `INSTALL_ABIWORD` build variable to any value.
|
||||
|
||||
Also, you will need to configure the path to the abiword executable
|
||||
via setting the `abiword` property in `<BASEDIR>/settings.json.docker` to
|
||||
`/usr/bin/abiword` or via setting the environment variable `ABIWORD` to
|
||||
`/usr/bin/abiword`.
|
||||
|
||||
#### Via Libreoffice
|
||||
|
||||
For installing Libreoffice instead, set the `INSTALL_SOFFICE` build variable
|
||||
to any value.
|
||||
|
||||
Also, you will need to configure the path to the libreoffice executable
|
||||
via setting the `soffice` property in `<BASEDIR>/settings.json.docker` to
|
||||
`/usr/bin/soffice` or via setting the environment variable `SOFFICE` to
|
||||
`/usr/bin/soffice`.
|
||||
|
||||
### Examples
|
||||
|
||||
Build a Docker image from the currently checked-out code:
|
||||
```bash
|
||||
docker build --tag <YOUR_USERNAME>/etherpad .
|
||||
```
|
||||
|
||||
Include two plugins in the container:
|
||||
```bash
|
||||
docker build --build-arg ETHERPAD_PLUGINS="ep_comments_page ep_author_neat" --tag <YOUR_USERNAME>/etherpad .
|
||||
```
|
||||
|
||||
## Running your instance:
|
||||
|
||||
To run your instance:
|
||||
```bash
|
||||
docker run --detach --publish <DESIRED_PORT>:9001 <YOUR_USERNAME>/etherpad
|
||||
```
|
||||
|
||||
And point your browser to `http://<YOUR_IP>:<DESIRED_PORT>`
|
||||
|
||||
## Options available by default
|
||||
|
||||
The `settings.json.docker` available by default allows to control almost every setting via environment variables.
|
||||
|
||||
### General
|
||||
|
||||
| Variable | Description | Default |
|
||||
| ------------------ | ------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `TITLE` | The name of the instance | `Etherpad` |
|
||||
| `FAVICON` | favicon default name, or a fully specified URL to your own favicon | `favicon.ico` |
|
||||
| `DEFAULT_PAD_TEXT` | The default text of a pad | `Welcome to Etherpad! This pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents! Get involved with Etherpad at https://etherpad.org` |
|
||||
| `IP` | IP which etherpad should bind at. Change to `::` for IPv6 | `0.0.0.0` |
|
||||
| `PORT` | port which etherpad should bind at | `9001` |
|
||||
| `ADMIN_PASSWORD` | the password for the `admin` user (leave unspecified if you do not want to create it) | |
|
||||
| `USER_PASSWORD` | the password for the first user `user` (leave unspecified if you do not want to create it) | |
|
||||
|
||||
|
||||
### Database
|
||||
|
||||
| Variable | Description | Default |
|
||||
| ------------- | -------------------------------------------------------------- | --------------------------------------------------------------------- |
|
||||
| `DB_TYPE` | a database supported by https://www.npmjs.com/package/ueberdb2 | not set, thus will fall back to `DirtyDB` (please choose one instead) |
|
||||
| `DB_HOST` | the host of the database | |
|
||||
| `DB_PORT` | the port of the database | |
|
||||
| `DB_NAME` | the database name | |
|
||||
| `DB_USER` | a database user with sufficient permissions to create tables | |
|
||||
| `DB_PASS` | the password for the database username | |
|
||||
| `DB_CHARSET` | the character set for the tables (only required for MySQL) | |
|
||||
| `DB_FILENAME` | in case `DB_TYPE` is `DirtyDB` or `sqlite`, the database file. | `var/dirty.db`, `var/etherpad.sq3` |
|
||||
|
||||
If your database needs additional settings, you will have to use a personalized `settings.json.docker` and rebuild the container (or otherwise put the updated `settings.json` inside your image).
|
||||
|
||||
|
||||
### Pad Options
|
||||
|
||||
| Variable | Description | Default |
|
||||
| -------------------------------- | ----------- | ------- |
|
||||
| `PAD_OPTIONS_NO_COLORS` | | `false` |
|
||||
| `PAD_OPTIONS_SHOW_CONTROLS` | | `true` |
|
||||
| `PAD_OPTIONS_SHOW_CHAT` | | `true` |
|
||||
| `PAD_OPTIONS_SHOW_LINE_NUMBERS` | | `true` |
|
||||
| `PAD_OPTIONS_USE_MONOSPACE_FONT` | | `false` |
|
||||
| `PAD_OPTIONS_USER_NAME` | | `null` |
|
||||
| `PAD_OPTIONS_USER_COLOR` | | `null` |
|
||||
| `PAD_OPTIONS_RTL` | | `false` |
|
||||
| `PAD_OPTIONS_ALWAYS_SHOW_CHAT` | | `false` |
|
||||
| `PAD_OPTIONS_CHAT_AND_USERS` | | `false` |
|
||||
| `PAD_OPTIONS_LANG` | | `null` |
|
||||
|
||||
|
||||
### Shortcuts
|
||||
|
||||
| Variable | Description | Default |
|
||||
| ----------------------------------- | ------------------------------------------------ | ------- |
|
||||
| `PAD_SHORTCUTS_ENABLED_ALT_F9` | focus on the File Menu and/or editbar | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_ALT_C` | focus on the Chat window | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_CMD_S` | save a revision | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_CMD_Z` | undo/redo | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_CMD_Y` | redo | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_CMD_I` | italic | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_CMD_B` | bold | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_CMD_U` | underline | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_CMD_H` | backspace | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_CMD_5` | strike through | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_CMD_SHIFT_1` | ordered list | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_CMD_SHIFT_2` | shows a gritter popup showing a line author | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_CMD_SHIFT_L` | unordered list | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_CMD_SHIFT_N` | ordered list | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_CMD_SHIFT_C` | clear authorship | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_DELETE` | | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_RETURN` | | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_ESC` | in mozilla versions 14-19 avoid reconnecting pad | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_TAB` | indent | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_CTRL_HOME` | scroll to top of pad | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_PAGE_UP` | | `true` |
|
||||
| `PAD_SHORTCUTS_ENABLED_PAGE_DOWN` | | `true` |
|
||||
|
||||
|
||||
### Skins
|
||||
|
||||
You can use the UI skin variants builder at `/p/test#skinvariantsbuilder`
|
||||
|
||||
For the colibris skin only, you can choose how to render the three main containers:
|
||||
* toolbar (top menu with icons)
|
||||
* editor (containing the text of the pad)
|
||||
* background (area outside of editor, mostly visible when using page style)
|
||||
|
||||
For each of the 3 containers you can choose 4 color combinations:
|
||||
* super-light
|
||||
* light
|
||||
* dark
|
||||
* super-dark
|
||||
|
||||
For the editor container, you can also make it full width by adding `full-width-editor` variant (by default editor is rendered as a page, with a max-width of 900px).
|
||||
|
||||
| Variable | Description | Default |
|
||||
| --------------- | ------------------------------------------------------------------------------ | --------------------------------------------------------- |
|
||||
| `SKIN_NAME` | either `no-skin`, `colibris` or an existing directory under `src/static/skins` | `colibris` |
|
||||
| `SKIN_VARIANTS` | multiple skin variants separated by spaces | `super-light-toolbar super-light-editor light-background` |
|
||||
|
||||
|
||||
### Logging
|
||||
|
||||
| Variable | Description | Default |
|
||||
| -------------------- | ---------------------------------------------------- | ------- |
|
||||
| `LOGLEVEL` | valid values are `DEBUG`, `INFO`, `WARN` and `ERROR` | `INFO` |
|
||||
| `DISABLE_IP_LOGGING` | Privacy: disable IP logging | `false` |
|
||||
|
||||
|
||||
### Advanced
|
||||
|
||||
| Variable | Description | Default |
|
||||
|-----------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------|
|
||||
| `COOKIE_SAME_SITE` | Value of the SameSite cookie property. | `"Lax"` |
|
||||
| `COOKIE_SESSION_LIFETIME` | How long (ms) a user can be away before they must log in again. | `864000000` (10 days) |
|
||||
| `COOKIE_SESSION_REFRESH_INTERVAL` | How often (ms) to write the latest cookie expiration time. | `86400000` (1 day) |
|
||||
| `SHOW_SETTINGS_IN_ADMIN_PAGE` | hide/show the settings.json in admin page | `true` |
|
||||
| `TRUST_PROXY` | set to `true` if you are using a reverse proxy in front of Etherpad (for example: Traefik for SSL termination via Let's Encrypt). This will affect security and correctness of the logs if not done | `false` |
|
||||
| `IMPORT_MAX_FILE_SIZE` | maximum allowed file size when importing a pad, in bytes. | `52428800` (50 MB) |
|
||||
| `IMPORT_EXPORT_MAX_REQ_PER_IP` | maximum number of import/export calls per IP. | `10` |
|
||||
| `IMPORT_EXPORT_RATE_LIMIT_WINDOW` | the call rate for import/export requests will be estimated in this time window (in milliseconds) | `90000` |
|
||||
| `COMMIT_RATE_LIMIT_DURATION` | duration of the rate limit window for commits by individual users/IPs (in seconds) | `1` |
|
||||
| `COMMIT_RATE_LIMIT_POINTS` | maximum number of changes per IP to allow during the rate limit window | `10` |
|
||||
| `SUPPRESS_ERRORS_IN_PAD_TEXT` | Should we suppress errors from being visible in the default Pad Text? | `false` |
|
||||
| `REQUIRE_SESSION` | If this option is enabled, a user must have a session to access pads. This effectively allows only group pads to be accessed. | `false` |
|
||||
| `EDIT_ONLY` | Users may edit pads but not create new ones. Pad creation is only via the API. This applies both to group pads and regular pads. | `false` |
|
||||
| `MINIFY` | If true, all css & js will be minified before sending to the client. This will improve the loading performance massively, but makes it difficult to debug the javascript/css | `true` |
|
||||
| `MAX_AGE` | How long may clients use served javascript code (in seconds)? Not setting this may cause problems during deployment. Set to 0 to disable caching. | `21600` (6 hours) |
|
||||
| `ABIWORD` | Absolute path to the Abiword executable. Abiword is needed to get advanced import/export features of pads. Setting it to null disables Abiword and will only allow plain text and HTML import/exports. | `null` |
|
||||
| `SOFFICE` | This is the absolute path to the soffice executable. LibreOffice can be used in lieu of Abiword to export pads. Setting it to null disables LibreOffice exporting. | `null` |
|
||||
| `ALLOW_UNKNOWN_FILE_ENDS` | Allow import of file types other than the supported ones: txt, doc, docx, rtf, odt, html & htm | `true` |
|
||||
| `REQUIRE_AUTHENTICATION` | This setting is used if you require authentication of all users. Note: "/admin" always requires authentication. | `false` |
|
||||
| `REQUIRE_AUTHORIZATION` | Require authorization by a module, or a user with is_admin set, see below. | `false` |
|
||||
| `AUTOMATIC_RECONNECTION_TIMEOUT` | Time (in seconds) to automatically reconnect pad when a "Force reconnect" message is shown to user. Set to 0 to disable automatic reconnection. | `0` |
|
||||
| `FOCUS_LINE_PERCENTAGE_ABOVE` | Percentage of viewport height to be additionally scrolled. e.g. 0.5, to place caret line in the middle of viewport, when user edits a line above of the viewport. Set to 0 to disable extra scrolling | `0` |
|
||||
| `FOCUS_LINE_PERCENTAGE_BELOW` | Percentage of viewport height to be additionally scrolled. e.g. 0.5, to place caret line in the middle of viewport, when user edits a line below of the viewport. Set to 0 to disable extra scrolling | `0` |
|
||||
| `FOCUS_LINE_PERCENTAGE_ARROW_UP` | Percentage of viewport height to be additionally scrolled when user presses arrow up in the line of the top of the viewport. Set to 0 to let the scroll to be handled as default by Etherpad | `0` |
|
||||
| `FOCUS_LINE_DURATION` | Time (in milliseconds) used to animate the scroll transition. Set to 0 to disable animation | `0` |
|
||||
| `FOCUS_LINE_CARET_SCROLL` | Flag to control if it should scroll when user places the caret in the last line of the viewport | `false` |
|
||||
| `SOCKETIO_MAX_HTTP_BUFFER_SIZE` | The maximum size (in bytes) of a single message accepted via Socket.IO. If a client sends a larger message, its connection gets closed to prevent DoS (memory exhaustion) attacks. | `50000` |
|
||||
| `LOAD_TEST` | Allow Load Testing tools to hit the Etherpad Instance. WARNING: this will disable security on the instance. | `false` |
|
||||
| `DUMP_ON_UNCLEAN_EXIT` | Enable dumping objects preventing a clean exit of Node.js. WARNING: this has a significant performance impact. | `false` |
|
||||
| `EXPOSE_VERSION` | Expose Etherpad version in the web interface and in the Server http header. Do not enable on production machines. | `false` |
|
||||
|
||||
### Add plugin configurations
|
||||
|
||||
It is possible to add arbitrary configurations for plugins by setting the `EP__PLUGIN__<PLUGIN_NAME>__<CONFIG_NAME>` environment variable. It is important to separate paths with a double underscore `__`.
|
||||
|
||||
For example, to configure the `ep_comments` plugin to use the `comments` database, you can set the following environment variables:
|
||||
|
||||
The original config looks like this:
|
||||
```json
|
||||
"ep_comments_page": {
|
||||
"highlightSelectedText": true
|
||||
},
|
||||
```
|
||||
We have two paths ep_comments_page and highlightSelectedText, so we need to set the following environment variable:
|
||||
|
||||
|
||||
```yaml
|
||||
EP__ep_comments_page__highlightSelectedText=true
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
Use a Postgres database, no admin user enabled:
|
||||
|
||||
```shell
|
||||
docker run -d \
|
||||
--name etherpad \
|
||||
-p 9001:9001 \
|
||||
-e 'DB_TYPE=postgres' \
|
||||
-e 'DB_HOST=db.local' \
|
||||
-e 'DB_PORT=4321' \
|
||||
-e 'DB_NAME=etherpad' \
|
||||
-e 'DB_USER=dbusername' \
|
||||
-e 'DB_PASS=mypassword' \
|
||||
etherpad/etherpad
|
||||
```
|
||||
|
||||
Run enabling the administrative user `admin`:
|
||||
|
||||
```shell
|
||||
docker run -d \
|
||||
--name etherpad \
|
||||
-p 9001:9001 \
|
||||
-e 'ADMIN_PASSWORD=supersecret' \
|
||||
etherpad/etherpad
|
||||
```
|
||||
|
||||
Run a test instance running DirtyDB on a persistent volume:
|
||||
|
||||
```shell
|
||||
docker run -d \
|
||||
-v etherpad_data:/opt/etherpad-lite/var \
|
||||
-p 9001:9001 \
|
||||
etherpad/etherpad
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Ready to use Docker Compose
|
||||
|
||||
```yaml
|
||||
services:
|
||||
app:
|
||||
user: "0:0"
|
||||
image: etherpad/etherpad:latest
|
||||
tty: true
|
||||
stdin_open: true
|
||||
volumes:
|
||||
- plugins:/opt/etherpad-lite/src/plugin_packages
|
||||
- etherpad-var:/opt/etherpad-lite/var
|
||||
depends_on:
|
||||
- postgres
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
ADMIN_PASSWORD: ${DOCKER_COMPOSE_APP_ADMIN_PASSWORD:-admin}
|
||||
DB_CHARSET: ${DOCKER_COMPOSE_APP_DB_CHARSET:-utf8mb4}
|
||||
DB_HOST: postgres
|
||||
DB_NAME: ${DOCKER_COMPOSE_POSTGRES_DATABASE:-etherpad}
|
||||
DB_PASS: ${DOCKER_COMPOSE_POSTGRES_PASSWORD:-admin}
|
||||
DB_PORT: ${DOCKER_COMPOSE_POSTGRES_PORT:-5432}
|
||||
DB_TYPE: "postgres"
|
||||
DB_USER: ${DOCKER_COMPOSE_POSTGRES_USER:-admin}
|
||||
# For now, the env var DEFAULT_PAD_TEXT cannot be unset or empty; it seems to be mandatory in the latest version of etherpad
|
||||
DEFAULT_PAD_TEXT: ${DOCKER_COMPOSE_APP_DEFAULT_PAD_TEXT:- }
|
||||
DISABLE_IP_LOGGING: ${DOCKER_COMPOSE_APP_DISABLE_IP_LOGGING:-false}
|
||||
SOFFICE: ${DOCKER_COMPOSE_APP_SOFFICE:-null}
|
||||
TRUST_PROXY: ${DOCKER_COMPOSE_APP_TRUST_PROXY:-true}
|
||||
restart: always
|
||||
ports:
|
||||
- "${DOCKER_COMPOSE_APP_PORT_PUBLISHED:-9001}:${DOCKER_COMPOSE_APP_PORT_TARGET:-9001}"
|
||||
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
environment:
|
||||
POSTGRES_DB: ${DOCKER_COMPOSE_POSTGRES_DATABASE:-etherpad}
|
||||
POSTGRES_PASSWORD: ${DOCKER_COMPOSE_POSTGRES_PASSWORD:-admin}
|
||||
POSTGRES_PORT: ${DOCKER_COMPOSE_POSTGRES_PORT:-5432}
|
||||
POSTGRES_USER: ${DOCKER_COMPOSE_POSTGRES_USER:-admin}
|
||||
PGDATA: /var/lib/postgresql/data/pgdata
|
||||
restart: always
|
||||
# Exposing the port is not needed unless you want to access this database instance from the host.
|
||||
# Be careful when other postgres docker container are running on the same port
|
||||
# ports:
|
||||
# - "5432:5432"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data/pgdata
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
plugins:
|
||||
etherpad-var:
|
||||
```
|
|
@ -1,15 +0,0 @@
|
|||
# About this Documentation
|
||||
|
||||
<!-- type=misc -->
|
||||
|
||||
The goal of this documentation is to comprehensively explain Etherpad,
|
||||
both from a reference and a conceptual point of view.
|
||||
|
||||
Where appropriate, property types, method arguments, and the arguments
|
||||
provided to event handlers are detailed in a list underneath the topic
|
||||
heading.
|
||||
|
||||
Every `.html` file is generated based on the corresponding
|
||||
`.md` file in the `doc/api/` folder in the source tree. The
|
||||
documentation is generated using the `src/bin/doc/generate.js` program.
|
||||
The HTML template is located at `doc/template.html`.
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 874 KiB After Width: | Height: | Size: 874 KiB |
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
Before Width: | Height: | Size: 533 KiB After Width: | Height: | Size: 533 KiB |