Giter Site home page Giter Site logo

kytta / share2fedi Goto Github PK

View Code? Open in Web Editor NEW
23.0 5.0 3.0 1.48 MB

Cross-instance share page for the Fediverse

Home Page: https://s2f.kytta.dev/

License: GNU Affero General Public License v3.0

JavaScript 4.11% SCSS 9.31% HTML 3.17% Shell 2.87% TypeScript 46.25% Astro 34.29%
mastodon cross-posting fediverse misskey firefish gnusocial

share2fedi's Introduction

Share2Fedi

Instance-agnostic share page for the Fediverse.

Share₂Fedi (pronounced ‘share-to-fedi’) allows you to share stuff on Mastodon, Misskey, Friendica, and other federated social networks, instance-agnostic. Just type in the post text and the instance URL, and click ‘Post’!

Or, open this page with the prefilled text URL parameter—it will be automatically inserted into the text field. The same goes for the instance and lang URL parameters. This can be used to build custom share buttons for the federated social networks:

<a href="https://s2f.kytta.dev/?text=Hello%20world!&instance=mastodon.xyz">
  Share on mastodon.xyz
</a>

The instance URL can be saved in your localStorage to be automatically appended if used later—handy!

Important

I know I provide a Share₂Fedi instance for others to use, but if you want to use Share₂Fedi for your share buttons, please consider self-hosting it. Although it's free now, running my instance may become too expensive for me in the future.

Hosting

Vercel, Netlify, Cloudflare Pages

Share₂Fedi was designed to run on Vercel, but you can also run it on Netlify or Cloudflare Pages. To deploy it yourself (it's free!), you can use the following buttons:

Deploy to Vercel Deploy to Netlify

To deploy to Cloudflare Pages, fork the repository and follow the instructions.

Host it yourself

Self-hosting Share₂Fedi outside of SSR providers requires some extra setup:

Prerequisites: modern Node.js (v18 is recommended), pnpm. You can host with Deno, but Node.js is still required to build Share₂Fedi.

  1. Install dependencies.

    pnpm install
  2. Build.

    pnpm build

    If you want to use Deno, add the --s2f-use-deno flag:

    pnpm build --s2f-use-deno
  3. Run server.

    By default, this will only listen on localhost port 3000. To enable listening on a certain host and/or port, set the HOST and PORT environment variables, respectively.

    node dist/server/entry.mjs

    In production, you might want to use a process manager, like PM2:

    # Start the app, restart on file changes (except node_modules)
    pm2 start dist/server/entry.mjs --name "Share2Fedi" --watch --ignore-watch="node_modules"

    More information about self-hosting an Astro website with Node: https://docs.astro.build/en/guides/integrations-guide/node/#standalone

    If you've built Share₂Fedi for Deno:

    deno run --allow-net --allow-read --allow-env ./dist/server/entry.mjs

    More information about self-hosting an Astro website with Deno: https://docs.astro.build/en/guides/integrations-guide/deno/#usage

  4. Set up a reverse proxy.

    Basically, you need to run a reverse proxy that would redirect all incoming requests to localhost:3000. Here's how to achieve this in various HTTP servers:

    1. Apache
    ProxyPass "/" "http://localhost:3000/"
    1. Nginx
    location / {
        proxy_pass http://localhost:3000/;
    }
    1. Caddy
    reverse_proxy :3000
    

Docker

If you really have to use Docker, there is a good guide on building Astro apps with Docker. I will not provide support for Docker-based deployments in the observable future.

See also

📯 Shareon (lightweight, stylish, and ethical share buttons) uses Share₂Fedi under the hood!

Licence

© 2020–2023 Nikita Karamov
Licensed under the GNU Affero General Public License v3.0 only.


This project is hosted on GitHub: https://github.com/kytta/share2fedi.git

share2fedi's People

Contributors

andybalaam avatar dependabot[bot] avatar kytta avatar pre-commit-ci[bot] avatar sunny avatar tealk avatar vistaus avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

share2fedi's Issues

Managing Share2Fedi via a systemd unit.

Hello,

I manage to install Share2fedi on my own instance this morning. For some reason it keep crashing and restarting when I tried to start it with PM2, but maybe it's my fault, but as it work fine with the "node" command directly, I keep it this way.

I created a little systemd unit to start and stop it, it could be nice to add it to the files of the project, so interacting with it will be easier than launching a command by hand.
For your info, I made a copy of the "mastodon-web" unit as a base and modified, so, I guess it's not perfect.
Before I forgot, in my example file I run Share2Fedi on port 3030 as the 3000 is already used.

I'm sorry if it's not the right place for that, as it's not a issue but more an addition proposal, I'm still a noob with github. :/

share2fedi.service.txt

Change project's name to Share2Fedi

Imported from: https://codeberg.org/kytta/toot/issues/1

"toot" is too ambigious and Mastodon-centric.

  1. "Toot" means "post"/"status" in Mastodon's terms, there is a CLI client and an iOS client under the same name.
  2. I am planning to extend this share page beyond Mastodon to include Pleroma, Friendica, etc., where "toot" is not even a term.

Ideas for a new name that I have:

  • FediShare (cons: already exists)
  • FediSharePage (cons: too long?)
  • ShareOnFedi (cons: sounds too much like Shareon, another social-sharing-related project of mine)
  • AgnoShare (cons: doesn't mention Fediverse and/or ActivityPub)
  • "Share Page for Fediverse from A to Z" or SPF42 (cons: sounds weird, uses 1337speak)

Suggestions are welcome!

UPDATE: I've settled on Share2Fedi (thanks Tealk). Task list:

  • make a new logo
  • rename repo
    • Codeberg repo
    • GitHub repo
  • delegate new subdomains (s2f.kytta.dev, share2fedi.kytta.dev)
    • make redirects from toot.kytta.dev

Fix LanguageTool inserting a ghost element in `<body>`

If the user has the LanguageTool extension installed, it will insert a ghost element into <body> with children for each LT Toolbar. Due to the fact, that toot's <body> is a flex container with justify-content: space-between;, the layout gets pushed up by the ghost element:
Screenshot

Possible solutions:

  • add margin: auto 0 to <main>
  • add flex-grow: 1 to <main> and make it a flex element itself to centre the contents
  • wrap the body contents in a <div>

Handle overlong toots

(First of all, thanks for this project - very cool! ❤️ )

I just included this on my website and noticed that when sharing overlong toots, the server throws an error. Try it with this text.

That said, it isn't simply "501 characters fail", "500 work" (which I kinda expected). Instead the working number of characters varies. Sometimes I had to go as low 430 for it to work, sometimes a few more were possible as well. 🤷🏾

Add footer link to the status page

Imported from: https://codeberg.org/kytta/toot/issues/8

I have started monitoring the uptime of share2fedi to be able to catch when the website goes offline: https://stats.uptimerobot.com/QOXj3uXPDX. The status page contains links to three "mirrors" of s2f.

These aren't mirrors per se, as they all are hosted on Vercel. However, they all are configured independently one from another, which may be useful in case I misconfigure DNS again.

The status page should be linked in the footer.

JavaScript needed to toot

Currently, the user has to have JS enabled to submit a post. We can replace this with a call to toot's internal endpoint, which will redirect the user to a needed page and (possibly) check whether the instance is a valid Mastodon instance

Style select drop-down list for instances in some way

In general, I like UI elements on websites being unstyled and looking like the operating system theme. However, when I first used toot, I thought the drop down was one provided by my browser, remembering things I typed into text fields on other websites, until I read it's content and realised it was actually a very useful list of mastodon instances.

Obviously, so many websites style their drop-downs, that my brain automatically thought that this could not be part of the website.

That's why I propose applying some CSS to it, in order to make it look dark and part of the page. @NickKaramoff What do you think about this?

Allow self-hosters to update the hosting metadata

Some thoughts here, related to v3 & translations: the fact that it mentions s2f.kytta.dev, Vercel and links to s2f.kytta.dev’s Status page means that anybody wanting to make theire own instance need to also update the texts, which is not ideal.

I don’t know how best to handle this (detect the domain & the host, make an easy to update configuration file, …), but thought I should mention it.

Originally posted by @sunny in #38 (comment)

too recent node.js verison required

Too bad, debian ships a too old version and so you can't build v3 anymore

Node.js v18.13.0 is not supported by Astro!
Please upgrade Node.js to a supported version: ">=18.14.1"

toot should not open Mastodon instance in a new tab

When I use shareon's new Mastodon button, it opens toot in a new browser tab. Then, when I click Toot! in toot, it opens another browser tab.

I think that once I click Toot!, I am finished with toot for now, so it should open the Mastodon instance in the same tab.

What do you think?

Support Pleroma

Pleroma is a tough one, since it supports and encourages using different frontends, and instances vary in which frontends they support. The "default" frontend, Pleroma-FE, does not have the /share endpoint I thought it did (Fedishare mentions it, but it doesn't work).

AFAIK, neither Pleroma-FE nor Akkoma-FE have the endpoint we could redirect to.

Style toot in a more mastodon-branded way

I'm really glad I found this project, I really think an instance-agnostic sharing functionality was missing and needed for mastodon.

However, I worry if people might be confused by the fact that the site is not exactly mastodon branded. Sure, it looks kind of mastodon-ish, but I'm pretty sure some people will be confused, and maybe treat it for some sort of shady phishing site, because it looks not the way joinmastadon.org looks like.

I'm pretty sure this could be fixed by some slight adjustments, that might include the straight lines that separate the header and the footer on https://joinmastodon.org/communities, and also include replacing the "toot" icon with the official mastodon logo.

@NickKaramoff What do you think about this? Would that be in line with your vision for the project?

Encourage people to deploy their own instances

V3 will support more deployment variants, including Netlify, Cloudflare, and maybe even Deno Deploy. There also needs to be a section in the docs encouraging people to make their own instances for their sites. The serverless providers make this very easy, and it costs nothing (at least for me (at least for now)). We need to make it clear, that the default instance is getting way too popular.

Also for this issue: We need to ask dev.to to do this, maybe even before the docs update

Support more services

Imported from: https://codeberg.org/kytta/toot/issues/2

I would want to support more than Mastodon. I reckon many federated services have a share page of some sorts; GNU Social and Diaspora sure do.

Services to implement

  • Mastodon
  • GNU Social
  • Pleroma
  • Friendica
  • Hubzilla
  • Misskey
  • Zap
  • diaspora* (maybe later)
  • Lemmy (later)

Helpful links

  • Share buttons by FSFE have support for auto-detecting instances
  • Fedishare is a browser add-on that supports sharing to lots of services.

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.