1
0
forked from icd/rentgen

Compare commits

..

No commits in common. "7f5c571c8601e4478b5de1e48a0ed269bf38ce62" and "b53aeccd8c3dad3dbee35c185eb381ae19b6b57e" have entirely different histories.

5 changed files with 63 additions and 74 deletions

View File

@ -1,9 +1,34 @@
# Rentgen Browser Extension - Docker Build # Rentgen Browser Extension - Docker Build
# See README.md for detailed usage instructions #
# Usage:
# Build and extract artifacts directly:
# docker buildx build . --output artifacts
#
# Build with tests (typecheck + lint):
# docker build --build-arg RUN_TESTS=true -t rentgen .
#
# Or traditional build (creates full development environment):
# docker build -t rentgen .
# docker run --rm rentgen ls -lh /app/web-ext-artifacts/
#
# Run commands in the container:
# docker run --rm rentgen npm run build:chrome
# docker run --rm rentgen npm run typecheck
#
# Run extension in Firefox (headless):
# docker build --target runtime -t rentgen-run .
# docker run --rm -it rentgen-run
#
# Using docker-compose:
# docker-compose up rentgen_check # Build only
# docker-compose up rentgen_run # Run in Firefox
# Build stage # Build stage
FROM node:lts AS builder FROM node:lts AS builder
# Optional: run tests during build (typecheck + lint)
ARG RUN_TESTS=false
WORKDIR /app WORKDIR /app
# Copy package files for dependency installation (better layer caching) # Copy package files for dependency installation (better layer caching)
@ -21,9 +46,13 @@ RUN npm run build
# Create the package # Create the package
RUN npm run create-package RUN npm run create-package
# Test stage - for running quality checks # Optional: run quality checks
FROM builder AS test RUN if [ "$RUN_TESTS" = "true" ]; then \
RUN npm run typecheck && npm run lint echo "Running TypeScript type checking..."; \
npm run typecheck; \
echo "Running web-ext lint..."; \
npm run lint; \
fi
# Artifacts stage - only contains the built artifacts (for --output) # Artifacts stage - only contains the built artifacts (for --output)
FROM scratch AS artifacts FROM scratch AS artifacts

View File

@ -41,50 +41,6 @@ Firefox: https://addons.mozilla.org/en-US/firefox/addon/rentgen/
3. Click _Load Temporary Add-on..._ button 3. Click _Load Temporary Add-on..._ button
4. Pick the zip archive from last step of build process. 4. Pick the zip archive from last step of build process.
## Docker Usage
### Build and extract artifacts directly
```bash
docker buildx build . --output artifacts
```
This will build the extension and extract the `.zip` file to the `artifacts/` directory.
### Build with tests (typecheck + lint)
```bash
docker build --target test -t rentgen-test .
```
### Traditional build (creates full development environment)
```bash
docker build -t rentgen .
docker run --rm rentgen ls -lh /app/web-ext-artifacts/
```
### Run commands in the container
```bash
docker run --rm rentgen npm run build:chrome
docker run --rm rentgen npm run typecheck
```
### Run extension in Firefox (headless)
```bash
docker build --target runtime -t rentgen-run .
docker run --rm -it rentgen-run
```
### Using docker-compose
```bash
docker-compose up rentgen_check # Build only
docker-compose up rentgen_run # Run in Firefox
```
## Issue tracker ## Issue tracker
If you find a problem, please send us an email: kontakt@internet-czas-dzialac.pl If you find a problem, please send us an email: kontakt@internet-czas-dzialac.pl

View File

@ -1,18 +1,18 @@
#!/bin/bash #!/bin/bash
# #
# test_start_extension.sh - Starts Rentgen extension in headless Firefox with verification # test_start_extension.sh - Uruchamia rozszerzenie Rentgen w headless Firefox z weryfikacją
# #
# This script is used by Docker runtime stage to: # Ten skrypt jest używany przez Docker runtime stage do:
# 1. Start Xvfb (virtual X server) on display :99 # 1. Uruchomienia Xvfb (wirtualny X server) na display :99
# 2. Run web-ext with verbose logging # 2. Uruchomienia web-ext run z verbose loggingiem
# 3. Verify extension was installed correctly # 3. Weryfikacji czy extension został poprawnie zainstalowany
# 4. Verify extension code executed (by checking ABSENCE of errors) # 4. Weryfikacji czy kod extensiona się wykonał (przez sprawdzenie BRAKU błędów)
# #
# IMPORTANT: console.error from background pages does NOT appear in web-ext stdout # WAŻNE: console.error z background page NIE pojawia się w web-ext stdout
# (Firefox limitation). Verification works by: # (to ograniczenie Firefoksa). Weryfikacja działa poprzez:
# - Checking that extension installed # - Sprawdzenie czy extension się zainstalował
# - Checking NO JavaScript errors in logs # - Sprawdzenie czy NIE MA błędów JavaScript w logach
# - No errors = code executed correctly # - Jeśli nie ma błędów = kod się wykonał poprawnie
# #
set -e set -e
@ -50,12 +50,12 @@ for i in {1..30}; do
if grep -i "JavaScript error.*background.js\|SyntaxError.*background\|ReferenceError.*background" /tmp/web-ext.log 2>/dev/null | grep -v "BackupService\|RSLoader"; then if grep -i "JavaScript error.*background.js\|SyntaxError.*background\|ReferenceError.*background" /tmp/web-ext.log 2>/dev/null | grep -v "BackupService\|RSLoader"; then
echo "" echo ""
echo "========================================" echo "========================================"
echo "✗✗✗ CRITICAL ERROR ✗✗✗" echo "✗✗✗ KRYTYCZNY BŁĄD ✗✗✗"
echo "========================================" echo "========================================"
echo "Found JavaScript errors in background.js!" echo "Znaleziono błędy JavaScript w background.js!"
echo "Extension installed but CODE DID NOT EXECUTE!" echo "Extension się zainstalował ale KOD SIĘ NIE WYKONAŁ!"
echo "" echo ""
echo "Errors:" echo "Błędy:"
grep -i "JavaScript error.*background.js\|SyntaxError.*background\|ReferenceError.*background" /tmp/web-ext.log 2>/dev/null | head -10 grep -i "JavaScript error.*background.js\|SyntaxError.*background\|ReferenceError.*background" /tmp/web-ext.log 2>/dev/null | head -10
echo "========================================" echo "========================================"
exit 1 exit 1

View File

@ -1,13 +1,13 @@
#!/bin/bash #!/bin/bash
# #
# test_verify.sh - Verifies extension and exits (doesn't wait forever) # test_verify.sh - Weryfikuje extension i kończy (nie czeka nieskończenie)
# #
# This script is a test version of test_start_extension.sh that: # Ten skrypt jest wersją testową test_start_extension.sh która:
# - Starts Firefox with the extension # - Uruchamia Firefox z extensionem
# - Verifies extension loaded without errors # - Weryfikuje czy extension się załadował bez błędów
# - EXITS after verification (instead of waiting forever) # - KOŃCZY się po weryfikacji (zamiast czekać nieskończenie)
# #
# Used for automated tests in CI/Docker. # Używany do automatycznych testów w CI/Docker.
# #
set -e set -e
@ -58,12 +58,12 @@ echo "Checking for JavaScript errors in extension code..."
if grep -i "JavaScript error.*background.js\|SyntaxError.*background\|ReferenceError.*background" /tmp/web-ext.log 2>/dev/null | grep -v "BackupService\|RSLoader"; then if grep -i "JavaScript error.*background.js\|SyntaxError.*background\|ReferenceError.*background" /tmp/web-ext.log 2>/dev/null | grep -v "BackupService\|RSLoader"; then
echo "" echo ""
echo "========================================" echo "========================================"
echo "✗✗✗ CRITICAL ERROR ✗✗✗" echo "✗✗✗ KRYTYCZNY BŁĄD ✗✗✗"
echo "========================================" echo "========================================"
echo "Found JavaScript errors in background.js!" echo "Znaleziono błędy JavaScript w background.js!"
echo "Extension installed but CODE DID NOT EXECUTE!" echo "Extension się zainstalował ale KOD SIĘ NIE WYKONAŁ!"
echo "" echo ""
echo "Errors:" echo "Błędy:"
grep -i "JavaScript error.*background.js\|SyntaxError.*background\|ReferenceError.*background" /tmp/web-ext.log 2>/dev/null | head -10 grep -i "JavaScript error.*background.js\|SyntaxError.*background\|ReferenceError.*background" /tmp/web-ext.log 2>/dev/null | head -10
echo "========================================" echo "========================================"

View File

@ -109,7 +109,11 @@ export class StolenDataEntry extends SaferEmitter {
.map((kv) => kv.split('=')) .map((kv) => kv.split('='))
); );
} catch (e) { } catch (e) {
// failed to parse as query string, safe to ignore // failed to parse as query string
console.log(
'Failed attempt to parse hash location as query string, probably safe to ignore:',
e
);
} }
} }
const searchParams = Object.fromEntries( const searchParams = Object.fromEntries(