Skip to content

Commit

Permalink
fix: ignore file and editor protocols
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed Nov 18, 2024
1 parent 47e6c28 commit 2badb9b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
5 changes: 4 additions & 1 deletion apps/main/src/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import path from "node:path"
import { fileURLToPath } from "node:url"

import { is } from "@electron-toolkit/utils"
import { APP_PROTOCOL } from "@follow/shared"
import { callWindowExpose } from "@follow/shared/bridge"
import type { BrowserWindowConstructorOptions } from "electron"
import { app, BrowserWindow, screen, shell } from "electron"
Expand Down Expand Up @@ -113,7 +114,9 @@ export function createWindow(

const handleExternalProtocol = async (e: Event, url: string, window: BrowserWindow) => {
const { protocol } = new URL(url)
if (protocol === "http:" || protocol === "https:" || protocol === "follow:") {

const ignoreProtocols = ["http", "https", APP_PROTOCOL, "file", "code", "cursor"]
if (ignoreProtocols.includes(protocol.slice(0, -1))) {
return
}
e.preventDefault()
Expand Down
25 changes: 14 additions & 11 deletions apps/renderer/src/modules/upgrade/container.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useOnce } from "@follow/hooks"
import { nextFrame } from "@follow/utils/dom"
import { getStorageNS } from "@follow/utils/ns"
import { repository } from "@pkg"
import type { FC } from "react"
Expand Down Expand Up @@ -72,18 +73,20 @@ const AppNotificationContainer: FC = () => {
? {
label: "What's new?",
onClick: () => {
present({
clickOutsideToDismiss: true,
title: "What's new?",
autoFocus: false,
modalClassName:
"relative mx-auto mt-[10vh] scrollbar-none max-w-full overflow-auto px-2 lg:max-w-[65rem] lg:p-0",
nextFrame(() => {
present({
clickOutsideToDismiss: true,
title: "What's new?",
autoFocus: false,
modalClassName:
"relative mx-auto mt-[10vh] scrollbar-none max-w-full overflow-auto px-2 lg:max-w-[65rem] lg:p-0",

CustomModalComponent: ({ children }) => {
return <PeekModal>{children}</PeekModal>
},
content: Changelog,
overlay: true,
CustomModalComponent: ({ children }) => {
return <PeekModal>{children}</PeekModal>
},
content: Changelog,
overlay: true,
})
})
},
}
Expand Down

0 comments on commit 2badb9b

Please sign in to comment.