Skip to content

Adding support for Raindrop as a provider#2

Open
magebeans wants to merge 1 commit intoBHSPitMonkey:mainfrom
magebeans:raindrop-support
Open

Adding support for Raindrop as a provider#2
magebeans wants to merge 1 commit intoBHSPitMonkey:mainfrom
magebeans:raindrop-support

Conversation

@magebeans
Copy link

Took a stab at adding Raindrop support since Pocket's going away. I've moved to Raindrop mostly because it's got iOS-native apps and Safari extensions and Alfred integration, which make it easy to add links/bookmarks to it (same as Pocket before), and it has an actual API, which a lot of other alternatives I looked at didn't. This is very much a quick and dirty implementation; I'm hoping to have proper OAuth2 support when I have a little more time to work on it.

Copy link
Owner

@BHSPitMonkey BHSPitMonkey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is timely—I'm working on migrating my links to Karakeep and adding support here to match, when I get a few more minutes of spare time. Thanks for the PR! I've added a couple suggestions to consider

Comment on lines +118 to +129
// Route to handle Raindrop token submission from the index page
app.post("/configure/raindrop", urlencodedParser, (req: Request, res: Response) => {
const token = req.body.raindropToken;
if (typeof token === 'string' && token.trim() !== '') {
raindropProvider.setAccessToken(token.trim());
res.redirect("/"); // Redirect back to the index page
} else {
// Optional: redirect back with an error message, or just show a simple error
res.status(400).send("Raindrop.io API token cannot be empty. <a href=\"/\">Go back</a>");
}
});

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would probably be best to register this route in raindrop.ts instead, just to keep the service's logic separated—though, in this initial version where there's no OAuth handler, why not just forgo the HTML form and this POST handler in favor of just defining an environment variable instead?

*/
import fs from "node:fs";
import express, { Express, Request, Response } from "express";
import express, { Express, Request, Response, urlencoded } from "express"; // Added urlencoded
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment can probably be left out of the final commit (since it's describing the diff rather than the code)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants