The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { managedCapabilityDenial } from "@t3tools/client-runtime/contract-labels"; |
| 2 | import type { EnvironmentId } from "@t3tools/contracts"; |
| 3 | import { Atom } from "effect/reactivity"; |
| 4 | |
| 5 | import { environmentPresentations } from "~/state/presentation"; |
| 6 | import { serverEnvironment } from "~/state/server"; |
| 7 | |
| 8 | /** |
| 9 | * Whether this environment offers "Share with guest": the user may create links there, and its |
| 10 | * Guest links beta is on (Settings > Labs). The server refuses links while the beta is off. |
| 11 | * Guests arrive through T3 Connect, so a policy that turns Connect off hides sharing too. |
| 12 | */ |
| 13 | export const canShareWithGuestAtom = Atom.family((environmentId: EnvironmentId) => |
| 14 | Atom.make((get) => { |
| 15 | const serverConfig = get(environmentPresentations.serverConfigsAtom).get(environmentId); |
| 16 | return ( |
| 17 | get(serverEnvironment.createGuestShare.permissionAtom(environmentId)) && |
| 18 | serverConfig?.settings.guestSharingEnabled === true && |
| 19 | managedCapabilityDenial(serverConfig.managedPolicy, "connect") === undefined |
| 20 | ); |
| 21 | }).pipe(Atom.withLabel(`guest-share:available:${environmentId}`)), |
| 22 | ); |