diff --git a/frontend/apps/desktop/src/app-drafts.ts b/frontend/apps/desktop/src/app-drafts.ts index ca1ffbf9c..904a12537 100644 --- a/frontend/apps/desktop/src/app-drafts.ts +++ b/frontend/apps/desktop/src/app-drafts.ts @@ -12,9 +12,7 @@ async function initDrafts() { await fs.mkdir(draftsDir, {recursive: true}) await fs.readdir(draftsDir) const allDraftFiles = await fs.readdir(draftsDir) - const allDraftIds = allDraftFiles.map((filename) => { - return filename.replace(/\.json$/, '') - }) + const allDraftIds = allDraftFiles.map(draftFileNameToId) draftIdList = allDraftIds } @@ -26,12 +24,23 @@ initDrafts() console.error('[MAIN]: error preparing drafts', e) }) +function inputIdToDraftFile(id: string) { + const encodedId = Buffer.from(id).toString('base64') + return `${encodedId}.json` +} + +function draftFileNameToId(filename: string) { + const baseName = filename.replace(/\.json$/, '') + const id = Buffer.from(baseName, 'base64').toString('utf-8') + return id +} + export const draftsApi = t.router({ list: t.procedure.query(async () => { return draftIdList }), - get: t.procedure.input(z.string().optional()).query(async ({input}) => { - const draftPath = join(draftsDir, `${input}.json`) + get: t.procedure.input(z.string()).query(async ({input}) => { + const draftPath = join(draftsDir, inputIdToDraftFile(input)) try { const fileContent = await fs.readFile(draftPath, 'utf-8') const draft = JSON.parse(fileContent) @@ -51,7 +60,7 @@ export const draftsApi = t.router({ }), ) .mutation(async ({input}) => { - const draftPath = join(draftsDir, `${input.id}.json`) + const draftPath = join(draftsDir, inputIdToDraftFile(input.id)) if (!draftIdList?.includes(input.id)) { draftIdList?.push(input.id) } diff --git a/frontend/apps/desktop/src/components/sidebar-neo.tsx b/frontend/apps/desktop/src/components/sidebar-neo.tsx index ed39676f9..cfc761c80 100644 --- a/frontend/apps/desktop/src/components/sidebar-neo.tsx +++ b/frontend/apps/desktop/src/components/sidebar-neo.tsx @@ -52,7 +52,6 @@ function _SidebarNeo() { ? ({ key: 'account', accountId: myAccount } as BaseAccountRoute) : null }, [myAccount]) - console.log({ myAccountRoute }) const navigate = useNavigate() const replace = useNavigate('replace') let myAccountSection: ReactNode = null diff --git a/frontend/apps/desktop/src/models/accounts.ts b/frontend/apps/desktop/src/models/accounts.ts index e5d8b0f28..273a3de3e 100644 --- a/frontend/apps/desktop/src/models/accounts.ts +++ b/frontend/apps/desktop/src/models/accounts.ts @@ -101,7 +101,6 @@ export function useAccountIsConnected(account: HMAccount) { export function useMyAccount_deprecated() { const accountKeys = useAccountKeys() - console.log(accountKeys.data) if (!accountKeys.data) return null if (!accountKeys.data.length) return null if (accountKeys.data.length > 1) diff --git a/frontend/apps/desktop/src/models/entities.ts b/frontend/apps/desktop/src/models/entities.ts index 1f71270fe..b368d7437 100644 --- a/frontend/apps/desktop/src/models/entities.ts +++ b/frontend/apps/desktop/src/models/entities.ts @@ -221,7 +221,6 @@ export function useEntitiesContent( return false }) .filter((result) => !!result) - console.log('useEntitiesContent', routes, output) return output }