diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..92a9608 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + lint: + runs-on: docker + container: git.nakama.town/fmartingr/ci-images/ci-base:1.0.0 + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-bun@v2 + - run: make lint + + build: + runs-on: docker + container: git.nakama.town/fmartingr/ci-images/ci-base:1.0.0 + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-bun@v2 + - run: make build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..22c79db --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Release + +on: + push: + tags: ["v*"] + +jobs: + release: + runs-on: docker + container: git.nakama.town/fmartingr/ci-images/ci-base:1.0.0 + steps: + - uses: actions/checkout@v6 + + - uses: actions/setup-bun@v2 + + - name: Build extension + run: make build + + - name: Prepare artifacts + run: | + TAG=${GITHUB_REF#refs/tags/} + mkdir -p release + find web-ext-artifacts -name "*.zip" -exec mv {} release/webext-dark-mode-${TAG}.zip \; + cp release/webext-dark-mode-${TAG}.zip release/webext-dark-mode-${TAG}.xpi + + - name: Create release + uses: actions/forgejo-release@v2.6.0 + with: + direction: upload + tag: ${{ github.ref_name }} + title: ${{ github.ref_name }} + release-notes: "" + download-url: ${{ server_url }}/${{ github.repository }} + token: ${{ secrets.FORGEJO_TOKEN }} + release-dir: release + release-notes-assistant: "" diff --git a/.gitignore b/.gitignore index 3c0f63d..53241c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,14 @@ extension.zip .DS_Store node_modules/ +bun.lockb *.log +web-ext-artifacts/ + +# AI tools +.serena +.cursor +.claude +CLAUDE.md +AGENTS.md +.playwright-mcp diff --git a/.woodpecker/release.yml b/.woodpecker/release.yml deleted file mode 100644 index 8d995eb..0000000 --- a/.woodpecker/release.yml +++ /dev/null @@ -1,22 +0,0 @@ -when: - - event: tag - ref: refs/tags/v* - -steps: - - name: build - image: alpine:latest - commands: - - apk add --no-cache make nodejs npm - - make build - - find web-ext-artifacts -name "*.zip" -exec mv {} webext-dark-mode-${CI_COMMIT_TAG}.zip \; - - cp webext-dark-mode-${CI_COMMIT_TAG}.zip webext-dark-mode-${CI_COMMIT_TAG}.xpi - - - name: release - image: woodpeckerci/plugin-release - settings: - api_key: - from_secret: FORGEJO_TOKEN - files: - - webext-dark-mode-${CI_COMMIT_TAG}.zip - - webext-dark-mode-${CI_COMMIT_TAG}.xpi - title: ${CI_COMMIT_TAG} diff --git a/Makefile b/Makefile index 1f60a82..dfbe661 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ help: ## Show this help message build: ## Build the extension @echo "Building extension..." - @npx web-ext build --overwrite-dest + @bunx --bun web-ext build --overwrite-dest clean: ## Remove build artifacts @echo "Cleaning up..." @@ -20,4 +20,4 @@ clean: ## Remove build artifacts lint: ## Lint the extension @echo "Linting..." - @npx web-ext lint + @bunx --bun web-ext lint diff --git a/manifest.json b/manifest.json index 295a47d..0f3f4ae 100644 --- a/manifest.json +++ b/manifest.json @@ -8,6 +8,14 @@ "activeTab", "scripting" ], + "browser_specific_settings": { + "gecko": { + "id": "smart-dark-mode@fmartingr.com", + "data_collection_permissions": { + "required": ["none"] + } + } + }, "action": { "default_popup": "popup.html", "default_icon": { diff --git a/styles.css b/styles.css index 33a6b62..1ad9579 100644 --- a/styles.css +++ b/styles.css @@ -16,6 +16,14 @@ html.smart-dark-mode .smart-dark-mode-preserve { filter: invert(1) hue-rotate(180deg) !important; } +/* Re-invert fullscreen videos to preserve original colors */ +html.smart-dark-mode video:fullscreen, +html.smart-dark-mode video:-webkit-full-screen, +html.smart-dark-mode video:-moz-full-screen, +html.smart-dark-mode video:-ms-fullscreen { + filter: invert(1) hue-rotate(180deg) !important; +} + /* Prevent double inversion for media inside preserved containers */ html.smart-dark-mode .smart-dark-mode-preserve img, html.smart-dark-mode .smart-dark-mode-preserve video, @@ -28,6 +36,6 @@ html.smart-dark-mode .smart-dark-mode-preserve [style*="background-image"] { filter: none !important; } -/* Exclude already dark elements if possible - this is tricky with just CSS filters, - but we can try to exclude some common patterns if needed. - For now, the re-inversion is the main "smart" part. */ \ No newline at end of file +/* Exclude already dark elements if possible - this is tricky with just CSS filters, + but we can try to exclude some common patterns if needed. + For now, the re-inversion is the main "smart" part. */