mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 15:36:16 -04:00
Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3a9e126866 | ||
![]() |
6a37a5c52a |
17 changed files with 538 additions and 643 deletions
4
.github/workflows/backend-tests.yml
vendored
4
.github/workflows/backend-tests.yml
vendored
|
@ -24,7 +24,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
node: [20, 22, 23]
|
node: [18, 20, 22]
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout repository
|
name: Checkout repository
|
||||||
|
@ -84,7 +84,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
node: [20, 22, 23]
|
node: [18, 20, 22]
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout repository
|
name: Checkout repository
|
||||||
|
|
30
.github/workflows/docker.yml
vendored
30
.github/workflows/docker.yml
vendored
|
@ -22,9 +22,6 @@ jobs:
|
||||||
-
|
-
|
||||||
name: Check out
|
name: Check out
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
path: etherpad
|
|
||||||
|
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
if: github.event_name == 'push'
|
if: github.event_name == 'push'
|
||||||
|
@ -36,7 +33,7 @@ jobs:
|
||||||
name: Build and export to Docker
|
name: Build and export to Docker
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: ./etherpad
|
context: .
|
||||||
target: production
|
target: production
|
||||||
load: true
|
load: true
|
||||||
tags: ${{ env.TEST_TAG }}
|
tags: ${{ env.TEST_TAG }}
|
||||||
|
@ -65,7 +62,6 @@ jobs:
|
||||||
${{ runner.os }}-pnpm-store-
|
${{ runner.os }}-pnpm-store-
|
||||||
-
|
-
|
||||||
name: Test
|
name: Test
|
||||||
working-directory: etherpad
|
|
||||||
run: |
|
run: |
|
||||||
docker run --rm -d -p 9001:9001 --name test ${{ env.TEST_TAG }}
|
docker run --rm -d -p 9001:9001 --name test ${{ env.TEST_TAG }}
|
||||||
./bin/installDeps.sh
|
./bin/installDeps.sh
|
||||||
|
@ -102,11 +98,10 @@ jobs:
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
id: build-docker
|
|
||||||
if: github.event_name == 'push'
|
if: github.event_name == 'push'
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: ./etherpad
|
context: .
|
||||||
target: production
|
target: production
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
|
@ -116,28 +111,7 @@ jobs:
|
||||||
uses: peter-evans/dockerhub-description@v4
|
uses: peter-evans/dockerhub-description@v4
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
with:
|
with:
|
||||||
readme-filepath: ./etherpad/README.md
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
repository: etherpad/etherpad
|
repository: etherpad/etherpad
|
||||||
enable-url-completion: true
|
enable-url-completion: true
|
||||||
- name: Check out
|
|
||||||
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
|
|
||||||
|
|
2
.github/workflows/frontend-admin-tests.yml
vendored
2
.github/workflows/frontend-admin-tests.yml
vendored
|
@ -17,7 +17,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
node: [20, 22, 23]
|
node: [20, 22]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
|
|
|
@ -24,7 +24,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
node: [20, 22, 23]
|
node: [18, 20, 22]
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Check out latest release
|
name: Check out latest release
|
||||||
|
|
|
@ -90,7 +90,7 @@ services:
|
||||||
# ports:
|
# ports:
|
||||||
# - "5432:5432"
|
# - "5432:5432"
|
||||||
volumes:
|
volumes:
|
||||||
- postgres_data:/var/lib/postgresql/data
|
- postgres_data:/var/lib/postgresql/data/pgdata
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
|
|
|
@ -11,31 +11,31 @@
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@radix-ui/react-switch": "^1.1.4"
|
"@radix-ui/react-switch": "^1.1.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@radix-ui/react-dialog": "^1.1.7",
|
"@radix-ui/react-dialog": "^1.1.6",
|
||||||
"@radix-ui/react-toast": "^1.2.7",
|
"@radix-ui/react-toast": "^1.2.6",
|
||||||
"@types/react": "^19.1.2",
|
"@types/react": "^19.0.12",
|
||||||
"@types/react-dom": "^19.1.2",
|
"@types/react-dom": "^19.0.4",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.30.1",
|
"@typescript-eslint/eslint-plugin": "^8.28.0",
|
||||||
"@typescript-eslint/parser": "^8.30.1",
|
"@typescript-eslint/parser": "^8.28.0",
|
||||||
"@vitejs/plugin-react-swc": "^3.9.0",
|
"@vitejs/plugin-react-swc": "^3.8.1",
|
||||||
"eslint": "^9.23.0",
|
"eslint": "^9.23.0",
|
||||||
"eslint-plugin-react-hooks": "^5.2.0",
|
"eslint-plugin-react-hooks": "^5.2.0",
|
||||||
"eslint-plugin-react-refresh": "^0.4.19",
|
"eslint-plugin-react-refresh": "^0.4.19",
|
||||||
"i18next": "^25.0.0",
|
"i18next": "^24.2.3",
|
||||||
"i18next-browser-languagedetector": "^8.0.5",
|
"i18next-browser-languagedetector": "^8.0.4",
|
||||||
"lucide-react": "^0.501.0",
|
"lucide-react": "^0.487.0",
|
||||||
"react": "^19.1.0",
|
"react": "^19.1.0",
|
||||||
"react-dom": "^19.1.0",
|
"react-dom": "^19.1.0",
|
||||||
"react-hook-form": "^7.55.0",
|
"react-hook-form": "^7.55.0",
|
||||||
"react-i18next": "^15.4.1",
|
"react-i18next": "^15.4.1",
|
||||||
"react-router-dom": "^7.5.1",
|
"react-router-dom": "^7.4.1",
|
||||||
"socket.io-client": "^4.8.1",
|
"socket.io-client": "^4.8.1",
|
||||||
"typescript": "^5.8.2",
|
"typescript": "^5.8.2",
|
||||||
"vite": "^6.3.2",
|
"vite": "^6.2.5",
|
||||||
"vite-plugin-static-copy": "^2.3.1",
|
"vite-plugin-static-copy": "^2.3.0",
|
||||||
"vite-plugin-svgr": "^4.3.0",
|
"vite-plugin-svgr": "^4.3.0",
|
||||||
"zustand": "^5.0.3"
|
"zustand": "^5.0.3"
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
"ueberdb2": "^5.0.6"
|
"ueberdb2": "^5.0.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^22.14.1",
|
"@types/node": "^22.13.14",
|
||||||
"@types/semver": "^7.7.0",
|
"@types/semver": "^7.7.0",
|
||||||
"typescript": "^5.8.2"
|
"typescript": "^5.8.2"
|
||||||
},
|
},
|
||||||
|
|
990
pnpm-lock.yaml
generated
990
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
|
@ -96,7 +96,7 @@
|
||||||
* 3) if you want to use newlines in the default value of a string parameter,
|
* 3) if you want to use newlines in the default value of a string parameter,
|
||||||
* use "\n" as usual.
|
* use "\n" as usual.
|
||||||
*
|
*
|
||||||
* "defaultPadText" : "${DEFAULT_PAD_TEXT:Line 1\nLine 2}"
|
* "defaultPadText" : "${DEFAULT_PAD_TEXT}Line 1\nLine 2"
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -87,7 +87,7 @@
|
||||||
* 3) if you want to use newlines in the default value of a string parameter,
|
* 3) if you want to use newlines in the default value of a string parameter,
|
||||||
* use "\n" as usual.
|
* use "\n" as usual.
|
||||||
*
|
*
|
||||||
* "defaultPadText" : "${DEFAULT_PAD_TEXT:Line 1\nLine 2}"
|
* "defaultPadText" : "${DEFAULT_PAD_TEXT}Line 1\nLine 2"
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
{
|
|
||||||
"@metadata": {
|
|
||||||
"authors": [
|
|
||||||
"BOKOBA VEROLY"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"admin.page-title": "Admin Dashboard - Etherpad",
|
|
||||||
"admin_plugins": "Mokambi ya plug-in",
|
|
||||||
"admin_plugins.available": "Ba plugins oyo ezali",
|
|
||||||
"admin_plugins.available_not-found": "Ba plugins ezwamaki te.",
|
|
||||||
"admin_plugins.available_fetching": "Kozwa...",
|
|
||||||
"admin_plugins.available_install.value": "Kotya",
|
|
||||||
"admin_plugins.available_search.placeholder": "Bolukiluki ya ba plugins mpo na kotya",
|
|
||||||
"admin_plugins.description": "Ndimbola",
|
|
||||||
"admin_plugins.installed": "Ba plugins oyo etyamaki",
|
|
||||||
"admin_plugins.installed_fetching": "Kozwa ba plugins oyo etyamaki...",
|
|
||||||
"admin_plugins.installed_nothing": "Otikaki naino ba plugins te.",
|
|
||||||
"admin_plugins.installed_uninstall.value": "Kofungola esika",
|
|
||||||
"admin_plugins.last-update": "Makambo ya sika ya suka",
|
|
||||||
"admin_plugins.name": "Nkombo na yango",
|
|
||||||
"admin_plugins.page-title": "Gestionnaire de greffons — Etherpad",
|
|
||||||
"admin_plugins.version": "Libongoli",
|
|
||||||
"admin_plugins_info": "Informations de résolution de problème",
|
|
||||||
"admin_plugins_info.hooks": "Crochets installés",
|
|
||||||
"admin_plugins_info.hooks_client": "Crochets côté client",
|
|
||||||
"admin_plugins_info.hooks_server": "Crochets côté serveur",
|
|
||||||
"admin_plugins_info.parts": "Biteni oyo batye",
|
|
||||||
"admin_plugins_info.plugins": "Ba plugins oyo etyamaki",
|
|
||||||
"admin_plugins_info.page-title": "Makambo etali ordinatɛrɛ - Etherpad",
|
|
||||||
"admin_plugins_info.version": "Libongoli ya Etherpad",
|
|
||||||
"admin_plugins_info.version_latest": "Libongoli ya sika",
|
|
||||||
"admin_plugins_info.version_number": "Numero ya version",
|
|
||||||
"admin_settings": "Ndenge ya kobongisa yango",
|
|
||||||
"admin_settings.current": "Configuration ya lelo",
|
|
||||||
"admin_settings.current_example-devel": "Ndakisa modèle ya paramètres ya développement",
|
|
||||||
"admin_settings.current_example-prod": "Ndakisa modèle ya paramètres ya production",
|
|
||||||
"admin_settings.current_restart.value": "Bobandi lisusu Etherpad",
|
|
||||||
"admin_settings.current_save.value": "Bomba ba Paramètres",
|
|
||||||
"admin_settings.page-title": "Paramètres - Etherpad ya kosala",
|
|
||||||
"index.newPad": "Pad ya sika",
|
|
||||||
"index.createOpenPad": "to kosala/kofungola Pad na nkombo:",
|
|
||||||
"index.openPad": "kofungola Pad oyo ezali na nkombo:",
|
|
||||||
"pad.toolbar.bold.title": "Makomi ya moindo makasi (Ctrl+B)",
|
|
||||||
"pad.toolbar.underline.title": "Mokanda ya nse (Ctrl+U)",
|
|
||||||
"pad.toolbar.strikethrough.title": "Strikethrough (Ctrl+5)",
|
|
||||||
"pad.toolbar.ol.title": "Liste oyo esɛngami (Ctrl+Shift+N)",
|
|
||||||
"pad.toolbar.ul.title": "Liste oyo etyami na molongo te (Ctrl+Shift+L)",
|
|
||||||
"pad.toolbar.indent.title": "Indent (TAB)",
|
|
||||||
"pad.toolbar.unindent.title": "Mikuwa ya libándá (Shift+TAB)",
|
|
||||||
"pad.toolbar.undo.title": "Undo (Ctrl+Z)",
|
|
||||||
"pad.toolbar.redo.title": "Redo (Ctrl+Y)",
|
|
||||||
"pad.toolbar.clearAuthorship.title": "Langi ya polele ya mokomi (Ctrl+Shift+C)",
|
|
||||||
"pad.toolbar.import_export.title": "Kokotisa/kobimisa na/na ba formats ya ba fichiers ndenge na ndenge",
|
|
||||||
"pad.toolbar.timeslider.title": "Mokambi ya ntango",
|
|
||||||
"pad.toolbar.savedRevision.title": "Kobomba lisusu",
|
|
||||||
"pad.toolbar.settings.title": "Ndenge ya kobongisa yango",
|
|
||||||
"pad.toolbar.embed.title": "Kopesa mpe kobakisa yango",
|
|
||||||
"pad.toolbar.showusers.title": "Tyá bato oyo basalelaka yango",
|
|
||||||
"pad.colorpicker.save": "Kobikisa",
|
|
||||||
"pad.colorpicker.cancel": "Kolongola"
|
|
||||||
}
|
|
|
@ -5,10 +5,9 @@ import {ErrorCaused} from "../../types/ErrorCaused";
|
||||||
import {QueryType} from "../../types/QueryType";
|
import {QueryType} from "../../types/QueryType";
|
||||||
|
|
||||||
import {getAvailablePlugins, install, search, uninstall} from "../../../static/js/pluginfw/installer";
|
import {getAvailablePlugins, install, search, uninstall} from "../../../static/js/pluginfw/installer";
|
||||||
import {PackageData, PackageInfo} from "../../types/PackageInfo";
|
import {PackageData} from "../../types/PackageInfo";
|
||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
import log4js from 'log4js';
|
import log4js from 'log4js';
|
||||||
import {MapArrayType} from "../../types/MapType";
|
|
||||||
|
|
||||||
const pluginDefs = require('../../../static/js/pluginfw/plugin_defs');
|
const pluginDefs = require('../../../static/js/pluginfw/plugin_defs');
|
||||||
const logger = log4js.getLogger('adminPlugins');
|
const logger = log4js.getLogger('adminPlugins');
|
||||||
|
@ -22,13 +21,7 @@ exports.socketio = (hookName:string, args:ArgsExpressType, cb:Function) => {
|
||||||
if (!isAdmin) return;
|
if (!isAdmin) return;
|
||||||
|
|
||||||
const checkPluginForUpdates = async () => {
|
const checkPluginForUpdates = async () => {
|
||||||
let results: MapArrayType<PackageInfo>
|
const results = await getAvailablePlugins(/* maxCacheAge:*/ 60 * 10);
|
||||||
try {
|
|
||||||
results = await getAvailablePlugins(/* maxCacheAge:*/ 60 * 10);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error checking for plugin updates:', error);
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
return Object.keys(pluginDefs.plugins).filter((plugin) => {
|
return Object.keys(pluginDefs.plugins).filter((plugin) => {
|
||||||
if (!results[plugin]) return false;
|
if (!results[plugin]) return false;
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,6 @@ exports.authnFailureDelayMs = 1000;
|
||||||
|
|
||||||
const staticResources = [
|
const staticResources = [
|
||||||
/^\/padbootstrap-[a-zA-Z0-9]+\.min\.js$/,
|
/^\/padbootstrap-[a-zA-Z0-9]+\.min\.js$/,
|
||||||
/^\/timeSliderBootstrap-[a-zA-Z0-9]+\.min\.js$/,
|
|
||||||
/^\/manifest.json$/
|
/^\/manifest.json$/
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -42,10 +42,6 @@ if (settings.dumpOnUncleanExit) {
|
||||||
const addProxyToAxios = (url: URL) => {
|
const addProxyToAxios = (url: URL) => {
|
||||||
axios.defaults.proxy = {
|
axios.defaults.proxy = {
|
||||||
host: url.hostname,
|
host: url.hostname,
|
||||||
auth: {
|
|
||||||
username: url.username,
|
|
||||||
password: url.password,
|
|
||||||
},
|
|
||||||
port: Number(url.port),
|
port: Number(url.port),
|
||||||
protocol: url.protocol,
|
protocol: url.protocol,
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,6 @@
|
||||||
"jsdom": "^26.0.0",
|
"jsdom": "^26.0.0",
|
||||||
"jsonminify": "0.4.2",
|
"jsonminify": "0.4.2",
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.2",
|
||||||
"jwt-decode": "^4.0.0",
|
|
||||||
"languages4translatewiki": "0.1.3",
|
"languages4translatewiki": "0.1.3",
|
||||||
"live-plugin-manager": "^1.0.0",
|
"live-plugin-manager": "^1.0.0",
|
||||||
"lodash.clonedeep": "4.5.0",
|
"lodash.clonedeep": "4.5.0",
|
||||||
|
@ -60,7 +59,7 @@
|
||||||
"oidc-provider": "^8.8.1",
|
"oidc-provider": "^8.8.1",
|
||||||
"openapi-backend": "^5.11.1",
|
"openapi-backend": "^5.11.1",
|
||||||
"proxy-addr": "^2.0.7",
|
"proxy-addr": "^2.0.7",
|
||||||
"rate-limiter-flexible": "^7.0.0",
|
"rate-limiter-flexible": "^6.2.1",
|
||||||
"rehype": "^13.0.2",
|
"rehype": "^13.0.2",
|
||||||
"rehype-minify-whitespace": "^6.0.2",
|
"rehype-minify-whitespace": "^6.0.2",
|
||||||
"resolve": "1.22.10",
|
"resolve": "1.22.10",
|
||||||
|
@ -71,6 +70,7 @@
|
||||||
"socket.io-client": "^4.8.1",
|
"socket.io-client": "^4.8.1",
|
||||||
"superagent": "10.2.0",
|
"superagent": "10.2.0",
|
||||||
"swagger-ui-express": "^5.0.1",
|
"swagger-ui-express": "^5.0.1",
|
||||||
|
"jwt-decode": "^4.0.0",
|
||||||
"tinycon": "0.6.8",
|
"tinycon": "0.6.8",
|
||||||
"tsx": "4.19.3",
|
"tsx": "4.19.3",
|
||||||
"ueberdb2": "^5.0.6",
|
"ueberdb2": "^5.0.6",
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
"etherpad-lite": "node/server.ts"
|
"etherpad-lite": "node/server.ts"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@playwright/test": "^1.52.0",
|
"@playwright/test": "^1.51.1",
|
||||||
"@types/async": "^3.2.24",
|
"@types/async": "^3.2.24",
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
"@types/formidable": "^3.4.5",
|
"@types/formidable": "^3.4.5",
|
||||||
|
@ -94,7 +94,7 @@
|
||||||
"@types/jsonwebtoken": "^9.0.9",
|
"@types/jsonwebtoken": "^9.0.9",
|
||||||
"@types/mime-types": "^2.1.4",
|
"@types/mime-types": "^2.1.4",
|
||||||
"@types/mocha": "^10.0.9",
|
"@types/mocha": "^10.0.9",
|
||||||
"@types/node": "^22.14.1",
|
"@types/node": "^22.13.14",
|
||||||
"@types/oidc-provider": "^8.8.1",
|
"@types/oidc-provider": "^8.8.1",
|
||||||
"@types/semver": "^7.7.0",
|
"@types/semver": "^7.7.0",
|
||||||
"@types/sinon": "^17.0.3",
|
"@types/sinon": "^17.0.3",
|
||||||
|
|
|
@ -162,18 +162,23 @@ export const install = async (pluginName: string, cb:Function|null = null) => {
|
||||||
export let availablePlugins:MapArrayType<PackageInfo>|null = null;
|
export let availablePlugins:MapArrayType<PackageInfo>|null = null;
|
||||||
let cacheTimestamp = 0;
|
let cacheTimestamp = 0;
|
||||||
|
|
||||||
export const getAvailablePlugins = async (maxCacheAge: number | false) => {
|
export const getAvailablePlugins = (maxCacheAge: number|false) => {
|
||||||
const nowTimestamp = Math.round(Date.now() / 1000);
|
const nowTimestamp = Math.round(Date.now() / 1000);
|
||||||
|
|
||||||
|
return new Promise<MapArrayType<PackageInfo>>(async (resolve, reject) => {
|
||||||
// check cache age before making any request
|
// check cache age before making any request
|
||||||
if (availablePlugins && maxCacheAge && (nowTimestamp - cacheTimestamp) <= maxCacheAge) {
|
if (availablePlugins && maxCacheAge && (nowTimestamp - cacheTimestamp) <= maxCacheAge) {
|
||||||
return availablePlugins;
|
return resolve(availablePlugins);
|
||||||
}
|
}
|
||||||
|
|
||||||
const pluginsLoaded: AxiosResponse<MapArrayType<PackageInfo>> = await axios.get(`${settings.updateServer}/plugins.json`, {headers})
|
await axios.get(`${settings.updateServer}/plugins.json`, {headers})
|
||||||
|
.then((pluginsLoaded:AxiosResponse<MapArrayType<PackageInfo>>) => {
|
||||||
availablePlugins = pluginsLoaded.data;
|
availablePlugins = pluginsLoaded.data;
|
||||||
cacheTimestamp = nowTimestamp;
|
cacheTimestamp = nowTimestamp;
|
||||||
return availablePlugins;
|
resolve(availablePlugins);
|
||||||
|
})
|
||||||
|
.catch(async (err) => reject(err));
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -206,7 +211,4 @@ export const search = (searchTerm: string, maxCacheAge: number) => getAvailableP
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
).catch((err)=>{
|
);
|
||||||
logger.error(`Error searching plugins: ${err}`);
|
|
||||||
return {} as MapArrayType<PackageInfo>;
|
|
||||||
});
|
|
||||||
|
|
|
@ -12,6 +12,6 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"ep_etherpad-lite": "workspace:../src",
|
"ep_etherpad-lite": "workspace:../src",
|
||||||
"typescript": "^5.8.2",
|
"typescript": "^5.8.2",
|
||||||
"vite": "^6.3.2"
|
"vite": "^6.2.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue