Giter Club home page Giter Club logo

shuttlecraft's Introduction

SHUTTLECRAFT by Ben Brown

This is a project to create an "easy" way to participate in the ActivityPub "Fediverse" and other indie web protocols like RSS. This was created and is maintained by Ben Brown.

Currently, this means:

  • a stand-alone NodeJS web application
  • with no external service dependencies
  • that is hostable on Glitch or commodity virtualhost

Including features:

  • Follow people (on Mastodon, other instances)
  • Compose posts and deliver on the web, and also via ActivityPub, RSS
  • Fave, boost and reply to posts
  • View notifications
  • Send and receive DMs
  • Block people or instances

Not yet supported:

  • Media uploads

Warning: Experimental Software!

This software should be considered an EXPERIMENTAL PROTOTYPE. Do not use it to store or exchange sensitive information.

  • This software creates publicly available web endpoints.
  • This software sends outbound web requests.
  • This software reads and writes to the filesystem!
  • This software has not been audited for potential security problems!!

Because of the way the Mastodon works, once you start to engage with users on other instances, you will start to receive traffic from a wide array of other instances -- not all of which is necessary or relevant to you. As a result, operating this software on a small basis may result in unexpected amounts of incoming traffic.

Warning: Known limitations!

My goal with this app is to not use any major external services. As a result, all data is written as PLAIN TEXT FILES to the disk.

Right now, the app builds an IN-MEMORY INDEX of EVERY SINGLE POST. This will work for several thousand posts, but ... maybe not for 10,000s of posts. I'm not sure how far it will go. I have ideas about being able to shard the index into multiple files and page through it, etc. But.

ALSO, there is nothing fancy happening in terms of queuing or rate limiting outgoing posts. When you post, it will send out HTTP requests right away, all at once. This may cause issues.

Acknowledgements

This project owes a great debt to @dariusk's excellent express-activitypub repo. My work started from his reference implementation, and there are many lines of code cribbed from his work.

Bug Reports & Contributions

Please file bugs on Github: https://github.com/benbrown/shuttlecraft/issues

Please read the contributor's guide before sending pull requests.

Install

Quick start: Remix on Glitch

Clone the repo: git clone [email protected]:benbrown/shuttlecraft.git

Enter folder: cd shuttlecraft

Install node dependencies: npm install

You are ready to run! But first, set your configuration.

When you are ready to start, run: npm start

Config

Initial configuration of your instance is done by editing the .env file to include your desired USERNAME, PASSWORD, and DOMAIN NAME. These values MUST BE SET before you launch the application, as they are used to generate your account details, including your Fediverse actor ID.

In the .env file, put:

USERNAME=yourusername
PASS=yourpasswordforadmintools
DOMAIN=yourdomainname
PORT=3000

USERNAME and PASS are required to login to the private dashboard tools.

When you launch the app for the first time, these values will be used to create the .data/account.json file which is the source of your public account information, and will be used for many operations.

There is currently no UI built to view or manage your account. If you need to make updates, edit the JSON directly.

HOWEVER PLEASE NOTE that your ID is a real URL, and it must reflect the real URL served by this app. Also note that it is embedded in every post you write - so if you change values in the account.json file, your previous posts may break.

Login

To login, visit https://yourdomain.com/private and provide the username and password from your .env file

Debugging

If you want more logging or want to see what is happening in the background, enable debugging by adding DEBUG=ono:* to the .env file, or starting the app with:

DEBUG=ono:* npm start

Where is my data?

All of the data is stored in the .data folder in JSON files.

Incoming activities will be in .data/activitystream. Each incoming post is in a dated folder, for example 2022/12-01/GUID.json

Local posts are in .data/posts

Cached user information is in .data/users

Follower list, following list, like list, boost list, block list, and notifications can all be found in their own files at the root of the .data folder. This is your data! Back it up if you care about it.

Host

This is a node app that runs by default on port 3000, or the port specified in the .env file.

In order to play nice with the fediverse, it must be hosted on an SSL-enabled endpoint.

Easiest: Glitch

Use Glitch to create a new project! Glitch will provide you with hosting for your instance of Shuttlecraft, and you can start for FREE!

It all starts when you click this link -> Remix this project on Glitch <--

WHOA! What happened? Well, a copy of the Shuttlecraft code was sent to a new, unique, owned-by-you web server and it started getting set up. You just need to make it yours by following these steps:

  1. First, make sure the URL of your Glitch project is the one you like. You can change it in the "Settings" menu.
  2. Then, configure the options as described above using the .env editor.
  3. Finally, login to the dashboard at https://yourdomain.glitch.me/private.
  4. Done!

Basic: Reverse proxy

  1. Clone the repo to your own server.
  2. Configure it and set it up to run on a port of your choosing.
  3. Configure Caddy or Nginx with a Certbot SSL certificate.
  4. Configure your domain to proxy requests to the localhost port.

A sample Caddyfile is included in the repo. Install Caddy and run:

caddy run --config Caddyfile

Advanced: Docker

  1. Clone the repo.
  2. Build the image:
    docker build . --tag "${yourRegistryUsername}/shuttlecraft:latest"
    
  3. Test locally:
    docker run -e PORT=3000 -e DOMAIN="your-domain.com" -e USERNAME="yourUsername" -e PASS="yourPassword" -p "3000:3000" "${yourRegistryUsername}/shuttlecraft"
    
  4. Push the image to your registry:
    docker push "${yourRegistryUsername}/shuttlecraft:latest"
    
  5. Deploy the image to your container platform with the required environment variables (DOMAIN, USERNAME, PASS).
  6. Configure a web service to proxy requests to the container port and provide HTTPS (see "Reverse proxy" above).

Customize

This app uses HandlebarsJS for templating.

Customize the public pages:

  • Templates are in design/public/home.handlebars and design/public/note.handlebars and design/layouts/public.handlebars
  • CSS is in public/css/main.css

Customize your avatar:

  • Replace public/images/avatar.png
  • As necessary, update the url in .data/account.json inside the actor.icon.url field

Customize the backend:

  • Templates are in design/dashboard.handlebars and design/notifications.handlebars and design/layouts/private.handlebars
  • Some common components in design/partials
  • CSS in public/css/secret.css

To block users or instances:

shuttlecraft's People

Contributors

anildash avatar benbrown avatar patrickmcurry avatar ringtailsoftware avatar selfagency avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shuttlecraft's Issues

Feature Suggestion: allow profile edit

Add an area that allows for setting profile page. This should at minimum include a self description area.

Optimally it would also allow for listing links and link validation to indicate identity proof.

Perf: Should purge old/inaccessible posts

Things like replies to posts from people we don't follow can pile up.
We can purge these out of storage and out of the index. They can always be refetched if necessary.

Validate mimetype is sane

Currently, the attachments PR takes the mimetype "X/Y" and names files ".Y". We should validate that Y isn't something like "../" or "/etc/passwd"

Bug: Password field does not properly handle special characters

When using a complex password with special characters it can causes unexpected behavior. I don't have a lot of time to investigate, but at a glance/guess this is likely from the password field reading escape characters which could allow for injection.

The limitations of the password field should be documented and eventually sanitization or filtering added to properly process special characters in the password field.

Documentation: The `.data` folder on Glitch

When setting this up on Glitch, it took me a minute to realize that the .data folder was hidden and only accessible through the Glitch Terminal. Also, editors (such as nano, vi, emacs) get weird if they're not loaded in Glitch's Full Page Terminal.

Would be a good idea to call this out in the documentation. Happy to submit a PR if need be.

Feature: migration support (embark/disembark in shuttle terminology)

Feature request, support migration to/from Mastodon.

From what I've seen, migrating to Shuttlecraft just needs us to add knownAs to the account, then we will acquire new followers when Mastodon tells them to move.

To move from Shuttlecraft to Mastodon (once the user sets up knownAs on their target server), we just send all followers an ActivityPub Move message telling them where we've gone to.

mastodon/mastodon#9629
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-move

Receiving a message without date causes NaN directory name

(There is no way to publish a poll yet, but I hacked createNote() directly to get one sent)

On receiving a poll response (from Mastodon), the ActivityPub message doesn't contain a datestamp.
I now have a directory .data/activitystream/NaN/NaN-NaN/

The message received was:

{
  "id": "https://botsin.space/users/microdon1#votes/65830",
  "type": "Note",
  "name": "a",
  "attributedTo": "https://botsin.space/users/microdon1",
  "inReplyTo": "https://labs.ringtailsoftware.co.uk/m/a14a8b6f68e4aff4ad831fbf767365a0",
  "to": "https://labs.ringtailsoftware.co.uk/u/testuser5"
}

Perf: The index should probably be stored in sqlite

Storing the entire index in memory is probably not going to scale to a few 10,000s of posts, maybe not even that far.

However, swapping in sqlite for this feature should increase scale we can operate at while keeping the rest mostly the same.

Reply to notification fails

Pressing reply button from the notifications view fails.
"TypeError post is null"

Possibly because the message posting form isn't present on that page.

Converting an RSS feed to Activitypub

The user should be able to add any source that has an RSS feed in their single activitypub instance.

Based on prior work, it should be possible to turn an RSS feed into an activitypub feed, although possibly not necessary.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.