Merge pull request #51 from cloud-neutral-toolkit/consolidate-experience-mode-v2
fix(experience): consolidate demo account into sandbox@svc.plus
This commit is contained in:
commit
3d24d0af1d
@ -184,22 +184,12 @@ export async function GET(request: NextRequest) {
|
||||
const normalizedUsernameLower = String(rawUser.username ?? '').trim().toLowerCase()
|
||||
const normalizedNameLower = String(rawUser.name ?? '').trim().toLowerCase()
|
||||
const identifierLower = (identifier ?? '').toLowerCase()
|
||||
const isNamedDemo =
|
||||
normalizedUsernameLower === 'demo' ||
|
||||
normalizedUsernameLower.startsWith('demo-') ||
|
||||
normalizedNameLower === 'demo' ||
|
||||
normalizedNameLower.startsWith('demo-') ||
|
||||
identifierLower === 'demo' ||
|
||||
identifierLower.startsWith('demo-')
|
||||
|
||||
const normalizedReadOnly =
|
||||
Boolean(rawUser.readOnly) ||
|
||||
normalizedGroups.some((group) => group.toLowerCase() === 'readonly role') ||
|
||||
rawRole === 'readonly' ||
|
||||
rawRole === 'read_only' ||
|
||||
String(rawUser.email ?? '').trim().toLowerCase() === 'demo@svc.plus' ||
|
||||
String(rawUser.email ?? '').trim().toLowerCase() === 'sandbox@svc.plus' ||
|
||||
isNamedDemo
|
||||
String(rawUser.email ?? '').trim().toLowerCase() === 'sandbox@svc.plus'
|
||||
const normalizedProxyUuid =
|
||||
typeof rawUser.proxyUuid === 'string' && rawUser.proxyUuid.trim().length > 0
|
||||
? rawUser.proxyUuid.trim()
|
||||
|
||||
@ -259,22 +259,10 @@ async function fetchSessionUser(): Promise<User | null> {
|
||||
.map((value) => value.trim())
|
||||
: []
|
||||
const normalizedEmail = typeof email === 'string' ? email.trim().toLowerCase() : ''
|
||||
const normalizedUsernameLower = normalizedUsername?.trim().toLowerCase() ?? ''
|
||||
const normalizedNameLower = normalizedName?.trim().toLowerCase() ?? ''
|
||||
const identifierLower = identifier.toLowerCase()
|
||||
const isNamedDemo =
|
||||
normalizedUsernameLower === 'demo' ||
|
||||
normalizedUsernameLower.startsWith('demo-') ||
|
||||
normalizedNameLower === 'demo' ||
|
||||
normalizedNameLower.startsWith('demo-') ||
|
||||
identifierLower === 'demo' ||
|
||||
identifierLower.startsWith('demo-')
|
||||
const inferredReadOnly =
|
||||
rawRole === 'readonly' ||
|
||||
rawRole === 'read_only' ||
|
||||
normalizedEmail === 'demo@svc.plus' ||
|
||||
normalizedEmail === 'sandbox@svc.plus' ||
|
||||
isNamedDemo ||
|
||||
normalizedGroups.some((value) => value.toLowerCase() === 'readonly role')
|
||||
const normalizedReadOnly = Boolean(sessionUser.readOnly) || inferredReadOnly
|
||||
const normalizedProxyUuid =
|
||||
|
||||
@ -59,7 +59,7 @@ export default function UserOverview({ hideMfaMainPrompt = false }: UserOverview
|
||||
const docsUrl = mfaCopy.actions.docsUrl
|
||||
const normalizedEmail = user?.email?.toLowerCase() ?? ''
|
||||
const isGuestSandboxReadOnly = Boolean(
|
||||
user?.isReadOnly && (normalizedEmail === 'sandbox@svc.plus' || normalizedEmail === 'demo@svc.plus'),
|
||||
user?.isReadOnly && (normalizedEmail === 'sandbox@svc.plus'),
|
||||
)
|
||||
const guestUuidExpiresAtText = useMemo(() => {
|
||||
if (!isGuestSandboxReadOnly || !user?.proxyUuidExpiresAt) {
|
||||
|
||||
@ -65,7 +65,7 @@ export default function UserCenterAgentRoute() {
|
||||
const [boundNode, setBoundNode] = useState<VlessNode | null>(null)
|
||||
const normalizedEmail = user?.email?.toLowerCase() ?? ''
|
||||
const isGuestSandboxReadOnly = Boolean(
|
||||
user?.isReadOnly && (normalizedEmail === 'sandbox@svc.plus' || normalizedEmail === 'demo@svc.plus'),
|
||||
user?.isReadOnly && (normalizedEmail === 'sandbox@svc.plus'),
|
||||
)
|
||||
const visibleNodes = useMemo(() => {
|
||||
return (nodes ?? []).filter((node) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user