Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desktop: Resolves #7934: Add Simple Backup as a default plugin #9360

Merged
merged 46 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
e6a70ea
WIP: Build default plugins in CI
personalizedrefrigerator Nov 22, 2023
3ff8dae
Plugin base repo
personalizedrefrigerator Nov 22, 2023
9be4526
Bundle note tabs and simple backup with the app
personalizedrefrigerator Nov 22, 2023
af9efa8
Remove note tabs from default plugins
personalizedrefrigerator Nov 23, 2023
4514e1b
Change patch method for simple-backup
personalizedrefrigerator Nov 23, 2023
6181e22
Change @joplin/utils dependency version specifier
personalizedrefrigerator Nov 23, 2023
610b0e3
Try to fix @joplin/utils dependency
personalizedrefrigerator Nov 24, 2023
fd88f12
Fix build
personalizedrefrigerator Nov 24, 2023
7396698
Initialize submodules on build if not yet initialized
personalizedrefrigerator Nov 24, 2023
9887ed7
Fix "no commit author" in CI and try to decrease size of simple-backu…
personalizedrefrigerator Nov 24, 2023
812fd2e
Use same version of `@types/yargs` as other packages
personalizedrefrigerator Nov 24, 2023
9db257b
Try to fix build on Windows
personalizedrefrigerator Nov 24, 2023
3cbd360
Mark plugins as built-in in manifest
personalizedrefrigerator Nov 24, 2023
632f011
Improve plugin patch command
personalizedrefrigerator Nov 24, 2023
8899d8f
Fix 7zip backups
personalizedrefrigerator Nov 24, 2023
f0545d0
Significantly decrease patch size
personalizedrefrigerator Nov 26, 2023
615fbe4
Merge remote-tracking branch 'upstream/dev' into pr/default-plugins
personalizedrefrigerator Nov 28, 2023
75b8227
Clone with git, rather than use submodules & change commit used for s…
personalizedrefrigerator Nov 28, 2023
da8953b
Refactoring
personalizedrefrigerator Nov 28, 2023
b4d115e
Show UI to mark a plugin as built-in
personalizedrefrigerator Nov 28, 2023
20d30db
Prevent default plugins from being updated through settings
personalizedrefrigerator Nov 28, 2023
b6f89b4
Fix 7zip still bundled with default copy of backup plugin
personalizedrefrigerator Nov 29, 2023
ddfd3ec
Merge remote-tracking branch 'upstream/dev' into pr/default-plugins
personalizedrefrigerator Nov 29, 2023
6a4cf2f
Update @types/yargs to match recent Renovate commit
personalizedrefrigerator Nov 29, 2023
ebfc8ab
Refactor build script into multiple files
personalizedrefrigerator Dec 4, 2023
3f4f1f5
Refactor: Make default-plugins a dependency of the desktop app (and b…
personalizedrefrigerator Dec 4, 2023
c743006
Remove built gulpfile
personalizedrefrigerator Dec 4, 2023
840d2e8
tsconfig.json: Avoid compiling gulpfile.ts
personalizedrefrigerator Dec 4, 2023
5868af5
Update default_plugins.md
personalizedrefrigerator Dec 5, 2023
2ca5a7b
Update simple backup plugin
personalizedrefrigerator Dec 5, 2023
58ffb86
Update gulpfile: Build default plugins after other portions of build …
personalizedrefrigerator Dec 5, 2023
ad1cb0d
Update setupNewRelease to also increase default-plugins package version
personalizedrefrigerator Dec 6, 2023
17fa5f7
Spelling: Remove extra "e"
personalizedrefrigerator Dec 6, 2023
304db99
Merge remote-tracking branch 'upstream/dev' into pr/default-plugins
personalizedrefrigerator Dec 7, 2023
40235f7
Revert changes to webpack.config.js: By default don't give plugin aut…
personalizedrefrigerator Dec 7, 2023
c47c2d1
Include only the 7zip binary for the current platform
personalizedrefrigerator Dec 7, 2023
2bf0e2c
Copy 7za for the target platform and architecture, not the current
personalizedrefrigerator Dec 7, 2023
8509fa8
Logging
personalizedrefrigerator Dec 7, 2023
d41d3f2
Add simple default plugins test
personalizedrefrigerator Dec 7, 2023
4165edd
Remove generated .js file from version control
personalizedrefrigerator Dec 7, 2023
806c7e5
Add additional simple backup test
personalizedrefrigerator Dec 7, 2023
4954c61
Fix importing 7zip-bin, fix "read only file system" error
personalizedrefrigerator Dec 7, 2023
9c581a1
Fix importing 7zip-bin in development mode
personalizedrefrigerator Dec 7, 2023
efc9dc4
Trying to make end-to-end test more reliable
personalizedrefrigerator Dec 7, 2023
c1ccafe
Make end-to-end tests more reliable -- wait for plugins to load
personalizedrefrigerator Dec 8, 2023
6926af8
Revert part of patch change to Simple Backup -- the error message it …
personalizedrefrigerator Dec 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ packages/app-mobile/locales
packages/app-mobile/node_modules
packages/app-mobile/pluginAssets/
packages/fork-*
packages/default-plugins/plugin-base-repo/
packages/default-plugins/plugin-sources/
packages/htmlpack/dist/
packages/lib/assets/
packages/lib/lib/lib.js
Expand Down Expand Up @@ -380,10 +382,12 @@ packages/app-desktop/gui/style/StyledTextInput.js
packages/app-desktop/gui/utils/NoteListUtils.js
packages/app-desktop/gui/utils/convertToScreenCoordinates.js
packages/app-desktop/gui/utils/loadScript.js
packages/app-desktop/gulpfile.js
packages/app-desktop/integration-tests/main.spec.js
packages/app-desktop/integration-tests/models/MainScreen.js
packages/app-desktop/integration-tests/models/NoteEditorScreen.js
packages/app-desktop/integration-tests/models/SettingsScreen.js
packages/app-desktop/integration-tests/simpleBackup.spec.js
packages/app-desktop/integration-tests/util/activateMainMenuItem.js
packages/app-desktop/integration-tests/util/createStartupArgs.js
packages/app-desktop/integration-tests/util/firstNonDevToolsWindow.js
Expand Down Expand Up @@ -415,6 +419,7 @@ packages/app-desktop/services/sortOrder/PerFolderSortOrderService.js
packages/app-desktop/services/sortOrder/notesSortOrderUtils.test.js
packages/app-desktop/services/sortOrder/notesSortOrderUtils.js
packages/app-desktop/services/spellChecker/SpellCheckerServiceDriverNative.js
packages/app-desktop/tools/copy7Zip.js
packages/app-desktop/tools/notarizeMacApp.js
packages/app-desktop/tools/renameReleaseAssets.js
packages/app-desktop/utils/checkForUpdatesUtils.test.js
Expand Down Expand Up @@ -530,6 +535,13 @@ packages/app-mobile/utils/fs-driver/runOnDeviceTests.js
packages/app-mobile/utils/setupNotifications.js
packages/app-mobile/utils/shareHandler.js
packages/app-mobile/utils/types.js
packages/default-plugins/build.js
packages/default-plugins/buildDefaultPlugins.js
packages/default-plugins/commands/buildAll.js
packages/default-plugins/commands/editPatch.js
packages/default-plugins/utils/getPathToPatchFileFor.js
packages/default-plugins/utils/readRepositoryJson.js
packages/default-plugins/utils/waitForCliInput.js
packages/editor/CodeMirror/CodeMirror5Emulation/CodeMirror5Emulation.test.js
packages/editor/CodeMirror/CodeMirror5Emulation/CodeMirror5Emulation.js
packages/editor/CodeMirror/CodeMirror5Emulation/Decorator.js
Expand Down Expand Up @@ -1011,8 +1023,6 @@ packages/tools/build-translation.js
packages/tools/build-welcome.js
packages/tools/buildServerDocker.test.js
packages/tools/buildServerDocker.js
packages/tools/bundleDefaultPlugins.test.js
packages/tools/bundleDefaultPlugins.js
packages/tools/checkIgnoredFiles.js
packages/tools/checkLibPaths.test.js
packages/tools/checkLibPaths.js
Expand Down
12 changes: 10 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,12 @@ packages/app-desktop/gui/style/StyledTextInput.js
packages/app-desktop/gui/utils/NoteListUtils.js
packages/app-desktop/gui/utils/convertToScreenCoordinates.js
packages/app-desktop/gui/utils/loadScript.js
packages/app-desktop/gulpfile.js
packages/app-desktop/integration-tests/main.spec.js
packages/app-desktop/integration-tests/models/MainScreen.js
packages/app-desktop/integration-tests/models/NoteEditorScreen.js
packages/app-desktop/integration-tests/models/SettingsScreen.js
packages/app-desktop/integration-tests/simpleBackup.spec.js
packages/app-desktop/integration-tests/util/activateMainMenuItem.js
packages/app-desktop/integration-tests/util/createStartupArgs.js
packages/app-desktop/integration-tests/util/firstNonDevToolsWindow.js
Expand Down Expand Up @@ -397,6 +399,7 @@ packages/app-desktop/services/sortOrder/PerFolderSortOrderService.js
packages/app-desktop/services/sortOrder/notesSortOrderUtils.test.js
packages/app-desktop/services/sortOrder/notesSortOrderUtils.js
packages/app-desktop/services/spellChecker/SpellCheckerServiceDriverNative.js
packages/app-desktop/tools/copy7Zip.js
packages/app-desktop/tools/notarizeMacApp.js
packages/app-desktop/tools/renameReleaseAssets.js
packages/app-desktop/utils/checkForUpdatesUtils.test.js
Expand Down Expand Up @@ -512,6 +515,13 @@ packages/app-mobile/utils/fs-driver/runOnDeviceTests.js
packages/app-mobile/utils/setupNotifications.js
packages/app-mobile/utils/shareHandler.js
packages/app-mobile/utils/types.js
packages/default-plugins/build.js
packages/default-plugins/buildDefaultPlugins.js
packages/default-plugins/commands/buildAll.js
packages/default-plugins/commands/editPatch.js
packages/default-plugins/utils/getPathToPatchFileFor.js
packages/default-plugins/utils/readRepositoryJson.js
packages/default-plugins/utils/waitForCliInput.js
packages/editor/CodeMirror/CodeMirror5Emulation/CodeMirror5Emulation.test.js
packages/editor/CodeMirror/CodeMirror5Emulation/CodeMirror5Emulation.js
packages/editor/CodeMirror/CodeMirror5Emulation/Decorator.js
Expand Down Expand Up @@ -993,8 +1003,6 @@ packages/tools/build-translation.js
packages/tools/build-welcome.js
packages/tools/buildServerDocker.test.js
packages/tools/buildServerDocker.js
packages/tools/bundleDefaultPlugins.test.js
packages/tools/bundleDefaultPlugins.js
packages/tools/checkIgnoredFiles.js
packages/tools/checkLibPaths.test.js
packages/tools/checkLibPaths.js
Expand Down
4 changes: 3 additions & 1 deletion .npmpackagejsonlintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
packages/app-clipper/popup/
packages/app-cli/tests/support/plugins/
packages/doc-builder/
packages/doc-builder/
packages/default-plugins/plugin-base-repo/
packages/default-plugins/plugin-sources/
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,11 @@ describe('defaultPluginsUtils', () => {

const defaultPluginsInfo: DefaultPluginsInfo = {
'io.github.jackgruber.backup': {
version: '1.0.2',
settings: {
'path': `${Setting.value('profileDir')}`,
},
},
'plugin.calebjohn.rich-markdown': {
version: '0.8.3',
},
};

Expand Down Expand Up @@ -245,14 +243,12 @@ describe('defaultPluginsUtils', () => {

const defaultPluginsInfo: DefaultPluginsInfo = {
'io.github.jackgruber.backup': {
version: '1.0.2',
settings: {
'path': `${Setting.value('profileDir')}`,
'missing-key1': 'someValue',
},
},
'plugin.calebjohn.rich-markdown': {
version: '0.8.3',
settings: {
'missing-key2': 'someValue',
},
Expand Down
3 changes: 3 additions & 0 deletions packages/app-desktop/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ test-results/
playwright-report/
playwright/.cache/
integration-tests/test-profile/
build/defaultPlugins/
build/7zip/7za
build/7zip/7za.exe
7 changes: 6 additions & 1 deletion packages/app-desktop/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { reg } from '@joplin/lib/registry';
const packageInfo: PackageInfo = require('./packageInfo.js');
import DecryptionWorker from '@joplin/lib/services/DecryptionWorker';
import ClipperServer from '@joplin/lib/ClipperServer';
const { webFrame } = require('electron');
import { ipcRenderer, webFrame } from 'electron';
const Menu = bridge().Menu;
const PluginManager = require('@joplin/lib/services/PluginManager');
import RevisionService from '@joplin/lib/services/RevisionService';
Expand Down Expand Up @@ -333,6 +333,11 @@ class Application extends BaseApplication {
type: 'STARTUP_PLUGINS_LOADED',
value: true,
});

// Sends an event to the main process -- this is used by the Playwright
// tests to wait for plugins to load.
ipcRenderer.send('startup-plugins-loaded');

setSettingsForDefaultPlugins(getDefaultPluginsInfo());
}
}, 500);
Expand Down
90 changes: 90 additions & 0 deletions packages/app-desktop/build/7zip/license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
7-Zip
~~~~~
License for use and distribution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

7-Zip Copyright (C) 1999-2023 Igor Pavlov.

The licenses for files are:

1) 7z.dll:
- The "GNU LGPL" as main license for most of the code
- The "GNU LGPL" with "unRAR license restriction" for some code
- The "BSD 3-clause License" for some code
2) All other files: the "GNU LGPL".

Redistributions in binary form must reproduce related license information from this file.

Note:
You can use 7-Zip on any computer, including a computer in a commercial
organization. You don't need to register or pay for 7-Zip.


GNU LGPL information
--------------------

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You can receive a copy of the GNU Lesser General Public License from
http://www.gnu.org/




BSD 3-clause License
--------------------

The "BSD 3-clause License" is used for the code in 7z.dll that implements LZFSE data decompression.
That code was derived from the code in the "LZFSE compression library" developed by Apple Inc,
that also uses the "BSD 3-clause License":

----
Copyright (c) 2015-2016, Apple Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder(s) nor the names of any contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----




unRAR license restriction
-------------------------

The decompression engine for RAR archives was developed using source
code of unRAR program.
All copyrights to original unRAR code are owned by Alexander Roshal.

The license for original unRAR code has the following restriction:

The unRAR sources cannot be used to re-create the RAR compression algorithm,
which is proprietary. Distribution of modified unRAR sources in separate form
or as a part of other software is permitted, provided that it is clearly
stated in the documentation and source comments that the code may
not be used to develop a RAR (WinRAR) compatible archiver.


--
Igor Pavlov
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const CellRoot = styled.div<{ isCompatible: boolean }>`
box-sizing: border-box;
background-color: ${props => props.theme.backgroundColor};
flex-direction: column;
align-items: flex-start;
align-items: stretch;
padding: 15px;
border: 1px solid ${props => props.theme.dividerColor};
border-radius: 6px;
Expand Down Expand Up @@ -96,12 +96,15 @@ const NeedUpgradeMessage = styled.span`
font-size: ${props => props.theme.fontSize}px;
`;

const DevModeLabel = styled.div`
const BoxedLabel = styled.div`
border: 1px solid ${props => props.theme.color};
border-radius: 4px;
padding: 4px 6px;
font-size: ${props => props.theme.fontSize * 0.75}px;
color: ${props => props.theme.color};
flex-grow: 0;
height: min-content;
margin-top: auto;
`;

const StyledNameAndVersion = styled.div<{ mb: any }>`
Expand Down Expand Up @@ -170,7 +173,7 @@ export default function(props: Props) {
if (!props.onToggle) return null;

if (item.devMode) {
return <DevModeLabel>DEV</DevModeLabel>;
return <BoxedLabel>DEV</BoxedLabel>;
}

return <ToggleButton
Expand Down Expand Up @@ -217,6 +220,17 @@ export default function(props: Props) {
/>;
}

const renderDefaultPluginLabel = () => {
// Built-in plugins can only be disabled
if (item.manifest._built_in) {
return (
<BoxedLabel>{_('Built in')}</BoxedLabel>
laurent22 marked this conversation as resolved.
Show resolved Hide resolved
);
}

return null;
};

function renderFooter() {
if (item.devMode) return null;

Expand All @@ -236,6 +250,7 @@ export default function(props: Props) {
{renderInstallButton()}
{renderUpdateButton()}
<div style={{ display: 'flex', flex: 1 }}/>
{renderDefaultPluginLabel()}
</CellFooter>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,18 @@ export default function(props: Props) {
let cancelled = false;

async function fetchPluginIds() {
const pluginIds = await repoApi().canBeUpdatedPlugins(pluginItems.map(p => p.manifest), pluginService.appVersion);
// Built-in plugins can't be updated from the main repoApi
const nonDefaultPlugins = pluginItems
.map(p => p.manifest)
.filter(manifest => !manifest._built_in);

const pluginIds = await repoApi().canBeUpdatedPlugins(nonDefaultPlugins, pluginService.appVersion);
if (cancelled) return;

const conv: Record<string, boolean> = {};
// eslint-disable-next-line github/array-foreach -- Old code before rule was applied
pluginIds.forEach(id => conv[id] = true);
for (const id of pluginIds) {
conv[id] = true;
}
setCanBeUpdatedPluginIds(conv);
}

Expand Down Expand Up @@ -281,10 +288,17 @@ export default function(props: Props) {
</UserPluginsRoot>
);
} else {
const nonDefaultPlugins = pluginItems.filter(item => !item.manifest._built_in);
const defaultPlugins = pluginItems.filter(item => item.manifest._built_in);
return (
<UserPluginsRoot>
{renderCells(pluginItems)}
</UserPluginsRoot>
<>
<UserPluginsRoot>
{renderCells(nonDefaultPlugins)}
</UserPluginsRoot>
<UserPluginsRoot>
{renderCells(defaultPlugins)}
</UserPluginsRoot>
</>
);
}
}
Expand Down
Loading
Loading