Make plugin-system #4

Closed
Arxcis wants to merge 0 commits from Arxcis/rolodex:main into main
Collaborator

Goal

  • Rewrite the core to make it feasible to add a plugins like facebook.js in a later PR.
  • I other words, make the extension extendable.

TODO before merging:

  • Test usage agains linkedin.com, to make sure this PR does not break existing functionality. Assignee: @nilsnh

Plugin interface

The interface between plugin(s) and popup.js could be discussed further, but this PR tries (so far) to keep the interface as it was found, just documenting it without breaking anything and without introducing anything new. The only tiny addition is the add a export const name = '<pluginname>', to make it possible to make popup.js 100% generic.

/**
 * interface Plugin {
 *   name:          string;
 *   vcardify:      (data: UserProfile) => string;
 *   isProfilePage: (unparsedUrl: string) => bool;
 *   extactData:    () => UserProfile;
 * }
 */

Moving two utility-functions to vcard.js

downloadFile()
base64EncodeProfileImage()

...was moved to vcard.js by necessity, as a result of the refactoring of popup.js and linkedin.js.

## Goal * Rewrite the core to make it feasible to add a plugins like `facebook.js` in a [later PR](https://code.on.nilsnh.no/Arxcis/rolodex/pulls/1/files). * I other words, make the extension extendable. ## TODO before merging: * Test usage agains `linkedin.com`, to make sure this PR does not break existing functionality. Assignee: @nilsnh ## Plugin interface The interface between plugin(s) and `popup.js` could be discussed further, but this PR tries (so far) to keep the interface as it was found, just documenting it without breaking anything and without introducing anything new. The only tiny addition is the add a `export const name = '<pluginname>'`, to make it possible to make `popup.js` 100% generic. ```js /** * interface Plugin { * name: string; * vcardify: (data: UserProfile) => string; * isProfilePage: (unparsedUrl: string) => bool; * extactData: () => UserProfile; * } */ ``` ## Moving two utility-functions to `vcard.js` ``` downloadFile() base64EncodeProfileImage() ``` ...was moved to `vcard.js` by necessity, as a result of the refactoring of `popup.js` and `linkedin.js`.
Owner

Thank you for your work! I like the direction. It might take some days for me to find time to review. Thank you for your patience.

Finding the right abstraction is something we'll have to explore (inspiration). :)

Hope it's okay that I might commit to this repo if/when I explore how to realize how this plugin system will work?

Thank you for your work! I like the direction. It might take some days for me to find time to review. Thank you for your patience. Finding the right abstraction is something we'll have to explore ([inspiration](https://sandimetz.com/blog/2016/1/20/the-wrong-abstraction)). :) Hope it's okay that I might commit to this repo if/when I explore how to realize how this plugin system will work?
Author
Collaborator

You are more than welcome to contribute to this PR @nilsnh , in your own time🙏

You are more than welcome to contribute to this PR @nilsnh , in your own time🙏
Author
Collaborator

Update

Made a PR on top of this one, adding facebook.js. This also made it so I could test this plugin system with two plugins, which is better than testing with one 👍

See diff: Arxcis/rolodex#1/files

This concludes my transition away from Github, and the github.com/arxcis/rolodex-repo has now been permanently deleted 🥳

**Update** Made a [PR](https://code.on.nilsnh.no/Arxcis/rolodex/pulls/1/) on top of this one, adding `facebook.js`. This also made it so I could test this plugin system with two plugins, which is better than testing with one 👍 See diff: https://code.on.nilsnh.no/Arxcis/rolodex/pulls/1/files This concludes my transition away from Github, and the [github.com/arxcis/rolodex](https://github.com/Arxcis/rolodex)-repo has now been permanently deleted 🥳
Owner

Your contributions have been merged in #6 . Thank you! :)

Your contributions have been merged in https://code.on.nilsnh.no/nilsnh/rolodex/pulls/6 . Thank you! :)
nilsnh closed this pull request 2026-07-22 08:27:56 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
nilsnh/rolodex!4
No description provided.