-
Notifications
You must be signed in to change notification settings - Fork 5
Add all bridges #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add all bridges #13
Conversation
Bumps the npm_and_yarn group with 5 updates in the / directory: | Package | From | To | | --- | --- | --- | | [graphql](https://github.com/graphql/graphql-js) | `16.7.1` | `16.8.1` | | [next](https://github.com/vercel/next.js) | `14.2.4` | `14.2.10` | | [postcss](https://github.com/postcss/postcss) | `8.4.27` | `8.4.31` | | [braces](https://github.com/micromatch/braces) | `3.0.2` | `3.0.3` | | [micromatch](https://github.com/micromatch/micromatch) | `4.0.5` | `4.0.8` | Updates `graphql` from 16.7.1 to 16.8.1 - [Release notes](https://github.com/graphql/graphql-js/releases) - [Commits](graphql/graphql-js@v16.7.1...v16.8.1) Updates `next` from 14.2.4 to 14.2.10 - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](vercel/next.js@v14.2.4...v14.2.10) Updates `postcss` from 8.4.27 to 8.4.31 - [Release notes](https://github.com/postcss/postcss/releases) - [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md) - [Commits](postcss/postcss@8.4.27...8.4.31) Updates `braces` from 3.0.2 to 3.0.3 - [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md) - [Commits](micromatch/braces@3.0.2...3.0.3) Updates `micromatch` from 4.0.5 to 4.0.8 - [Release notes](https://github.com/micromatch/micromatch/releases) - [Changelog](https://github.com/micromatch/micromatch/blob/master/CHANGELOG.md) - [Commits](micromatch/micromatch@4.0.5...4.0.8) --- updated-dependencies: - dependency-name: graphql dependency-type: direct:production dependency-group: npm_and_yarn - dependency-name: next dependency-type: direct:production dependency-group: npm_and_yarn - dependency-name: postcss dependency-type: direct:production dependency-group: npm_and_yarn - dependency-name: braces dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: micromatch dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <support@github.com>
…arn-40d9cccc4f Bump the npm_and_yarn group across 1 directory with 5 updates
Bumps the npm_and_yarn group with 1 update in the / directory: [nanoid](https://github.com/ai/nanoid). Updates `nanoid` from 3.3.6 to 3.3.8 - [Release notes](https://github.com/ai/nanoid/releases) - [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md) - [Commits](ai/nanoid@3.3.6...3.3.8) --- updated-dependencies: - dependency-name: nanoid dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <support@github.com>
…arn-af93afb32e Bump nanoid from 3.3.6 to 3.3.8 in the npm_and_yarn group across 1 directory
Bumps the npm_and_yarn group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [cross-spawn](https://github.com/moxystudio/node-cross-spawn). Updates `next` from 14.2.10 to 14.2.21 - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](vercel/next.js@v14.2.10...v14.2.21) Updates `cross-spawn` from 7.0.3 to 7.0.6 - [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md) - [Commits](moxystudio/node-cross-spawn@v7.0.3...v7.0.6) --- updated-dependencies: - dependency-name: next dependency-type: direct:production dependency-group: npm_and_yarn - dependency-name: cross-spawn dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <support@github.com>
…arn-b42a7f98e3 Bump the npm_and_yarn group across 1 directory with 2 updates
Bumps the npm_and_yarn group with 1 update in the / directory: [next](https://github.com/vercel/next.js). Updates `next` from 14.2.21 to 14.2.30 - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](vercel/next.js@v14.2.21...v14.2.30) --- updated-dependencies: - dependency-name: next dependency-version: 14.2.30 dependency-type: direct:production dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <support@github.com>
…arn-3bd7c2c787 Bump next from 14.2.21 to 14.2.30 in the npm_and_yarn group across 1 directory
📝 WalkthroughSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughThis PR adds support for new bridges (instagramgo, facebookgo, signal), implements a redeploy feature for bridge instances, updates authentication documentation for org deploy tokens, adds Dependabot configuration, and bumps dependency versions. Changes
Sequence DiagramsequenceDiagram
participant User as BridgeInstance UI
participant API as /api/deploy Route
participant Fly as Fly Machines API
participant Beeper as Beeper API
User->>API: POST /api/deploy (redeploy: true, appName, flyToken)
API->>Fly: GET /apps/{appName}/machines
Fly-->>API: List of machines
API->>Fly: POST /apps/{appName}/machines/{machineId}/updates
Note over Fly: Update image to ghcr.io/beeper/bridge-manager
Fly-->>API: Update response
loop Poll for completion
API->>Beeper: GET /api/apps/{appName}/bridges
Beeper-->>API: Bridge status
Note over API: Check if app is registered
end
API-->>User: Success response with appName
Note over User: Show updated status or error message
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (8)
.github/dependabot.yml(1 hunks)app/api/deploy/route.ts(4 hunks)app/components/BeeperLogin.tsx(3 hunks)app/components/BridgeDeploy.tsx(2 hunks)app/components/BridgeInstance.tsx(2 hunks)app/components/FlyLogin.tsx(1 hunks)app/components/Welcome.tsx(1 hunks)package.json(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
app/api/deploy/route.ts (1)
app/api/bridges/route.ts (1)
POST(4-63)
🔇 Additional comments (9)
app/components/FlyLogin.tsx (1)
15-19: LGTM! Clear documentation improvement.The update to reference "org deploy token" with a direct link to the tokens page improves user guidance and aligns with Fly.io's authentication best practices.
.github/dependabot.yml (1)
1-11: LGTM! Standard Dependabot configuration.The Dependabot setup is correctly configured for yarn with weekly updates, which will help keep dependencies current and secure.
package.json (2)
5-5: Good addition for dependency management.The
packageManagerfield helps ensure consistent package manager versions across environments when using Corepack.
19-22: Dependency versions are secure and verified.All three versions are legitimate, secure releases:
- graphql@16.8.1: Fixes CVE-2023-26144 (DoS vulnerability)
- next@14.2.32: Fixes CVE-2025-57822 (SSRF in Middleware) and CVE-2025-57752 (image optimization cache issue from 14.2.31)
- postcss@8.4.31: Fixes CVE-2023-44270 (parsing/injection vulnerability)
The Next.js update from 14.2.4 to 14.2.32 is a patch-level change within the same minor version (28 patch updates), not a significant version jump. No breaking changes are expected from these security-focused patch updates.
app/components/BeeperLogin.tsx (2)
36-37: Good UX improvement for code input handling.Stripping whitespace allows users to paste codes formatted with spaces (like "123 456") and have them work correctly.
85-91: Better input type for numeric codes.Changing from
type="number"totype="text"withinputMode="numeric"is the correct approach for verification codes, as it prevents invalid characters (e, +, -, .) while still showing the numeric keyboard on mobile devices.app/components/BridgeInstance.tsx (1)
57-62: Nice UX enhancements.The Copy button for the bot handle and the View on Fly link provide helpful shortcuts for users to interact with their deployed bridges.
app/api/deploy/route.ts (1)
51-203: LGTM! Existing deploy logic preserved.The formatting changes don't affect the deployment logic, and the flow remains intact with proper error handling and deployment verification.
app/components/BridgeDeploy.tsx (1)
47-49: Verify new bridge names are supported by the backend.The bridge mapping now includes
instagramgo,facebookgo, andsignal(replacing the oldghcr.io/beeper/bridge-managercontainer expects and are properly supported. Verify the changes are used consistently throughout the codebase and that no stale references to the old
| // If redeploy flag is passed, update existing machine to latest image | ||
| if (redeploy) { | ||
| const res_list = await fetch(`https://api.machines.dev/v1/apps/${appName}/machines`, { | ||
| method: 'GET', | ||
| headers: { | ||
| 'Authorization': `Bearer ${flyToken}`, | ||
| 'Content-Type': 'application/json', | ||
| } | ||
| }) | ||
|
|
||
| if (res_list.status !== 200) { | ||
| const list_data = await res_list.json() | ||
| return NextResponse.json({ error: JSON.stringify(list_data) }, { status: 500 }) | ||
| } | ||
|
|
||
| const machines = await res_list.json() | ||
| if (!machines || machines.length === 0) { | ||
| return NextResponse.json({ error: `No machines found for app ${appName}` }, { status: 404 }) | ||
| } | ||
|
|
||
| const machine = machines[0] | ||
|
|
||
| const update_res = await fetch(`https://api.machines.dev/v1/apps/${appName}/machines/${machine.id}`, { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Authorization': `Bearer ${flyToken}`, | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| body: JSON.stringify({ | ||
| config: { | ||
| ...machine.config, | ||
| image: "ghcr.io/beeper/bridge-manager" | ||
| } | ||
| }) | ||
| }) | ||
|
|
||
| if (update_res.status !== 200) { | ||
| const update_data = await update_res.json() | ||
| return NextResponse.json({ error: JSON.stringify(update_data) }, { status: 500 }) | ||
| } | ||
|
|
||
| return NextResponse.json({ success: true }) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redeploy logic needs improvements for robustness.
The redeploy implementation has several concerns:
-
Line 27: Always uses the first machine without validation - if multiple machines exist, is this intentional?
-
Line 38: The hardcoded image
"ghcr.io/beeper/bridge-manager"has no version tag:- Docker may use cached images instead of pulling the latest
- Consider using a specific tag or
:latestexplicitly - No guarantee the image will actually update
-
No deployment verification: Unlike the main deploy flow (lines 182-200), the redeploy returns immediately without confirming the machine restarted or is running the new image
-
Line 37: Spreading
...machine.configcould be risky if the config schema has changed between bridge-manager versions
Consider these improvements:
// If redeploy flag is passed, update existing machine to latest image
if (redeploy) {
const res_list = await fetch(`https://api.machines.dev/v1/apps/${appName}/machines`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${flyToken}`,
'Content-Type': 'application/json',
}
})
if (res_list.status !== 200) {
const list_data = await res_list.json()
return NextResponse.json({ error: JSON.stringify(list_data) }, { status: 500 })
}
const machines = await res_list.json()
if (!machines || machines.length === 0) {
return NextResponse.json({ error: `No machines found for app ${appName}` }, { status: 404 })
}
const machine = machines[0]
const update_res = await fetch(`https://api.machines.dev/v1/apps/${appName}/machines/${machine.id}`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${flyToken}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
config: {
...machine.config,
- image: "ghcr.io/beeper/bridge-manager"
+ image: "ghcr.io/beeper/bridge-manager:latest"
}
})
})
if (update_res.status !== 200) {
const update_data = await update_res.json()
return NextResponse.json({ error: JSON.stringify(update_data) }, { status: 500 })
}
+
+ // TODO: Consider adding verification that the machine restarted successfully
return NextResponse.json({ success: true })
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // If redeploy flag is passed, update existing machine to latest image | |
| if (redeploy) { | |
| const res_list = await fetch(`https://api.machines.dev/v1/apps/${appName}/machines`, { | |
| method: 'GET', | |
| headers: { | |
| 'Authorization': `Bearer ${flyToken}`, | |
| 'Content-Type': 'application/json', | |
| } | |
| }) | |
| if (res_list.status !== 200) { | |
| const list_data = await res_list.json() | |
| return NextResponse.json({ error: JSON.stringify(list_data) }, { status: 500 }) | |
| } | |
| const machines = await res_list.json() | |
| if (!machines || machines.length === 0) { | |
| return NextResponse.json({ error: `No machines found for app ${appName}` }, { status: 404 }) | |
| } | |
| const machine = machines[0] | |
| const update_res = await fetch(`https://api.machines.dev/v1/apps/${appName}/machines/${machine.id}`, { | |
| method: 'POST', | |
| headers: { | |
| 'Authorization': `Bearer ${flyToken}`, | |
| 'Content-Type': 'application/json', | |
| }, | |
| body: JSON.stringify({ | |
| config: { | |
| ...machine.config, | |
| image: "ghcr.io/beeper/bridge-manager" | |
| } | |
| }) | |
| }) | |
| if (update_res.status !== 200) { | |
| const update_data = await update_res.json() | |
| return NextResponse.json({ error: JSON.stringify(update_data) }, { status: 500 }) | |
| } | |
| return NextResponse.json({ success: true }) | |
| } | |
| // If redeploy flag is passed, update existing machine to latest image | |
| if (redeploy) { | |
| const res_list = await fetch(`https://api.machines.dev/v1/apps/${appName}/machines`, { | |
| method: 'GET', | |
| headers: { | |
| 'Authorization': `Bearer ${flyToken}`, | |
| 'Content-Type': 'application/json', | |
| } | |
| }) | |
| if (res_list.status !== 200) { | |
| const list_data = await res_list.json() | |
| return NextResponse.json({ error: JSON.stringify(list_data) }, { status: 500 }) | |
| } | |
| const machines = await res_list.json() | |
| if (!machines || machines.length === 0) { | |
| return NextResponse.json({ error: `No machines found for app ${appName}` }, { status: 404 }) | |
| } | |
| const machine = machines[0] | |
| const update_res = await fetch(`https://api.machines.dev/v1/apps/${appName}/machines/${machine.id}`, { | |
| method: 'POST', | |
| headers: { | |
| 'Authorization': `Bearer ${flyToken}`, | |
| 'Content-Type': 'application/json', | |
| }, | |
| body: JSON.stringify({ | |
| config: { | |
| ...machine.config, | |
| image: "ghcr.io/beeper/bridge-manager:latest" | |
| } | |
| }) | |
| }) | |
| if (update_res.status !== 200) { | |
| const update_data = await update_res.json() | |
| return NextResponse.json({ error: JSON.stringify(update_data) }, { status: 500 }) | |
| } | |
| // TODO: Consider adding verification that the machine restarted successfully | |
| return NextResponse.json({ success: true }) | |
| } |
🤖 Prompt for AI Agents
In app/api/deploy/route.ts around lines 7 to 49, the redeploy branch is fragile:
it unconditionally picks the first machine, injects a hardcoded untagged image,
blindly spreads machine.config, and returns before verifying the update. Fix by
selecting the correct machine (validate if multiple exist and choose by
role/name or surface an error if ambiguous), require or append an explicit image
tag (or accept a tag param) instead of a bare registry string, build the new
config by copying only known-safe fields rather than blind ...machine.config
spreading, perform the machine update call and then poll the machine status
endpoint (with a short retry/backoff and a timeout) to verify the machine
restarted and is running the new image, and propagate detailed error responses
if selection, update, or verification fails.
| async function redeployBridge() { | ||
| setRedeploying(true) | ||
|
|
||
| const res = await fetch("/api/deploy", { | ||
| method: "POST", | ||
| headers: { | ||
| "Content-Type": "application/json" | ||
| }, | ||
| body: JSON.stringify({ | ||
| redeploy: true, | ||
| appName: name, | ||
| flyToken: flyToken | ||
| }) | ||
| }) | ||
|
|
||
| if (res.status !== 200) { | ||
| const error_data = await res.json() | ||
| setErrorMessage(error_data.error) | ||
| } | ||
|
|
||
| setRedeploying(false) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Improve redeploy error handling and user feedback.
The redeploy implementation has a few issues:
- The
redeployingstate is cleared even when an error occurs (line 47), which hides the error state from the user's perspective - There's no success feedback after a successful redeploy
- The
errorMessagefrom previous operations might still be displayed
Consider these improvements:
async function redeployBridge() {
setRedeploying(true)
+ setErrorMessage("") // Clear previous errors
const res = await fetch("/api/deploy", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
redeploy: true,
appName: name,
flyToken: flyToken
})
})
if (res.status !== 200) {
const error_data = await res.json()
setErrorMessage(error_data.error)
+ setRedeploying(false)
+ return
}
+ // Success feedback
+ setErrorMessage("") // Clear any errors
+ // Consider adding success state/message
setRedeploying(false)
}🤖 Prompt for AI Agents
In app/components/BridgeInstance.tsx around lines 27 to 48, improve redeploy
error handling by: clear any prior errorMessage before starting the request,
wrap the fetch in try/catch/finally, set a success message (e.g. "Redeploy
started") when res.status === 200, set errorMessage from the response in the
catch/failed branch, and move setRedeploying(false) into finally so redeploying
is only cleared after success or error handling is complete.
| <div className="px-20"> | ||
| <p className="mt-10">Use this web app to self-host bridges on your <a target="_blank" href={"https://fly.io/"} rel="noopener noreferrer">fly.io</a> account. Simply sign into Beeper and Fly, and this web app will run the bridge on your Fly account and install it in Beeper.</p> | ||
| <p className="mt-5">This site is open-source at <a target="_blank" href={"https://github.com/beeper/self-host-web"} rel="noopener noreferrer">https://github.com/beeper/self-host-web</a>. This webpage is being auto-deployed, however, you can run it from the GitHub if you prefer. Just follow the instructions in the README.</p> | ||
| <p className="mt-5">This site is open-source at <a target="_blank" href={"https://github.com/kubo6472/beeper-selfhost/"} rel="noopener noreferrer">https://github.com/kubo6472/beeper-selfhost</a>. This webpage is being auto-deployed, however, you can run it from the GitHub if you prefer. Just follow the instructions in the README.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirm canonical GitHub URL (personal fork vs upstream).
Line 22 changes the “open‑source at” link to https://github.com/kubo6472/beeper-selfhost/, which appears to be a personal fork rather than the upstream project. For users of the main repo, this may be confusing and could send them to the wrong source of truth.
Unless the canonical project has actually moved to that URL, consider keeping (or switching back to) the upstream org repo instead:
- <p className="mt-5">This site is open-source at <a target="_blank" href={"https://github.com/kubo6472/beeper-selfhost/"} rel="noopener noreferrer">https://github.com/kubo6472/beeper-selfhost</a>. This webpage is being auto-deployed, however, you can run it from the GitHub if you prefer. Just follow the instructions in the README.</p>
+ <p className="mt-5">This site is open-source at <a target="_blank" href={"https://github.com/beeper/self-host-web"} rel="noopener noreferrer">https://github.com/beeper/self-host-web</a>. This webpage is being auto-deployed, however, you can run it from the GitHub if you prefer. Just follow the instructions in the README.</p>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <p className="mt-5">This site is open-source at <a target="_blank" href={"https://github.com/kubo6472/beeper-selfhost/"} rel="noopener noreferrer">https://github.com/kubo6472/beeper-selfhost</a>. This webpage is being auto-deployed, however, you can run it from the GitHub if you prefer. Just follow the instructions in the README.</p> | |
| <p className="mt-5">This site is open-source at <a target="_blank" href={"https://github.com/beeper/self-host-web"} rel="noopener noreferrer">https://github.com/beeper/self-host-web</a>. This webpage is being auto-deployed, however, you can run it from the GitHub if you prefer. Just follow the instructions in the README.</p> |
🤖 Prompt for AI Agents
In app/components/Welcome.tsx around line 22, the "open-source at" link points
to a personal fork (https://github.com/kubo6472/beeper-selfhost/) rather than
the upstream canonical repository; verify which repository is intended (upstream
org vs this fork) and then update the href and visible URL to the canonical
upstream repo if the project hasn't moved, or add a short note clarifying that
this is a personal fork if that was intentional so users are directed to the
correct source of truth.
tested on my vercel, resolves #10