Initial snapshot before step 6 options.js split

This commit is contained in:
admin
2026-05-22 21:05:21 +02:00
commit f8e781f0e9
26 changed files with 9741 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
{
"name": "com.rcjav.host",
"description": "rclonex native messaging host (rc-jav bridge)",
"path": "D:\\DEV\\Extensions\\Production\\rclone-jav\\host\\rcjav-host.bat",
"type": "stdio",
"allowed_origins": [
"chrome-extension://afbnfamppannbmhgphbbgdkmilijfagp/"
]
}
+9
View File
@@ -0,0 +1,9 @@
{
"name": "com.rcjav.host",
"description": "rclonex native messaging host (rc-jav bridge)",
"path": "__HOST_BAT__",
"type": "stdio",
"allowed_origins": [
"chrome-extension://__EXTENSION_ID__/"
]
}
+75
View File
@@ -0,0 +1,75 @@
# install-host.ps1
# Registers rclonex native-messaging host so Brave can launch it.
#
# Usage: .\install-host.ps1 -ExtensionId <id-from-brave://extensions>
#
# Writes manifest to host\com.rcjav.host.json with the correct path + extension ID baked in,
# then registers it in HKLM (requires admin - script self-elevates if needed) AND HKCU.
# HKLM is required on some Brave installs; HKCU alone is not always honored.
param(
[Parameter(Mandatory = $true)]
[string]$ExtensionId
)
$ErrorActionPreference = "Stop"
$hostDir = $PSScriptRoot
$batPath = Join-Path $hostDir "rcjav-host.bat"
if (-not (Test-Path $batPath)) { throw "Host bat not found: $batPath" }
$manifestPath = Join-Path $hostDir "com.rcjav.host.json"
$template = Join-Path $hostDir "com.rcjav.host.json.template"
if (-not (Test-Path $template)) { throw "Template not found: $template" }
$content = Get-Content $template -Raw
$content = $content.Replace("__HOST_BAT__", ($batPath -replace "\\", "\\"))
$content = $content.Replace("__EXTENSION_ID__", $ExtensionId)
# UTF-8 WITHOUT BOM - Chrome/Brave rejects manifests with a BOM.
[System.IO.File]::WriteAllText($manifestPath, $content, [System.Text.UTF8Encoding]::new($false))
Write-Host "Manifest written: $manifestPath"
# Self-elevate for HKLM if not already admin.
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(
[Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $isAdmin) {
Write-Host "Not running as admin - relaunching elevated to write HKLM..."
Start-Process pwsh -Verb RunAs -ArgumentList @(
"-NoProfile", "-ExecutionPolicy", "Bypass",
"-File", $PSCommandPath,
"-ExtensionId", $ExtensionId
)
exit
}
# Register in HKLM - required on some Brave installs.
$keys = @(
'HKLM:\Software\BraveSoftware\Brave-Browser\NativeMessagingHosts\com.rcjav.host',
'HKLM:\Software\Google\Chrome\NativeMessagingHosts\com.rcjav.host',
'HKLM:\Software\WOW6432Node\Google\Chrome\NativeMessagingHosts\com.rcjav.host',
'HKLM:\Software\Chromium\NativeMessagingHosts\com.rcjav.host',
# HKCU as belt-and-suspenders for installs that prefer it
'HKCU:\Software\BraveSoftware\Brave-Browser\NativeMessagingHosts\com.rcjav.host',
'HKCU:\Software\Google\Chrome\NativeMessagingHosts\com.rcjav.host',
'HKCU:\Software\Chromium\NativeMessagingHosts\com.rcjav.host'
)
foreach ($k in $keys) {
try {
New-Item -Path $k -Force -ErrorAction Stop | Out-Null
Set-Item -Path $k -Value $manifestPath
Write-Host " Set: $k"
} catch {
Write-Host " FAILED: $k ($($_.Exception.Message))"
}
}
Write-Host ""
Write-Host "Manifest contents:"
Write-Host "-------------------"
Write-Host $content
Write-Host "-------------------"
Write-Host ""
Write-Host "Fully restart Brave (kill all brave.exe processes, then reopen) for the registry"
Write-Host "entries to be picked up. Then click rclonex toolbar > Ping host."
Read-Host "Press Enter to close"
+8
View File
@@ -0,0 +1,8 @@
@echo off
REM Portable: uses Windows py launcher if present, falls back to python on PATH.
REM Stderr redirected to log file so it can't pollute stdout (native messaging is binary).
setlocal
set "PYBIN=python"
where py >nul 2>&1 && set "PYBIN=py"
if not exist "%~dp0logs" mkdir "%~dp0logs"
"%PYBIN%" -u "%~dp0rcjav-host.py" 2>>"%~dp0logs\rcjav-host-stderr.log"
+1
View File
@@ -0,0 +1 @@
stdin closed, exiting
+2041
View File
File diff suppressed because it is too large Load Diff
+17
View File
@@ -0,0 +1,17 @@
@echo off
REM Double-click this to register the native messaging host with Brave.
REM Prompts for the extension ID, then runs install-host.ps1.
setlocal
set /p EXT_ID="Paste the rclone-jav extension ID from brave://extensions: "
if "%EXT_ID%"=="" (
echo No ID entered. Aborting.
pause
exit /b 1
)
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0install-host.ps1" -ExtensionId "%EXT_ID%"
echo.
echo Done. Press any key to close.
pause >nul