ep_email_notifications 10.0.2 → 11.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/dependabot.yml +11 -0
- package/.github/workflows/backend-tests.yml +71 -0
- package/.github/workflows/frontend-tests.yml +94 -0
- package/.github/workflows/npmpublish.yml +99 -0
- package/.github/workflows/test-and-release.yml +26 -0
- package/README.md +1 -1
- package/client.js +1 -1
- package/handleMessage.js +1 -1
- package/index.js +1 -1
- package/package.json +8 -12
- package/update.js +1 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
name: Backend Tests
|
|
2
|
+
|
|
3
|
+
# any branch is useful for testing before a PR is submitted
|
|
4
|
+
on:
|
|
5
|
+
workflow_call:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
withplugins:
|
|
9
|
+
# run on pushes to any branch
|
|
10
|
+
# run on PRs from external forks
|
|
11
|
+
if: |
|
|
12
|
+
(github.event_name != 'pull_request')
|
|
13
|
+
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
|
|
14
|
+
name: with Plugins
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
-
|
|
18
|
+
name: Install libreoffice
|
|
19
|
+
uses: awalsh128/cache-apt-pkgs-action@v1.6.0
|
|
20
|
+
with:
|
|
21
|
+
packages: libreoffice libreoffice-pdfimport
|
|
22
|
+
version: 1.0
|
|
23
|
+
-
|
|
24
|
+
name: Install etherpad core
|
|
25
|
+
uses: actions/checkout@v4
|
|
26
|
+
with:
|
|
27
|
+
repository: ether/etherpad-lite
|
|
28
|
+
path: etherpad-lite
|
|
29
|
+
- uses: pnpm/action-setup@v3
|
|
30
|
+
name: Install pnpm
|
|
31
|
+
with:
|
|
32
|
+
version: 10
|
|
33
|
+
run_install: false
|
|
34
|
+
- name: Get pnpm store directory
|
|
35
|
+
shell: bash
|
|
36
|
+
run: |
|
|
37
|
+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
38
|
+
- uses: actions/cache@v4
|
|
39
|
+
name: Setup pnpm cache
|
|
40
|
+
with:
|
|
41
|
+
path: ${{ env.STORE_PATH }}
|
|
42
|
+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
43
|
+
restore-keys: |
|
|
44
|
+
${{ runner.os }}-pnpm-store-
|
|
45
|
+
-
|
|
46
|
+
name: Checkout plugin repository
|
|
47
|
+
uses: actions/checkout@v4
|
|
48
|
+
with:
|
|
49
|
+
path: plugin
|
|
50
|
+
- name: Remove tests
|
|
51
|
+
working-directory: ./etherpad-lite
|
|
52
|
+
run: rm -rf ./src/tests/backend/specs
|
|
53
|
+
-
|
|
54
|
+
name: Install Etherpad core dependencies
|
|
55
|
+
working-directory: ./etherpad-lite
|
|
56
|
+
run: bin/installDeps.sh
|
|
57
|
+
- name: Install plugin
|
|
58
|
+
working-directory: ./etherpad-lite
|
|
59
|
+
run: |
|
|
60
|
+
pnpm run plugins i --path ../../plugin
|
|
61
|
+
-
|
|
62
|
+
name: Run the backend tests
|
|
63
|
+
working-directory: ./etherpad-lite/src
|
|
64
|
+
run: |
|
|
65
|
+
shopt -s globstar
|
|
66
|
+
res=$(find ./plugin_packages -path "*/static/tests/backend/specs/*" 2>/dev/null | wc -l)
|
|
67
|
+
if [ $res -eq 0 ]; then
|
|
68
|
+
echo "No backend tests found"
|
|
69
|
+
else
|
|
70
|
+
npx cross-env NODE_ENV=production mocha --import=tsx --timeout 120000 --recursive node_modules/ep_*/static/tests/backend/specs/**
|
|
71
|
+
fi
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Publicly credit Sauce Labs because they generously support open source
|
|
2
|
+
# projects.
|
|
3
|
+
name: Frontend Tests
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
workflow_call:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test-frontend:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
-
|
|
14
|
+
name: Check out Etherpad core
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
with:
|
|
17
|
+
repository: ether/etherpad-lite
|
|
18
|
+
- uses: pnpm/action-setup@v3
|
|
19
|
+
name: Install pnpm
|
|
20
|
+
with:
|
|
21
|
+
version: 10
|
|
22
|
+
run_install: false
|
|
23
|
+
- name: Get pnpm store directory
|
|
24
|
+
shell: bash
|
|
25
|
+
run: |
|
|
26
|
+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
27
|
+
- uses: actions/cache@v4
|
|
28
|
+
name: Setup pnpm cache
|
|
29
|
+
with:
|
|
30
|
+
path: ${{ env.STORE_PATH }}
|
|
31
|
+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
32
|
+
restore-keys: |
|
|
33
|
+
${{ runner.os }}-pnpm-store-
|
|
34
|
+
-
|
|
35
|
+
name: Check out the plugin
|
|
36
|
+
uses: actions/checkout@v4
|
|
37
|
+
with:
|
|
38
|
+
path: ./node_modules/__tmp
|
|
39
|
+
-
|
|
40
|
+
name: export GIT_HASH to env
|
|
41
|
+
id: environment
|
|
42
|
+
run: |
|
|
43
|
+
cd ./node_modules/__tmp
|
|
44
|
+
echo "::set-output name=sha_short::$(git rev-parse --short ${{ github.sha }})"
|
|
45
|
+
-
|
|
46
|
+
name: Determine plugin name
|
|
47
|
+
id: plugin_name
|
|
48
|
+
run: |
|
|
49
|
+
cd ./node_modules/__tmp
|
|
50
|
+
npx -c 'printf %s\\n "::set-output name=plugin_name::${npm_package_name}"'
|
|
51
|
+
-
|
|
52
|
+
name: Rename plugin directory
|
|
53
|
+
env:
|
|
54
|
+
PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }}
|
|
55
|
+
run: |
|
|
56
|
+
mv ./node_modules/__tmp ./node_modules/"${PLUGIN_NAME}"
|
|
57
|
+
-
|
|
58
|
+
name: Install plugin dependencies
|
|
59
|
+
env:
|
|
60
|
+
PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }}
|
|
61
|
+
run: |
|
|
62
|
+
cd ./node_modules/"${PLUGIN_NAME}"
|
|
63
|
+
pnpm i
|
|
64
|
+
# Etherpad core dependencies must be installed after installing the
|
|
65
|
+
# plugin's dependencies, otherwise npm will try to hoist common
|
|
66
|
+
# dependencies by removing them from src/node_modules and installing them
|
|
67
|
+
# in the top-level node_modules. As of v6.14.10, npm's hoist logic appears
|
|
68
|
+
# to be buggy, because it sometimes removes dependencies from
|
|
69
|
+
# src/node_modules but fails to add them to the top-level node_modules.
|
|
70
|
+
# Even if npm correctly hoists the dependencies, the hoisting seems to
|
|
71
|
+
# confuse tools such as `npm outdated`, `npm update`, and some ESLint
|
|
72
|
+
# rules.
|
|
73
|
+
-
|
|
74
|
+
name: Install Etherpad core dependencies
|
|
75
|
+
run: bin/installDeps.sh
|
|
76
|
+
- name: Create settings.json
|
|
77
|
+
run: cp ./src/tests/settings.json settings.json
|
|
78
|
+
- name: Run the frontend tests
|
|
79
|
+
shell: bash
|
|
80
|
+
run: |
|
|
81
|
+
pnpm run dev &
|
|
82
|
+
connected=false
|
|
83
|
+
can_connect() {
|
|
84
|
+
curl -sSfo /dev/null http://localhost:9001/ || return 1
|
|
85
|
+
connected=true
|
|
86
|
+
}
|
|
87
|
+
now() { date +%s; }
|
|
88
|
+
start=$(now)
|
|
89
|
+
while [ $(($(now) - $start)) -le 15 ] && ! can_connect; do
|
|
90
|
+
sleep 1
|
|
91
|
+
done
|
|
92
|
+
cd src
|
|
93
|
+
pnpm exec playwright install chromium --with-deps
|
|
94
|
+
pnpm run test-ui --project=chromium
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# This workflow will run tests using node and then publish a package to the npm registry when a release is created
|
|
2
|
+
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
|
|
3
|
+
#
|
|
4
|
+
# Publishing uses npm Trusted Publishing (OIDC) — no NPM_TOKEN secret is
|
|
5
|
+
# required. Each package must have a trusted publisher configured on npmjs.com
|
|
6
|
+
# pointing at this workflow file. See:
|
|
7
|
+
# https://docs.npmjs.com/trusted-publishers
|
|
8
|
+
|
|
9
|
+
name: Node.js Package
|
|
10
|
+
|
|
11
|
+
on:
|
|
12
|
+
workflow_call:
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
publish-npm:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
permissions:
|
|
18
|
+
contents: write # for the atomic version-bump push (branch + tag)
|
|
19
|
+
id-token: write # for npm OIDC trusted publishing
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/setup-node@v6
|
|
22
|
+
with:
|
|
23
|
+
# OIDC trusted publishing needs npm >= 11.5.1, which requires
|
|
24
|
+
# Node >= 20.17.0. setup-node's `20` resolves to the latest
|
|
25
|
+
# 20.x, which satisfies that.
|
|
26
|
+
node-version: 20
|
|
27
|
+
registry-url: https://registry.npmjs.org/
|
|
28
|
+
- name: Upgrade npm to >=11.5.1 (required for trusted publishing)
|
|
29
|
+
run: npm install -g npm@latest
|
|
30
|
+
- name: Check out Etherpad core
|
|
31
|
+
uses: actions/checkout@v6
|
|
32
|
+
with:
|
|
33
|
+
repository: ether/etherpad-lite
|
|
34
|
+
- uses: pnpm/action-setup@v5
|
|
35
|
+
name: Install pnpm
|
|
36
|
+
with:
|
|
37
|
+
version: 10
|
|
38
|
+
run_install: false
|
|
39
|
+
- name: Get pnpm store directory
|
|
40
|
+
shell: bash
|
|
41
|
+
run: |
|
|
42
|
+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
43
|
+
- uses: actions/cache@v5
|
|
44
|
+
name: Setup pnpm cache
|
|
45
|
+
with:
|
|
46
|
+
path: ${{ env.STORE_PATH }}
|
|
47
|
+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
48
|
+
restore-keys: |
|
|
49
|
+
${{ runner.os }}-pnpm-store-
|
|
50
|
+
-
|
|
51
|
+
uses: actions/checkout@v6
|
|
52
|
+
with:
|
|
53
|
+
fetch-depth: 0
|
|
54
|
+
-
|
|
55
|
+
name: Bump version (patch)
|
|
56
|
+
run: |
|
|
57
|
+
LATEST_TAG=$(git describe --tags --abbrev=0) || exit 1
|
|
58
|
+
NEW_COMMITS=$(git rev-list --count "${LATEST_TAG}"..) || exit 1
|
|
59
|
+
[ "${NEW_COMMITS}" -gt 0 ] || exit 0
|
|
60
|
+
git config user.name 'github-actions[bot]'
|
|
61
|
+
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
|
62
|
+
pnpm i
|
|
63
|
+
# `pnpm version patch` bumps package.json, makes a commit, and creates
|
|
64
|
+
# a `v<new-version>` tag. Capture the new tag name from package.json
|
|
65
|
+
# rather than parsing pnpm's output, which has historically varied.
|
|
66
|
+
pnpm version patch
|
|
67
|
+
NEW_TAG="v$(node -p "require('./package.json').version")"
|
|
68
|
+
# CRITICAL: use --atomic so the branch update and the tag update
|
|
69
|
+
# succeed (or fail) as a single transaction on the server. The old
|
|
70
|
+
# `git push --follow-tags` was non-atomic per ref: if a concurrent
|
|
71
|
+
# publish run won the race, the branch fast-forward would be rejected
|
|
72
|
+
# but the tag push would still land — leaving a dangling tag with no
|
|
73
|
+
# matching commit on the branch. Subsequent runs would then forever
|
|
74
|
+
# try to bump to the same already-existing tag and fail with
|
|
75
|
+
# `tag 'vN+1' already exists`. With --atomic, a rejected branch push
|
|
76
|
+
# rejects the tag push too, and the next workflow tick can retry
|
|
77
|
+
# cleanly against the up-to-date refs.
|
|
78
|
+
git push --atomic origin "${GITHUB_REF_NAME}" "${NEW_TAG}"
|
|
79
|
+
# This is required if the package has a prepare script that uses something
|
|
80
|
+
# in dependencies or devDependencies.
|
|
81
|
+
-
|
|
82
|
+
run: pnpm i
|
|
83
|
+
# `npm publish` must come after `git push` otherwise there is a race
|
|
84
|
+
# condition: If two PRs are merged back-to-back then master/main will be
|
|
85
|
+
# updated with the commits from the second PR before the first PR's
|
|
86
|
+
# workflow has a chance to push the commit generated by `npm version
|
|
87
|
+
# patch`. This causes the first PR's `git push` step to fail after the
|
|
88
|
+
# package has already been published, which in turn will cause all future
|
|
89
|
+
# workflow runs to fail because they will all attempt to use the same
|
|
90
|
+
# already-used version number. By running `npm publish` after `git push`,
|
|
91
|
+
# back-to-back merges will cause the first merge's workflow to fail but
|
|
92
|
+
# the second's will succeed.
|
|
93
|
+
#
|
|
94
|
+
# Use `npm publish` directly (not `pnpm publish`) because OIDC trusted
|
|
95
|
+
# publishing requires npm CLI >= 11.5.1 and `pnpm publish` shells out to
|
|
96
|
+
# whichever `npm` is on PATH; calling `npm` directly avoids any shim
|
|
97
|
+
# ambiguity.
|
|
98
|
+
- name: Publish to npm via OIDC
|
|
99
|
+
run: npm publish --provenance --access public
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Node.js Package
|
|
2
|
+
on: [push]
|
|
3
|
+
|
|
4
|
+
# id-token: write must be granted here so the reusable npmpublish workflow
|
|
5
|
+
# can request an OIDC token for npm trusted publishing.
|
|
6
|
+
permissions:
|
|
7
|
+
contents: write
|
|
8
|
+
id-token: write
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
backend:
|
|
12
|
+
uses: ./.github/workflows/backend-tests.yml
|
|
13
|
+
secrets: inherit
|
|
14
|
+
frontend:
|
|
15
|
+
uses: ./.github/workflows/frontend-tests.yml
|
|
16
|
+
secrets: inherit
|
|
17
|
+
release:
|
|
18
|
+
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
|
|
19
|
+
needs:
|
|
20
|
+
- backend
|
|
21
|
+
- frontend
|
|
22
|
+
permissions:
|
|
23
|
+
contents: write # for the version bump push
|
|
24
|
+
id-token: write # for npm OIDC trusted publishing
|
|
25
|
+
uses: ./.github/workflows/npmpublish.yml
|
|
26
|
+
secrets: inherit
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
  [](https://github.com/ether/ep_email_notifications/actions/workflows/test-and-release.yml)
|
|
2
2
|
|
|
3
3
|
# BROKEN PLUGIN, NEEDS FIXING
|
|
4
4
|
This plugin allows users to subscribe to pads and receive email updates when a pad is being modified. You can modify the frequency. This plugin is still in early stage and has things TODO (See TODO).
|
package/client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const eejs = require('ep_etherpad-lite/node/eejs');
|
|
4
|
-
|
|
4
|
+
const settings = require('ep_etherpad-lite/node/utils/Settings');
|
|
5
5
|
|
|
6
6
|
exports.eejsBlock_mySettings = (hookName, args, cb) => {
|
|
7
7
|
args.content += eejs.require('ep_email_notifications/templates/email_notifications_settings.ejs');
|
package/handleMessage.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const db = require('ep_etherpad-lite/node/db/DB');
|
|
4
4
|
const email = require('emailjs');
|
|
5
5
|
const randomString = require('ep_etherpad-lite/static/js/pad_utils').randomString;
|
|
6
|
-
|
|
6
|
+
const settings = require('ep_etherpad-lite/node/utils/Settings');
|
|
7
7
|
const util = require('util');
|
|
8
8
|
const validator = require('validator');
|
|
9
9
|
|
package/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const db = require('ep_etherpad-lite/node/db/DB');
|
|
4
4
|
const fs = require('fs').promises;
|
|
5
|
-
|
|
5
|
+
const settings = require('ep_etherpad-lite/node/utils/Settings');
|
|
6
6
|
|
|
7
7
|
// Remove cache for this procedure
|
|
8
8
|
db.db.dbSettings.cache = 0;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ep_email_notifications",
|
|
3
3
|
"description": "Subscribe to a pad and receive an email when someone edits your pad",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "11.0.3",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "John Mclear",
|
|
7
7
|
"email": "john@mclear.co.uk",
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
}
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"emailjs": "
|
|
19
|
-
"validator": "13.
|
|
18
|
+
"emailjs": "5.0.0",
|
|
19
|
+
"validator": "13.15.35"
|
|
20
20
|
},
|
|
21
21
|
"engines": {
|
|
22
|
-
"node": ">=
|
|
22
|
+
"node": ">=18.0.0"
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
26
|
-
"url": "https://github.com/ether/
|
|
26
|
+
"url": "https://github.com/ether/ep_email_notifications.git"
|
|
27
27
|
},
|
|
28
28
|
"readme": "# Description\nThis plugin allows users to subscribe to pads and receive email updates when a pad is being modified. You can modify the frequency. This plugin is very much in alpha stage and has a lot of things TODO (See TODO).\n\n# Installation\nMake sure an SMTP gateway is installed IE postfix\nConfigure SPF and RDNS records to ensure proper mail flow <-- Search online\nCopy/Edit the below to your settings.json\nConnect to a pad, Click on the Share/Embed link and enter in your email address.\nOpen that pad in ANOTHER BROWSER then begin modifying, you should receive an email when the pad has begun editing and once the pad has gone stale (when everyone stops editing it and a time period passes).\nNOTE: You will NOT receive an email if you(the author that registered their email) are currently on or editing that pad!\n\n```\n \"ep_email_notifications\" : {\n checkFrequency: 6000, // checkFrequency = How frequently(milliseconds) to check for pad updates -- Move me to the settings file\n staleTime: 30000, // staleTime = How stale(milliseconds) does a pad need to be before notifying subscribers? Move me to settings\n fromName: \"Etherpad SETTINGS FILE!\",\n fromEmail: \"pad@etherpad.org\",\n urlToPads: \"http://beta.etherpad.org/p/\", // urlToPads = The URL to your pads note the trailing /\n emailServer: { // See https://github.com/eleith/emailjs for settings\n host: \"127.0.0.1\"\n }\n }\n```\n\n# TODO\n* Clean up all code\n\n# FUTURE VERSIONS TODO\n* v2 - Get the modified contents from the API HTML diff and append that to the Email and make the email from the server HTML not plain text\n* v2 - a point to unsubscribe and validate/verify email https://github.com/alfredwesterveld/node-email-verification\n* v2 - Keep a record of when a user was last on a pad\n",
|
|
29
29
|
"readmeFilename": "README.md",
|
|
@@ -36,16 +36,12 @@
|
|
|
36
36
|
"url": "https://etherpad.org/"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"eslint": "^
|
|
39
|
+
"eslint": "^8.57.1",
|
|
40
40
|
"eslint-config-etherpad": "^4.0.4",
|
|
41
|
-
"typescript": "^5.
|
|
41
|
+
"typescript": "^5.9.3"
|
|
42
42
|
},
|
|
43
|
-
"bugs": {
|
|
44
|
-
"url": "https://github.com/ether/ether-plugins/issues"
|
|
45
|
-
},
|
|
46
|
-
"homepage": "https://github.com/ether/ether-plugins/tree/main/ep_email_notifications#readme",
|
|
47
43
|
"scripts": {
|
|
48
44
|
"lint": "eslint .",
|
|
49
45
|
"lint:fix": "eslint --fix ."
|
|
50
46
|
}
|
|
51
|
-
}
|
|
47
|
+
}
|
package/update.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
const db = require('ep_etherpad-lite/node/db/DB');
|
|
6
6
|
const API = require('ep_etherpad-lite/node/db/API.js');
|
|
7
7
|
const email = require('emailjs');
|
|
8
|
-
|
|
8
|
+
const settings = require('ep_etherpad-lite/node/utils/Settings');
|
|
9
9
|
const util = require('util');
|
|
10
10
|
|
|
11
11
|
const SMTPClient = email.SMTPClient;
|