diff --git a/src/__tests__/renderer/adapters/plugins.spec.ts b/src/__tests__/renderer/adapters/plugins.spec.ts index e5d4d1f..344569c 100644 --- a/src/__tests__/renderer/adapters/plugins.spec.ts +++ b/src/__tests__/renderer/adapters/plugins.spec.ts @@ -1,10 +1,11 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' -import { SHOW_PLUGIN_PAGE_MENU, OPEN_URL } from '#/events/constants' +import { SHOW_PLUGIN_PAGE_MENU } from '#/events/constants' import { IRPCActionType } from '~/universal/types/enum' vi.mock('@/utils/dataSender', () => ({ getConfig: vi.fn(), invokeRPC: vi.fn(), + openURL: vi.fn(), saveConfig: vi.fn(), sendRPC: vi.fn(), sendToMain: vi.fn() @@ -14,6 +15,7 @@ import { pluginsAdapter } from '@/adapters/plugins' import { getConfig, invokeRPC, + openURL, saveConfig, sendRPC, sendToMain @@ -152,15 +154,13 @@ describe('renderer/adapters plugins', () => { expect(sendRPCMock).toHaveBeenCalledWith(IRPCActionType.RELOAD_APP) }) - it('opens homepage and awesome list through main events', () => { + it('opens homepage and awesome list through openURL', () => { + const openURLMock = vi.mocked(openURL) + pluginsAdapter.openPluginHomepage('https://example.com') pluginsAdapter.openAwesomeList() - expect(sendToMainMock).toHaveBeenNthCalledWith(1, OPEN_URL, 'https://example.com') - expect(sendToMainMock).toHaveBeenNthCalledWith( - 2, - OPEN_URL, - 'https://github.com/PicGo/Awesome-PicGo' - ) + expect(openURLMock).toHaveBeenNthCalledWith(1, 'https://example.com') + expect(openURLMock).toHaveBeenNthCalledWith(2, 'https://github.com/PicGo/Awesome-PicGo') }) }) diff --git a/src/renderer/adapters/plugins.ts b/src/renderer/adapters/plugins.ts index ce21f75..9c9fabe 100644 --- a/src/renderer/adapters/plugins.ts +++ b/src/renderer/adapters/plugins.ts @@ -1,7 +1,7 @@ import axios from 'axios' -import { OPEN_URL, SHOW_PLUGIN_PAGE_MENU } from '#/events/constants' +import { SHOW_PLUGIN_PAGE_MENU } from '#/events/constants' import { IRPCActionType } from '~/universal/types/enum' -import { getConfig, invokeRPC, saveConfig, sendRPC, sendToMain } from '@/utils/dataSender' +import { getConfig, invokeRPC, openURL, saveConfig, sendRPC, sendToMain } from '@/utils/dataSender' import { ipc } from '@/utils/bridge' import type { ProviderPluginConfig } from '@/components/main/providers/types' import { normalizePluginConfigSchema } from '@/components/common/normalize-plugin-schema' @@ -222,9 +222,9 @@ export const pluginsAdapter = { if (!url) { return } - sendToMain(OPEN_URL, url) + openURL(url) }, openAwesomeList () { - sendToMain(OPEN_URL, 'https://github.com/PicGo/Awesome-PicGo') + openURL('https://github.com/PicGo/Awesome-PicGo') } } diff --git a/src/renderer/adapters/settings.ts b/src/renderer/adapters/settings.ts index b7ae37d..f703280 100644 --- a/src/renderer/adapters/settings.ts +++ b/src/renderer/adapters/settings.ts @@ -1,7 +1,7 @@ -import { GET_PICBEDS, OPEN_URL, PICGO_OPEN_FILE, TOGGLE_SHORTKEY_MODIFIED_MODE } from '#/events/constants' +import { GET_PICBEDS, PICGO_OPEN_FILE, TOGGLE_SHORTKEY_MODIFIED_MODE } from '#/events/constants' import { IRPCActionType } from '~/universal/types/enum' import { appConfigAdapter } from './app-config' -import { getConfig, invokeRPC, saveConfig, sendRPC, sendToMain } from '@/utils/dataSender' +import { getConfig, invokeRPC, openURL, saveConfig, sendRPC, sendToMain } from '@/utils/dataSender' import { ipc } from '@/utils/bridge' export const settingsAdapter = { @@ -27,7 +27,7 @@ export const settingsAdapter = { sendToMain(PICGO_OPEN_FILE, 'picgo.log') }, openExternalUrl (url: string) { - sendToMain(OPEN_URL, url) + openURL(url) }, updateServer () { sendToMain('updateServer') diff --git a/src/renderer/components/independent-window/rename/picgo-rename-page.tsx b/src/renderer/components/independent-window/rename/picgo-rename-page.tsx index 6450e03..7f64fae 100644 --- a/src/renderer/components/independent-window/rename/picgo-rename-page.tsx +++ b/src/renderer/components/independent-window/rename/picgo-rename-page.tsx @@ -86,13 +86,13 @@ export function PicGoRenamePage() { return ( - -
+ + -
+
-
+
+
+ +
diff --git a/src/renderer/components/main/layout/main-more-dialog.tsx b/src/renderer/components/main/layout/main-more-dialog.tsx index b6deadb..6b21e75 100644 --- a/src/renderer/components/main/layout/main-more-dialog.tsx +++ b/src/renderer/components/main/layout/main-more-dialog.tsx @@ -13,7 +13,7 @@ import { DialogHeader, DialogTitle } from '@/components/ui/dialog' -import { getConfig, getPicBeds } from '@/utils/dataSender' +import { getConfig, getPicBeds, openURL } from '@/utils/dataSender' import { clipboard, ipc } from '@/utils/bridge' import { toast } from 'sonner' import { mainMoreAdapter } from '@/adapters/main-more' @@ -182,6 +182,18 @@ export function MainMoreDialog ({ open, onOpenChange }: MainMoreDialogProps) { {t('PICGO_SPONSOR_TEXT')} +
+ +
+