@echo off
chcp 65001 >nul
title MAPINLIFE 키오스크 카메라 자동 허용
net session >nul 2>&1
if %errorlevel% neq 0 (
  powershell -NoProfile -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
  exit /b
)
echo.
echo  MAPINLIFE 키오스크 - 카메라/마이크·결제 단말 연결 자동 허용 설정
echo  ------------------------------------------------
for %%B in ("Google\Chrome" "Microsoft\Edge") do (
  reg add "HKLM\SOFTWARE\Policies\%%~B\VideoCaptureAllowedUrls" /v 901 /t REG_SZ /d "https://mapinlife.store" /f >nul
  reg add "HKLM\SOFTWARE\Policies\%%~B\VideoCaptureAllowedUrls" /v 902 /t REG_SZ /d "https://mapinlife.com" /f >nul
  reg add "HKLM\SOFTWARE\Policies\%%~B\AudioCaptureAllowedUrls" /v 901 /t REG_SZ /d "https://mapinlife.store" /f >nul
  reg add "HKLM\SOFTWARE\Policies\%%~B\AudioCaptureAllowedUrls" /v 902 /t REG_SZ /d "https://mapinlife.com" /f >nul
  reg add "HKLM\SOFTWARE\Policies\%%~B\AutoplayAllowlist" /v 901 /t REG_SZ /d "https://mapinlife.store" /f >nul
  reg add "HKLM\SOFTWARE\Policies\%%~B\LocalNetworkAccessAllowedForUrls" /v 901 /t REG_SZ /d "https://mapinlife.store" /f >nul
  reg add "HKLM\SOFTWARE\Policies\%%~B\LocalNetworkAccessAllowedForUrls" /v 902 /t REG_SZ /d "https://mapinlife.com" /f >nul
)
echo  [완료] 크롬 / 엣지 모두 적용했습니다.
echo  PC를 다시 시작하거나 브라우저를 다시 켜면 카메라 허용 창이 더 이상 뜨지 않습니다.
echo.
choice /c YN /m " 지금 PC를 다시 시작할까요? (Y=예, N=나중에)"
if errorlevel 2 goto end
shutdown /r /t 5
:end
echo.
pause
