-
Notifications
You must be signed in to change notification settings - Fork 78
feat: hybrid follow engine — LinkedIn WebView interaction, session management & deep-link fallback #177
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
Open
Itzzavdheshh
wants to merge
6
commits into
Dev-Card:main
Choose a base branch
from
Itzzavdheshh:card
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: hybrid follow engine — LinkedIn WebView interaction, session management & deep-link fallback #177
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
eb4c39b
feat: Layer 2 WebView Follow Engine — LinkedIn In-App Connect + Sessi…
Itzzavdheshh 6b6393c
fix: resolve TypeScript compilation issues and restore settings navig…
Itzzavdheshh c07c39d
feat: WebView LinkedIn Connect Engine + Follow system (Section 6.9)
Itzzavdheshh 375dcdd
fix: address PR review comments from Harxhit
Itzzavdheshh 02200ba
fix: address remaining PR review comments from Harxhit
Itzzavdheshh 1b646b7
chore: merge upstream/main and resolve conflicts
Itzzavdheshh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # DevCard Backend | ||
|
|
||
| ## Follow Engine Architecture | ||
|
|
||
| DevCard implements a multi-layered Hybrid Follow Engine designed to connect platform professionals seamlessly while maintaining platform policy compliance. | ||
|
|
||
| ```mermaid | ||
| graph TD | ||
| A[User triggers Follow/Connect] --> B{Check Platform Strategy} | ||
| B -- api (GitHub) --> C[Layer 1: Direct OAuth API integration] | ||
| B -- webview (LinkedIn) --> D[Layer 2: In-app WebView Interaction Engine] | ||
| B -- link (GitLab/Devfolio) --> E[Layer 3: Native deep-linking / Browser redirect] | ||
| B -- copy (Discord) --> F[Layer 4: Clipboard Copy fallback] | ||
| ``` | ||
|
|
||
| ### Layer 2: WebView Interaction Engine (LinkedIn) | ||
|
|
||
| Due to LinkedIn's modern API restrictions preventing programmatic connection requests, direct API follow (Layer 1) is not viable. Instead, the WebView Interaction Engine routes the action through a secure, native WebView: | ||
|
|
||
| 1. **Routing Strategy**: The backend parses the connection request and returns `{ strategy: 'webview', url }` containing the resolved profile link. | ||
| 2. **Session Persistence**: The mobile WebView loads the target profile URL using system-level OAuth cookie-sharing (`sharedCookiesEnabled={true}`), ensuring the user remains authenticated. | ||
| 3. **DOM Introspection**: A lightweight JavaScript snippet is injected to continuously poll for the native LinkedIn 'Connect' button, smooth-scrolls it into view, and highlights it visually to encourage action. | ||
| 4. **Interactive Send**: Users retain full control over actual connection request submission, adhering completely to platform terms of service. | ||
| 5. **State Detection**: | ||
| - URL State Polling: The engine inspects URL transitions containing `invite-sent` or similar sub-routes. | ||
| - DOM Observation: The injected Javascript queries for structural indicators of successful invitation (e.g. "Pending" button state or toaster text) and posts a serialized message back to the native layer. | ||
| 6. **Robust Fallback**: If network or WebView loading times out (>10s), the engine gracefully falls back to native deep links (`linkedin://profile?id={username}`) or launches the default browser with an interactive custom in-app overlay. | ||
| 7. **Telemetry Logging**: Upon client-side success (detected via state changes or DOM indicators), the mobile app makes a `POST /api/follow/:platform/:targetUsername/log` request to the backend. This writes a record to the `FollowLog` database table for auditing and analytics tracking. |
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.