mirror of
https://github.com/laurent22/joplin.git
synced 2025-02-04 19:16:07 +02:00
Revert "Merge branch 'desktop-protocol' of https://github.com/roman-r-m/joplin into dev"
This reverts commit 7c85889c1f94eadcbcf21675aec5d576b77ba781, reversing changes made to ab134807eae53b303fe8bb054ec5808543fa9624. Reason: Messed up and accidentally merged a pull request.
This commit is contained in:
parent
7c85889c1f
commit
f371bb8e59
@ -864,9 +864,6 @@ packages/lib/Logger.js.map
|
|||||||
packages/lib/PoorManIntervals.d.ts
|
packages/lib/PoorManIntervals.d.ts
|
||||||
packages/lib/PoorManIntervals.js
|
packages/lib/PoorManIntervals.js
|
||||||
packages/lib/PoorManIntervals.js.map
|
packages/lib/PoorManIntervals.js.map
|
||||||
packages/lib/ProtocolUtils.d.ts
|
|
||||||
packages/lib/ProtocolUtils.js
|
|
||||||
packages/lib/ProtocolUtils.js.map
|
|
||||||
packages/lib/SyncTargetJoplinCloud.d.ts
|
packages/lib/SyncTargetJoplinCloud.d.ts
|
||||||
packages/lib/SyncTargetJoplinCloud.js
|
packages/lib/SyncTargetJoplinCloud.js
|
||||||
packages/lib/SyncTargetJoplinCloud.js.map
|
packages/lib/SyncTargetJoplinCloud.js.map
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -850,9 +850,6 @@ packages/lib/Logger.js.map
|
|||||||
packages/lib/PoorManIntervals.d.ts
|
packages/lib/PoorManIntervals.d.ts
|
||||||
packages/lib/PoorManIntervals.js
|
packages/lib/PoorManIntervals.js
|
||||||
packages/lib/PoorManIntervals.js.map
|
packages/lib/PoorManIntervals.js.map
|
||||||
packages/lib/ProtocolUtils.d.ts
|
|
||||||
packages/lib/ProtocolUtils.js
|
|
||||||
packages/lib/ProtocolUtils.js.map
|
|
||||||
packages/lib/SyncTargetJoplinCloud.d.ts
|
packages/lib/SyncTargetJoplinCloud.d.ts
|
||||||
packages/lib/SyncTargetJoplinCloud.js
|
packages/lib/SyncTargetJoplinCloud.js
|
||||||
packages/lib/SyncTargetJoplinCloud.js.map
|
packages/lib/SyncTargetJoplinCloud.js.map
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import Logger from '@joplin/lib/Logger';
|
import Logger from '@joplin/lib/Logger';
|
||||||
import { PluginMessage } from './services/plugins/PluginRunner';
|
import { PluginMessage } from './services/plugins/PluginRunner';
|
||||||
import shim from '@joplin/lib/shim';
|
import shim from '@joplin/lib/shim';
|
||||||
import { isCallbackUrl } from '@joplin/lib/callbackUrlUtils';
|
|
||||||
|
|
||||||
const { BrowserWindow, Tray, screen } = require('electron');
|
const { BrowserWindow, Tray, screen } = require('electron');
|
||||||
const url = require('url');
|
const url = require('url');
|
||||||
@ -31,14 +30,12 @@ export default class ElectronAppWrapper {
|
|||||||
private buildDir_: string = null;
|
private buildDir_: string = null;
|
||||||
private rendererProcessQuitReply_: RendererProcessQuitReply = null;
|
private rendererProcessQuitReply_: RendererProcessQuitReply = null;
|
||||||
private pluginWindows_: PluginWindows = {};
|
private pluginWindows_: PluginWindows = {};
|
||||||
private initialCallbackUrl_: string = null;
|
|
||||||
|
|
||||||
constructor(electronApp: any, env: string, profilePath: string, isDebugMode: boolean, initialCallbackUrl: string) {
|
constructor(electronApp: any, env: string, profilePath: string, isDebugMode: boolean) {
|
||||||
this.electronApp_ = electronApp;
|
this.electronApp_ = electronApp;
|
||||||
this.env_ = env;
|
this.env_ = env;
|
||||||
this.isDebugMode_ = isDebugMode;
|
this.isDebugMode_ = isDebugMode;
|
||||||
this.profilePath_ = profilePath;
|
this.profilePath_ = profilePath;
|
||||||
this.initialCallbackUrl_ = initialCallbackUrl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
electronApp() {
|
electronApp() {
|
||||||
@ -61,10 +58,6 @@ export default class ElectronAppWrapper {
|
|||||||
return this.env_;
|
return this.env_;
|
||||||
}
|
}
|
||||||
|
|
||||||
initialCallbackUrl() {
|
|
||||||
return this.initialCallbackUrl_;
|
|
||||||
}
|
|
||||||
|
|
||||||
createWindow() {
|
createWindow() {
|
||||||
// Set to true to view errors if the application does not start
|
// Set to true to view errors if the application does not start
|
||||||
const debugEarlyBugs = this.env_ === 'dev' || this.isDebugMode_;
|
const debugEarlyBugs = this.env_ === 'dev' || this.isDebugMode_;
|
||||||
@ -327,18 +320,12 @@ export default class ElectronAppWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Someone tried to open a second instance - focus our window instead
|
// Someone tried to open a second instance - focus our window instead
|
||||||
this.electronApp_.on('second-instance', (_e: any, argv: string[]) => {
|
this.electronApp_.on('second-instance', () => {
|
||||||
const win = this.window();
|
const win = this.window();
|
||||||
if (!win) return;
|
if (!win) return;
|
||||||
if (win.isMinimized()) win.restore();
|
if (win.isMinimized()) win.restore();
|
||||||
win.show();
|
win.show();
|
||||||
win.focus();
|
win.focus();
|
||||||
if (process.platform !== 'darwin') {
|
|
||||||
const url = argv.find((arg) => isCallbackUrl(arg));
|
|
||||||
if (url) {
|
|
||||||
void this.openCallbackUrl(url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -365,16 +352,6 @@ export default class ElectronAppWrapper {
|
|||||||
this.electronApp_.on('activate', () => {
|
this.electronApp_.on('activate', () => {
|
||||||
this.win_.show();
|
this.win_.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.electronApp_.on('open-url', (_event: any, url: string) => {
|
|
||||||
void this.openCallbackUrl(url);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async openCallbackUrl(url: string) {
|
|
||||||
this.win_.webContents.send('asynchronous-message', 'openCallbackUrl', {
|
|
||||||
url: url,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,6 @@ import ShareService from '@joplin/lib/services/share/ShareService';
|
|||||||
import { reg } from '@joplin/lib/registry';
|
import { reg } from '@joplin/lib/registry';
|
||||||
import removeKeylessItems from '../ResizableLayout/utils/removeKeylessItems';
|
import removeKeylessItems from '../ResizableLayout/utils/removeKeylessItems';
|
||||||
import { localSyncInfoFromState } from '@joplin/lib/services/synchronizer/syncInfoUtils';
|
import { localSyncInfoFromState } from '@joplin/lib/services/synchronizer/syncInfoUtils';
|
||||||
import { parseCallbackUrl } from '@joplin/lib/callbackUrlUtils';
|
|
||||||
import ElectronAppWrapper from '../../ElectronAppWrapper';
|
|
||||||
import { showMissingMasterKeyMessage } from '@joplin/lib/services/e2ee/utils';
|
import { showMissingMasterKeyMessage } from '@joplin/lib/services/e2ee/utils';
|
||||||
|
|
||||||
const { connect } = require('react-redux');
|
const { connect } = require('react-redux');
|
||||||
@ -189,23 +187,6 @@ class MainScreenComponent extends React.Component<Props, State> {
|
|||||||
this.layoutModeListenerKeyDown = this.layoutModeListenerKeyDown.bind(this);
|
this.layoutModeListenerKeyDown = this.layoutModeListenerKeyDown.bind(this);
|
||||||
|
|
||||||
window.addEventListener('resize', this.window_resize);
|
window.addEventListener('resize', this.window_resize);
|
||||||
|
|
||||||
ipcRenderer.on('asynchronous-message', (_event: any, message: string, args: any) => {
|
|
||||||
if (message === 'openCallbackUrl') {
|
|
||||||
this.openCallbackUrl(args.url);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const initialCallbackUrl = (bridge().electronApp() as ElectronAppWrapper).initialCallbackUrl();
|
|
||||||
if (initialCallbackUrl) {
|
|
||||||
this.openCallbackUrl(initialCallbackUrl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private openCallbackUrl(url: string) {
|
|
||||||
console.log(`openUrl ${url}`);
|
|
||||||
const { command, params } = parseCallbackUrl(url);
|
|
||||||
void CommandService.instance().execute(command.toString(), params.id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateLayoutPluginViews(layout: LayoutItem, plugins: PluginStates) {
|
private updateLayoutPluginViews(layout: LayoutItem, plugins: PluginStates) {
|
||||||
|
@ -20,7 +20,6 @@ import Logger from '@joplin/lib/Logger';
|
|||||||
import { FolderEntity } from '@joplin/lib/services/database/types';
|
import { FolderEntity } from '@joplin/lib/services/database/types';
|
||||||
import stateToWhenClauseContext from '../../services/commands/stateToWhenClauseContext';
|
import stateToWhenClauseContext from '../../services/commands/stateToWhenClauseContext';
|
||||||
import { store } from '@joplin/lib/reducer';
|
import { store } from '@joplin/lib/reducer';
|
||||||
import { getFolderCallbackUrl, getTagCallbackUrl } from '@joplin/lib/callbackUrlUtils';
|
|
||||||
const { connect } = require('react-redux');
|
const { connect } = require('react-redux');
|
||||||
const shared = require('@joplin/lib/components/shared/side-menu-shared.js');
|
const shared = require('@joplin/lib/components/shared/side-menu-shared.js');
|
||||||
const { themeStyle } = require('@joplin/lib/theme');
|
const { themeStyle } = require('@joplin/lib/theme');
|
||||||
@ -29,7 +28,6 @@ const Menu = bridge().Menu;
|
|||||||
const MenuItem = bridge().MenuItem;
|
const MenuItem = bridge().MenuItem;
|
||||||
const { substrWithEllipsis } = require('@joplin/lib/string-utils');
|
const { substrWithEllipsis } = require('@joplin/lib/string-utils');
|
||||||
const { ALL_NOTES_FILTER_ID } = require('@joplin/lib/reserved-ids');
|
const { ALL_NOTES_FILTER_ID } = require('@joplin/lib/reserved-ids');
|
||||||
const { clipboard } = require('electron');
|
|
||||||
|
|
||||||
const logger = Logger.create('Sidebar');
|
const logger = Logger.create('Sidebar');
|
||||||
|
|
||||||
@ -328,29 +326,10 @@ class SidebarComponent extends React.Component<Props, State> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemType === BaseModel.TYPE_FOLDER) {
|
|
||||||
menu.append(
|
|
||||||
new MenuItem({
|
|
||||||
label: _('Copy external link'),
|
|
||||||
click: () => {
|
|
||||||
clipboard.writeText(getFolderCallbackUrl(itemId));
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itemType === BaseModel.TYPE_TAG) {
|
if (itemType === BaseModel.TYPE_TAG) {
|
||||||
menu.append(new MenuItem(
|
menu.append(new MenuItem(
|
||||||
menuUtils.commandToStatefulMenuItem('renameTag', itemId)
|
menuUtils.commandToStatefulMenuItem('renameTag', itemId)
|
||||||
));
|
));
|
||||||
menu.append(
|
|
||||||
new MenuItem({
|
|
||||||
label: _('Copy external link'),
|
|
||||||
click: () => {
|
|
||||||
clipboard.writeText(getTagCallbackUrl(itemId));
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const pluginViews = pluginUtils.viewsByType(this.pluginsRef.current, 'menuItem');
|
const pluginViews = pluginUtils.viewsByType(this.pluginsRef.current, 'menuItem');
|
||||||
|
@ -6,7 +6,6 @@ import MenuUtils from '@joplin/lib/services/commands/MenuUtils';
|
|||||||
import InteropServiceHelper from '../../InteropServiceHelper';
|
import InteropServiceHelper from '../../InteropServiceHelper';
|
||||||
import { _ } from '@joplin/lib/locale';
|
import { _ } from '@joplin/lib/locale';
|
||||||
import { MenuItemLocation } from '@joplin/lib/services/plugins/api/types';
|
import { MenuItemLocation } from '@joplin/lib/services/plugins/api/types';
|
||||||
import { getNoteCallbackUrl } from '@joplin/lib/callbackUrlUtils';
|
|
||||||
|
|
||||||
import BaseModel from '@joplin/lib/BaseModel';
|
import BaseModel from '@joplin/lib/BaseModel';
|
||||||
const bridge = require('electron').remote.require('./bridge').default;
|
const bridge = require('electron').remote.require('./bridge').default;
|
||||||
@ -15,7 +14,6 @@ const MenuItem = bridge().MenuItem;
|
|||||||
import Note from '@joplin/lib/models/Note';
|
import Note from '@joplin/lib/models/Note';
|
||||||
import Setting from '@joplin/lib/models/Setting';
|
import Setting from '@joplin/lib/models/Setting';
|
||||||
const { substrWithEllipsis } = require('@joplin/lib/string-utils');
|
const { substrWithEllipsis } = require('@joplin/lib/string-utils');
|
||||||
const { clipboard } = require('electron');
|
|
||||||
|
|
||||||
interface ContextMenuProps {
|
interface ContextMenuProps {
|
||||||
notes: any[];
|
notes: any[];
|
||||||
@ -124,6 +122,7 @@ export default class NoteListUtils {
|
|||||||
new MenuItem({
|
new MenuItem({
|
||||||
label: _('Copy Markdown link'),
|
label: _('Copy Markdown link'),
|
||||||
click: async () => {
|
click: async () => {
|
||||||
|
const { clipboard } = require('electron');
|
||||||
const links = [];
|
const links = [];
|
||||||
for (let i = 0; i < noteIds.length; i++) {
|
for (let i = 0; i < noteIds.length; i++) {
|
||||||
const note = await Note.load(noteIds[i]);
|
const note = await Note.load(noteIds[i]);
|
||||||
@ -134,17 +133,6 @@ export default class NoteListUtils {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
if (noteIds.length == 1) {
|
|
||||||
menu.append(
|
|
||||||
new MenuItem({
|
|
||||||
label: _('Copy external link'),
|
|
||||||
click: () => {
|
|
||||||
clipboard.writeText(getNoteCallbackUrl(noteIds[0]));
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ([9, 10].includes(Setting.value('sync.target'))) {
|
if ([9, 10].includes(Setting.value('sync.target'))) {
|
||||||
menu.append(
|
menu.append(
|
||||||
new MenuItem(
|
new MenuItem(
|
||||||
|
@ -7,7 +7,6 @@ const Logger = require('@joplin/lib/Logger').default;
|
|||||||
const FsDriverNode = require('@joplin/lib/fs-driver-node').default;
|
const FsDriverNode = require('@joplin/lib/fs-driver-node').default;
|
||||||
const envFromArgs = require('@joplin/lib/envFromArgs');
|
const envFromArgs = require('@joplin/lib/envFromArgs');
|
||||||
const packageInfo = require('./packageInfo.js');
|
const packageInfo = require('./packageInfo.js');
|
||||||
const { isCallbackUrl } = require('@joplin/lib/ProtocolUtils');
|
|
||||||
|
|
||||||
// Electron takes the application name from package.json `name` and
|
// Electron takes the application name from package.json `name` and
|
||||||
// displays this in the tray icon toolip and message box titles, however in
|
// displays this in the tray icon toolip and message box titles, however in
|
||||||
@ -37,11 +36,7 @@ const env = envFromArgs(process.argv);
|
|||||||
const profilePath = profileFromArgs(process.argv);
|
const profilePath = profileFromArgs(process.argv);
|
||||||
const isDebugMode = !!process.argv && process.argv.indexOf('--debug') >= 0;
|
const isDebugMode = !!process.argv && process.argv.indexOf('--debug') >= 0;
|
||||||
|
|
||||||
electronApp.setAsDefaultProtocolClient('joplin');
|
const wrapper = new ElectronAppWrapper(electronApp, env, profilePath, isDebugMode);
|
||||||
|
|
||||||
const initialCallbackUrl = process.argv.find((arg) => isCallbackUrl(arg));
|
|
||||||
|
|
||||||
const wrapper = new ElectronAppWrapper(electronApp, env, profilePath, isDebugMode, initialCallbackUrl);
|
|
||||||
|
|
||||||
initBridge(wrapper);
|
initBridge(wrapper);
|
||||||
|
|
||||||
|
@ -77,22 +77,13 @@
|
|||||||
"icon": "../../Assets/macOs.icns",
|
"icon": "../../Assets/macOs.icns",
|
||||||
"target": "dmg",
|
"target": "dmg",
|
||||||
"hardenedRuntime": true,
|
"hardenedRuntime": true,
|
||||||
"entitlements": "./build-mac/entitlements.mac.inherit.plist",
|
"entitlements": "./build-mac/entitlements.mac.inherit.plist"
|
||||||
"extendInfo": {
|
|
||||||
"CFBundleURLTypes": [
|
|
||||||
{
|
|
||||||
"CFBundleURLSchemes": ["joplin"],
|
|
||||||
"CFBundleTypeRole": "Editor"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"linux": {
|
"linux": {
|
||||||
"icon": "../../Assets/LinuxIcons",
|
"icon": "../../Assets/LinuxIcons",
|
||||||
"category": "Office",
|
"category": "Office",
|
||||||
"desktop": {
|
"desktop": {
|
||||||
"Icon": "joplin",
|
"Icon": "joplin"
|
||||||
"MimeType": "x-scheme-handler/joplin;"
|
|
||||||
},
|
},
|
||||||
"target": "AppImage"
|
"target": "AppImage"
|
||||||
},
|
},
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
const URL = require('url-parse');
|
|
||||||
|
|
||||||
export function isCallbackUrl(s: string) {
|
|
||||||
return s.startsWith('joplin://x-callback-url/');
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getNoteCallbackUrl(noteId: string) {
|
|
||||||
return `joplin://x-callback-url/openNote?id=${encodeURIComponent(noteId)}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getFolderCallbackUrl(folderId: string) {
|
|
||||||
return `joplin://x-callback-url/openFolder?id=${encodeURIComponent(folderId)}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getTagCallbackUrl(tagId: string) {
|
|
||||||
return `joplin://x-callback-url/openTag?id=${encodeURIComponent(tagId)}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const enum CallbackUrlCommand {
|
|
||||||
OpenNote = 'openNote',
|
|
||||||
OpenFolder = 'openFolder',
|
|
||||||
OpenTag = 'openTag',
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CallbackUrlInfo {
|
|
||||||
command: CallbackUrlCommand;
|
|
||||||
params: Record<string, string>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function parseCallbackUrl(s: string): CallbackUrlInfo {
|
|
||||||
if (!isCallbackUrl(s)) throw new Error(`Invalid callback url ${s}`);
|
|
||||||
const url = new URL(s, true);
|
|
||||||
return {
|
|
||||||
command: url.pathname.substring(url.pathname.lastIndexOf('/') + 1) as CallbackUrlCommand,
|
|
||||||
params: url.query,
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user