Comments (7)
Hey @Fivefold
- one extension covering multiple bookmarking services would be even better!
- agree bookmark-injector would make sense
- I like the theme as it is!
- as much as I'd love to help out, I have never built an extension before and never wrote anything in node but I can definitely test, document or translate stuff! I actually gave a shot to building the extension, but the resulting ZIP wouldn't load (firefox reporting it corrupted, but can still install in debug mode, but quickly fail at the configuration step... I see the testConnection and get a 200 but get an error still).
from linkding-injector.
Thank you @gingerbeardman, this looks good! I wasn't aware of the subtlecrypto API. Will try it out the next time I take a shot at this.
In the meantime I tried to get rollup to bundle node modules with the help of ChatGPT but even then I was unable to get the bundling working properly. Apparently it should be enough to add preferBuiltins: false
to the resolve
Plugin in rollup.js.
linkding-injector/rollup.config.js
Line 56 in a66b0e8
linkding-injector/rollup.config.js
Line 81 in a66b0e8
The resolve
plugin itself is from @rollup/plugin-node-resolve
and is specifically there to bundle node modules. Unfortunately I still got ReferenceErrors
when trying to access stuff from imported node modules.
from linkding-injector.
Hey @sebw!
A few thoughts:
-
Yeah, looks like most of the work would probably be on the configuration side (user UI for choosing linkding or Shaarli API and configuring that).
-
This is likely not relevant to you personally but would probably mean the extension should be renamed to bookmark-injector or similar down the line.
-
Of course the injected results would still be styled like linkding, but theming support is not essential and not something I'm willing to tackle for now.
Is this a feature request only or do you intend to make a PR? In case of the latter I would ask you to wait until the next release. I'm in the process of changing the extension to support manifest v3 and that will include changes in a lot of files.
from linkding-injector.
Maybe you can write and test a JavaScript function for encoding/generation of the JWT token as shown for PHP at the shaarli docs https://github.com/shaarli/api-documentation/blob/master/api-authentication.md#php
You can do this completely outside of the extension context.
This would take some of the work off me. It will still most likely take weeks until I can actually get to implement it though.
from linkding-injector.
Here's a working example using jsonwebtoken
library.
let jwt = require('jsonwebtoken');
let now = Math.floor(Date.now() / 1000)
const shaarli_api_secret = 'shaarli-api-secret';
const payload = {
"iat": now
};
let token = jwt.sign(payload, shaarli_api_secret, { algorithm: 'HS512'});
console.log(token)
from linkding-injector.
Thank you very much, @sebw! Looks good and easy.
Unfortunately I just found out using node modules in browser extensions requires bundling them with the extension. I'm using rollup as a bundler, mostly because I started from the code of the official linkding extension and it seemed to do the job well. I'm very inexperienced with rollup. It can probably bundle node modules too but it would likely take a lot of time for me to set it up just for encoding the JWT token. I might take a shot at it nontheless.
Ideally, I'm looking for a vanilla JavaScript solution, although I'm not sure if JavaScript supports base64 encoding or sha512 hashing out of the box or how much trouble it would be to implement them.
If you do know rollup that would be even better and cleaner though.
from linkding-injector.
Just checking out the project and though I might be of help
- plain JS base64 https://stackoverflow.com/a/45844934/28290
- browser crypto sha512 https://stackoverflow.com/a/55926440/28290
from linkding-injector.
Related Issues (19)
- domain restriction HOT 2
- Theme option in settings / SearX support HOT 10
- Support for selfhosted Whoogle HOT 7
- Thank you! HOT 1
- Doesn't match against link tags unless use # HOT 4
- SearX/SearXNG support HOT 1
- Support for mobile HOT 3
- Feature Request: Support for Brave Search HOT 2
- Firefox extension connected, but no search results shown HOT 3
- duckduckgo support is broken HOT 1
- Support for Qwant HOT 2
- Several URL parameters in GET query break search parameter detection HOT 10
- Injection in Brave Search broken after page redesign HOT 7
- Support for Startpage
- Searching for tags HOT 2
- Duckduckgo injection broken HOT 5
- Support for Readeck HOT 2
- More robust SearXNG support (themes and URL patterns) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from linkding-injector.