mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2025-12-05 18:20:39 -08:00
parent
95bc83022f
commit
15daa6cb51
4 changed files with 25 additions and 8 deletions
|
|
@ -107,6 +107,8 @@ TBD
|
||||||
|
|
||||||
### `Uncaught ReferenceError: require is not defined`
|
### `Uncaught ReferenceError: require is not defined`
|
||||||
|
|
||||||
|
Or `Uncaught TypeError: Cannot read properties of undefined (reading 'call') at __webpack_require__ (index.js:4317:33)`
|
||||||
|
|
||||||
`pnpm run clean:cache` can fix this.
|
`pnpm run clean:cache` can fix this.
|
||||||
|
|
||||||
### Electron download slow
|
### Electron download slow
|
||||||
|
|
|
||||||
|
|
@ -18,18 +18,23 @@ export class DeepLinkService implements IDeepLinkService {
|
||||||
*/
|
*/
|
||||||
private readonly deepLinkHandler: (requestUrl: string) => Promise<void> = async (requestUrl) => {
|
private readonly deepLinkHandler: (requestUrl: string) => Promise<void> = async (requestUrl) => {
|
||||||
logger.info(`Receiving deep link`, { requestUrl, function: 'deepLinkHandler' });
|
logger.info(`Receiving deep link`, { requestUrl, function: 'deepLinkHandler' });
|
||||||
const url = new URL(requestUrl);
|
// hostname is workspace id or name
|
||||||
const workspaceId = url.hostname;
|
const { hostname, hash } = new URL(requestUrl);
|
||||||
const workspace = await this.workspaceService.get(workspaceId);
|
let workspace = await this.workspaceService.get(hostname);
|
||||||
if (workspace === undefined) {
|
if (workspace === undefined) {
|
||||||
logger.error(`Workspace not found`, { workspaceId, function: 'deepLinkHandler' });
|
logger.error(`Workspace not found, try get by name`, { hostname, function: 'deepLinkHandler' });
|
||||||
return;
|
workspace = await this.workspaceService.getByWikiName(hostname);
|
||||||
|
if (workspace === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let tiddlerName = url.hash.substring(1); // remove '#:'
|
let tiddlerName = hash.substring(1); // remove '#:'
|
||||||
if (tiddlerName.includes(':')) {
|
if (tiddlerName.includes(':')) {
|
||||||
tiddlerName = tiddlerName.split(':')[1];
|
tiddlerName = tiddlerName.split(':')[1];
|
||||||
}
|
}
|
||||||
logger.info(`Open deep link`, { workspaceId, tiddlerName, function: 'deepLinkHandler' });
|
// Support CJK
|
||||||
|
tiddlerName = decodeURIComponent(tiddlerName);
|
||||||
|
logger.info(`Open deep link`, { workspaceId: workspace.id, tiddlerName, function: 'deepLinkHandler' });
|
||||||
await this.workspaceService.openWorkspaceTiddler(workspace, tiddlerName);
|
await this.workspaceService.openWorkspaceTiddler(workspace, tiddlerName);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -289,6 +289,12 @@ export class Workspace implements IWorkspaceService {
|
||||||
return (await this.getWorkspacesAsList()).find((workspace) => workspace.wikiFolderLocation === wikiFolderLocation);
|
return (await this.getWorkspacesAsList()).find((workspace) => workspace.wikiFolderLocation === wikiFolderLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async getByWikiName(wikiName: string): Promise<IWorkspace | undefined> {
|
||||||
|
return (await this.getWorkspacesAsList())
|
||||||
|
.sort((a, b) => a.order - b.order)
|
||||||
|
.find((workspace) => workspace.name === wikiName);
|
||||||
|
}
|
||||||
|
|
||||||
public getPreviousWorkspace = async (id: string): Promise<IWorkspace | undefined> => {
|
public getPreviousWorkspace = async (id: string): Promise<IWorkspace | undefined> => {
|
||||||
const workspaceList = await this.getWorkspacesAsList();
|
const workspaceList = await this.getWorkspacesAsList();
|
||||||
let currentWorkspaceIndex = 0;
|
let currentWorkspaceIndex = 0;
|
||||||
|
|
|
||||||
|
|
@ -186,6 +186,10 @@ export interface IWorkspaceService {
|
||||||
getActiveWorkspaceSync: () => IWorkspace | undefined;
|
getActiveWorkspaceSync: () => IWorkspace | undefined;
|
||||||
getAllMetaData: () => Promise<Record<string, Partial<IWorkspaceMetaData>>>;
|
getAllMetaData: () => Promise<Record<string, Partial<IWorkspaceMetaData>>>;
|
||||||
getByWikiFolderLocation(wikiFolderLocation: string): Promise<IWorkspace | undefined>;
|
getByWikiFolderLocation(wikiFolderLocation: string): Promise<IWorkspace | undefined>;
|
||||||
|
/**
|
||||||
|
* Get workspace by human readable wiki name, if no workspace found, return undefined. If multiple workspace with same name, return the first one order by sidebar.
|
||||||
|
*/
|
||||||
|
getByWikiName(wikiName: string): Promise<IWorkspace | undefined>;
|
||||||
getFirstWorkspace: () => Promise<IWorkspace | undefined>;
|
getFirstWorkspace: () => Promise<IWorkspace | undefined>;
|
||||||
/**
|
/**
|
||||||
* Get parent workspace of a subWorkspace, if the workspace you provided is a main workspace, return undefined.
|
* Get parent workspace of a subWorkspace, if the workspace you provided is a main workspace, return undefined.
|
||||||
|
|
@ -236,7 +240,7 @@ export const WorkspaceServiceIPCDescriptor = {
|
||||||
get$: ProxyPropertyType.Function$,
|
get$: ProxyPropertyType.Function$,
|
||||||
getActiveWorkspace: ProxyPropertyType.Function,
|
getActiveWorkspace: ProxyPropertyType.Function,
|
||||||
getAllMetaData: ProxyPropertyType.Function,
|
getAllMetaData: ProxyPropertyType.Function,
|
||||||
getByName: ProxyPropertyType.Function,
|
getByWikiName: ProxyPropertyType.Function,
|
||||||
getFirstWorkspace: ProxyPropertyType.Function,
|
getFirstWorkspace: ProxyPropertyType.Function,
|
||||||
getMainWorkspace: ProxyPropertyType.Function,
|
getMainWorkspace: ProxyPropertyType.Function,
|
||||||
getMetaData: ProxyPropertyType.Function,
|
getMetaData: ProxyPropertyType.Function,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue