Initial release
This commit is contained in:
187
README.md
187
README.md
@@ -1 +1,186 @@
|
||||
# express-twtkpr-upload-button
|
||||
# express-twtkpr-core-plugins
|
||||
|
||||
> [!WARNING]
|
||||
> **STILL IN ALPHA**: Although this is a fully-functional set of plugins which are actively deployed to at least one
|
||||
> site (my own), it currently lacks documentation, examples, tests, installation flexibility, or polish (and still has
|
||||
> a couple of bugs that need to be fixed).
|
||||
> _USE AT YOUR OWN RISK_
|
||||
|
||||
A collection of 3 recommended plugins to expand the functionality of your `express-twtkpr` installation.
|
||||
|
||||
These plugins include:
|
||||
|
||||
- [`emojiButton`](#emojibutton): Adds a simple button to the textarea which appends an emoji to your twt.
|
||||
- [`postToMastodon`](#posttomastodon): Enables automatic posting to your Mastodon account.
|
||||
- [`uploadButton`](#uploadbutton): Adds support for drag-and-drop and button-driven file uploads, with optional
|
||||
automatic hashing, renaming, metadata stripping, and resizing of images.
|
||||
|
||||
```
|
||||
import express, { Request, Response } from "express";
|
||||
|
||||
import twtkpr from "express-twtkpr";
|
||||
import {
|
||||
emojiButton,
|
||||
postToMastodon,
|
||||
uploadButton,
|
||||
} from "express-twtkpr-core-plugins";
|
||||
|
||||
// import other middleware
|
||||
|
||||
const app = express();
|
||||
|
||||
// add other middleware
|
||||
|
||||
app.use(
|
||||
"/",
|
||||
twtkpr(
|
||||
{
|
||||
// config options
|
||||
},
|
||||
[emojiButton, postToMastodon, uploadButton],
|
||||
),
|
||||
);
|
||||
|
||||
// add error handler
|
||||
|
||||
export default app;
|
||||
|
||||
```
|
||||
|
||||
## emojiButton
|
||||
|
||||
Adds a simple button to the textarea which appends an emoji to your twt.
|
||||
|
||||
- Uses [jwz's](https://www.jwz.org/) [emoji.js](https://www.dnalounge.com/webcast/emoji.js) and [emoji.css](https://www.dnalounge.com/webcast/emoji.css) files to generate the button.
|
||||
- Keeps track of recently used emoji.
|
||||
- Includes support for a _massive list_ of emojis.
|
||||
|
||||
### Usage
|
||||
|
||||
```
|
||||
import express, { Request, Response } from "express";
|
||||
|
||||
import twtkpr from "express-twtkpr";
|
||||
import {
|
||||
emojiButton,
|
||||
postToMastodon,
|
||||
uploadButton,
|
||||
} from "express-twtkpr-core-plugins";
|
||||
|
||||
// import other middleware
|
||||
|
||||
const app = express();
|
||||
|
||||
// add other middleware
|
||||
|
||||
app.use(
|
||||
"/",
|
||||
twtkpr(
|
||||
{
|
||||
// config options
|
||||
},
|
||||
[emojiButton],
|
||||
),
|
||||
);
|
||||
|
||||
// add error handler
|
||||
|
||||
export default app;
|
||||
|
||||
```
|
||||
|
||||
## postToMastodon
|
||||
|
||||
Enables automatic posting to your Mastodon account.
|
||||
|
||||
- Follows principle of POSSE (Publish Own Site, Syndicate Elsewhere)
|
||||
|
||||
### Usage
|
||||
|
||||
For it to work, you _MUST_ include both of the following values:
|
||||
|
||||
- `application_token`: On your Mastodon client, go to "Preferences", then "Development". Create a
|
||||
new application, then look for the value "Your access token".
|
||||
- `server_url`: The root URL for your Mastodon server (ex: "https://toot.cafe")
|
||||
|
||||
The preferred way to include them _WILL BE_ via ENV variables (once the work is complete).
|
||||
|
||||
```
|
||||
import express, { Request, Response } from "express";
|
||||
|
||||
import twtkpr from "express-twtkpr";
|
||||
import {
|
||||
emojiButton,
|
||||
postToMastodon,
|
||||
uploadButton,
|
||||
} from "express-twtkpr-core-plugins";
|
||||
|
||||
// import other middleware
|
||||
|
||||
const app = express();
|
||||
|
||||
// add other middleware
|
||||
|
||||
app.use(
|
||||
"/",
|
||||
twtkpr(
|
||||
{
|
||||
plugins: {
|
||||
postToMastodon: {
|
||||
application_token: "<TOKEN>", // or via ENV variable TWTKPR_PLUGIN_PTM_APP_TOKEN
|
||||
server_url: "<URL>", // or via ENV variable TWTKPR_PLUGIN_PTM_APP_TOKEN
|
||||
},
|
||||
},
|
||||
// other config options
|
||||
},
|
||||
[postToMastodon],
|
||||
),
|
||||
);
|
||||
|
||||
// add error handler
|
||||
|
||||
export default app;
|
||||
|
||||
```
|
||||
|
||||
## uploadButton
|
||||
|
||||
Adds support for drag-and-drop and button-driven file uploads, with optional automatic hashing,
|
||||
renaming, metadata stripping, and resizing of images.
|
||||
|
||||
```
|
||||
import express, { Request, Response } from "express";
|
||||
|
||||
import twtkpr from "express-twtkpr";
|
||||
import {
|
||||
emojiButton,
|
||||
postToMastodon,
|
||||
uploadButton,
|
||||
} from "express-twtkpr-core-plugins";
|
||||
|
||||
// import other middleware
|
||||
|
||||
const app = express();
|
||||
|
||||
// add other middleware
|
||||
|
||||
app.use(
|
||||
"/",
|
||||
twtkpr(
|
||||
{
|
||||
// config options
|
||||
},
|
||||
[uploadButton],
|
||||
),
|
||||
);
|
||||
|
||||
// add error handler
|
||||
|
||||
export default app;
|
||||
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2026 Eric Woodward, released under the
|
||||
[MIT License](https://www.itsericwoodward.com/licenses/mit/).
|
||||
|
||||
Reference in New Issue
Block a user