1
0
forked from icd/rentgen

Compare commits

..

5 Commits

Author SHA1 Message Date
7f5c571c86 i18n: translate test_verify.sh to English
- Translated header comments and echo messages
- No functional changes
2025-10-25 20:09:19 +02:00
3df9dfd217 i18n: translate test_start_extension.sh to English
- Translated comments and echo messages
- No functional changes
- Part of comprehensive English translation effort
2025-10-25 20:08:32 +02:00
ffcf2b6b02 cleanup: remove console.log from stolen-data-entry.ts
- Removed debug console.log from catch block
- Comment updated to clarify error is safe to ignore
- Cleaner production logs
2025-10-25 20:07:53 +02:00
00e853de7a refactor(docker): replace RUN_TESTS ARG with test stage
- Removed ARG RUN_TESTS and conditional if block
- Added dedicated 'test' stage for quality checks
- Usage: docker build --target test -t rentgen-test .
- Cleaner separation of concerns
- Updated README with new command
2025-10-25 20:07:19 +02:00
8b2498642f docs(docker): move Dockerfile usage comments to README
- Dockerfile header reduced to single line reference to README
- Added comprehensive 'Docker Usage' section to README.md
- Easier to maintain documentation in one place
- Includes all usage examples: build, test, runtime, docker-compose
2025-10-25 20:06:09 +02:00
5 changed files with 74 additions and 63 deletions

View File

@ -1,34 +1,9 @@
# 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)
@ -46,13 +21,9 @@ RUN npm run build
# Create the package # Create the package
RUN npm run create-package RUN npm run create-package
# Optional: run quality checks # Test stage - for running quality checks
RUN if [ "$RUN_TESTS" = "true" ]; then \ FROM builder AS test
echo "Running TypeScript type checking..."; \ RUN npm run typecheck && npm run lint
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,6 +41,50 @@ 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 - Uruchamia rozszerzenie Rentgen w headless Firefox z weryfikacją # test_start_extension.sh - Starts Rentgen extension in headless Firefox with verification
# #
# Ten skrypt jest używany przez Docker runtime stage do: # This script is used by Docker runtime stage to:
# 1. Uruchomienia Xvfb (wirtualny X server) na display :99 # 1. Start Xvfb (virtual X server) on display :99
# 2. Uruchomienia web-ext run z verbose loggingiem # 2. Run web-ext with verbose logging
# 3. Weryfikacji czy extension został poprawnie zainstalowany # 3. Verify extension was installed correctly
# 4. Weryfikacji czy kod extensiona się wykonał (przez sprawdzenie BRAKU błędów) # 4. Verify extension code executed (by checking ABSENCE of errors)
# #
# WAŻNE: console.error z background page NIE pojawia się w web-ext stdout # IMPORTANT: console.error from background pages does NOT appear in web-ext stdout
# (to ograniczenie Firefoksa). Weryfikacja działa poprzez: # (Firefox limitation). Verification works by:
# - Sprawdzenie czy extension się zainstalował # - Checking that extension installed
# - Sprawdzenie czy NIE MA błędów JavaScript w logach # - Checking NO JavaScript errors in logs
# - Jeśli nie ma błędów = kod się wykonał poprawnie # - No errors = code executed correctly
# #
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 "✗✗✗ KRYTYCZNY BŁĄD ✗✗✗" echo "✗✗✗ CRITICAL ERROR ✗✗✗"
echo "========================================" echo "========================================"
echo "Znaleziono błędy JavaScript w background.js!" echo "Found JavaScript errors in background.js!"
echo "Extension się zainstalował ale KOD SIĘ NIE WYKONAŁ!" echo "Extension installed but CODE DID NOT EXECUTE!"
echo "" echo ""
echo "Błędy:" echo "Errors:"
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 - Weryfikuje extension i kończy (nie czeka nieskończenie) # test_verify.sh - Verifies extension and exits (doesn't wait forever)
# #
# Ten skrypt jest wersją testową test_start_extension.sh która: # This script is a test version of test_start_extension.sh that:
# - Uruchamia Firefox z extensionem # - Starts Firefox with the extension
# - Weryfikuje czy extension się załadował bez błędów # - Verifies extension loaded without errors
# - KOŃCZY się po weryfikacji (zamiast czekać nieskończenie) # - EXITS after verification (instead of waiting forever)
# #
# Używany do automatycznych testów w CI/Docker. # Used for automated tests in 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 "✗✗✗ KRYTYCZNY BŁĄD ✗✗✗" echo "✗✗✗ CRITICAL ERROR ✗✗✗"
echo "========================================" echo "========================================"
echo "Znaleziono błędy JavaScript w background.js!" echo "Found JavaScript errors in background.js!"
echo "Extension się zainstalował ale KOD SIĘ NIE WYKONAŁ!" echo "Extension installed but CODE DID NOT EXECUTE!"
echo "" echo ""
echo "Błędy:" echo "Errors:"
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,11 +109,7 @@ export class StolenDataEntry extends SaferEmitter {
.map((kv) => kv.split('=')) .map((kv) => kv.split('='))
); );
} catch (e) { } catch (e) {
// failed to parse as query string // failed to parse as query string, safe to ignore
console.log(
'Failed attempt to parse hash location as query string, probably safe to ignore:',
e
);
} }
} }
const searchParams = Object.fromEntries( const searchParams = Object.fromEntries(