From 7f107b408d2f76d591bdcc74b525afe1857001ad Mon Sep 17 00:00:00 2001 From: Nikita Karamov Date: Fri, 17 Mar 2023 14:06:30 +0100 Subject: [PATCH] Update code style --- .editorconfig | 1 + CHANGELOG.md | 13 +++++++--- README.md | 29 +++++++++++++-------- api/share.js | 2 +- index.html | 70 ++++++++++++++++++++++++++++++++++++++++++--------- lib/count.js | 4 +-- lib/main.js | 6 ++--- package.json | 7 ++++++ 8 files changed, 99 insertions(+), 33 deletions(-) diff --git a/.editorconfig b/.editorconfig index 2bed039..dceeb34 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,6 +4,7 @@ root = true charset = utf-8 end_of_line = lf indent_style = tab +tab_width = 2 insert_final_newline = true max_line_length = 80 trim_trailing_whitespace = true diff --git a/CHANGELOG.md b/CHANGELOG.md index 57e1249..272575a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,9 @@ All notable changes to this project will be documented in this file. -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to +[Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [v3 (unreleased)][Unreleased] @@ -153,7 +155,8 @@ as to indicate that sharing to other federated networks is now possible. ### Changed -- design of the page so that it looks more like a Mastodon website (without impersonating anyone) +- design of the page so that it looks more like a Mastodon website (without + impersonating anyone) ### Fixed @@ -167,7 +170,8 @@ as to indicate that sharing to other federated networks is now possible. ### Security -- migrated from `gulp-sass` to `@mr-hope/gulp-sass` to avoid loading and building `node-sass` and other old deps +- migrated from `gulp-sass` to `@mr-hope/gulp-sass` to avoid loading and + building `node-sass` and other old deps ## [1.1.1] - 2021-03-03 @@ -236,4 +240,5 @@ Initial release of the site [1.1.2]: https://github.com/kytta/share2fedi/compare/v1.1.1...v1.1.2 [1.1.1]: https://github.com/kytta/share2fedi/compare/v1.1.0...v1.1.1 [1.1.0]: https://github.com/kytta/share2fedi/compare/v1.0.0...v1.1.0 -[1.0.0]: https://github.com/kytta/share2fedi/compare/e85aa15400bcdbcccf655d331f72df8304744b85...v1.0.0 +[1.0.0]: + https://github.com/kytta/share2fedi/compare/e85aa15400bcdbcccf655d331f72df8304744b85...v1.0.0 diff --git a/README.md b/README.md index c66b6e1..0b5e3d5 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,14 @@ > Instance-agnostic share page for the Fediverse. -**[Share₂Fedi]** allows you to share stuff on Mastodon, GoToSocial, Pleroma, and other federated social networks, instance-agnostic. Just type in the post text and the instance URL, and click ‘Post!’ +**[Share₂Fedi]** allows you to share stuff on Mastodon, GoToSocial, Pleroma, 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` URL parameter. This can be used to build custom share buttons for the federated social networks: +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` URL +parameter. This can be used to build custom share buttons for the federated +social networks: ```html ``` -The instance URL can be saved in your `localStorage` to be automatically appended if used later—handy! +The instance URL can be saved in your `localStorage` to be automatically +appended if used later—handy! ## Hosting ### One-click Vercel deploy -**Share₂Fedi** is designed to run on [Vercel](https://vercel.com/). -To deploy it yourself (it's free!), you can use the following button: +**Share₂Fedi** is designed to run on [Vercel](https://vercel.com/). To deploy it +yourself (it's free!), you can use the following button: [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fkytta%2Fshare2fedi) @@ -55,13 +61,14 @@ Self-hosting **Share₂Fedi** outside of Vercel requires some extra setup: pm2 start api/share.js --watch --ignore-watch="node_modules" ``` - > You can find a summary for pm2 at: https://pm2.keymetrics.io/docs/usage/quick-start/ + > You can find a summary for pm2 at: + > https://pm2.keymetrics.io/docs/usage/quick-start/ 4. Set up a web server - Basically, you need to run a server that would proxy the requests to `/api/share`. - to the Node.js server you started. Here's how to achieve this in various HTTP - servers: + Basically, you need to run a server that would proxy the requests to + `/api/share`. to the Node.js server you started. Here's how to achieve this + in various HTTP servers: 1. Apache @@ -95,8 +102,8 @@ Self-hosting **Share₂Fedi** outside of Vercel requires some extra setup: ## See also -**[📯 Shareon](https://shareon.js.org)** -(lightweight, stylish, and ethical share buttons) uses **Share₂Fedi** under the hood! +**[📯 Shareon](https://shareon.js.org)** (lightweight, stylish, and ethical +share buttons) uses **Share₂Fedi** under the hood! ## Licence diff --git a/api/share.js b/api/share.js index c914e44..8518baf 100644 --- a/api/share.js +++ b/api/share.js @@ -53,7 +53,7 @@ const queryUrl = (url, service) => { const detectService = async (instanceURL) => { const checkPromises = Object.entries(pathsMap).map( ([service, { checkUrl }]) => - queryUrl(new URL(checkUrl, instanceURL), service) + queryUrl(new URL(checkUrl, instanceURL), service), ); return await Promise.any(checkPromises); diff --git a/index.html b/index.html index f576756..154f200 100644 --- a/index.html +++ b/index.html @@ -24,7 +24,10 @@ - + Share₂Fedi — an instance-agnostic share page for the Fediverse @@ -32,22 +35,58 @@ name="description" content="Share₂Fedi is a share page for Mastodon and GNU Social. Type in your post text and the instance URL and click ‘Publish!’" /> - + - - + + - - - - + + + +
- Share2Fedi + Share2Fedi
-
+