Skip to content

Commit

Permalink
Support Edge and Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
joneslloyd committed Nov 30, 2024
1 parent 942dc73 commit 87495f5
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 40 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/build-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ jobs:
working-directory: ./packages/wxt
run: pnpm zip:firefox

# Run the Edge build command from ./packages/wxt/
- name: Build Edge ZIP
working-directory: ./packages/wxt
run: pnpm zip:edge

# Debugging: Check if ZIP files are generated
- name: Check Output Directory
run: ls -l ./packages/wxt/.output/*.zip || echo "No ZIP files found in the output directory"
Expand All @@ -80,6 +85,7 @@ jobs:
run: |
mv ./packages/wxt/.output/bluniversal-comments-chrome.zip ./bluniversal-comments-chrome.zip
mv ./packages/wxt/.output/bluniversal-comments-firefox.zip ./bluniversal-comments-firefox.zip
mv ./packages/wxt/.output/bluniversal-comments-edge.zip ./bluniversal-comments-edge.zip
echo "Moved ZIP files to the root directory"
# Debugging: List files in the root directory
Expand All @@ -100,6 +106,13 @@ jobs:
name: bluniversal-comments-firefox
path: ./bluniversal-comments-firefox.zip

# Upload the Firefox ZIP file as a GitHub Release Artifact
- name: Upload Edge ZIP as Artifact
uses: actions/upload-artifact@v3
with:
name: bluniversal-comments-edge
path: ./bluniversal-comments-edge.zip

# Get the version number
- name: Get Version
id: get-version
Expand Down Expand Up @@ -146,3 +159,15 @@ jobs:
asset_path: ./bluniversal-comments-firefox.zip
asset_name: bluniversal-comments-firefox.zip
asset_content_type: application/zip

# Upload Edge ZIP to Release
- name: Upload Edge ZIP to Release
if: github.ref == 'refs/heads/main'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ./bluniversal-comments-edge.zip
asset_name: bluniversal-comments-edge.zip
asset_content_type: application/zip
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,46 @@ Bluniversal Comments is a Chrome Extension enabling "universal comments" via Blu
### Step 1: Download the Extension

1. Visit the **[Releases](https://github.com/joneslloyd/bluniversal-comments/releases)** page on the GitHub repository.
2. Download the latest `chrome-extension.zip` file for the extension.

2. **Chrome:**
Download the latest `chrome-extension.zip` file for the extension.

**Firefox:**
Download the latest `firefox-extension.zip` file for the extension.

**Edge:**
Download the latest `edge-extension.zip` file for the extension.

### Step 2: Install the Extension

**Chrome and Edge**

1. Unpackage the `.zip` file to a directory on your computer.
2. Open Chrome and navigate to `chrome://extensions/`.
3. Enable **Developer mode** using the toggle switch in the top right corner of the page.
4. Click the **Load unpacked** button.
5. Select the directory where you unpackaged the `.zip` file.

**Firefox**

1. Download the `.zip` file to a directory on your computer, but don't unpackage it.
2. Open Firefox and navigate to `about:debugging#/runtime/this-firefox`.
3. Click the **Load Temporary Add-On** button.
4. Select the directory containing the `.zip` file.

### Step 3: Use the Extension

1. Open any supported webpage.
2. Click the Bluniversal Comments extension icon in the browser toolbar.
3. Log in to your Bluesky account using your username and app password via the **Options** page (accessible by right-clicking on the extension icon and then Options).
4. Once logged in, interact with existing Bluesky discussions or start a new thread for the page you're viewing.
3. Log in to your Bluesky account using your username and app password – A new tab should open automatically, but if not:

**Chrome and Edge:**
Navigate to the **Options** page (accessible by right-clicking on the extension icon and then Options).

**Firefox:**
In the Temporary Extension page, click the three dots (...) icon next to the Bluniversal Comments Extension, and then click Preferences.

4. Once logged in, go to any web page and interact with existing Bluesky discussions or start a new thread for the page you're viewing.

---

Expand Down
5 changes: 3 additions & 2 deletions packages/wxt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
"dev": "wxt",
"dev:firefox": "wxt -b firefox",
"build": "wxt build",
"build:firefox": "wxt build -b firefox",
"build:firefox": "wxt build -b firefox --mv3",
"zip": "wxt zip",
"zip:firefox": "wxt zip -b firefox",
"zip:firefox": "wxt zip -b firefox --mv3",
"zip:edge": "wxt zip -b edge",
"compile": "tsc --noEmit",
"postinstall": "wxt prepare"
},
Expand Down
83 changes: 48 additions & 35 deletions packages/wxt/wxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,55 @@
import { defineConfig } from "wxt";

const isFirefox = import.meta.env.FIREFOX;
const isDevelopment = import.meta.env.DEV;

export default defineConfig({
extensionApi: isFirefox ? "webextension-polyfill" : "chrome",
extensionApi: "chrome",
modules: ["@wxt-dev/module-react"],
manifest: {
manifest_version: 3,
name: "Bluniversal Comments",
version: "1.0",
description:
"Universal comments with Bluesky! Displays a Bluesky comments feed for the current page.",
permissions: isFirefox
? ["activeTab", "storage"]
: [
"activeTab",
"storage",
"https://*.bsky.social/*",
"https://*.bsky.app/*",
"https://*.bsky.team/*",
"https://public.api.bsky.app/*",
],
host_permissions: isFirefox
? []
: [
"https://bsky.social/*",
"https://bsky.app/*",
"https://*.bsky.social/*",
"https://*.bsky.app/*",
"https://*.bsky.team/*",
"https://public.api.bsky.app/*",
],
content_security_policy: {
extension_pages: isDevelopment
? "script-src 'self' 'unsafe-eval' 'unsafe-inline' http://localhost:*; object-src 'self'; connect-src ws://localhost:*;"
: "script-src 'self'; object-src 'self';",
},
manifest: ({ mode, command, browser }) => {
const isFirefox = browser === "firefox";
const isDevelopment = mode !== "production";

return {
manifest_version: 3,
name: "Bluniversal Comments",
version: "1.0",
description:
"Universal comments with Bluesky! Displays a Bluesky comments feed for the current page.",
permissions: isFirefox
? ["activeTab", "storage"] // Firefox-compatible permissions
: [
"activeTab",
"storage",
"https://bsky.social/*",
"https://bsky.app/*",
"https://bsky.team/*",
"https://public.api.bsky.app/*",
],
host_permissions: isFirefox
? [
"https://bsky.social/*",
"https://bsky.app/*",
"https://bsky.team/*",
"https://public.api.bsky.app/*",
]
: [
"https://*.bsky.social/*",
"https://*.bsky.app/*",
"https://*.bsky.team/*",
"https://public.api.bsky.app/*",
],
content_security_policy: {
extension_pages: isDevelopment
? "script-src 'self' 'unsafe-eval' 'unsafe-inline' http://localhost:*; object-src 'self'; connect-src ws://localhost:*;"
: "script-src 'self'; object-src 'self';",
},
...(isFirefox && {
browser_specific_settings: {
gecko: {
id: "{123e4567-e89b-12d3-a456-426614174000}",
strict_min_version: "58.0",
},
},
}),
};
},
zip: {
artifactTemplate: "{{name}}-{{browser}}.zip",
Expand Down

0 comments on commit 87495f5

Please sign in to comment.