gitscope
← marzneshin / master / dashboard/src/modules/hosts/dialogs/mutation/profiles/profiles.ts
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/modules/hosts/dialogs/mutation/profiles/profiles.ts · TypeScript
Blame Raw
 1import {
 2    GeneralSchema,
 3    GeneralProfileFields,
 4    generalProfileDefaultValue,
 5} from "./general";
 6import {
 7    WireguardSchema,
 8    WireguardProfileFields,
 9    wireguardProfileDefaultValue,
10} from "./wireguard";
11import {
12    Hysteria2Schema,
13    Hysteria2ProfileFields,
14    hysteria2ProfileDefaultValue,
15} from "./hysteria2";
16import {
17    ShadowTlsSchema,
18    ShadowTlsProfileFields,
19    shadowTlsProfileDefaultValue,
20} from "./shadowtls";
21import { TuicSchema, TuicProfileFields, tuicProfileDefaultValue } from "./tuic";
22import { FC } from "react";
23import { z } from "zod";
24import { ProtocolType } from "@marzneshin/modules/inbounds";
25
26export type ProfileConfig = [z.ZodTypeAny, FC, object];
27
28export const generalProfile: ProfileConfig = [
29    GeneralSchema,
30    GeneralProfileFields,
31    generalProfileDefaultValue,
32];
33
34export const profileByProtocol: Record<ProtocolType, ProfileConfig> = {
35    vless: generalProfile,
36    vmess: generalProfile,
37    trojan: generalProfile,
38    shadowsocks: generalProfile,
39    shadowsocks2022: generalProfile,
40    wireguard: [
41        WireguardSchema,
42        WireguardProfileFields,
43        wireguardProfileDefaultValue,
44    ],
45    hysteria2: [
46        Hysteria2Schema,
47        Hysteria2ProfileFields,
48        hysteria2ProfileDefaultValue,
49    ],
50    shadowtls: [
51        ShadowTlsSchema,
52        ShadowTlsProfileFields,
53        shadowTlsProfileDefaultValue,
54    ],
55    tuic: [TuicSchema, TuicProfileFields, tuicProfileDefaultValue],
56};