feat(android): add configurable network access setting#144
Open
lucletoffe wants to merge 2 commits intoActivityWatch:masterfrom
Open
feat(android): add configurable network access setting#144lucletoffe wants to merge 2 commits intoActivityWatch:masterfrom
lucletoffe wants to merge 2 commits intoActivityWatch:masterfrom
Conversation
Add a Settings screen with a toggle to allow network access to the embedded ActivityWatch server. When enabled, the server binds to 0.0.0.0 instead of 127.0.0.1, allowing other devices on the local network to connect. The setting is off by default. Enabling it shows a security warning dialog explaining the risks (no authentication on the API, data exposed to the network). The change takes effect on app restart. This also wires up the previously-unimplemented Settings action bar button to open the new Settings screen. The aw-server-rust submodule is updated to accept a host parameter in the JNI startServer() call instead of using a hardcoded address. Closes ActivityWatch#121, closes ActivityWatch#107
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to c68cd3d in 10 seconds. Click for details.
- Reviewed
222lines of code in8files - Skipped
0files when reviewing. - Skipped posting
0draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
Workflow ID: wflow_KwTYz1tLqtlRe2VO
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
Greptile SummaryThis PR adds a user-configurable "Allow network access" setting that enables the embedded ActivityWatch server to bind to Key changes:
Implementation quality:
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User clicks Settings button] --> B[SettingsActivity opens]
B --> C{Network access<br/>switch toggled?}
C -->|Enable| D[Show security warning dialog]
C -->|Disable| E[Save preference: false]
D -->|User clicks Enable| F[Save preference: true]
D -->|User cancels| G[Revert switch to off]
F --> H[Show restart notice toast]
E --> H
H --> I[User restarts app]
I --> J[MainActivity.onCreate]
J --> K{Check preference:<br/>isNetworkAccessEnabled?}
K -->|true| L[host = 0.0.0.0]
K -->|false| M[host = 127.0.0.1]
L --> N[RustInterface.startServerTask]
M --> N
N --> O[Native startServer called<br/>with host parameter]
O --> P{Binding address}
P -->|0.0.0.0| Q[Server accepts<br/>external connections]
P -->|127.0.0.1| R[Server localhost only]
Last reviewed commit: c68cd3d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a user-facing "Allow network access" toggle so the embedded server can optionally bind to
0.0.0.0instead of127.0.0.1, letting other devices on the local network connect to the ActivityWatch API.Off by default. Enabling shows a security warning dialog.
Changes
Settings UI:
SettingsActivitywith a Material switch, accessible from the action bar Settings button (which previously showed a "not yet implemented" snackbar)Plumbing:
AWPreferences: newisNetworkAccessEnabled/setNetworkAccessEnabledmethodsRustInterface:startServer()andstartServerTask()now accept ahostparameterMainActivity: reads the preference on startup, passes"0.0.0.0"or"127.0.0.1"to the serverstrings.xml: setting labels and warning textAndroidManifest.xml: registeredSettingsActivityaw-server-rust submodule:
Security
The toggle is opt-in with a clear warning dialog. The warning mentions:
Notes
onCreate). I kept it simple rather than adding server restart logic.Closes #121, relates to #107
This is my first PR on the project. If there's anything I should do differently (commit structure, code style, approach), let me know — happy to adjust.
Important
Adds a user-configurable network access setting to allow the embedded server to bind to all network interfaces, with a security warning and requiring app restart.
SettingsActivityto allow network access, binding the server to0.0.0.0instead of127.0.0.1.AWPreferences: AddsisNetworkAccessEnabledandsetNetworkAccessEnabledmethods.MainActivity: Reads network access preference and starts server with appropriate host.RustInterface: UpdatesstartServer()andstartServerTask()to accept ahostparameter.SettingsActivitytoAndroidManifest.xml.strings.xmlwith new labels and warning messages.activity_settings.xmllayout for settings UI.aw-server-rustsubmodule to include JNI changes for host parameter.This description was created by
for c68cd3d. You can customize this summary. It will automatically update as commits are pushed.