← marzneshin
/
dashboard/src/modules/hosts/dialogs/mutation/profiles/use-profile-strategy.ts
/
blame
https://dev.kronoz.win/r/marzneshin.git
| 1 | d636f3f | Dawsh | 2y ago | import { ProtocolType } from "@marzneshin/modules/inbounds"; |
| 2 | 4056c66 | Dawsh | 1y ago | import { generalProfile, profileByProtocol, ProfileConfig } from "./profiles"; |
| 3 | d636f3f | Dawsh | 2y ago | |
| 4 | d636f3f | Dawsh | 2y ago | /** |
| 5 | 4056c66 | Dawsh | 1y ago | * @param {ProtocolType} protocol - Inbound protocol of host |
| 6 | 4056c66 | Dawsh | 1y ago | * @returns {ProfileConfig} config - An array of schema, profile fields, and their default |
| 7 | 4056c66 | Dawsh | 1y ago | * @default *General Profile* if no protocol is specified |
| 8 | d636f3f | Dawsh | 2y ago | */ |
| 9 | 4056c66 | Dawsh | 1y ago | export const useProfileStrategy = (protocol?: ProtocolType): ProfileConfig => { |
| 10 | 4056c66 | Dawsh | 1y ago | return protocol && profileByProtocol[protocol] |
| 11 | 4056c66 | Dawsh | 1y ago | ? profileByProtocol[protocol] |
| 12 | 4056c66 | Dawsh | 1y ago | : generalProfile; |
| 13 | d636f3f | Dawsh | 2y ago | }; |