Last active
June 21, 2024 19:25
-
-
Save ianjennings/fa2839cfb91002b5226e9d891f0363c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define the path for the required directory | |
$directoryPath = "$env:USERPROFILE\AppData\Roaming\Dashcam" | |
# List of files to be created | |
$files = @( | |
".replayable--mainwindow-ever-launched", | |
".replayable--has-accepted-tos", | |
".replayable--segment-done", | |
".replayable--ever-launched", | |
".replayable--do-not-update", | |
".replayable--do-not-open-browser" | |
) | |
# Check if the directory exists, if not, create it | |
if (-not (Test-Path -Path $directoryPath)) { | |
New-Item -ItemType Directory -Path $directoryPath | |
} | |
# Check if each file exists, if not, create it | |
foreach ($file in $files) { | |
$filePath = Join-Path -Path $directoryPath -ChildPath $file | |
if (-not (Test-Path -Path $filePath)) { | |
New-Item -ItemType File -Path $filePath | |
} | |
} | |
# Define the path for the settings.json file | |
$settingsFilePath = Join-Path -Path $directoryPath -ChildPath "settings.json" | |
# Define the JSON content | |
$jsonContent = @{ | |
"EDIT_ON_CLIP" = $false | |
"CAPTURE_ERROR" = $false | |
"DETECT_ERRORS_ONCE" = $true | |
} | ConvertTo-Json | |
# Write the JSON content to the settings.json file | |
$jsonContent | Out-File -FilePath $settingsFilePath -Encoding UTF8 | |
# # Define the source URL and destination path for the Node.js installer | |
$nodeUrl = "https://nodejs.org/dist/v16.15.1/node-v16.15.1-x64.msi" | |
$nodeInstallerPath = "$env:USERPROFILE\Desktop\node-v16.15.1-x64.msi" | |
# # Download the Node.js installer | |
Invoke-WebRequest -Uri $nodeUrl -OutFile $nodeInstallerPath | |
# # Run the Node.js installer | |
Start-Process -FilePath $nodeInstallerPath -ArgumentList "/quiet" -Wait | |
# Verify the Node.js and npm installation | |
if (node -v) { | |
# Install dashcam globally using npm | |
npm install -g dashcam | |
} else { | |
Write-Error "Node.js or npm installation failed. Please check the installer log for details." | |
} | |
# Define the source URL and destination path for the Dashcam installer | |
$dashcamUrl = "https://replayable-api-production.herokuapp.com/download/win" | |
$dashcamInstallerPath = "$env:USERPROFILE\Downloads\Dashcam-Setup.exe" | |
# Download the Dashcam installer | |
Invoke-WebRequest -Uri $dashcamUrl -OutFile $dashcamInstallerPath | |
# Run the Dashcam installer | |
Start-Process -FilePath $dashcamInstallerPath -Wait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Authenticate dashcam with your API key | |
$apiKey = "YOUR_API_KEY" | |
dashcam auth $apiKey | |
# Set up dashcam tracking | |
dashcam track --name=test --type=application --pattern="C:\Users\Switc\OneDrive\Desktop\*.log*" | |
# Start dashcam | |
dashcam start | |
# Generate a log file | |
Get-ChildItem C:\Windows\System32 | Tee-Object -FilePath 'C:\Users\Switc\OneDrive\Desktop\test.log' | |
# Submit dashcam results | |
dashcam -t "My Test Result" -p --md |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment