refactor: lock wayfern

This commit is contained in:
zhom
2026-01-11 21:01:25 +04:00
parent eeea15c65d
commit 6c632abc4b
+37 -44
View File
@@ -1,6 +1,7 @@
"use client"; "use client";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { LuLock } from "react-icons/lu";
import { Alert, AlertDescription } from "@/components/ui/alert"; import { Alert, AlertDescription } from "@/components/ui/alert";
import { Checkbox } from "@/components/ui/checkbox"; import { Checkbox } from "@/components/ui/checkbox";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
@@ -65,8 +66,6 @@ export function WayfernConfigForm({
const [currentOS] = useState<WayfernOS>(getCurrentOS); const [currentOS] = useState<WayfernOS>(getCurrentOS);
const selectedOS = config.os || currentOS; const selectedOS = config.os || currentOS;
const isOSDifferent = selectedOS !== currentOS;
const isMobileOS = selectedOS === "android" || selectedOS === "ios";
useEffect(() => { useEffect(() => {
if (isCreating && typeof window !== "undefined") { if (isCreating && typeof window !== "undefined") {
@@ -155,29 +154,23 @@ export function WayfernConfigForm({
<SelectValue placeholder="Select operating system" /> <SelectValue placeholder="Select operating system" />
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>
<SelectItem value="windows">{osLabels.windows}</SelectItem> {(
<SelectItem value="macos">{osLabels.macos}</SelectItem> ["windows", "macos", "linux", "android", "ios"] as WayfernOS[]
<SelectItem value="linux">{osLabels.linux}</SelectItem> ).map((os) => {
<SelectItem value="android">{osLabels.android}</SelectItem> const isDisabled = os !== currentOS;
<SelectItem value="ios">{osLabels.ios}</SelectItem> return (
<SelectItem key={os} value={os} disabled={isDisabled}>
<span className="flex items-center gap-2">
{osLabels[os]}
{isDisabled && (
<LuLock className="w-3 h-3 text-muted-foreground" />
)}
</span>
</SelectItem>
);
})}
</SelectContent> </SelectContent>
</Select> </Select>
{isOSDifferent && !isMobileOS && (
<Alert className="border-yellow-500/50 bg-yellow-500/10">
<AlertDescription className="text-yellow-600 dark:text-yellow-400">
Warning: Selecting an OS different from your current system (
{osLabels[currentOS]}) increases the risk of detection.
</AlertDescription>
</Alert>
)}
{isMobileOS && (
<Alert className="border-yellow-500/50 bg-yellow-500/10">
<AlertDescription className="text-yellow-600 dark:text-yellow-400">
Warning: Mobile OS spoofing on desktop has high detection risk.
Websites can detect the mismatch between fingerprint and behavior.
</AlertDescription>
</Alert>
)}
</div> </div>
{/* Randomize Fingerprint Option */} {/* Randomize Fingerprint Option */}
@@ -941,29 +934,29 @@ export function WayfernConfigForm({
<SelectValue placeholder="Select operating system" /> <SelectValue placeholder="Select operating system" />
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>
<SelectItem value="windows">{osLabels.windows}</SelectItem> {(
<SelectItem value="macos">{osLabels.macos}</SelectItem> [
<SelectItem value="linux">{osLabels.linux}</SelectItem> "windows",
<SelectItem value="android">{osLabels.android}</SelectItem> "macos",
<SelectItem value="ios">{osLabels.ios}</SelectItem> "linux",
"android",
"ios",
] as WayfernOS[]
).map((os) => {
const isDisabled = os !== currentOS;
return (
<SelectItem key={os} value={os} disabled={isDisabled}>
<span className="flex items-center gap-2">
{osLabels[os]}
{isDisabled && (
<LuLock className="w-3 h-3 text-muted-foreground" />
)}
</span>
</SelectItem>
);
})}
</SelectContent> </SelectContent>
</Select> </Select>
{isOSDifferent && !isMobileOS && (
<Alert className="border-yellow-500/50 bg-yellow-500/10">
<AlertDescription className="text-yellow-600 dark:text-yellow-400">
Warning: Selecting an OS different from your current system
({osLabels[currentOS]}) increases the risk of detection.
</AlertDescription>
</Alert>
)}
{isMobileOS && (
<Alert className="border-yellow-500/50 bg-yellow-500/10">
<AlertDescription className="text-yellow-600 dark:text-yellow-400">
Warning: Mobile OS spoofing on desktop has high detection
risk.
</AlertDescription>
</Alert>
)}
</div> </div>
{/* Randomize Fingerprint Option */} {/* Randomize Fingerprint Option */}