| 24 | } |
| 25 | |
| 26 | const getProjectURL = (port: number, settings: Settings) => { |
| 27 | // get the window location |
| 28 | const { location } = window |
| 29 | |
| 30 | // Support proxying for Runpod |
| 31 | // check if the current origin matches this pattern: https://<pod id>-<port number>.proxy.runpod.net |
| 32 | const match = location.origin.match( |
| 33 | /^https:\/\/([a-zA-Z0-9]+)-([0-9]+)\.proxy\.runpod\.net$/ |
| 34 | ) |
| 35 | if (match) { |
| 36 | // if it does, replace the port number with the new port number |
| 37 | return `https://${match[1]}-${port}.proxy.runpod.net` |
| 38 | } |
| 39 | |
| 40 | if (settings.PROXY_MODE) { |
| 41 | return `/comfy/${port}/`; // proxy mode |
| 42 | } |
| 43 | |
| 44 | // otherwise, replace the port in the current origin with the new port number |
| 45 | return location.origin.replace(/:[0-9]+$/, `:${port}`) |
| 46 | } |
| 47 | |
| 48 | function ProjectCard({ item, settings }: ProjectCardProps) { |
| 49 | const queryClient = useQueryClient() |