Merge remote-tracking branch 'origin/develop' into feat/add_revision_cleanup

This commit is contained in:
Stefan Müller 2024-09-10 11:09:46 +02:00
commit 491d4af19e
15 changed files with 241 additions and 204 deletions

View file

@ -107,6 +107,7 @@ exports.ttl = {
RefreshToken: 1 * 24 * 60 * 60, // 1 day in seconds
}
exports.updateServer = "https://static.etherpad.org"
/*
@ -941,11 +942,12 @@ exports.reloadSettings = () => {
logger.warn(`${dirtyWarning} File location: ${exports.dbSettings.filename}`);
}
if (exports.dbType === 'rustydb') {
if (exports.dbType === 'rustydb' || exports.dbType === "sqlite") {
exports.dbSettings.filename = absolutePaths.makeAbsolute(exports.dbSettings.filename);
logger.warn(`File location: ${exports.dbSettings.filename}`);
}
if (exports.ip === '') {
// using Unix socket for connectivity
logger.warn('The settings file contains an empty string ("") for the "ip" parameter. The ' +

View file

@ -20,7 +20,7 @@ const loadEtherpadInformations = () => {
return infos;
}
return axios.get('https://static.etherpad.org/info.json', {headers: headers})
return axios.get(`${settings.updateServer}/info.json`, {headers: headers})
.then(async (resp: any) => {
infos = await resp.data;
if (infos === undefined || infos === null) {

View file

@ -70,11 +70,11 @@
"superagent": "10.1.0",
"tinycon": "0.6.8",
"tsx": "4.19.0",
"ueberdb2": "^4.2.103",
"ueberdb2": "^5.0.2",
"underscore": "1.13.7",
"unorm": "1.6.0",
"wtfnode": "^0.9.3",
"rusty-store-kv": "^1.2.0"
"rusty-store-kv": "^1.3.1"
},
"bin": {
"etherpad-healthcheck": "../bin/etherpad-healthcheck",
@ -99,7 +99,7 @@
"@types/supertest": "^6.0.2",
"@types/underscore": "^1.11.15",
"chokidar": "^3.6.0",
"eslint": "^9.9.1",
"eslint": "^9.10.0",
"eslint-config-etherpad": "^4.0.4",
"etherpad-cli-client": "^3.0.2",
"mocha": "^10.7.3",
@ -138,6 +138,6 @@
"debug:socketio": "cross-env DEBUG=socket.io* node --require tsx/cjs node/server.ts",
"test:vitest": "vitest"
},
"version": "2.2.3",
"version": "2.2.4",
"license": "Apache-2.0"
}

View file

@ -167,7 +167,7 @@ function Ace2Inner(editorInfo, cssManagers) {
for (const name of names) console[name] = noop;
}
const scheduler = parent; // hack for opera required
const scheduler = window; // hack for opera required
const performDocumentReplaceRange = (start, end, newText) => {
if (start === undefined) start = rep.selStart;
@ -240,7 +240,7 @@ function Ace2Inner(editorInfo, cssManagers) {
bgcolor = fadeColor(bgcolor, info.fade);
}
const textColor =
colorutils.textColorFromBackgroundColor(bgcolor, parent.parent.clientVars.skinName);
colorutils.textColorFromBackgroundColor(bgcolor, window.clientVars.skinName);
const styles = [
cssManagers.inner.selectorStyle(authorSelector),
cssManagers.parent.selectorStyle(authorSelector),
@ -1270,7 +1270,7 @@ function Ace2Inner(editorInfo, cssManagers) {
const prevLine = rep.lines.prev(thisLine);
const prevLineText = prevLine.text;
let theIndent = /^ *(?:)/.exec(prevLineText)[0];
const shouldIndent = parent.parent.clientVars.indentationOnNewLine;
const shouldIndent = window.clientVars.indentationOnNewLine;
if (shouldIndent && /[[(:{]\s*$/.exec(prevLineText)) {
theIndent += THE_TAB;
}
@ -2023,7 +2023,7 @@ function Ace2Inner(editorInfo, cssManagers) {
const isPadLoading = (t) => t === 'setup' || t === 'setBaseText' || t === 'importText';
const updateStyleButtonState = (attribName, hasStyleOnRepSelection) => {
const $formattingButton = parent.parent.$(`[data-key="${attribName}"]`).find('a');
const $formattingButton = window.$(`[data-key="${attribName}"]`).find('a');
$formattingButton.toggleClass(SELECT_BUTTON_CLASS, hasStyleOnRepSelection);
};
@ -2277,7 +2277,7 @@ function Ace2Inner(editorInfo, cssManagers) {
};
const hideEditBarDropdowns = () => {
window.parent.parent.padeditbar.toggleDropDown('none');
window.padeditbar.toggleDropDown('none');
};
const renumberList = (lineNum) => {
@ -2582,7 +2582,7 @@ function Ace2Inner(editorInfo, cssManagers) {
specialHandled = specialHandledInHook.indexOf(true) !== -1;
}
const padShortcutEnabled = parent.parent.clientVars.padShortcutEnabled;
const padShortcutEnabled = window.clientVars.padShortcutEnabled;
if (!specialHandled && isTypeForSpecialKey &&
altKey && keyCode === 120 &&
padShortcutEnabled.altF9) {
@ -2591,7 +2591,7 @@ function Ace2Inner(editorInfo, cssManagers) {
// As ubuntu cannot use Alt F10....
// Focus on the editbar.
// -- TODO: Move Focus back to previous state (we know it so we can use it)
const firstEditbarElement = parent.parent.$('#editbar')
const firstEditbarElement = window.$('#editbar')
.children('ul').first().children().first()
.children().first().children().first();
$(this).trigger('blur');
@ -2603,8 +2603,8 @@ function Ace2Inner(editorInfo, cssManagers) {
padShortcutEnabled.altC) {
// Alt c focuses on the Chat window
$(this).trigger('blur');
parent.parent.chat.show();
parent.parent.$('#chatinput').trigger('focus');
window.chat.show();
window.$('#chatinput').trigger('focus');
evt.preventDefault();
}
if (!specialHandled && type === 'keydown' &&
@ -2626,12 +2626,12 @@ function Ace2Inner(editorInfo, cssManagers) {
if (authorId) authorIds.add(authorId);
}
}
const idToName = new Map(parent.parent.pad.userList().map((a) => [a.userId, a.name]));
const myId = parent.parent.clientVars.userId;
const idToName = new Map(window.pad.userList().map((a) => [a.userId, a.name]));
const myId = window.clientVars.userId;
const authors =
[...authorIds].map((id) => id === myId ? 'me' : idToName.get(id) || 'unknown');
parent.parent.$.gritter.add({
window.$.gritter.add({
title: 'Line Authors',
text:
authors.length === 0 ? 'No author information is available'
@ -2680,7 +2680,7 @@ function Ace2Inner(editorInfo, cssManagers) {
specialHandled = true;
// close all gritters when the user hits escape key
parent.parent.$.gritter.removeAll();
window.$.gritter.removeAll();
}
if (!specialHandled && isTypeForCmdKey &&
/* Do a saved revision on ctrl S */
@ -2688,13 +2688,13 @@ function Ace2Inner(editorInfo, cssManagers) {
!evt.altKey &&
padShortcutEnabled.cmdS) {
evt.preventDefault();
const originalBackground = parent.parent.$('#revisionlink').css('background');
parent.parent.$('#revisionlink').css({background: 'lightyellow'});
const originalBackground = window.$('#revisionlink').css('background');
window.$('#revisionlink').css({background: 'lightyellow'});
scheduler.setTimeout(() => {
parent.parent.$('#revisionlink').css({background: originalBackground});
window.$('#revisionlink').css({background: originalBackground});
}, 1000);
/* The parent.parent part of this is BAD and I feel bad.. It may break something */
parent.parent.pad.collabClient.sendMessage({type: 'SAVE_REVISION'});
window.pad.collabClient.sendMessage({type: 'SAVE_REVISION'});
specialHandled = true;
}
if (!specialHandled && isTypeForSpecialKey &&

View file

@ -140,7 +140,7 @@ const makeChangesetTracker = (scheduler, apool, aceCallbacksProvider) => {
toSubmit = compose(submittedChangeset, userChangeset, apool);
} else {
// Get my authorID
const authorId = parent.parent.pad.myUserInfo.userId;
const authorId = window.pad.myUserInfo.userId;
// Sanitize authorship: Replace all author attributes with this user's author ID in case the
// text was copied from another author.

View file

@ -171,7 +171,7 @@ export const getAvailablePlugins = (maxCacheAge: number|false) => {
return resolve(availablePlugins);
}
await axios.get('https://static.etherpad.org/plugins.json', {headers})
await axios.get(`${settings.updateServer}/plugins.json`, {headers})
.then((pluginsLoaded:AxiosResponse<MapArrayType<PackageInfo>>) => {
availablePlugins = pluginsLoaded.data;
cacheTimestamp = nowTimestamp;

View file

@ -15,7 +15,8 @@ class Scroll {
// DOM reference
this.outerWin = outerWin;
this.doc = this.outerWin.contentDocument!;
this.rootDocument = parent.parent.document;
this.rootDocument = document;
console.log(this.rootDocument)
}
scrollWhenCaretIsInTheLastLineOfViewportWhenNecessary(rep: RepModel, isScrollableEvent: boolean, innerHeight: number) {
@ -112,7 +113,7 @@ class Scroll {
};
_getEditorPositionTop() {
const editor = parent.document.getElementsByTagName('iframe');
const editor = document.getElementsByTagName('iframe');
const editorPositionTop = editor[0].offsetTop;
return editorPositionTop;
};