Compare commits

...

271 Commits

Author SHA1 Message Date
Nikita Karamov 6805d75bcd
Update dependencies (#70) 2024-04-04 19:19:39 +02:00
Nikita Karamov 940c311473 Update everything else 2024-04-04 19:16:39 +02:00
dependabot[bot] 1cc33c20ee
Bump vite from 5.1.1 to 5.2.8
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.1.1 to 5.2.8.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.2.8/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-03 17:02:00 +00:00
Nikita Karamov f56cf1412c
Update dependencies (#63) 2024-02-25 01:19:06 +01:00
Nikita Karamov 95e1011dca Add type annotations to transform() 2024-02-25 01:13:41 +01:00
Nikita Karamov 8f61bc80c1 Update Astro and adapters 2024-02-25 01:13:41 +01:00
Nikita Karamov b7001edc6e Update Sharp 2024-02-25 01:13:41 +01:00
Nikita Karamov 4b41ec6238 Update lint-staged 2024-02-25 01:13:41 +01:00
Nikita Karamov c432d71b36 Update Husky 2024-02-25 01:13:41 +01:00
Nikita Karamov 146274ebf2 Update eslint-plugin-unicorn 2024-02-25 01:13:41 +01:00
Nikita Karamov fc53cc46f7 Update Stylelint 2024-02-25 01:13:41 +01:00
Nikita Karamov 4a4899f3db Update Astro dev dependencies 2024-02-25 01:13:41 +01:00
Nikita Karamov 031d9825d9 Update dependencies 2024-02-25 01:13:41 +01:00
Nikita Karamov 8e38dd5b63
Translations update from Hosted Weblate (#68)
Translations update from Hosted Weblate
2024-02-14 11:59:00 +01:00
Nikita Karamov 2364b8de68
Translated using Weblate (Ukrainian)
Currently translated at 100.0% (23 of 23 strings)

Translation: Share₂Fedi/Site
Translate-URL: https://hosted.weblate.org/projects/share2fedi/site/uk/
2024-02-13 20:01:58 +01:00
Nikita Karamov 9843ed6937
Translated using Weblate (French)
Currently translated at 100.0% (23 of 23 strings)

Translation: Share₂Fedi/Site
Translate-URL: https://hosted.weblate.org/projects/share2fedi/site/fr/
2024-02-13 20:01:57 +01:00
Nikita Karamov fdf3964008
Release 3.1.0 2024-02-12 20:35:19 +01:00
Nikita Karamov 7aaeead310
Disable indexing (#67) 2024-02-12 20:19:26 +01:00
Nikita Karamov b9eeaabf57
Disable indexing 2024-02-12 20:16:19 +01:00
Nikita Karamov dcaa57215a
Add Arabic language (#66) 2024-02-12 19:32:05 +01:00
Nikita Karamov 461487a85f
Make domains LTR 2024-02-12 19:26:34 +01:00
Nikita Karamov 8d44d9b4d4
Reduce amount of placeholders 2024-02-12 19:24:08 +01:00
Nikita Karamov a37470bf9c
Format list of supported projects with `Intl` 2024-02-12 19:09:33 +01:00
Nikita Karamov 166d4fcc44
Resort languages in the dropdown 2024-02-12 19:08:51 +01:00
Nikita Karamov c0ef8cac73
Use `dir="auto"` for big text paragraphs
This way, if some of them are untranslated, they will be displayed
properly
2024-02-12 18:46:07 +01:00
Nikita Karamov e93cdd9c21
WIP arabic 2024-02-12 18:40:25 +01:00
Nikita Karamov 77c17fb0e8
Translations update from Hosted Weblate (#65) 2024-02-12 18:39:50 +01:00
ButterflyOfFire b48ab209d4
Translated using Weblate (Arabic)
Currently translated at 95.6% (22 of 23 strings)

Translation: Share₂Fedi/Site
Translate-URL: https://hosted.weblate.org/projects/share2fedi/site/ar/
2024-02-08 22:01:54 +01:00
Nikita Karamov f122ebb8b1
Move to Hosted Weblate (#62) 2024-02-07 14:36:56 +01:00
Nikita Karamov 2ce8c0fcb8
Disable prose wrap for Prettier 2024-02-07 14:35:08 +01:00
Nikita Karamov c2cc47a0da
Fix formatting in README.md 2024-02-07 14:07:26 +01:00
Nikita Karamov 13c4bab2ef
Fix formatting in CONTRIBUTING.md 2024-02-07 14:07:07 +01:00
Nikita Karamov 8d060bfd88 Update contributing guide 2024-02-07 13:05:09 +00:00
Nikita Karamov 5fabf5768e Fix formatting 2024-02-07 12:54:28 +00:00
Nikita Karamov 09f27033e2
Mention Weblate in the README 2024-02-07 13:43:44 +01:00
Nikita Karamov f619bcfbbe
Update translations
Co-authored-by: butterflyoffire <butterflyoffire@users.noreply.translate.codeberg.org>
2024-02-07 12:05:16 +01:00
Nikita Karamov e92ef44127
Translated using Weblate (Ukrainian)
Currently translated at 39.1% (9 of 23 strings)

Translation: Share₂Fedi/Site
Translate-URL: https://translate.codeberg.org/projects/share2fedi/site/uk/
2024-02-07 09:13:30 +00:00
Nikita Karamov 0e1022622e
Added translation using Weblate (Ukrainian) 2024-02-07 07:47:30 +00:00
butterflyoffire 148623dca0
Translated using Weblate (Arabic)
Currently translated at 91.3% (21 of 23 strings)

Translation: Share₂Fedi/Site
Translate-URL: https://translate.codeberg.org/projects/share2fedi/site/ar/
2024-01-20 15:53:22 +00:00
butterflyoffire 660574bade
Added translation using Weblate (Arabic) 2024-01-20 15:53:22 +00:00
Nikita Karamov d49584937b
Bump vite from 4.5.1 to 4.5.2 (#59) 2024-01-20 16:53:18 +01:00
dependabot[bot] eba2725fac
Bump vite from 4.5.1 to 4.5.2
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.5.1 to 4.5.2.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v4.5.2/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v4.5.2/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-20 15:45:39 +00:00
Nikita Karamov 8304cf0f10
Improve i18n (#61)
- add support for RTL languages
- fix bug with non-existent locale in localStorage
- add globe icon to detect the language field
2024-01-20 16:44:36 +01:00
Nikita Karamov 447c877f3c
Fix i18n not working if locale is set to a non-existen language 2024-01-20 16:42:23 +01:00
Nikita Karamov 3819048880
Improve language selector display 2024-01-20 16:42:01 +01:00
Nikita Karamov fa497c08d0
Improve CSS support for non-tbltr scripts 2024-01-20 16:34:48 +01:00
Nikita Karamov fc617ff4f5
Add support for script direction 2024-01-20 16:34:48 +01:00
Nikita Karamov 0806678b5a
Bump miniflare from 3.20231002.1 to 3.20231030.4 (#58) 2024-01-20 15:53:48 +01:00
dependabot[bot] 09fcfd8f60
Bump miniflare from 3.20231002.1 to 3.20231030.4
Bumps [miniflare](https://github.com/cloudflare/workers-sdk/tree/HEAD/packages/miniflare) from 3.20231002.1 to 3.20231030.4.
- [Release notes](https://github.com/cloudflare/workers-sdk/releases)
- [Changelog](https://github.com/cloudflare/workers-sdk/blob/main/packages/miniflare/CHANGELOG.md)
- [Commits](https://github.com/cloudflare/workers-sdk/commits/miniflare@3.20231030.4/packages/miniflare)

---
updated-dependencies:
- dependency-name: miniflare
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-29 19:39:44 +00:00
Nikita Karamov d2f51723a2
Bump vite from 4.4.11 to 4.5.1 (#57) 2023-12-06 15:41:16 +01:00
dependabot[bot] 2dfbdf3e2a
Bump vite from 4.4.11 to 4.5.1
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.4.11 to 4.5.1.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v4.5.1/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v4.5.1/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-05 23:52:00 +00:00
Nikita Karamov 605285b6f4
Bump @babel/traverse from 7.23.0 to 7.23.2 (#56) 2023-10-19 16:11:47 +02:00
dependabot[bot] dad69599c8
Bump @babel/traverse from 7.23.0 to 7.23.2
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.23.0 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-19 13:48:06 +00:00
Nikita Karamov 1a7d013fb4
Update dependencies (#55) 2023-10-08 17:58:44 +02:00
Nikita Karamov e562a349dd
Update everything else 2023-10-08 15:44:58 +02:00
Nikita Karamov 27b0c6bfc4
Update stylelint-config-standard-scss 2023-10-08 15:43:50 +02:00
Nikita Karamov 0faae418bd
Update @astrojs/vercel 2023-10-08 15:41:53 +02:00
Nikita Karamov a208cf2441
Minor deps update 2023-10-08 15:40:55 +02:00
Nikita Karamov cc3a917258
Translated using Weblate (Spanish) (#52) 2023-09-20 17:27:47 +00:00
gallegonovato 6a73d3e059
Translated using Weblate (Spanish)
Currently translated at 100.0% (23 of 23 strings)

Translation: Share₂Fedi/Site
Translate-URL: https://translate.codeberg.org/projects/share2fedi/site/es/
2023-09-11 10:53:07 +00:00
Nikita Karamov 21d3e690fd
Update Weblate translations (#51) 2023-09-09 18:15:08 +00:00
Nikita Karamov ee713eb7f3
Add Dutch to the language list 2023-09-09 20:12:31 +02:00
butterflyoffire cfcdaf4814
Translated using Weblate (French)
Currently translated at 100.0% (23 of 23 strings)

Translation: Share₂Fedi/Site
Translate-URL: https://translate.codeberg.org/projects/share2fedi/site/fr/
2023-09-09 05:53:07 +00:00
Vistaus 22382b54e4
Translated using Weblate (Dutch)
Currently translated at 100.0% (23 of 23 strings)

Translation: Share₂Fedi/Site
Translate-URL: https://translate.codeberg.org/projects/share2fedi/site/nl/
2023-09-06 12:53:06 +00:00
Vistaus e1fb69801b
Added translation using Weblate (Dutch) 2023-09-05 11:42:09 +00:00
Nikita Karamov 2e26554364
Translated using Weblate (Russian)
Currently translated at 100.0% (23 of 23 strings)

Translation: Share₂Fedi/Site
Translate-URL: https://translate.codeberg.org/projects/share2fedi/site/ru/
2023-09-03 23:53:07 +00:00
Nikita Karamov adaea3cea7
Translated using Weblate (German)
Currently translated at 100.0% (23 of 23 strings)

Translation: Share₂Fedi/Site
Translate-URL: https://translate.codeberg.org/projects/share2fedi/site/de/
2023-09-03 23:53:06 +00:00
Nikita Karamov e38d80cc1e
Release v3.0.0 2023-09-03 00:30:03 +02:00
Nikita Karamov 658fc19dcb
Release v3 (#23) 2023-09-02 22:23:43 +00:00
Nikita Karamov 7059a8adfd
Add Deno Deploy action 2023-09-03 00:09:26 +02:00
Nikita Karamov 00a4faa495
Add S2F version to the page 2023-09-02 23:59:09 +02:00
Nikita Karamov bc99af31e9
Simplify GH Actions 2023-09-02 23:45:46 +02:00
Nikita Karamov 849212e038
Remove 'referrer' from fetch
This is not supported by Cloudflare. Oh well
2023-09-02 23:42:54 +02:00
Nikita Karamov 861abd1b43
Add .node-version
This may simplify deployment as it will automatically pick the correct
version in CF and Vercel
2023-09-02 23:38:35 +02:00
Nikita Karamov 399f995ce9
Fix Netlify?
Apparently Netlify doesn't split functions properly
2023-09-02 23:35:04 +02:00
Nikita Karamov f4845de588
Add dev config to netlify
This somehow fixed it? I do not understand how Netlify works
2023-09-02 23:29:36 +02:00
Nikita Karamov 1b32a5a600
Add netlify.toml 2023-09-02 23:06:01 +02:00
Nikita Karamov cda2ca6614
Try using split functions on Netlify 2023-09-02 22:51:19 +02:00
Nikita Karamov 88fb903120
Improve button padding 2023-09-02 22:40:45 +02:00
Nikita Karamov e6c4c42590
Hide "Prevously used" if there are no previously used instances 2023-09-02 22:40:38 +02:00
Nikita Karamov 2bc66c7f04
Update to Astro v3 2023-09-02 22:15:57 +02:00
Nikita Karamov dedb96ba91
Disable title translation 2023-09-02 22:01:49 +02:00
Nikita Karamov 660aa2bbe1
Update vercel.json 2023-09-02 21:57:51 +02:00
Nikita Karamov 13a1d2bc55
Add contributing guide 2023-09-02 21:57:01 +02:00
Nikita Karamov 0f95c6ec58
Add OG tags 2023-09-02 21:57:01 +02:00
Nikita Karamov 603871f20e
Improve a11y of language selector 2023-09-02 21:57:01 +02:00
Nikita Karamov 725d7316c4
Replace /api/share with / + errors 2023-09-02 21:57:01 +02:00
Nikita Karamov 9828b123d9
Move form to page 2023-09-02 21:57:00 +02:00
Nikita Karamov 12aa0823d9
Move non-form content to Layout 2023-09-02 21:57:00 +02:00
Nikita Karamov 6fdeee1269
Better API code structure 2023-09-02 21:57:00 +02:00
Nikita Karamov 4f3488c427
Add <noscript> to indicate that saving instances will not work 2023-09-02 21:57:00 +02:00
Nikita Karamov a5c41729c1
Update licence to AGPL-3.0-only 2023-09-02 21:57:00 +02:00
Nikita Karamov e24b89bba7
Fix translations 2023-09-02 21:57:00 +02:00
Nikita Karamov 498a515f46
Enable splitting on Vercel 2023-09-02 21:56:59 +02:00
Nikita Karamov e2208315d4
Improve caching 2023-09-02 21:56:59 +02:00
Nikita Karamov 700c830341
Install PNPM in CI 2023-09-02 21:56:59 +02:00
Nikita Karamov e4b2db54ba
Rename GitHub Actions folder 2023-09-02 21:56:59 +02:00
Nikita Karamov fc8b44849c
Fix TypeScript issue 2023-09-02 21:56:59 +02:00
Nikita Karamov 7f1bb68adb
Fix typos 2023-09-02 21:56:59 +02:00
Nikita Karamov 420490e12a
Add GitHub Actions to lint 2023-09-02 21:56:59 +02:00
Nikita Karamov 5aef40e0ea
Add small fixes to README 2023-09-02 21:56:58 +02:00
Nikita Karamov 3c7ea423c2
Remove old config file 2023-09-02 21:56:58 +02:00
Nikita Karamov 4ee55fe77c
Simplify Astro config 2023-09-02 21:56:58 +02:00
Nikita Karamov ebb3bdd013
Minimize Prettier config 2023-09-02 21:56:58 +02:00
Nikita Karamov 420d45953e
Replace pre-commit with husky + lint-staged 2023-09-02 21:56:58 +02:00
Nikita Karamov c92780de35
Rename config to .ts again 2023-09-02 21:56:58 +02:00
Nikita Karamov 3a656ec38e
Minimize ESLint config 2023-09-02 21:56:58 +02:00
Nikita Karamov b1ff802b3f
Update .ignore files 2023-09-02 21:56:57 +02:00
Nikita Karamov 97e4909ffe
Fix EditorConfig 2023-09-02 21:56:57 +02:00
Nikita Karamov ca7a2d8045
Prepare translation files for use with Weblate 2023-09-02 21:56:57 +02:00
Nikita Karamov e352afb5d9
Translated using Weblate (Russian)
Currently translated at 100.0% (24 of 24 strings)

Translation: Share₂Fedi/Site
Translate-URL: https://translate.codeberg.org/projects/share2fedi/site/ru/
2023-09-02 21:56:57 +02:00
Nikita Karamov 449d3476e8
Translated using Weblate (French)
Currently translated at 100.0% (24 of 24 strings)

Translation: Share₂Fedi/Site
Translate-URL: https://translate.codeberg.org/projects/share2fedi/site/fr/
2023-09-02 21:56:57 +02:00
Nikita Karamov 4ed9e335ac
Translated using Weblate (Spanish)
Currently translated at 100.0% (24 of 24 strings)

Translation: Share₂Fedi/Site
Translate-URL: https://translate.codeberg.org/projects/share2fedi/site/es/
2023-09-02 21:56:57 +02:00
Nikita Karamov d1d54b9937
Translated using Weblate (German)
Currently translated at 100.0% (24 of 24 strings)

Translation: Share₂Fedi/Site
Translate-URL: https://translate.codeberg.org/projects/share2fedi/site/de/
2023-09-02 21:56:56 +02:00
Nikita Karamov d434abbae0
Translated using Weblate (English)
Currently translated at 100.0% (24 of 24 strings)

Translation: Share₂Fedi/Site
Translate-URL: https://translate.codeberg.org/projects/share2fedi/site/en/
2023-09-02 21:56:56 +02:00
Nikita Karamov 258a63cfc1
Move translations to JSON files 2023-09-02 21:56:56 +02:00
Sunny Ripert 0799c98659
Add lang URL parameter 2023-09-02 21:56:56 +02:00
pre-commit-ci[bot] 8ea6921b12
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-09-02 21:56:56 +02:00
Sunny Ripert b92420bcbd
Translate to French and Spanish 2023-09-02 21:56:56 +02:00
Nikita Karamov 7834875ae2
Translate licence and privacy policy 2023-09-02 21:56:56 +02:00
Nikita Karamov e6d32be03a
Make licence and privacy look better 2023-09-02 21:56:55 +02:00
Nikita Karamov 0a6b2f7ae2
Rewrite licence and privacy as components 2023-09-02 21:56:55 +02:00
Nikita Karamov cee4a55937
Improve layout for mobile devices 2023-09-02 21:56:55 +02:00
Nikita Karamov 84af92f7e7
Remove Pleroma support
Apparently, there is no endpoint in Pleroma-FE that we could use :(

See also: https://github.com/kytta/share2fedi/issues/44
2023-09-02 21:56:55 +02:00
Nikita Karamov fee8aa0a3b
Set favicon.ico's 'sizes' to 32x32
> sizes="any" for ICO file was replaced to sizes="32x32" to fix bug when Chrome downloaded both ICO and SVG files.
2023-09-02 21:56:55 +02:00
Nikita Karamov 58c49957e4
Encourage people to self-host s2f
Closes #38
2023-09-02 21:56:55 +02:00
Nikita Karamov 1b9388a6fb
Update README 2023-09-02 21:56:54 +02:00
Nikita Karamov ea5db41462
Update CHANGELOG 2023-09-02 21:56:54 +02:00
Nikita Karamov 8c47346470
Fix pre-commit.ci 2023-09-02 21:56:54 +02:00
Nikita Karamov 3c3d779d3d
Disable function splitting 2023-09-02 21:56:54 +02:00
Nikita Karamov ccc2f2376e
Add Russian locale 2023-09-02 21:56:54 +02:00
Nikita Karamov 89bb338065
Implement translations
See also: https://github.com/kytta/share2fedi/pull/43
Co-authored-by: Sunny Ripert <sunny@sunfox.org>
2023-09-02 21:56:54 +02:00
Nikita Karamov 31d95aa834
Remove 'New' badge 2023-09-02 21:56:54 +02:00
Nikita Karamov 8439c8835d
Add GlitchCafe support 2023-09-02 21:56:53 +02:00
Nikita Karamov 762dd8051b
Add Misskey forks support 2023-09-02 21:56:53 +02:00
Nikita Karamov 6971f4e40f
Add Fedibird support 2023-09-02 21:56:53 +02:00
Nikita Karamov af241cfce9
Refactor /api/detect/[] 2023-09-02 21:56:53 +02:00
Nikita Karamov 256aa8fbd0
Improve /api/instances 2023-09-02 21:56:53 +02:00
Nikita Karamov 08c71218b2
Remove unused file 2023-09-02 21:56:53 +02:00
Nikita Karamov 9dc393e529
Simplify HTML 2023-09-02 21:56:53 +02:00
Nikita Karamov e84fed7952
Load and cache popular instances 2023-09-02 21:56:52 +02:00
Nikita Karamov 870406209e
Rewrite nanostore for saved instances 2023-09-02 21:56:52 +02:00
Nikita Karamov d6363e10f9
Fix Astro.generator 2023-09-02 21:56:52 +02:00
Nikita Karamov 16e30c45a2
Move to Lightning CSS 2023-09-02 21:56:52 +02:00
Nikita Karamov dc2b3bd805
Improve auto adapter 2023-09-02 21:56:52 +02:00
Nikita Karamov b309d646a4
Rename config file to be ESM 2023-09-02 21:56:52 +02:00
Nikita Karamov eb185b7ea1
Update stylelint 2023-09-02 21:56:51 +02:00
Nikita Karamov 7c2b270789
Remove unnecessary .ts extension 2023-09-02 21:56:51 +02:00
Nikita Karamov 469c4a99f9
New NPM scripts 2023-09-02 21:56:51 +02:00
Nikita Karamov 566bd0d1fd
Bump other dependencies 2023-09-02 21:56:51 +02:00
Nikita Karamov 0db52e2714
Bump ESLint & Prettier 2023-09-02 21:56:51 +02:00
Nikita Karamov 6e40a7c0f8
Bump Astro deps 2023-09-02 21:56:51 +02:00
Nikita Karamov 47426d5dc7
Normalize domains in store 2023-09-02 21:56:51 +02:00
Nikita Karamov ce3e19626f
Normalize domain on /api/share 2023-09-02 21:56:50 +02:00
Nikita Karamov 23fdf5ab07
Re-implement domain normalization 2023-09-02 21:56:50 +02:00
Nikita Karamov a5314e5923
Use nanostores for saving instances 2023-09-02 21:56:50 +02:00
Nikita Karamov 56db514d15
Extract form as a separate component 2023-09-02 21:56:50 +02:00
Nikita Karamov 84be267e16
Update dependencies 2023-09-02 21:56:50 +02:00
Nikita Karamov f0df611c16
Rearrange files 2023-09-02 21:56:50 +02:00
Nikita Karamov 343fcd7bc9
Extract layout 2023-09-02 21:56:50 +02:00
Nikita Karamov 86943968d4
Update webmanifest fields 2023-09-02 21:56:49 +02:00
Nikita Karamov e4feeb5903
Fix link to manifest 2023-09-02 21:56:49 +02:00
Nikita Karamov 9d59cad84b
Move script to a subfolder 2023-09-02 21:56:49 +02:00
Nikita Karamov cded0a9cbb
Move instance fetching to client 2023-09-02 21:56:49 +02:00
Nikita Karamov 454694447c
Fix dev script to use 127.0.0.1 2023-09-02 21:56:49 +02:00
Nikita Karamov b556e7f12d
Remove GoatCounter 2023-09-02 21:56:49 +02:00
Nikita Karamov ea48a7f29a
Extract license and privacy policy into separate pages 2023-09-02 21:56:49 +02:00
Nikita Karamov 4842d9954f
Implement Hometown support 2023-09-02 21:56:48 +02:00
Nikita Karamov f4506ae4bc
Detect Akkoma as Pleroma 2023-09-02 21:56:48 +02:00
Nikita Karamov 43e84ea53e
Improve README 2023-09-02 21:56:48 +02:00
Nikita Karamov 2ad24a91da
Improve instance detection
Instance detection is now based on NodeInfo, which is standardized and
lighterweight.
2023-09-02 21:56:48 +02:00
Nikita Karamov 6d4eca0131
Improve instance list
This now returns the list of instances of multiple Fediverse projects.
Currently pretty slow because of the Mastodon and Pleroma being too big.
2023-09-02 21:56:48 +02:00
Nikita Karamov f5cbb082ed
Fix some typing errors 2023-09-02 21:56:48 +02:00
Nikita Karamov effac10b7e
Mention other networks 2023-09-02 21:56:47 +02:00
Nikita Karamov 5e6b2c0a02
Update CHANGELOG 2023-09-02 21:56:47 +02:00
Nikita Karamov 546c9029aa
Make detect return 404 instead of 400 2023-09-02 21:56:47 +02:00
Nikita Karamov 4dfe43918f
Add Misskey (untested) 2023-09-02 21:56:47 +02:00
Nikita Karamov cb0fc3e11d
Kinda implement Hubzilla? 2023-09-02 21:56:47 +02:00
Nikita Karamov e1aa6966c0
Use a stricter TypeScript config 2023-09-02 21:56:47 +02:00
Nikita Karamov 4031a76291
Use a more specific path for GNU Social 2023-09-02 21:56:47 +02:00
Nikita Karamov 2c8a6c7da8
Implement Friendica 2023-09-02 21:56:46 +02:00
Nikita Karamov dd9ce344c6
Update CHANGELOG 2023-09-02 21:56:46 +02:00
Nikita Karamov 66fc114f4f
Try to make Cloudflare deploy its config and not Netlify 2023-09-02 21:56:46 +02:00
Nikita Karamov c9dc947fe1
Try to fix pre-commit ci 2023-09-02 21:56:46 +02:00
Nikita Karamov 7d0fda5c11
Fix pre-commit-config 2023-09-02 21:56:46 +02:00
Nikita Karamov 808ab27ed4
Return empty list if no instances could be fetched 2023-09-02 21:56:46 +02:00
Nikita Karamov 2871f3f6e8
Update build instructions 2023-09-02 21:56:46 +02:00
Nikita Karamov 835e75519b
Add Cloudflare Pages support 2023-09-02 21:56:45 +02:00
Nikita Karamov 97f7be04b9
Update CHANGELOG 2023-09-02 21:56:45 +02:00
Nikita Karamov 3d369d4265
Rewrite docs 2023-09-02 21:56:45 +02:00
Nikita Karamov f811ba371d
Add copyright notices 2023-09-02 21:56:45 +02:00
Nikita Karamov 0c6b2ba372
Optimize images 2023-09-02 21:56:45 +02:00
Nikita Karamov 64cc54e717
Remove deprecated slash division 2023-09-02 21:56:45 +02:00
Nikita Karamov 9771d67af9
Re-add GoatCounter script 2023-09-02 21:56:45 +02:00
Nikita Karamov 47c498ad2e
Re-implement prefilling instance and text 2023-09-02 21:56:44 +02:00
Nikita Karamov 378351a5d8
Add host detection
This re-implements the posting that was achieved in v3.
2023-09-02 21:56:44 +02:00
Nikita Karamov 2301f2dc32
Fix pre-commit configs 2023-09-02 21:56:44 +02:00
Nikita Karamov 6f338966d7
Fix lint error 2023-09-02 21:56:44 +02:00
Nikita Karamov 3de15b1b4c
Re-implement saving instances
Also implements saving of multiple instances, which
closes https://github.com/kytta/share2fedi/issues/29
2023-09-02 21:56:44 +02:00
Nikita Karamov f2ba7d5324
Add a bit better error handling 2023-09-02 21:56:44 +02:00
Nikita Karamov 49a489d532
Re-implement pre-filling instances 2023-09-02 21:56:43 +02:00
Nikita Karamov 43d36bd6d7
Fix bug in datalist 2023-09-02 21:56:43 +02:00
Nikita Karamov d3fb510bbb
Rewrite the instance selector
This commit adds a new '/api/instances' endpoint that returns
the domains of the available Mastodon instances. This also changes the
input field, making it accept a host rather than the full domain.
2023-09-02 21:56:43 +02:00
Nikita Karamov 6031d959ea
Migrate HTML file and basic API functionality 2023-09-02 21:56:43 +02:00
Nikita Karamov 1ba204644b
Install Astro instead of Vite 2023-09-02 21:56:43 +02:00
Nikita Karamov 48e6fc3fc7
Add support for Pleroma 2023-09-02 21:56:43 +02:00
Nikita Karamov 7f107b408d
Update code style 2023-09-02 21:56:43 +02:00
Nikita Karamov 65bef1053f
Update design 2023-09-02 21:56:42 +02:00
Nikita Karamov c670cdaf74
Name GNU Social alongside Mastodon 2023-09-02 21:56:42 +02:00
Nikita Karamov cc6dc2d408
Update motto 2023-09-02 21:56:42 +02:00
Nikita Karamov 814b6d6a9b
Add support for GNU Social 2023-09-02 21:56:42 +02:00
Nikita Karamov 90585fcb68
Refactor API server 2023-09-02 21:56:42 +02:00
Nikita Karamov 8c0ab7cd7c
Add image optimisation 2023-09-02 21:56:42 +02:00
Nikita Karamov 6ae45b0cbd
Update icons 2023-09-02 21:56:42 +02:00
Nikita Karamov d7dd716b23
Update CHANGELOG 2023-09-02 21:56:41 +02:00
Nikita Karamov 009ac42c3b
Add link to status page
Closes https://github.com/kytta/share2fedi/issues/28
2023-09-02 21:56:41 +02:00
Nikita Karamov 79575af4cd
Add a privacy policy
Closes https://github.com/kytta/share2fedi/issues/26
Closes https://github.com/kytta/share2fedi/issues/27
2023-09-02 21:56:41 +02:00
Nikita Karamov b3cf886f6c
Remove mention of Mastodon logo 2023-09-02 21:56:41 +02:00
Nikita Karamov ee4fad1e13
Append CHANGELOG about other breaking changes 2023-09-02 21:56:41 +02:00
Nikita Karamov 068e8d09a3
Update self-hosting instructions 2023-09-02 21:56:41 +02:00
Nikita Karamov 434bb203cb
Get rid of the old name completely 2023-09-02 21:56:40 +02:00
Nikita Karamov 304406c380
Mention new design in the CHANGELOG 2023-09-02 21:56:40 +02:00
Nikita Karamov 304875e50e
Fix pre-commit config 2023-09-02 21:56:40 +02:00
Nikita Karamov a055071bdf
Add stylelint 2023-09-02 21:56:40 +02:00
Nikita Karamov 5f95406002
Restyle the website
This makes the style much simpler and more lightweight
2023-09-02 21:56:40 +02:00
Nikita Karamov af516510fa
Remove custom fonts 2023-09-02 21:56:40 +02:00
Nikita Karamov df0ab992b8
Update styles to match those of Mastodon 2023-09-02 21:56:40 +02:00
Nikita Karamov 7f6b25296d
Replace title logo 2023-09-02 21:56:39 +02:00
Nikita Karamov c53384a54d
Fix Vite config
Node plugin would also work on build which messes up the `root` config
entry. This should fix the deploy not working.
2023-09-02 21:56:39 +02:00
Nikita Karamov 3d528cc4e4
Update dependencies 2023-09-02 21:56:39 +02:00
Nikita Karamov 790fa837bc
Simplify .gitignore 2023-09-02 21:56:39 +02:00
Nikita Karamov 5413d7c5a1
Format Markdown with Prettier too 2023-09-02 21:56:39 +02:00
Nikita Karamov 2c9f5c11f0
Add foreword to CHANGELOG 2023-09-02 21:56:39 +02:00
Nikita Karamov 40c0add0e3
Add vite-plugin-node to be able to run API locally 2023-09-02 21:56:38 +02:00
Nikita Karamov 03f49e4056
BREAKING: Refactor /api endpoint
The endpoint was renamed to `/api/share` and refactored to use ESM instead of CommonJS
2023-09-02 21:56:38 +02:00
Nikita Karamov aeda860af6
Update CHANGELOG 2023-09-02 21:56:38 +02:00
Nikita Karamov 42ff4cac1a
Replace 'onload' with an event listener 2023-09-02 21:56:38 +02:00
Nikita Karamov ea3339d413
Replace Gulp with Vite 2023-09-02 21:56:38 +02:00
Nikita Karamov 01e82d462d
Update URLs to lead to GitHub 2023-09-02 21:56:38 +02:00
pre-commit-ci[bot] d8fe6060e8
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-09-02 21:56:38 +02:00
Nikita Karamov 3868d1325e
Update Browserslist config
The config was extended to always include Firefox ESR and `defaults`, and moved to the package.json
2023-09-02 21:56:37 +02:00
Nikita Karamov eedb876dcd
Update CHANGELOG 2023-09-02 21:56:37 +02:00
Nikita Karamov bf556860c1
Update copyright headers in files
This updates the project name, description, and copyright years
2023-09-02 21:56:37 +02:00
Nikita Karamov 94704c8f59
Update README 2023-09-02 21:56:37 +02:00
Nikita Karamov f33c58bb91
Use the new logo in the README 2023-09-02 21:56:37 +02:00
Nikita Karamov 3cfea7929f
Add new logos
See: #1
2023-09-02 21:56:37 +02:00
Nikita Karamov a5c5bb3351
Add vercel.json 2023-09-02 21:51:20 +02:00
Nikita Karamov 9c7211b8d2
Update lockfile version 2023-09-02 21:51:12 +02:00
Nikita Karamov 6dcf78c456
Release 2.4.5 2023-06-17 14:16:00 +02:00
Nikita Karamov 7bd29fd3cb
Use a better robots.txt to prevent information leakage (#33) 2023-06-17 14:13:18 +02:00
Nikita Karamov a41fe8ba9e
Update changelog 2023-06-17 14:10:33 +02:00
Nikita Karamov a040b32405
Use at() instead of charAt() 2023-06-17 14:08:15 +02:00
Nikita Karamov c23921d0ff
Update pre-commit 2023-06-17 14:07:34 +02:00
Nikita Karamov 9c0d08eb7d
Use a better robots.txt to prevent information leakage 2023-06-17 14:00:32 +02:00
Nikita Karamov c87d5a35ff
Release 2.4.4 2023-03-01 12:48:35 +01:00
Nikita Karamov 725f9353cf
Add linting and pre-commit
See: https://codeberg.org/kytta/toot/pulls/17
2023-03-01 12:46:12 +01:00
Nikita Karamov 4df79c322b
Fix lint problems 2023-03-01 12:42:40 +01:00
Nikita Karamov e2ddc5221f
Fix formatting issues 2023-03-01 12:42:40 +01:00
Nikita Karamov 0a546bdf50
Set up linters 2023-03-01 12:42:40 +01:00
Nikita Karamov 2b842ca027
Fix instance prefill not working
Closes https://codeberg.org/kytta/toot/issues/15

See: https://codeberg.org/kytta/toot/pulls/16
2023-03-01 11:52:08 +01:00
Nikita Karamov 74090c9ec7
Fix instance prefill not working
Closes https://codeberg.org/kytta/toot/issues/15
2023-03-01 11:51:12 +01:00
Nikita Karamov 91805c200a
Release 2.4.3 2022-12-23 03:12:03 +01:00
Nikita Karamov 445908b34a
Check for instance at the very beginning 2022-12-23 03:08:22 +01:00
Nikita Karamov 5f0e28e506
Only count views on the official instances 2022-12-23 03:05:09 +01:00
Nikita Karamov 1650a4bca1
Update caniuse-lite database 2022-12-23 02:57:20 +01:00
Nikita Karamov 9982dded07
Redo analytics again
This time I am manually calling the sendBeacon() function instead of
the script loading an image. This is faster, more privacy-friendly, and
more performant, since sendBeacon is being sent asynchronously. The
script I got at the end is also very small and hosted on my side.
2022-12-23 02:55:30 +01:00
Nikita Karamov 15ce72ae74
Relese 2.4.2 2022-12-21 12:05:56 +01:00
Nikita Karamov 3702f9a596
Remove pixel and only submit empty path 2022-12-21 11:59:25 +01:00
Nikita Karamov 5a000b35d4
Release 2.4.1 2022-11-20 16:19:14 +01:00
Nikita Karamov 59577b83e4
Fix "remember instance" (#13)
Closes: https://codeberg.org/kytta/toot/issues/12
See: https://codeberg.org/kytta/toot/pulls/13
2022-11-20 16:17:08 +01:00
Nikita Karamov cd8ba5b43c
Fix remember instances
Closes #12
2022-11-20 16:09:11 +01:00
90 changed files with 9069 additions and 3078 deletions

View File

@ -1 +0,0 @@
cover 95%

View File

@ -1,17 +1,27 @@
# This EditorConfig is part of Share₂Fedi
# https://github.com/kytta/share2fedi
#
# SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
# SPDX-License-Identifier: CC0-1.0
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
[*.md]
indent_size = 2
indent_style = space
[src/i18n/translations/*.json]
max_line_length = off
indent_style = space
indent_size = 4
[*.md]
indent_style = space
trim_trailing_whitespace = false
[*.yml]

10
.eslintignore Normal file
View File

@ -0,0 +1,10 @@
# This ESLint ignore file is part of Share₂Fedi
# https://github.com/kytta/share2fedi
#
# SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
# SPDX-License-Identifier: CC0-1.0
.vercel/
/dist/
node_modules/
script/

30
.eslintrc.json Normal file
View File

@ -0,0 +1,30 @@
// This ESLint config is part of ShareFedi
// https://github.com/kytta/share2fedi
//
// SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
// SPDX-License-Identifier: CC0-1.0
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:unicorn/recommended",
"plugin:astro/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"env": {
"browser": true
},
"overrides": [
{
"files": ["*.astro"],
"parser": "astro-eslint-parser",
"parserOptions": {
"parser": "@typescript-eslint/parser",
"extraFileExtensions": [".astro"]
}
}
]
}

5
.github/FUNDING.yml vendored
View File

@ -1,3 +1,8 @@
# This file is part of Share₂Fedi
# https://github.com/kytta/share2fedi
#
# SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
# SPDX-License-Identifier: CC0-1.0
github: kytta
liberapay: kytta
custom: paypal.me/NickKaramoff

32
.github/workflows/check.yml vendored Normal file
View File

@ -0,0 +1,32 @@
# This file is part of Share₂Fedi
# https://github.com/kytta/share2fedi
#
# SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
# SPDX-License-Identifier: AGPL-3.0-only
name: Check and build
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: "^18.17.0"
cache: "pnpm"
- run: pnpm install
- run: pnpm check
- run: pnpm build

36
.github/workflows/deploy-deno.yml vendored Normal file
View File

@ -0,0 +1,36 @@
name: Deploy to Deno
on:
push:
branches:
- "main"
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: "^18.17.0"
cache: "pnpm"
- run: pnpm install --frozen-lockfile
- run: pnpm run build --s2f-use-deno
- name: Upload to Deno Deploy
uses: denoland/deployctl@v1
with:
project: share2fedi
entrypoint: server/entry.mjs
root: dist

312
.gitignore vendored
View File

@ -1,305 +1,19 @@
# This Git ignore file is part of Share₂Fedi
# https://github.com/kytta/share2fedi
#
# SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
# SPDX-License-Identifier: CC0-1.0
# Created by https://www.toptal.com/developers/gitignore/api/node,now,visualstudiocode,webstorm+all,windows,macos,linux
# Edit at https://www.toptal.com/developers/gitignore?templates=node,now,visualstudiocode,webstorm+all,windows,macos,linux
# Outputs
/dist/
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
# Cache/state
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
.env.production
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
### now ###
.now
.vercel
### VisualStudioCode ###
.vscode/*
*.code-workspace
# Local History for Visual Studio Code
.history/
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
### WebStorm+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### WebStorm+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
# Editors/IDEs
.idea/
.vscode/
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
*.iml
modules.xml
.idea/misc.xml
*.ipr
# Sonarlint plugin
.idea/sonarlint
### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# End of https://www.toptal.com/developers/gitignore/api/node,now,visualstudiocode,webstorm+all,windows,macos,linux
/public
# Backend
.vercel/
.netlify

7
.husky/pre-commit Executable file
View File

@ -0,0 +1,7 @@
# This file is part of Share₂Fedi
# https://github.com/kytta/share2fedi
#
# SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
# SPDX-License-Identifier: CC0-1.0
npx lint-staged

View File

@ -1 +1 @@
14
18

View File

@ -1,3 +1,13 @@
*.md
/public
/.vercel
# This Prettier ignore file is part of Share₂Fedi
# https://github.com/kytta/share2fedi
#
# SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
# SPDX-License-Identifier: CC0-1.0
.vercel/
/dist/
node_modules/
script/
pnpm-lock.yaml
src/i18n/translations/*.json

View File

@ -1 +0,0 @@
{}

21
.reuse/dep5 Normal file
View File

@ -0,0 +1,21 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Share₂Fedi
Upstream-Contact: Nikita Karamov <me@kytta.dev>
Source: https://github.com/kytta/share2fedi
Files: public/site.webmanifest
Copyright: 2023 Nikita Karamov <me@kytta.dev>
License: AGPL-3.0-only
Files: src/i18n/translations/*.json
Copyright: 2023 Nikita Karamov <me@kytta.dev>
License: AGPL-3.0-only
Files:
assets/*.png
assets/*.svg
public/*.ico
public/*.png
public/*.svg
Copyright: 2023 Nikita Karamov <me@kytta.dev>
License: CC-BY-4.0

8
.vercelignore Normal file
View File

@ -0,0 +1,8 @@
# This Vercel ignore file is part of Share₂Fedi
# https://github.com/kytta/share2fedi
#
# SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
# SPDX-License-Identifier: CC0-1.0
/assets/
/script/

View File

@ -1,8 +1,141 @@
<!--
This change log is part of Share₂Fedi
https://github.com/kytta/share2fedi
SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
SPDX-License-Identifier: CC0-1.0
-->
# Changelog
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.0.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).
## [3.1.0] - 2024-02-12
## Added
- new translation languages
- Nederlands/Dutch (thx [Heimen](https://github.com/Vistaus)!)
- Español/Spanish (thx gallegonovato!)
- <span dir="rtl">العربية</span>/Arabic (thx ButterflyOfFire](https://mstdn.fr/@butterflyoffire)!)
### Fixed
- locale switcher would not work if an unknown locale is in the local storage
### Changed
- i18n engine improved
- added support for RTL languages
- enumerations (of project variations) are now done with Intl.ListFormat and
thus adhere to the language rules
- disabled search indexing
- hopefully this will prevent Google shamelessly indexing other's peoples'
content in Chrome
- moved translations to [Hosted Weblate](https://hosted.weblate.org/engage/share2fedi/)
- updated dependencies
## [v3][3.0.0]
This version is a huge reinvention of toot. The name was changed to Share₂Fedi,
as to indicate that sharing to other federated networks is now possible.
### ⚠️ BREAKING CHANGES
Share₂Fedi is now an [Astro](https://astro.build/) site. The migration allowed
us to have a performant service that is easily hostable on both serverless
platforms, like Vercel or Netlify, as well as locally. Setting the project up
now takes seconds! This comes with changes, though:
- **static files aren't built any more**, but generated server-side
- **new output directory**: ~~`public/`~~`dist/`
- this also means that `public/` **is not ignored any more**
Some changes came with the name change:
- **changed API endpoint path**: ~~`/api/toot`~~`/`
- just send a POST request instead of a GET request with the same body
### Added
- **new federated social networks**
- Friendica
- GNU Social
- Hubzilla
- Misskey (+ flavours)
- **new ways to host**
- Netlify
- Cloudflare Pages
- **multilingual share page**
- Share₂Fedi can be used in English, German, and Russian.
[Help us with other languages!](./src/i18n/translations.ts)
- remembering of multiple Fediverse instances
- new API endpoints
- `/api/instances` will return the list of popular instances
- `/api/detect/[host]` will detect the Fediverse project used by a host
- a privacy policy describing what data is being processed and stored
- a link to the status page
### Changed
- **new project name**: Share₂Fedi (see
[GH#24](https://github.com/kytta/share2fedi/issues/24))
- new default instance URL: <https://s2f.kytta.dev>
- new logo
- new design
- repository moved back to GitHub
- licence of the project is now AGPL v3 **only**
- for now, this has no effect. If AGPL v4 ever comes out, Share₂Fedi v2 will
not be available under it
- s2f is now being built with Astro
- Share₂Fedi is now 100% server-side rendered. You don't have to host any
static files, all you need is to run the Node server.
- when developing, the API endpoint can now be tested locally
### Removed
- GoatCounter analytics. I will no longer track the visitors of s2f.kytta.dev
## [2.4.5] - 2023-06-17
### Fixed
- blocked crawling of all pages other than index (#33)
## [2.4.4] - 2023-03-01
### Fixed
- fixed not working instance prefilling (#15)
## [2.4.3] - 2022-12-23
### Changed
- analytics script replaced with own implementation
- now uses `navigator.sendBeacon()` for a more lightweight solution
- now doesn't send anything other than path and screen size
- updated CanIUse databases, which may cause some browsers become unsupported
## [2.4.2] - 2022-12-21
### Changed
- analytics should send query parameters anymore
### Removed
- tracking pixel for JS-less analytics
## [2.4.1] - 2022-11-20
### Fixed
- "remember instance on this device" didn't work (#12, #13)
## [2.4.0] - 2022-11-14
@ -85,7 +218,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### 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
@ -99,7 +233,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### 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
@ -148,19 +283,26 @@ Initial release of the site
- Add main code for the site
[Unreleased]: https://codeberg.org/kytta/toot/compare/v2.4.0...HEAD
[2.4.0]: https://codeberg.org/kytta/toot/compare/v2.3.1...v2.4.0
[2.3.1]: https://codeberg.org/kytta/toot/compare/v2.3.0...v2.3.1
[2.3.0]: https://codeberg.org/kytta/toot/compare/v2.2.2...v2.3.0
[2.2.2]: https://codeberg.org/kytta/toot/compare/v2.2.1...v2.2.2
[2.2.1]: https://codeberg.org/kytta/toot/compare/v2.2.0...v2.2.1
[2.2.0]: https://codeberg.org/kytta/toot/compare/v2.1.0...v2.2.0
[2.1.0]: https://codeberg.org/kytta/toot/compare/v2.0.0...v2.1.0
[2.0.0]: https://codeberg.org/kytta/toot/compare/v1.2.2...v2.0.0
[1.2.2]: https://codeberg.org/kytta/toot/compare/v1.2.1...v1.2.2
[1.2.1]: https://codeberg.org/kytta/toot/compare/v1.2.0...v1.2.1
[1.2.0]: https://codeberg.org/kytta/toot/compare/v1.1.2...v1.2.0
[1.1.2]: https://codeberg.org/kytta/toot/compare/v1.1.1...v1.1.2
[1.1.1]: https://codeberg.org/kytta/toot/compare/v1.1.0...v1.1.1
[1.1.0]: https://codeberg.org/kytta/toot/compare/v1.0.0...v1.1.0
[1.0.0]: https://codeberg.org/kytta/toot/compare/e85aa15400bcdbcccf655d331f72df8304744b85...v1.0.0
[Unreleased]: https://github.com/kytta/share2fedi/compare/v3.1.0...HEAD
[3.1.0]: https://github.com/kytta/share2fedi/compare/v3.0.0...v3.1.0
[3.0.0]: https://github.com/kytta/share2fedi/compare/v2.4.5...v3.0.0
[2.4.5]: https://github.com/kytta/share2fedi/compare/v2.4.4...v2.4.5
[2.4.4]: https://github.com/kytta/share2fedi/compare/v2.4.3...v2.4.4
[2.4.3]: https://github.com/kytta/share2fedi/compare/v2.4.2...v2.4.3
[2.4.2]: https://github.com/kytta/share2fedi/compare/v2.4.1...v2.4.2
[2.4.1]: https://github.com/kytta/share2fedi/compare/v2.4.0...v2.4.1
[2.4.0]: https://github.com/kytta/share2fedi/compare/v2.3.1...v2.4.0
[2.3.1]: https://github.com/kytta/share2fedi/compare/v2.3.0...v2.3.1
[2.3.0]: https://github.com/kytta/share2fedi/compare/v2.2.2...v2.3.0
[2.2.2]: https://github.com/kytta/share2fedi/compare/v2.2.1...v2.2.2
[2.2.1]: https://github.com/kytta/share2fedi/compare/v2.2.0...v2.2.1
[2.2.0]: https://github.com/kytta/share2fedi/compare/v2.1.0...v2.2.0
[2.1.0]: https://github.com/kytta/share2fedi/compare/v2.0.0...v2.1.0
[2.0.0]: https://github.com/kytta/share2fedi/compare/v1.2.2...v2.0.0
[1.2.2]: https://github.com/kytta/share2fedi/compare/v1.2.1...v1.2.2
[1.2.1]: https://github.com/kytta/share2fedi/compare/v1.2.0...v1.2.1
[1.2.0]: https://github.com/kytta/share2fedi/compare/v1.1.2...v1.2.0
[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

139
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,139 @@
<!--
This file is part of Share₂Fedi
https://github.com/kytta/share2fedi
SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
SPDX-License-Identifier: CC0-1.0
-->
# Contributing guide
First off, thank you for considering contributing to Share₂Fedi! There are many
ways you can improve on the project:
- [write new and improve on the old code](#improving-code)
- [write documentation](#writing-documentation)
- [translate UI strings](#translating)
- [report bugs](#reporting-bugs)
Please, follow this guide if you want to contribute. We promise, it's not too
many rules! Following this helps us merge changes quicker!
Unsure where to begin contributing? You can start by looking through
[the help-wanted issues](https://github.com/kytta/share2fedi/labels/help%20wanted)!
## Improving code
Before you start, make sure you've got a fresh Node.js version (v18 should work)
installed. You'll also need to [install pnpm](https://pnpm.io/installation), as
this is our package manager of choice.
1. Fork the repository and clone it
2. Install dependencies:
```sh
pnpm install
```
3. To start a dev server, run:
```sh
pnpm dev
```
This server will auto-update on changes to the file
4. After implementing a feature, create a new Git branch and commit your changes
on it
5. Push the branch and open a PR.
### Adding support for other Fediverse projects
In order for a Fediverse project to be supported, it has to have a "Share" page
located at a fixed address. That means, that the address is the same for all
users and all frontends. For example, Mastodon's "Share" page is always at
`/share`. The share page should also accept the text of the post via URL
parameters. For example, Mastodon allows pre-filling the text of a post using
`?text=`. Lastly, it should be listed on
[fediverse.observer](https://fediverse.observer/).
If the Fediverse project satisfies these requirements, you can add it to
Share2Fedi. For this:
1. Add an entry to `supportedProjects` inside `src/lib/project.ts`.
- keep the list in alphabetical order
- the key should match the software name from NodeInfo/fediverse.observer
- the value should be an object of type `ProjectPublishConfig`. The endpoint
is the path to the "Share" page (leading slash optional).
- if the service you're adding is a flavour of an already supported service,
use the variable to reduce code duplication. See `mastodonConfig` for an
example
2. Pick an instance of the project you've added and visit
`/api/detect/<INSTANCE-DOMAIN>`. Make sure the detection is correct
3. Go to the `/` and try to share something to the instance. Make sure the
"Share" page opens with correct parameters.
## Writing documentation
Share₂Fedi's documentation is pretty complete at the moment, but you are free to
fix errors and to add clarifications. The only documentation we have is the
`README.md` and `CONTRIBUTING.md` that you're reading right now.
## Translating
Starting with v3, Share₂Fedi has a very primitive translation framework built
in. Despite it being simple, you can edit translations and add new languages in
form of JSON-based dictionaries.
There are two ways you can add/edit translations:
1. [Weblate](https://hosted.weblate.org/engage/share2fedi/), a web-based tool
that simplifies this process.
- we use Hosted Weblate. You can login using any account. Make sure to set
the correct email so that the changes can be attributed to you!
- Weblate handles PRs automatically. You do not need to do anything other
than use it to edit translations
2. The JSON files under `src/i18n/translations` represent dictionaried for
different languages. The two-letter codes correspond to the ISO 639-1
language codes.
- to edit translations, just edit the files. Refer to
[the coding guide](#improving-code) for more information on how to do this.
### Adding new languages
You may notice that adding a new language in Weblate or in the code does not add
it to the language dropdown. This is due to the i18n needing to define the
languages for the dropdown.
To add a new language, edit the `src/i18n/translations.ts` file. Import the JSON
file with the translations and add a new entry to the `languages` mapping.
> [!IMPORTANT]
> For the language name, use a **capitalized autonym**. An autonym
> is the name of the language in the language itself. You can consult CLDR or
> Wikipedia for this. It should be capitalized, if it makes sense in the
> language. It should NOT include the word "language" unless it's common to use
> it ("Bahasa Indonesia", but "Русский", not "русский язык")
>
> A good rule of thumb is to take the value that Wikipedia uses in their
> [language list](https://www.wikipedia.org/#js-lang-lists).
## Reporting bugs
> [!IMPORTANT]
> If you find a security vulnerability, do NOT open an issue. Email
> [Nikita Karamov](mailto:me@kytta.dev) instead.
If you find a bug you can't (or don't want to) fix yourself, don't hesitate
filing an issue. We do not have a preset issue template, but try to answer these
questions in the issue body:
1. What version of Share₂Fedi are you using?
2. How do you deploy it (Node/Vercel/Netlify/Cloudflare/Deno)?
3. What did you do?
4. What did you expect to see?
5. What did you see instead?
---
We are looking forward to your contributions!

235
LICENSES/AGPL-3.0-only.txt Normal file
View File

@ -0,0 +1,235 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
The precise terms and conditions for copying, distribution and modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based on the Program.
To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.
A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements.
You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see <http://www.gnu.org/licenses/>.

156
LICENSES/CC-BY-4.0.txt Normal file
View File

@ -0,0 +1,156 @@
Creative Commons Attribution 4.0 International
Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. More considerations for licensors.
Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensors permission is not necessary for any reasonfor example, because of any applicable exception or limitation to copyrightthen that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. More considerations for the public.
Creative Commons Attribution 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
Section 1 Definitions.
a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
c. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
d. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
e. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
f. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
g. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
h. Licensor means the individual(s) or entity(ies) granting rights under this Public License.
i. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
Section 2 Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
A. reproduce and Share the Licensed Material, in whole or in part; and
B. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
3. Term. The term of this Public License is specified in Section 6(a).
4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
5. Downstream recipients.
A. Offer from the Licensor Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
B. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this Public License.
3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties.
Section 3 License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified form), You must:
A. retain the following if it is supplied by the Licensor with the Licensed Material:
i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of warranties;
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License.
Section 4 Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database;
b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
Section 5 Disclaimer of Warranties and Limitation of Liability.
a. Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
b. To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
Section 6 Term and Termination.
a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
2. upon express reinstatement by the Licensor.
c. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
d. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
Section 8 Interpretation.
a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
Creative Commons may be contacted at creativecommons.org.

121
LICENSES/CC0-1.0.txt Normal file
View File

@ -0,0 +1,121 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.

8
LICENSES/ISC.txt Normal file
View File

@ -0,0 +1,8 @@
ISC License:
Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC")
Copyright (c) 1995-2003 by Internet Software Consortium
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

177
README.md
View File

@ -1,108 +1,185 @@
<h1 align="center"><img src="assets/logo.svg" width="128" height="128" alt="toot"></h1>
<!--
This README is part of Share₂Fedi
https://github.com/kytta/share2fedi
> Cross-instance share page for Mastodon
SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
SPDX-License-Identifier: CC0-1.0
-->
[toot] allows you to share stuff on Mastodon, cross-instance. Just put in your
post text and the instance URL and click Toot!
<h1 align="center"><img src="assets/share2fedi.svg" width="520" height="160" alt="Share2Fedi"></h1>
And if you open this page with `text` URL parameter, it will be auto-inserted
in the text field. The same goes for the `instance` URL parameter. This can be
used to build custom share buttons for Mastodon:
> 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:
```html
<a href="https://toot.kytta.dev/?text=Hello%20world!&instance=https%3A%2F%2Fmastodon.xyz">
Share on Mastodon
<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 later — handy!
appended if used later—handy!
> [!IMPORTANT]
> I know I provide [a Share₂Fedi instance](https://s2f.kytta.dev) 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
### One-click Vercel deploy
### Vercel, Netlify, Cloudflare Pages
For now, toot is a tad bit vendor-locked to run on
[Vercel](https://vercel.com/). To deploy it yourself, you can use the following
button:
Share₂Fedi was designed to run on [Vercel](https://vercel.com/), but you can
also run it on [Netlify](https://www.netlify.com/) or
[Cloudflare Pages](https://pages.cloudflare.com/). To deploy it yourself (it's
free!), you can use the following buttons:
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fkytta%2Ftoot)
[![Deploy to Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fkytta%2Fshare2fedi)
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/kytta/share2fedi)
To deploy to Cloudflare Pages, fork the repository and
[follow the instructions](https://docs.astro.build/en/guides/deploy/cloudflare/#how-to-deploy-a-site-with-git).
### Host it yourself
Self-hosting toot outside of Vercel requires some extra setup:
Self-hosting Share₂Fedi outside of SSR providers requires some extra setup:
1. Make sure you have got Node.js v12 or later as well as pnpm installed
**Prerequisites:** modern Node.js (v18 is recommended), `pnpm`. You can host
with Deno, but Node.js is still required to build Share₂Fedi.
2. Build the static part of toot:
1. Install dependencies.
```sh
pnpm install # to install dependencies
pnpm run build # to build the website
pnpm install
```
3. Run the backend server for the form:
2. Build.
```sh
node api/toot.js
pnpm build
```
or if you want to run the process in the background:
If you want to use Deno, add the `--s2f-use-deno` flag:
```sh
pm2 start api/toot.js --watch --ignore-watch="node_modules"
pnpm build --s2f-use-deno
```
> You can find a summary for pm2 at: https://pm2.keymetrics.io/docs/usage/quick-start/
3. Run server.
4. Set up webserver
> 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.
```sh
node dist/server/entry.mjs
```
In production, you might want to use a process manager, like
[PM2](https://pm2.keymetrics.io/docs/usage/quick-start/):
```sh
# 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:
```sh
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
```apacheconf
DocumentRoot "path_to_toot/public"
ProxyPass "/api/toot" "http://localhost:8000/"
ProxyPass "/" "http://localhost:3000/"
```
2. Nginx
```nginxconf
root path_to_toot/public;
index.html;
location /api/toot {
proxy_pass http://localhost:8000/;
location / {
proxy_pass http://localhost:3000/;
}
```
3. Caddy
```caddy
root * path_to_toot/public;
try_files index.html
handle_path /api/toot {
reverse_proxy localhost:8000
}
reverse_proxy :3000
```
### Docker
If you _really_ have to use Docker, there is
[a good guide on building Astro apps with Docker](https://docs.astro.build/en/recipes/docker/).
**I will not** provide support for Docker-based deployments in the observable
future.
## Contribute
### Source code
TL;DR: `pnpm install && pnpm dev`
See [contributing guide](CONTRIBUTING.md#improving-code) for instructions on how
to contribute source code to the project, including adding new Fediverse
projects.
### Translations
Share₂Fedi uses Hosted Weblate for translations.
[You can edit translations using it's practical interface.](https://hosted.weblate.org/engage/share2fedi/).
You also could do it manually by editing files in `src/i18n/translations`, but
this is NOT recommended.
<a href="https://hosted.weblate.org/engage/share2fedi/">
<img src="https://hosted.weblate.org/widget/share2fedi/site/multi-auto.svg" alt="Translation status" />
</a>
> [!NOTE]
> New languages do not become automatically available. For this, a
> separate change to our ad-hoc i18n engine has to be made. See
> [contributing guide](CONTRIBUTING.md#translating) for instructions
_We thank Weblate for providing Libre hosting!_
## See also
**[📯 Shareon](https://shareon.js.org)**
(lightweight, stylish, and ethical share buttons) uses [toot] under the hood!
**[📯 Shareon](https://shareon.js.org)** (lightweight, stylish, and ethical
share buttons) uses **Share₂Fedi** under the hood!
## Licence
Copyright © 20202022 [Nikita Karamov](https://www.kytta.dev/)
Licenced under the [GNU Affero General Public License, version 3](https://spdx.org/licenses/AGPL-3.0-only.html)
The toot logo is based on Mastodons Simple logo, licensed under [AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.html).
The repo banner includes Mastodons Full logo, licensed under [AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.html).
© 20202023 [Nikita Karamov]\
Licensed under the [GNU Affero General Public License v3.0 only][AGPL-3.0-only].
---
This project is hosted on Codeberg: <https://codeberg.org/kytta/toot>
This project is hosted on GitHub: <https://github.com/kytta/share2fedi.git>
[toot]: https://toot.kytta.dev/
[AGPL-3.0-only]: https://spdx.org/licenses/AGPL-3.0-only.html
[Nikita Karamov]: https://www.kytta.dev
[Share₂Fedi]: https://s2f.kytta.dev/

View File

@ -1,38 +0,0 @@
/*!
toot - Cross-instance share page for Mastodon
Copyright (C) 2020-2022 Nikita Karamov <me@kytta.dev>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
const http = require("http");
http
.createServer(async (req, res) => {
const buffers = [];
for await (const chunk of req) {
buffers.push(chunk);
}
const data = Buffer.concat(buffers).toString();
const params = new URLSearchParams(data);
const text = params.get("text") || "";
const instanceURL = params.get("instance") || "https://mastodon.social/";
const finalURL = new URL("share", instanceURL);
finalURL.search = new URLSearchParams({ text }).toString();
res.writeHead(303, { Location: finalURL.toString() }).end();
})
.listen(8000);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -1,9 +0,0 @@
<svg viewBox="0 0 174 186" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2">
<path d="M169.446 111.27c-2.545 13.093-22.794 27.422-46.05 30.199-12.127 1.447-24.067 2.777-36.799 2.193-20.822-.954-37.252-4.97-37.252-4.97 0 2.027.125 3.957.375 5.762 2.707 20.549 20.376 21.78 37.113 22.354 16.893.578 31.935-4.165 31.935-4.165l.694 15.272s-11.816 6.345-32.865 7.512c-11.607.638-26.019-.292-42.805-4.735C7.386 171.056 1.125 132.249.167 92.873-.125 81.182.055 70.158.055 60.938c0-40.264 26.381-52.066 26.381-52.066C39.738 2.763 62.563.194 86.292 0h.583c23.729.194 46.569 2.763 59.87 8.872 0 0 26.38 11.802 26.38 52.066 0 0 .331 29.707-3.679 50.332" fill="#3088d4" fill-rule="nonzero"/>
<g fill="#fff">
<path d="M170.804 102.751c-1.682.442-3.452.639-5.298.639-5.619 0-9.961-1.469-13.025-4.406-3.065-2.938-4.598-7.216-4.598-12.835V61.534h-8.428v-9.578h8.428V40.271h11.973v11.685h12.748c.357 2.821.521 5.813.521 8.982l-.001.596h-13.268v24.328c0 2.49.606 4.39 1.819 5.699 1.214 1.309 2.969 1.963 5.268 1.963 1.869 0 3.52-.341 4.944-1.046l-.175 2.226-.908 8.047z"/>
<path d="M115.127 103.39c-5.172 0-9.834-1.118-13.984-3.353-4.151-2.235-7.391-5.347-9.722-9.338-2.33-3.991-3.496-8.509-3.496-13.553 0-5.044 1.166-9.546 3.496-13.505 2.331-3.959 5.571-7.056 9.722-9.29 4.15-2.235 8.812-3.353 13.984-3.353 5.236 0 9.929 1.118 14.079 3.353 4.151 2.234 7.391 5.331 9.722 9.29 2.33 3.959 3.496 8.461 3.496 13.505 0 5.044-1.166 9.562-3.496 13.553-2.331 3.991-5.571 7.103-9.722 9.338-4.15 2.235-8.843 3.353-14.079 3.353zm0-10.249c4.405 0 8.045-1.468 10.918-4.406 2.874-2.937 4.311-6.8 4.311-11.589 0-4.789-1.437-8.652-4.311-11.589-2.873-2.937-6.513-4.406-10.918-4.406-4.406 0-8.03 1.469-10.871 4.406-2.842 2.937-4.262 6.8-4.262 11.589 0 4.789 1.42 8.652 4.262 11.589 2.841 2.938 6.465 4.406 10.871 4.406z" fill-rule="nonzero"/>
<path d="M61.011 103.39c-5.172 0-9.833-1.118-13.983-3.353-4.151-2.235-7.391-5.347-9.722-9.338-2.331-3.991-3.496-8.509-3.496-13.553 0-5.044 1.165-9.546 3.496-13.505 2.331-3.959 5.571-7.056 9.722-9.29 4.15-2.235 8.811-3.353 13.983-3.353 5.236 0 9.929 1.118 14.08 3.353 4.15 2.234 7.391 5.331 9.722 9.29 2.33 3.959 3.495 8.461 3.495 13.505 0 5.044-1.165 9.562-3.495 13.553-2.331 3.991-5.572 7.103-9.722 9.338-4.151 2.235-8.844 3.353-14.08 3.353zm0-10.249c4.406 0 8.046-1.468 10.919-4.406 2.874-2.937 4.31-6.8 4.31-11.589 0-4.789-1.436-8.652-4.31-11.589-2.873-2.937-6.513-4.406-10.919-4.406-4.405 0-8.029 1.469-10.871 4.406-2.841 2.937-4.262 6.8-4.262 11.589 0 4.789 1.421 8.652 4.262 11.589 2.842 2.938 6.466 4.406 10.871 4.406z" fill-rule="nonzero"/>
<path d="M.575 51.956h7.854V40.271h11.972v11.685h13.696v9.578H20.401v24.328c0 2.49.607 4.39 1.82 5.699 1.213 1.309 2.969 1.963 5.268 1.963 2.681 0 4.916-.702 6.704-2.107l3.352 8.524c-1.404 1.15-3.112 2.012-5.124 2.587-2.011.574-4.134.862-6.369.862-5.619 0-9.961-1.469-13.026-4.406-3.065-2.938-4.597-7.216-4.597-12.835V61.534H.053l.002-.596c0-3.169.163-6.161.52-8.982z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.0 KiB

26
assets/pentagon.svg Normal file
View File

@ -0,0 +1,26 @@
<!-- © 2022 Nikita Karamov. Licensed under CC-BY 4.0 -->
<svg viewBox="0 0 64 64" width="512" height="512" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
<defs>
<filter id="blur">
<feGaussianBlur stdDeviation="15"></feGaussianBlur>
</filter>
<clipPath id="pentagon">
<path d="m38.802 1.632 23.656 29.212-20.473 31.524-36.307-9.729-1.968-37.537z"></path>
</clipPath>
</defs>
<g clip-path="url(#pentagon)">
<g filter="url(#blur)">
<circle cx="0" cy="10" fill="#F44336" r="39"></circle>
<circle cx="45" cy="-5" fill="#FFEB3B" r="39"></circle>
<circle cx="70" cy="25" fill="#4CAF50" r="39"></circle>
<circle cx="50" cy="65" fill="#03A9F4" r="39"></circle>
<circle cx="5" cy="70" fill="#673AB7" r="39"></circle>
<circle cx="50" cy="31.5" fill="#4CAF50" r="12"></circle>
<circle cx="37.5" cy="50.5" fill="#03A9F4" r="12"></circle>
<circle cx="15.5" cy="44.5" fill="#673AB7" r="12"></circle>
<circle cx="14" cy="22" fill="#F44336" r="12"></circle>
<circle cx="36" cy="14" fill="#FFEB3B" r="12"></circle>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

29
assets/s2f.svg Normal file
View File

@ -0,0 +1,29 @@
<!-- © 2022 Nikita Karamov. Licensed under CC-BY 4.0 -->
<svg viewBox="0 0 64 64" width="512" height="512" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
<defs>
<filter id="blur">
<feGaussianBlur stdDeviation="15"></feGaussianBlur>
</filter>
<clipPath id="pentagon">
<path d="m38.802 1.632 23.656 29.212-20.473 31.524-36.307-9.729-1.968-37.537z"></path>
</clipPath>
</defs>
<g clip-path="url(#pentagon)">
<g filter="url(#blur)">
<circle cx="0" cy="10" fill="#F44336" r="39"></circle>
<circle cx="45" cy="-5" fill="#FFEB3B" r="39"></circle>
<circle cx="70" cy="25" fill="#4CAF50" r="39"></circle>
<circle cx="50" cy="65" fill="#03A9F4" r="39"></circle>
<circle cx="5" cy="70" fill="#673AB7" r="39"></circle>
<circle cx="50" cy="31.5" fill="#4CAF50" r="12"></circle>
<circle cx="37.5" cy="50.5" fill="#03A9F4" r="12"></circle>
<circle cx="15.5" cy="44.5" fill="#673AB7" r="12"></circle>
<circle cx="14" cy="22" fill="#F44336" r="12"></circle>
<circle cx="36" cy="14" fill="#FFEB3B" r="12"></circle>
</g>
</g>
<path
d="m17.498 27.02h6.489c-.034-4.909-3.81-8.136-9.853-8.136-5.94 0-10.128 3.193-10.093 7.93 0 3.914 2.677 6.077 7.106 7.038l2.506.515c2.781.618 3.708 1.305 3.742 2.472-.034 1.202-1.133 2.094-3.33 2.094-2.575 0-4.12-1.236-4.223-3.536h-6.454c.035 6.283 4.292 9.098 10.78 9.098 6.351 0 10.128-2.747 10.162-7.656-.034-3.81-2.3-6.488-7.793-7.656l-2.06-.446c-2.369-.515-3.433-1.202-3.364-2.403 0-1.099.927-1.888 3.02-1.888 2.198 0 3.228.96 3.365 2.574zm8.761 28.598h11.188v-3.162h-5.704v-.08l1.38-1.141c3.303-2.762 4.164-4.203 4.164-5.885 0-2.702-2.222-4.483-5.724-4.483-3.383 0-5.584 1.881-5.584 4.944h3.762c-.02-1.221.74-1.902 1.822-1.902 1.1 0 1.861.68 1.861 1.782 0 1.04-.66 1.7-1.721 2.602l-5.444 4.483zm13.589-11.432h6.763v-9.75h9.715v-5.459h-9.715v-4.291h10.78v-5.459h-17.543z"
fill="white" />
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

43
assets/share2fedi.svg Normal file
View File

@ -0,0 +1,43 @@
<!-- © 2022 Nikita Karamov. Licensed under CC-BY 4.0 -->
<svg viewBox="0 0 260 80" width="520" height="160" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
<defs>
<filter id="blur">
<feGaussianBlur stdDeviation="15"></feGaussianBlur>
</filter>
<clipPath id="pentagon">
<path d="m38.802 1.632 23.656 29.212-20.473 31.524-36.307-9.729-1.968-37.537z"></path>
</clipPath>
</defs>
<g clip-path="url(#pentagon)" transform="scale(0.6) translate(215,60)">
<g filter="url(#blur)">
<circle cx="0" cy="10" fill="#F44336" r="39"></circle>
<circle cx="45" cy="-5" fill="#FFEB3B" r="39"></circle>
<circle cx="70" cy="25" fill="#4CAF50" r="39"></circle>
<circle cx="50" cy="65" fill="#03A9F4" r="39"></circle>
<circle cx="5" cy="70" fill="#673AB7" r="39"></circle>
<circle cx="50" cy="31.5" fill="#4CAF50" r="12"></circle>
<circle cx="37.5" cy="50.5" fill="#03A9F4" r="12"></circle>
<circle cx="15.5" cy="44.5" fill="#673AB7" r="12"></circle>
<circle cx="14" cy="22" fill="#F44336" r="12"></circle>
<circle cx="36" cy="14" fill="#FFEB3B" r="12"></circle>
</g>
</g>
<style>
@media (prefers-color-scheme: dark) {
#text {
fill: #fff
}
}
</style>
<g id="text" fill="#000">
<path
d="M29.39 27.758h8.387C37.732 21.412 32.85 17.24 25.04 17.24c-7.678 0-13.092 4.127-13.047 10.251 0 5.06 3.461 7.855 9.186 9.098l3.24.665c3.594.8 4.792 1.687 4.836 3.196-.044 1.553-1.464 2.707-4.304 2.707-3.328 0-5.325-1.598-5.458-4.571H11.15c.044 8.12 5.547 11.76 13.934 11.76 8.21 0 13.091-3.55 13.136-9.896-.045-4.926-2.974-8.388-10.074-9.897l-2.663-.576c-3.062-.666-4.437-1.554-4.349-3.107 0-1.42 1.199-2.44 3.906-2.44 2.84 0 4.171 1.242 4.349 3.328zm21.002 8.564c0-2.396 1.375-3.816 3.505-3.816 2.22 0 3.506 1.42 3.462 3.816v13.624h8.698V34.503c.044-5.28-3.329-9.097-8.432-9.097-3.594 0-6.213 1.864-7.322 4.926h-.222V17.684h-8.387v32.262h8.698zm26.723 14.024c3.15 0 5.503-1.11 6.967-3.817h.222v3.417h8.121V33.35c0-4.438-4.26-7.943-11.183-7.943-7.233 0-10.783 3.816-11.094 8.21h8.032c.178-1.51 1.287-2.22 2.973-2.22 1.51 0 2.574.71 2.574 1.953v.089c0 1.376-1.553 1.82-5.636 2.13-4.97.355-8.875 2.396-8.875 7.677 0 4.837 3.24 7.1 7.9 7.1zm2.84-5.503c-1.509 0-2.53-.71-2.53-2.086 0-1.242.888-2.219 2.885-2.53 1.376-.221 2.574-.488 3.462-.887v2.041c0 2.22-1.864 3.462-3.817 3.462zm16.641 5.103h8.698V37.343c0-2.796 1.908-4.615 4.482-4.615.888 0 2.308.133 3.195.444V25.76a7.486 7.486 0 0 0-2.219-.355c-2.574 0-4.57 1.553-5.458 4.926h-.266V25.76h-8.432v24.185zm29.417.444c6.7 0 11.05-3.195 11.849-8.254h-7.944c-.488 1.376-1.952 2.13-3.728 2.13-2.573 0-4.082-1.686-4.082-4.038v-.355h15.754V37.83c0-7.677-4.704-12.425-12.027-12.425-7.5 0-12.292 5.014-12.292 12.514 0 7.81 4.704 12.47 12.47 12.47zm-3.905-15.31c.044-2.086 1.775-3.55 3.905-3.55 2.174 0 3.816 1.464 3.86 3.55z" />
<path
d="M158.001 49.946h8.743V37.343h12.558v-7.056h-12.558V24.74h13.934v-7.056h-22.677v32.262zm35.859.444c6.7 0 11.05-3.195 11.848-8.254h-7.944c-.488 1.376-1.952 2.13-3.727 2.13-2.574 0-4.083-1.686-4.083-4.038v-.355h15.754V37.83c0-7.677-4.704-12.425-12.026-12.425-7.5 0-12.293 5.014-12.293 12.514 0 7.81 4.704 12.47 12.47 12.47zm-3.906-15.31c.044-2.086 1.775-3.55 3.905-3.55 2.175 0 3.817 1.464 3.861 3.55zm28.042 15.177c3.417 0 5.725-1.82 6.746-4.26h.177v3.95h8.654V17.683h-8.698v12.293h-.133c-.932-2.486-3.196-4.571-6.79-4.571-4.793 0-9.452 3.683-9.452 12.425 0 8.388 4.349 12.426 9.496 12.426zm3.24-6.657c-2.397 0-3.817-2.174-3.817-5.769s1.42-5.724 3.817-5.724 3.816 2.13 3.816 5.724c0 3.55-1.42 5.77-3.816 5.77zm16.638 6.346h8.698V25.761h-8.698zm4.349-26.715c2.352 0 4.26-1.775 4.26-3.994 0-2.174-1.908-3.95-4.26-3.95-2.397 0-4.305 1.776-4.305 3.95 0 2.22 1.908 3.994 4.305 3.994z" />
</g>
<path fill="#fff"
d="M140.44 64.724h14.463v-4.088h-7.374v-.104l1.785-1.475c4.27-3.57 5.382-5.433 5.382-7.606 0-3.493-2.872-5.795-7.4-5.795-4.372 0-7.218 2.432-7.218 6.39h4.864c-.026-1.578.957-2.458 2.354-2.458 1.423 0 2.406.88 2.406 2.303 0 1.345-.853 2.199-2.225 3.363l-7.037 5.796v3.674z" />
</svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

85
astro.config.ts Normal file
View File

@ -0,0 +1,85 @@
/* eslint-env node */
/*!
* This file is part of ShareFedi
* https://github.com/kytta/share2fedi
*
* SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineConfig } from "astro/config";
import cloudflare from "@astrojs/cloudflare";
import deno from "@astrojs/deno";
import netlify from "@astrojs/netlify";
import node from "@astrojs/node";
import vercel from "@astrojs/vercel/serverless";
import browserslist from "browserslist";
import { browserslistToTargets, transform } from "lightningcss";
let adapterConfig = {};
if (process.env.VERCEL) {
console.info("Using Vercel (serverless) adapter...");
adapterConfig = {
adapter: vercel({
functionPerRoute: true,
}),
};
} else if (process.env.CF_PAGES) {
console.info("Using Cloudflare (Pages) adapter...");
adapterConfig = {
adapter: cloudflare(),
};
} else if (process.env.NETLIFY) {
console.info("Using Netlify (Functions) adapter...");
adapterConfig = {
adapter: netlify(),
};
} else if (process.argv.includes("--s2f-use-deno")) {
console.info("Using Deno adapter...");
adapterConfig = {
adapter: deno(),
};
} else {
console.info("Using Node.js adapter...");
console.info("Run with '--s2f-use-deno' flag to use Deno");
adapterConfig = {
adapter: node({
mode: "standalone",
}),
};
}
const lightningCssPlugin = () => {
const targets = browserslistToTargets(browserslist());
return {
name: "vite-plugin-lightningcss",
transform(source: string, id: string) {
if (!id.endsWith(".css")) return;
const { code, map } = transform({
filename: id,
code: Buffer.from(source),
minify: true,
sourceMap: true,
targets,
});
return {
code: code.toString(),
// eslint-disable-next-line unicorn/no-null
map: map ? map.toString() : null,
};
},
};
};
export default defineConfig({
site: "https://s2f.kytta.dev",
output: "server",
...adapterConfig,
vite: {
plugins: [lightningCssPlugin()],
},
});

View File

@ -1,47 +0,0 @@
const { join, resolve } = require("path");
const gulp = require("gulp");
const postcss = require("gulp-postcss");
const sass = require("gulp-sass")(require("sass"));
const sourcemaps = require("gulp-sourcemaps");
const terser = require("gulp-terser");
const SOURCE_DIR = resolve(__dirname, "src");
const OUTPUT_DIR = resolve(__dirname, "public");
function html() {
return gulp.src(join(SOURCE_DIR, "index.html")).pipe(gulp.dest(OUTPUT_DIR));
}
function css() {
return gulp
.src(join(SOURCE_DIR, "scss", "*.scss"))
.pipe(sourcemaps.init())
.pipe(sass.sync().on("error", sass.logError))
.pipe(postcss([require("autoprefixer"), require("postcss-csso")]))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest(OUTPUT_DIR));
}
function js() {
return gulp
.src(join(SOURCE_DIR, "main.js"))
.pipe(sourcemaps.init())
.pipe(terser({ ecma: 5 }))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest(OUTPUT_DIR));
}
function static() {
return gulp
.src(join(SOURCE_DIR, "static", "**", "*"))
.pipe(gulp.dest(OUTPUT_DIR));
}
exports.default = gulp.parallel(html, css, js, static);
exports.watch = () => {
gulp.watch(join(SOURCE_DIR, "index.html"), html);
gulp.watch(join(SOURCE_DIR, "scss", "*.scss"), css);
gulp.watch(join(SOURCE_DIR, "main.js"), js);
gulp.watch(join(SOURCE_DIR, "static", "**", "*"), static);
};

6
netlify.toml Normal file
View File

@ -0,0 +1,6 @@
[build]
command = "pnpm run build"
publish = "dist"
[dev]
command = "pnpm dev"
targetPort = 4321

View File

@ -1,32 +1,81 @@
{
"name": "toot",
"version": "2.4.0",
"description": "Cross-instance share page for Mastodon",
"license": "AGPL-3.0-or-later",
"name": "share2fedi",
"version": "3.1.0",
"description": "Instance-agnostic share page for the Fediverse.",
"license": "AGPL-3.0-only",
"author": "Nikita Karamov <me@kytta.dev>",
"homepage": "https://toot.kytta.dev/",
"homepage": "https://s2f.kytta.dev/",
"repository": {
"type": "git",
"url": "https://codeberg.org/kytta/toot.git"
"url": "https://github.com/kytta/share2fedi.git"
},
"private": true,
"type": "module",
"scripts": {
"build": "gulp",
"dev": "gulp watch",
"serve": "sirv ./public --dev"
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"build:icons": "bash ./script/build-icons",
"preview": "astro preview",
"check": "pnpm run /^check:/",
"check:astro": "astro check",
"check:eslint": "eslint .",
"check:prettier": "prettier --check --plugin=prettier-plugin-astro .",
"check:stylelint": "stylelint **/*.scss",
"check:typescript": "tsc --noEmit",
"fix": "pnpm fix:prettier . && pnpm fix:eslint .",
"fix:eslint": "eslint --fix",
"fix:prettier": "prettier --write --ignore-unknown --plugin=prettier-plugin-astro",
"fix:stylelint": "stylelint --fix",
"test": "pnpm run check",
"prepare": "husky"
},
"browserslist": "cover 95%, last 2 versions, Firefox ESR, not dead",
"dependencies": {
"@astrojs/cloudflare": "^9.2.1",
"@astrojs/deno": "^5.0.1",
"@astrojs/netlify": "^5.2.0",
"@astrojs/node": "^8.2.5",
"@astrojs/vercel": "^7.5.2",
"@nanostores/persistent": "^0.9.1",
"astro": "^4.5.16",
"nanostores": "^0.9.5"
},
"devDependencies": {
"autoprefixer": "^10.4.2",
"browserslist": "^4.19.1",
"gulp": "^4.0.2",
"gulp-postcss": "^9.0.1",
"gulp-sass": "^5.1.0",
"gulp-sourcemaps": "^3.0.0",
"gulp-terser": "^2.1.0",
"postcss": "^8.4.6",
"postcss-csso": "^6.0.0",
"prettier": "2.5.1",
"sass": "^1.49.7",
"sirv-cli": "^2.0.2"
"@astrojs/check": "^0.5.10",
"@types/node": "^18.19.29",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"browserslist": "^4.23.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-astro": "^0.31.4",
"eslint-plugin-unicorn": "^51.0.1",
"husky": "^9.0.11",
"lightningcss": "^1.24.1",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"prettier-plugin-astro": "^0.13.0",
"sass": "^1.74.1",
"sharp": "^0.33.3",
"stylelint": "^16.3.1",
"stylelint-config-standard-scss": "^13.1.0",
"svgo": "^3.2.0",
"typescript": "^5.4.3"
},
"lint-staged": {
"*": "pnpm run fix:prettier",
"*.{astro,js,ts}": "pnpm run fix:eslint",
"*.scss": "pnpm run fix:stylelint",
"assets/*.{png,svg}": "pnpm run build:icons"
},
"prettier": {
"singleAttributePerLine": true
},
"stylelint": {
"extends": "stylelint-config-standard-scss"
},
"engines": {
"node": "^18.17.0 || >= 20.3.0"
}
}

5
package.json.license Normal file
View File

@ -0,0 +1,5 @@
This file is part of Share₂Fedi
https://github.com/kytta/share2fedi
SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
SPDX-License-Identifier: CC0-1.0

File diff suppressed because it is too large Load Diff

5
pnpm-lock.yaml.license Normal file
View File

@ -0,0 +1,5 @@
This (auto-generated) file is part of Share₂Fedi
https://github.com/kytta/share2fedi
SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
SPDX-License-Identifier: CC0-1.0

BIN
public/apple-touch-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
public/banner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
public/icon-192.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
public/icon-512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

1
public/icon.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 64 64"><defs><clipPath id="a"><path d="m38.802 1.632 23.656 29.212-20.473 31.524-36.307-9.729L3.71 15.102z"/></clipPath><filter id="b"><feGaussianBlur stdDeviation="15"/></filter></defs><g clip-path="url(#a)" filter="url(#b)"><circle cy="10" r="39" fill="#F44336"/><circle cx="45" cy="-5" r="39" fill="#FFEB3B"/><circle cx="70" cy="25" r="39" fill="#4CAF50"/><circle cx="50" cy="65" r="39" fill="#03A9F4"/><circle cx="5" cy="70" r="39" fill="#673AB7"/><circle cx="50" cy="31.5" r="12" fill="#4CAF50"/><circle cx="37.5" cy="50.5" r="12" fill="#03A9F4"/><circle cx="15.5" cy="44.5" r="12" fill="#673AB7"/><circle cx="14" cy="22" r="12" fill="#F44336"/><circle cx="36" cy="14" r="12" fill="#FFEB3B"/></g></svg>

After

Width:  |  Height:  |  Size: 785 B

1
public/logo.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="520" height="160" viewBox="0 0 260 80"><defs><clipPath id="pentagon"><path d="m38.802 1.632 23.656 29.212-20.473 31.524-36.307-9.729L3.71 15.102z"/></clipPath><filter id="blur"><feGaussianBlur stdDeviation="15"/></filter></defs><g clip-path="url(#pentagon)" transform="matrix(.6 0 0 .6 129 36)"><g filter="url(#blur)"><circle cy="10" r="39" fill="#F44336"/><circle cx="45" cy="-5" r="39" fill="#FFEB3B"/><circle cx="70" cy="25" r="39" fill="#4CAF50"/><circle cx="50" cy="65" r="39" fill="#03A9F4"/><circle cx="5" cy="70" r="39" fill="#673AB7"/><circle cx="50" cy="31.5" r="12" fill="#4CAF50"/><circle cx="37.5" cy="50.5" r="12" fill="#03A9F4"/><circle cx="15.5" cy="44.5" r="12" fill="#673AB7"/><circle cx="14" cy="22" r="12" fill="#F44336"/><circle cx="36" cy="14" r="12" fill="#FFEB3B"/></g></g><style>@media (prefers-color-scheme:dark){#text{fill:#fff}}</style><path id="text" fill="#000" d="M29.39 27.758h8.387C37.732 21.412 32.85 17.24 25.04 17.24c-7.678 0-13.092 4.127-13.047 10.251 0 5.06 3.461 7.855 9.186 9.098l3.24.665c3.594.8 4.792 1.687 4.836 3.196-.044 1.553-1.464 2.707-4.304 2.707-3.328 0-5.325-1.598-5.458-4.571H11.15c.044 8.12 5.547 11.76 13.934 11.76 8.21 0 13.091-3.55 13.136-9.896-.045-4.926-2.974-8.388-10.074-9.897l-2.663-.576c-3.062-.666-4.437-1.554-4.349-3.107 0-1.42 1.199-2.44 3.906-2.44 2.84 0 4.171 1.242 4.349 3.328zm21.002 8.564c0-2.396 1.375-3.816 3.505-3.816 2.22 0 3.506 1.42 3.462 3.816v13.624h8.698V34.503c.044-5.28-3.329-9.097-8.432-9.097-3.594 0-6.213 1.864-7.322 4.926h-.222V17.684h-8.387v32.262h8.698zm26.723 14.024c3.15 0 5.503-1.11 6.967-3.817h.222v3.417h8.121V33.35c0-4.438-4.26-7.943-11.183-7.943-7.233 0-10.783 3.816-11.094 8.21h8.032c.178-1.51 1.287-2.22 2.973-2.22 1.51 0 2.574.71 2.574 1.953v.089c0 1.376-1.553 1.82-5.636 2.13-4.97.355-8.875 2.396-8.875 7.677 0 4.837 3.24 7.1 7.9 7.1zm2.84-5.503c-1.509 0-2.53-.71-2.53-2.086 0-1.242.888-2.219 2.885-2.53 1.376-.221 2.574-.488 3.462-.887v2.041c0 2.22-1.864 3.462-3.817 3.462zm16.641 5.103h8.698V37.343c0-2.796 1.908-4.615 4.482-4.615.888 0 2.308.133 3.195.444V25.76a7.486 7.486 0 0 0-2.219-.355c-2.574 0-4.57 1.553-5.458 4.926h-.266V25.76h-8.432v24.185zm29.417.444c6.7 0 11.05-3.195 11.849-8.254h-7.944c-.488 1.376-1.952 2.13-3.728 2.13-2.573 0-4.082-1.686-4.082-4.038v-.355h15.754V37.83c0-7.677-4.704-12.425-12.027-12.425-7.5 0-12.292 5.014-12.292 12.514 0 7.81 4.704 12.47 12.47 12.47zm-3.905-15.31c.044-2.086 1.775-3.55 3.905-3.55 2.174 0 3.816 1.464 3.86 3.55zm35.893 14.866h8.743V37.343h12.558v-7.056h-12.558V24.74h13.934v-7.056h-22.677v32.262zm35.859.444c6.7 0 11.05-3.195 11.848-8.254h-7.944c-.488 1.376-1.952 2.13-3.727 2.13-2.574 0-4.083-1.686-4.083-4.038v-.355h15.754V37.83c0-7.677-4.704-12.425-12.026-12.425-7.5 0-12.293 5.014-12.293 12.514 0 7.81 4.704 12.47 12.47 12.47zm-3.906-15.31c.044-2.086 1.775-3.55 3.905-3.55 2.175 0 3.817 1.464 3.861 3.55zm28.042 15.177c3.417 0 5.725-1.82 6.746-4.26h.177v3.95h8.654V17.683h-8.698v12.293h-.133c-.932-2.486-3.196-4.571-6.79-4.571-4.793 0-9.452 3.683-9.452 12.425 0 8.388 4.349 12.426 9.496 12.426zm3.24-6.657c-2.397 0-3.817-2.174-3.817-5.769s1.42-5.724 3.817-5.724 3.816 2.13 3.816 5.724c0 3.55-1.42 5.77-3.816 5.77zm16.638 6.346h8.698V25.761h-8.698zm4.349-26.715c2.352 0 4.26-1.775 4.26-3.994 0-2.174-1.908-3.95-4.26-3.95-2.397 0-4.305 1.776-4.305 3.95 0 2.22 1.908 3.994 4.305 3.994z"/><path fill="#fff" d="M140.44 64.724h14.463v-4.088h-7.374v-.104l1.785-1.475c4.27-3.57 5.382-5.433 5.382-7.606 0-3.493-2.872-5.795-7.4-5.795-4.372 0-7.218 2.432-7.218 6.39h4.864c-.026-1.578.957-2.458 2.354-2.458 1.423 0 2.406.88 2.406 2.303 0 1.345-.853 2.199-2.225 3.363l-7.037 5.796v3.674z"/></svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -1,2 +1,2 @@
User-agent: *
Allow: /
Disallow: /

View File

@ -1,6 +1,8 @@
{
"name": "toot",
"short_name": "toot",
"name": "Share₂Fedi",
"short_name": "Share₂Fedi",
"background_color": "#000",
"display": "standalone",
"icons": [
{
"src": "/icon-192.png",
@ -13,5 +15,5 @@
"type": "image/png"
}
],
"theme_color": "#3088d4"
"theme_color": "#40665c"
}

23
script/build-icons Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# This file is part of Share₂Fedi
# https://github.com/kytta/share2fedi
#
# SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
# SPDX-License-Identifier: AGPL-3.0-only
# This script converts raw SVG icons to favicons according to the article:
# https://evilmartians.com/chronicles/how-to-favicon-in-2021-six-files-that-fit-most-needs
set -euo pipefail
if ! type "magick"; then
echo "ImageMagick ('magick') not found; exiting"
exit 1
fi
node script/icons.js
magick convert public/favicon-32.png public/favicon-16.png public/favicon.ico
rm public/favicon-32.png public/favicon-16.png
echo "Done."

47
script/icons.js Normal file
View File

@ -0,0 +1,47 @@
/*!
* This file is part of Share₂Fedi
* https://github.com/kytta/share2fedi
*
* SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { readFileSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import sharp from "sharp";
import { optimize } from "svgo";
const pentagon = join(".", "assets", "pentagon.svg");
const smallLogo = join(".", "assets", "s2f.svg");
const outputDirectory = join(".", "public");
try {
await Promise.all([
sharp(pentagon).resize(32).toFile(join(outputDirectory, "favicon-32.png")),
sharp(pentagon).resize(16).toFile(join(outputDirectory, "favicon-16.png")),
sharp(smallLogo)
.resize(140)
.extend({
top: 20,
bottom: 20,
left: 20,
right: 20,
background: "#000",
})
.flatten({ background: "#000" })
.toFile(join(outputDirectory, "apple-touch-icon.png")),
sharp(smallLogo).resize(192).toFile(join(outputDirectory, "icon-192.png")),
sharp(smallLogo).resize(512).toFile(join(outputDirectory, "icon-512.png")),
]);
} catch (error) {
console.error(error);
}
writeFileSync(
join(outputDirectory, "icon.svg"),
optimize(readFileSync(pentagon), {
path: pentagon,
multipass: true,
}).data,
);

View File

@ -0,0 +1,169 @@
---
/*!
* This file is part of Share₂Fedi
* https://github.com/kytta/share2fedi
*
* SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
* SPDX-License-Identifier: AGPL-3.0-only
*/
const { instance, errors } = Astro.props;
---
<datalist id="popular-instances"></datalist>
<label class="mt1r">
<span data-translate="instance">Fediverse instance</span>
<div
class="instance-input"
dir="ltr"
>
<span id="https-label">https://</span>
<input
type="text"
name="instance"
id="instance"
list="popular-instances"
required
aria-invalid={Boolean(errors)}
aria-errormessage={errors ? "instance-error" : undefined}
aria-describedby="https-label"
value={instance}
/>
</div>
{
errors && (
<p
class="error"
id="instance-error"
aria-live="assertive"
>
{errors}
</p>
)
}
</label>
<div
id="saved-instances"
class="mt1r"
>
<span data-translate="previouslyUsed">Previously used:</span>&#x0020;
<span class="list"></span>
</div>
<label
class="mt1r"
for="remember"
>
<input
type="checkbox"
id="remember"
name="remember"
/>&#x0020;
<span data-translate="rememberInstance">Remember instance on this device</span
><noscript>.</noscript>
<noscript style="color:darkred;font-size:smaller">
This will not work when JavaScript is disabled.</noscript
>
</label>
<style lang="scss">
.instance-input {
position: relative;
display: flex;
flex-wrap: wrap;
align-items: stretch;
width: 100%;
span {
display: flex;
align-items: center;
padding: 0.5rem;
font-size: 1rem;
}
input[type="text"] {
position: relative;
flex: 1 1 auto;
width: 1%;
}
}
#saved-instances {
margin-block-end: 1rem;
> div {
display: inline-block;
}
:global(span.link) {
color: var(--s2f-accent-color-contrast);
cursor: pointer;
text-decoration: 1px solid underline currentColor;
}
}
</style>
<script>
import { getUrlDomain, normalizeURL } from "@lib/url";
import { $popularInstances } from "@stores/popular-instances";
import { $savedInstances, save } from "@stores/saved-instances";
const instanceElement = document.querySelector(
"#instance",
) as HTMLInputElement;
const savedInstancesElement = document.querySelector(
"#saved-instances",
) as HTMLDivElement;
$savedInstances.subscribe((instances) => {
if (instances.size === 0) {
savedInstancesElement.style.display = "none";
return;
}
const savedInstances = [...instances];
if (!instanceElement.value) {
instanceElement.value = getUrlDomain(savedInstances[0] as string);
}
savedInstancesElement.style.display = "block";
document.querySelector("#saved-instances>.list")!.replaceChildren(
...savedInstances
.flatMap((instance: string) => {
if (!instance) {
return [];
}
const host = getUrlDomain(instance);
const element = document.createElement("span");
element.classList.add("link");
element.textContent = host;
element.dir = "ltr";
element.addEventListener("click", () => {
instanceElement.value = host;
});
return [element, ", "];
})
.slice(0, -1),
);
});
document.querySelector("#form")!.addEventListener("submit", (event) => {
const formData = new FormData(event.target as HTMLFormElement);
if (formData.get("remember")) {
save(normalizeURL(formData.get("instance") as string));
}
return true;
});
$popularInstances.subscribe((instances) => {
document.querySelector("#popular-instances")!.replaceChildren(
...instances.map((domain) => {
const option = document.createElement("option");
option.value = domain;
return option;
}),
);
});
</script>

View File

@ -0,0 +1,58 @@
---
/*!
* This file is part of Share₂Fedi
* https://github.com/kytta/share2fedi
*
* SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { languages } from "@i18n/translations";
const initialLanguage = "en";
---
<label>
🌍 <span data-translate="language">Language:</span>&#x0020;
<select
name="language"
id="language"
>
{
Object.entries(languages).map(([k, v]) => {
return (
<option
selected={k === initialLanguage}
value={k}
>
{v.autonym}
</option>
);
})
}
</select>
</label>
<script>
import { findBestLanguage } from "@i18n/engine";
import { applyTranslations } from "@i18n/engine";
import { $locale } from "@stores/i18n";
const select: HTMLSelectElement = document.querySelector("#language")!;
document.addEventListener("DOMContentLoaded", () => {
$locale.subscribe((newLocale) => {
if (newLocale === undefined) {
newLocale = findBestLanguage();
}
applyTranslations(newLocale);
if (select.value !== newLocale) {
select.value = newLocale;
}
});
select.addEventListener("change", (event) => {
$locale.set((event.target as typeof select).value);
});
});
</script>

View File

@ -0,0 +1,29 @@
<!--
This file is part of Share₂Fedi
https://github.com/kytta/share2fedi
SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
SPDX-License-Identifier: CC0-1.0
-->
<details>
<summary data-translate="licence">Licence</summary>
<p
data-translate="licence1"
dir="auto"
>
Share₂Fedi is free software: you can redistribute it and/or modify it under
the terms of the GNU Affero General Public License, version 3, as published
by the Free Software Foundation.
</p>
<p
data-translate="licence2"
dir="auto"
>
Share₂Fedi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
for more details.
</p>
</details>

View File

@ -0,0 +1,34 @@
<!--
This file is part of Share₂Fedi
https://github.com/kytta/share2fedi
SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
SPDX-License-Identifier: CC0-1.0
-->
<details>
<summary data-translate="privacyNotice">Privacy Notice</summary>
<p
data-translate="privacy1"
dir="auto"
>
s2f.kytta.dev is hosted on Vercel. Vercel processes IP addresses, system
configuration information, and other information about traffic to and from
s2f.kytta.dev. Vercel does not store this information nor does it get shared
with third parties. See
<a
href="https://vercel.com/legal/privacy-policy#customers"
data-translate="vercelPP"
>Vercels privacy policy</a
>
for more information.
</p>
<p
data-translate="privacy2"
dir="auto"
>
When you click the Publish button, youll get redirected to a Fediverse
instance youve specified. It may process and/or store your data. Please
refer to the privacy policy of the respective instance.
</p>
</details>

9
src/env.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
/* eslint-disable unicorn/prevent-abbreviations */
/*!
* This file is part of ShareFedi
* https://github.com/kytta/share2fedi
*
* SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
* SPDX-License-Identifier: CC0-1.0
*/
/// <reference types="astro/client" />

90
src/i18n/engine.ts Normal file
View File

@ -0,0 +1,90 @@
/*!
* This file is part of ShareFedi
* https://github.com/kytta/share2fedi
*
* SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { strings, defaultLanguage, languages } from "./translations";
export function useTranslations(language: string) {
return function t(
key: keyof (typeof strings)[typeof defaultLanguage],
): string {
return (
strings[language as keyof typeof strings][key] ||
strings[defaultLanguage][key] ||
""
);
};
}
export function findBestLanguage(): string {
const urlLanguage = new URLSearchParams(window.location.search).get("lang");
if (urlLanguage && urlLanguage in languages) {
return urlLanguage;
}
let browserLanguages = navigator.languages;
if (!navigator.languages) browserLanguages = [navigator.language];
for (const language of browserLanguages) {
const locale = new Intl.Locale(language);
const minimized = locale.minimize();
for (const candidate of [locale.baseName, minimized.baseName]) {
if (candidate in languages) {
return candidate;
}
}
}
return defaultLanguage;
}
export function applyTranslations(language: string) {
if (!(language in strings)) {
language = defaultLanguage;
}
const t = useTranslations(language);
for (const node of document.querySelectorAll("[data-translate]")) {
const dataset = (node as HTMLElement).dataset;
if (dataset.translateAttribute) {
node.setAttribute(dataset.translateAttribute, t(dataset.translate!));
continue;
}
let splitTranslated = t(dataset.translate!).split("{}");
if (splitTranslated.length === 1) {
node.innerHTML = t(dataset.translate!);
continue;
}
// XXX: this is needed for the strings where the placholder sits at the very
// beginning, which introduces phantom empty strings.
splitTranslated = splitTranslated.filter((string) => string !== "");
for (const child of node.childNodes) {
if (child.nodeType === Node.TEXT_NODE) {
child.textContent = splitTranslated.shift() || "";
}
}
}
if (Intl.ListFormat) {
const formatter = new Intl.ListFormat(language, {
style: "short",
type: "conjunction",
});
for (const node of document.querySelectorAll("[data-enumerate]")) {
const dataset = (node as HTMLElement).dataset;
node.innerHTML = formatter.format(dataset.enumerate!.split(","));
}
}
document.documentElement.lang = language;
document.documentElement.dir =
languages[language as keyof typeof languages].dir;
}

37
src/i18n/translations.ts Normal file
View File

@ -0,0 +1,37 @@
/*!
* This file is part of ShareFedi
* https://github.com/kytta/share2fedi
*
* SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
* SPDX-License-Identifier: AGPL-3.0-only
*/
import ar from "./translations/ar.json";
import de from "./translations/de.json";
import en from "./translations/en.json";
import es from "./translations/es.json";
import fr from "./translations/fr.json";
import nl from "./translations/nl.json";
import ru from "./translations/ru.json";
export const languages = {
ar: { autonym: "العربية", dir: "rtl" },
de: { autonym: "Deutsch", dir: "ltr" },
en: { autonym: "English", dir: "ltr" },
es: { autonym: "Español", dir: "ltr" },
fr: { autonym: "Français", dir: "ltr" },
nl: { autonym: "Nederlands", dir: "ltr" },
ru: { autonym: "Русский", dir: "ltr" },
};
export const strings: Record<keyof typeof languages, Record<string, string>> = {
ar,
de,
en,
es,
fr,
nl,
ru,
} as const;
export const defaultLanguage: keyof typeof strings = "en";

View File

@ -0,0 +1,24 @@
{
"privacyNotice": "إشعار الخصوصية",
"postText": "نص المنشور",
"fediverse": "الفديفرس",
"vercelPP": "سياسة الخصوصية لـ Vercel",
"description": "شير تو فيدي Share₂Fedi هو موقع مشاركة لـ {}. يمكنك من خلاله نشر محتوى على منصات متعددة تتبع نموذج الفديرالية من صفحة واحدة.",
"incl": "بما فيه",
"postTextPlaceholder": "فيمَ تفكّر؟",
"rememberInstance": "تذكر مثيل الخادم على هذا الجهاز",
"instance": "مثيل خادم الفديفرس",
"licence1": "شير تو فيدي Share₂Fedi هو برنامج حر: يمكنك إعادة توزيعه و/أو تعديله وفقًا لشروط الرخصة العامة GNU Affero، الإصدار 3، كما نَشرَتها مؤسسة البرمجيات الحرة.",
"previouslyUsed": "تم استخدامه مسبقًا:",
"metaDescription": "شير تو فيدي Share₂Fedi هي صفحة مشاركة لـ Mastodon و Misskey و Friendica وغيرها. اكتب نص منشورك وعنوان الرابط التشعبي لمثيل الخادم، ثم انقر على ”أنشر“!",
"nikita": "نيكيتا كاراموف",
"statusPage": "صفحة الحالة",
"publish": "أنشر",
"licence": "الرخصة",
"language": "اللغة:",
"supportedProjects": "المشاريع المدعومة:",
"privacy2": "عندما تنقر على زر ”أنشر“، سيتم توجيهك إلى مثيل خادم الفديفرس الذي حددته. قد يقوم بمعالجة و/أو تخزين بياناتك. يرجى الرجوع إلى سياسة الخصوصية للخادم المعني.",
"onGitHub": "على جت هب",
"credits": "تم تطوير Share₂Fedi وصيانته من طرف {}. الشيفرة المصدرية متوفرة على {}. مستضافة على {}. {}.",
"licence2": "برنامج Share₂Fedi موزع بأمل أن يكون مفيدًا، ولكن دون أي ضمان؛ بدون حتى الضمان المتضمن للتسويق أو اللياقة لغرض معين. راجع ترخيص غنو العام GNU Affero General لمزيد من التفاصيل."
}

View File

@ -0,0 +1,25 @@
{
"metaDescription": "Share₂Fedi ist eine Share-Seite für Mastodon, Misskey, Friendica und andere. Geben Sie Ihren Beitragstext und die Instanz-URL ein und klicken Sie auf „Veröffentlichen“!",
"language": "Sprache:",
"description": "Share₂Fedi ist eine instanzunabhängige Share-Seite für {}. Mit ihr können Sie von einer einzigen Seite aus auf verschiedenen föderierten Plattformen posten.",
"fediverse": "das Fediverse",
"supportedProjects": "Unterstützte Projekte:",
"incl": "inkl.",
"credits": "Share₂Fedi wird von {} entwickelt und gepflegt. Der Quellcode ist {}. Gehostet mit {}. {}.",
"nikita": "Nikita Karamov",
"onGitHub": "auf GitHub",
"statusPage": "Statusseite",
"licence": "Lizenz",
"licence1": "Share₂Fedi ist freie Software: Sie können es unter den Bedingungen der GNU Affero General Public License, Version 3, wie von der Free Software Foundation veröffentlicht, weitergeben und/oder modifizieren.",
"licence2": "Die Veröffentlichung von Share₂Fedi erfolgt in der Hoffnung, dass es Ihnen von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne die implizite Garantie der MARKTREIFE oder der VERWENDBARKEIT FÜR EINEN BESTIMMTEN ZWECK. Details finden Sie in der GNU Affero General Public License.",
"privacyNotice": "Datenschutzhinweis",
"privacy1": "s2f.kytta.dev wird auf Vercel gehostet. Vercel verarbeitet IP-Adressen, Systemkonfigurationsinformationen und andere Informationen über den Verkehr von und zu s2f.kytta.dev. Vercel speichert diese Informationen nicht und gibt sie auch nicht an Dritte weiter. Siehe {} für weitere Informationen.",
"privacy2": "Wenn Sie auf die „Veröffentlichen“ klicken, werden Sie zu einer Fediverse-Instanz weitergeleitet, die Sie angegeben haben. Diese kann Ihre Daten verarbeiten und/oder speichern. Bitte beachten Sie die Datenschutzrichtlinien der jeweiligen Instanz.",
"vercelPP": "Vercels Datenschutzpolitik",
"postText": "Beitragstext",
"postTextPlaceholder": "Was gibts Neues?",
"instance": "Fediverse-Instanz",
"previouslyUsed": "Bisher verwendet:",
"rememberInstance": "Instanz auf diesem Gerät merken",
"publish": "Veröffentlichen"
}

View File

@ -0,0 +1,25 @@
{
"metaDescription": "Share₂Fedi is a share page for Mastodon, Misskey, Friendica, and others. Type in your post text and the instance URL and click Publish!",
"language": "Language:",
"description": "Share₂Fedi is an instance-agnostic share page for {}. With it, you can post to various federated platforms from a single page.",
"fediverse": "the Fediverse",
"supportedProjects": "Supported projects:",
"incl": "incl.",
"credits": "Share₂Fedi is developed and maintained by {}. Source code is {}. Hosted with {}. {}.",
"nikita": "Nikita Karamov",
"onGitHub": "on GitHub",
"statusPage": "Status page",
"licence": "Licence",
"licence1": "Share₂Fedi is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation.",
"licence2": "Share₂Fedi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.",
"privacyNotice": "Privacy Notice",
"privacy1": "s2f.kytta.dev is hosted on Vercel. Vercel processes IP addresses, system configuration information, and other information about traffic to and from s2f.kytta.dev. Vercel does not store this information nor does it get shared with third parties. See {} for more information.",
"privacy2": "When you click the Publish button, youll get redirected to a Fediverse instance youve specified. It may process and/or store your data. Please refer to the privacy policy of the respective instance.",
"vercelPP": "Vercels privacy policy",
"postText": "Post text",
"postTextPlaceholder": "Whats on your mind?",
"instance": "Fediverse instance",
"previouslyUsed": "Previously used:",
"rememberInstance": "Remember instance on this device",
"publish": "Publish"
}

View File

@ -0,0 +1,25 @@
{
"metaDescription": "Share₂Fedi es una página de compartir para Mastodon, Misskey, Friendica y otros. ¡Escriba su texto de publicación y la URL de la instancia y haga clic en «Publicar»!",
"language": "Idioma:",
"description": "Share₂Fedi es una página de compartir independiente de la instancia para {}. Con ella, puede publicar en varias plataformas federadas desde una sola página.",
"fediverse": "el Fediverso",
"supportedProjects": "Proyectos compatibles:",
"incl": "incl.",
"credits": "Share₂Fedi es desarrollado y mantenido por {}. El código fuente es {}. Alojado con {}. {}.",
"nikita": "Nikita Karamov",
"onGitHub": "en GitHub",
"statusPage": "Página de estado",
"licence": "Licencia",
"licence1": "Share₂Fedi es un software libre: puedes redistribuirlo y/o modificarlo bajo los términos de la Licencia Pública General GNU Affero, versión 3, publicada por la Free Software Foundation.",
"licence2": "Share₂Fedi se distribuye con la esperanza de que sea útil, pero SIN NINGUNA GARANTÍA; sin siquiera la garantía implícita de COMERCIABILIDAD o IDONEIDAD PARA UN PROPÓSITO PARTICULAR. Consulte la Licencia Pública General Affero de GNU para obtener más detalles.",
"privacyNotice": "Aviso de privacidad",
"privacy1": "s2f.kytta.dev está alojado en Vercel. Vercel procesa las direcciones IP, la información de configuración del sistema y otra información sobre el tráfico hacia y desde s2f.kytta.dev. Vercel no almacena esta información ni la comparte con terceros. Consulte {} para obtener más información.",
"privacy2": "Cuando hace clic en el botón «Publicar», se le redirige a una instancia de Fediverso que ha especificado. Puede procesar y/o almacenar sus datos. Consulte la política de privacidad de la instancia correspondiente.",
"vercelPP": "Política de privacidad de Vercel",
"postText": "Texto de la publicación",
"postTextPlaceholder": "¿Qué hay de nuevo?",
"instance": "Instancia del Fediverso",
"previouslyUsed": "Usado anteriormente:",
"rememberInstance": "Recordar instancia en este dispositivo",
"publish": "Publicar"
}

View File

@ -0,0 +1,25 @@
{
"metaDescription": "Share₂Fedi est une page de partage pour Mastodon, Misskey, Friendica et autres. Tapez votre texte de publication et lURL de linstance, puis cliquez sur « Publier »!",
"language": "Langue:",
"description": "Share₂Fedi est une page de partage indépendante pour {}. Avec elle, vous pouvez publier sur diverses plateformes fédérées depuis une seule page.",
"fediverse": "le Fediverse",
"supportedProjects": "Projets pris en charge:",
"incl": "dont",
"credits": "Share₂Fedi est développé et maintenu par {}. Le code source est {}. Hébergé avec {}. {}.",
"nikita": "Nikita Karamov",
"onGitHub": "sur GitHub",
"statusPage": "Page de statut",
"licence": "Licence",
"licence1": "Share₂Fedi est un logiciel libre: vous pouvez le redistribuer et/ou le modifier selon les termes de la licence publique générale Affero, version 3, telle que publiée par la Free Software Foundation.",
"licence2": "Share₂Fedi est distribué dans lespoir quil sera utile, mais SANS AUCUNE GARANTIE; sans même la garantie implicite de QUALITÉ MARCHANDE ou DADÉQUATION À UN USAGE PARTICULIER. Consultez la licence publique générale Affero de GNU pour plus de détails.",
"privacyNotice": "Avis de confidentialité",
"privacy1": "s2f.kytta.dev est hébergé sur Vercel. Vercel traite les adresses IP, les informations de configuration système et dautres informations sur le trafic vers et depuis s2f.kytta.dev. Vercel ne stocke pas ces informations et ne les partage pas avec des tiers. Voir {} pour plus dinformations.",
"privacy2": "Lorsque vous cliquez sur le bouton « Publier », vous êtes redirigé vers une instance du Fediverse que vous avez spécifiée. Elle peut traiter et/ou stocker vos données. Veuillez vous référer à la politique de confidentialité de linstance respective.",
"vercelPP": "Politique de confidentialité de Vercel",
"postText": "Texte de la publication",
"postTextPlaceholder": "Quoi de neuf?",
"instance": "Instance du Fediverse",
"previouslyUsed": "Utilisé précédemment:",
"rememberInstance": "Se souvenir de linstance sur cet appareil",
"publish": "Publier"
}

View File

@ -0,0 +1,25 @@
{
"metaDescription": "Share₂Fedi is een deelpagina voor Mastodon, Misskey, Friendica en andere fediversenetwerken. Voer een bericht in, plak de instantie-url en klik op Publiceren!",
"language": "Taal:",
"description": "Share₂Fedi is een instantie-onafhankelijke deelpagina voor {}. Zo kun je berichten plaatsen op meerdere fediversenetwerken tegelijk.",
"fediverse": "het Fediverse",
"supportedProjects": "Ondersteunde netwerken:",
"incl": "incl.",
"nikita": "Nikita Karamov",
"onGitHub": "op GitHub",
"statusPage": "Statuspagina",
"licence": "Licentie",
"privacyNotice": "Privacybeleid",
"privacy2": "Als je op publiceren klikt, wordt je doorgestuurd naar de opgegeven fediverse-instantie. Hierbij worden je gegevens mogelijk verwerkt en/of bewaard. Bekijk voor meer informatie het privacybeleid van je instantie.",
"vercelPP": "Vercels privacybeleid",
"postTextPlaceholder": "Wat gaat er door je hoofd?",
"instance": "Fediverse-instantie",
"postText": "Berichtinhoud",
"previouslyUsed": "Onlangs gebruikt:",
"rememberInstance": "Instantie onthouden op dit apparaat",
"publish": "Publiceren",
"credits": "Share₂Fedi wordt ontwikkeld en onderhouden door {}. Broncode: {} - Hosting: {}. {}.",
"licence1": "Share₂Fedi is vrije software: je mag de software opnieuw uitgeven en/of aanpassen onder de voorwaarden van de GNU Affero General Public License, versie 3, zoals omschreven door de Free Software Foundation.",
"licence2": "Share₂Fedi wordt verspreid in de hoop nuttig te zijn, maar wordt geleverd ZONDER ENIGE VORM VAN GARANTIE; zelfs zonder de garantie van VERKOOPBAARHEID of GESCHIKTHEID VOOR EEN BEPAALD DOEL. Bekijk voor meer informatie de GNU Affero General Public License.",
"privacy1": "s2f.kytta.dev wordt gehost door Vercel. Vercel verwerkt ip-adressen, systeemconfiguraties en andere informatie omtrent verkeer van en naar s2f.kytta.dev. Vercel bewaart deze informatie echter niet, noch deelt het de informatie met externe partijen. Bekijk voor meer informatie {}."
}

View File

@ -0,0 +1,25 @@
{
"metaDescription": "Share₂Fedi — это share-страница для Mastodon, Misskey, Friendica и других сервисов. Введите текст поста и URL-адрес инстанса и нажмите «Опубликовать»!",
"language": "Язык:",
"description": "Share₂Fedi — это инстанс-независимая share-страница для {}. С её помощью вы можете делиться информацией на различных федеративных платформах с одной страницы.",
"fediverse": "Федивёрса",
"supportedProjects": "Поддерживаемые проекты:",
"incl": "вкл.",
"credits": "Share₂Fedi разрабатывается и поддерживается {}. Исходный код {}. Хостится на {}. {}.",
"nikita": "Никитой Карамовым",
"onGitHub": "на GitHub",
"statusPage": "Статус",
"licence": "Лицензия",
"licence1": "Share₂Fedi является свободным программным обеспечением: вы можете распространять её и (или) изменять, соблюдая условия GNU Affero General Public License редакции 3, опубликованной Free Software Foundation.",
"licence2": "Share₂Fedi распространяется в расчёте на то, что она окажется полезной, но БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ, включая подразумеваемую гарантию КАЧЕСТВА либо ПРИГОДНОСТИ ДЛЯ ОПРЕДЕЛЁННЫХ ЦЕЛЕЙ. Ознакомьтесь с GNU Affero General Public License для получения более подробной информации.",
"privacyNotice": "Политика конфиденциальности",
"privacy1": "Сайт s2f.kytta.dev размещён на серверах Vercel. Vercel обрабатывает IP-адреса, информацию о конфигурации системы и другую информацию о трафике, идущем к s2f.kytta.dev и от него. Vercel не хранит эту информацию и не передает её третьим лицам. Более подробную информацию см. в {}.",
"privacy2": "Когда вы нажимаете кнопку «Опубликовать», вы попадаете на указанный вами инстанс Федивёрса. Он может обрабатывать и/или хранить ваши данные. Пожалуйста, ознакомьтесь с политикой конфиденциальности соответствующего инстанса.",
"vercelPP": "Политике конфиденциальности Vercel",
"postText": "Текст поста",
"postTextPlaceholder": "О чём думаете?",
"instance": "Инстанс Федивёрса",
"previouslyUsed": "Ранее использовались:",
"rememberInstance": "Запомнить инстанс на этом устройстве",
"publish": "Опубликовать"
}

View File

@ -0,0 +1,25 @@
{
"privacyNotice": "Політика конфіденційності",
"incl": "вкл.",
"postTextPlaceholder": "Що у вас на думці?",
"rememberInstance": "Запам'ятати інстанс на цьому пристрої",
"metaDescription": "Share₂Fedi — це share-сторінка для Mastodon, Misskey, Friendica та інших сервісів. Введіть текст посту та URL-адресу інстансу та натисніть «Опублікувати»!",
"statusPage": "Статус",
"publish": "Опублікувати",
"licence": "Ліцензія",
"language": "Мова:",
"supportedProjects": "Підтримувані проєкти:",
"onGitHub": "на GitHub",
"description": "Share₂Fedi - це інстанс-незалежна share-сторінка для {}. З її допомогою ви можете ділитися інформацією на різних федеративних платформах з однієї сторінки.",
"fediverse": "федіверсу",
"credits": "Share₂Fedi розробляється і підтримується {}. Вихідний код на {}. Розміщено на {}. {}.",
"nikita": "Микитою Карамовим",
"licence1": "Share₂Fedi є вільним програмним забезпеченням: ви можете розповсюджувати його та/або модифікувати відповідно до умов Загальної публічної ліцензії Affero GNU, версії 3, опублікованої Фондом вільного програмного забезпечення.",
"licence2": "Share₂Fedi розповсюджується з надією, що воно буде корисним, але БЕЗ ЖОДНИХ ГАРАНТІЙ; без навіть неявної гарантії ТОВАРНОСТІ або ПРИДАТНОСТІ ДЛЯ ПЕВНОЇ ЦІЛІ. Для більш детальної інформації див. Загальну публічну ліцензію Affero GNU.",
"privacy1": "Сайт s2f.kytta.dev розміщений на серверах Vercel. Vercel обробляє IP-адреси, інформацію про конфігурацію системи та іншу інформацію про трафік, що йде до s2f.kytta.dev і від нього. Vercel не зберігає цю інформацію і не передає її третім особам. Більш детальну інформацію див. у {}.",
"privacy2": "Коли ви натискаєте кнопку \"Опублікувати\", ви потрапляєте на вказаний вами інстанс федіверсу. Він може обробляти та/або зберігати ваші дані. Будь ласка, ознайомтеся з політикою конфіденційності відповідного інстансу.",
"vercelPP": "Політиці конфіденційності Vercel",
"postText": "Текст повідомлення",
"instance": "Інстанс федіверсу",
"previouslyUsed": "Раніше використовувалися:"
}

View File

@ -1,101 +0,0 @@
<!--
@source: https://codeberg.org/kytta/toot/src/branch/main/src/index.html
toot - Cross-instance share page for Mastodon
Copyright (C) 2020-2022 Nikita Karamov <me@kytta.dev>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
SPDX-License-Identifier: AGPL-3.0-or-later
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>toot &mdash; cross-instance share page for Mastodon</title>
<meta
name="description"
content="toot allows you to share stuff on Mastodon, cross-instance. Just put in your post text and the instance URL and click &lsquo;Toot!&rsquo;"
/>
<link rel="canonical" href="https://toot.kytta.dev/">
<link href="/style.css" rel="stylesheet" />
<link href="/favicon.ico" rel="icon" type="image/x-icon" />
<link href="/apple-touch-icon.png" rel="icon" type="image/svg+xml" />
<link href="/apple-touch-icon.png" rel="apple-touch-icon" />
<link href="/site.webmanifest" rel="manifest" />
<meta name="theme-color" content="#3088d4" />
</head>
<body>
<header>
<h1>
<img src="/icon.svg" alt="toot" width="72" height="72" />
</h1>
<p>
for
<img src="/mastodon.svg" alt="Mastodon" width="95.5" height="27" />
</p>
</header>
<main>
<form action="/api/toot" method="POST">
<section>
<label for="text">Post text</label>
<textarea
name="text"
id="text"
rows="6"
placeholder="What's on your mind?"
required
></textarea>
</section>
<section>
<datalist id="instanceDatalist"></datalist>
<label for="instance">Choose your Mastodon instance</label>
<input
type="url"
name="instance"
id="instance"
placeholder="https://"
list="instanceDatalist"
required
/>
</section>
<section class="remember">
<input type="checkbox" id="remember" name="remember" />
<label for="remember">Remember my instance on this device</label>
</section>
<section class="submit">
<input type="submit" value="TOOT!" />
</section>
</form>
</main>
<footer>
<section>
<a href="https://joinmastodon.org/">What is Mastodon?</a>
</section>
<section>
<a href="https://codeberg.org/kytta/toot">toot on Codeberg</a>
</section>
<script data-goatcounter="https://share2fedi.goatcounter.com/count"
async src="//gc.zgo.at/count.js"></script>
<noscript>
<img src="https://share2fedi.goatcounter.com/count?p=/">
</noscript>
</footer>
<script src="/main.js"></script>
</body>
</html>

154
src/layouts/layout.astro Normal file
View File

@ -0,0 +1,154 @@
---
/*!
* This file is part of Share₂Fedi
* https://github.com/kytta/share2fedi
*
* SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
* SPDX-License-Identifier: AGPL-3.0-only
*/
import "@styles/main.scss";
import LanguageSelect from "@components/language-select.astro";
import Licence from "@components/licence.html";
import Privacy from "@components/privacy.html";
import package_ from "../../package.json";
---
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<meta
name="robots"
content="noindex,nofollow"
/>
<title>Share₂Fedi</title>
<meta
name="description"
content="Share₂Fedi is a share page for Mastodon, Misskey, Friendica, and others. Type in your post text and the instance URL and click Publish!"
data-translate="metaDescription"
data-translate-attribute="content"
/>
<link
rel="canonical"
href={Astro.url}
/>
<meta
property="og:title"
content="Share₂Fedi, a share page for the Fediverse"
/>
<meta
property="og:type"
content="website"
/>
<meta
property="og:image"
content="/banner.png"
/>
<meta
property="og:url"
content={`${Astro.url}banner.png`}
/>
<link
rel="icon"
href="/favicon.ico"
sizes="32x32"
/>
<link
rel="icon"
href="/icon.svg"
type="image/svg+xml"
/>
<link
rel="apple-touch-icon"
href="/apple-touch-icon.png"
/>
<link
rel="manifest"
href="/site.webmanifest"
/>
<meta
name="generator"
content={Astro.generator}
/>
<meta
itemprop="version"
content={package_.version}
/>
</head>
<header>
<img
src="/logo.svg"
alt="Share2Fedi"
width="195"
height="60"
/>
<LanguageSelect />
</header>
<body>
<main>
<slot />
</main>
<aside>
<p data-translate="description">
Share₂Fedi is an instance-agnostic share page for
<a
href="https://en.wikipedia.org/wiki/Fediverse"
data-translate="fediverse"
>the Fediverse</a
>. With it, you can post to various federated platforms from a single
page.
</p>
<p><b data-translate="supportedProjects">Supported projects:</b></p>
<ul>
<li>
Mastodon (<span data-translate="incl">incl.</span>&#x0020;<span
data-enumerate="Hometown,Fedibird,GlitchCafé"
>Hometown, Fedibird, GlitchCafé</span
>)
</li>
<li>
Misskey (<span data-translate="incl">incl.</span>&#x0020;<span
data-enumerate="Firefish,Calckey,FoundKey,Meisskey"
>Firefish, Calckey, FoundKey, Meisskey</span
>)
</li>
<li>Friendica</li>
<li>Hubzilla</li>
<li>GNU Social</li>
</ul>
<p data-translate="credits">
Share₂Fedi is developed and maintained by
<a
href="https://www.kytta.dev/"
data-translate="nikita"
>Nikita Karamov</a
>. Source code is
<a
href="https://github.com/kytta/share2fedi"
data-translate="onGitHub"
>on GitHub</a
>. Hosted with
<a href="https://vercel.com">Vercel</a>.
<a
href="https://stats.uptimerobot.com/QOXj3uXPDX"
data-translate="statusPage"
>Status page</a
>.
</p>
<Licence />
<Privacy />
</aside>
</body>
</html>

59
src/lib/instance.ts Normal file
View File

@ -0,0 +1,59 @@
/*!
* This file is part of ShareFedi
* https://github.com/kytta/share2fedi
*
* SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { supportedProjects } from "./project";
interface Instance {
domain: string;
score: number;
active_users_monthly: number;
total_users: number;
}
const getInstancesForProject = async (
project: keyof typeof supportedProjects,
): Promise<Instance[]> => {
let instances: Instance[];
try {
const response = await fetch("https://api.fediverse.observer/", {
headers: {
Accept: "*/*",
"Accept-Language": "en;q=1.0",
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `{nodes(status:"UP",softwarename:"${project}"){domain score active_users_monthly total_users}}`,
}),
method: "POST",
});
const json = await response.json();
instances = json.data.nodes;
} catch (error) {
console.error(`Could not fetch instances for "${project}"`, error);
return [];
}
return instances.filter(
(instance) =>
instance.score > 90 &&
// sanity check for some spammy-looking instances
instance.total_users >= instance.active_users_monthly,
);
};
export const getPopularInstanceDomains = async (): Promise<string[]> => {
const instancesPerProject = await Promise.all(
Object.keys(supportedProjects).map((project) =>
getInstancesForProject(project),
),
);
const instances = instancesPerProject.flat();
instances.sort((a, b) => b.active_users_monthly - a.active_users_monthly);
return instances.slice(0, 200).map((instance) => instance.domain);
};

60
src/lib/nodeinfo.ts Normal file
View File

@ -0,0 +1,60 @@
/*!
* This file is part of ShareFedi
* https://github.com/kytta/share2fedi
*
* SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { normalizeURL } from "@lib/url";
interface NodeInfoList {
links: {
rel: string;
href: string;
}[];
}
interface NodeInfo {
software: {
name: string;
version: string;
[key: string]: unknown;
};
[key: string]: unknown;
}
export const getSoftwareName = async (
domain: string,
): Promise<string | undefined> => {
const nodeInfoListUrl = new URL(
"/.well-known/nodeinfo",
normalizeURL(domain),
);
let nodeInfoList: NodeInfoList;
try {
const nodeInfoListResponse = await fetch(nodeInfoListUrl);
nodeInfoList = await nodeInfoListResponse.json();
} catch (error) {
console.error("Could not fetch '.well-known/nodeinfo':", error);
return undefined;
}
for (const link of nodeInfoList.links) {
if (
/^http:\/\/nodeinfo\.diaspora\.software\/ns\/schema\/(1\.0|1\.1|2\.0|2\.1)/.test(
link.rel,
)
) {
const nodeInfoResponse = await fetch(link.href);
const nodeInfo = (await nodeInfoResponse.json()) as NodeInfo;
return nodeInfo.software.name;
}
}
// not found
console.warn("No NodeInfo found for domain:", domain);
return undefined;
};

64
src/lib/project.ts Normal file
View File

@ -0,0 +1,64 @@
/*!
* This file is part of ShareFedi
* https://github.com/kytta/share2fedi
*
* SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
* SPDX-License-Identifier: AGPL-3.0-only
*/
export interface ProjectPublishConfig {
endpoint: string;
params: {
text: string;
};
}
const mastodonConfig: ProjectPublishConfig = {
endpoint: "share",
params: {
text: "text",
},
};
const misskeyConfig: ProjectPublishConfig = {
endpoint: "share",
params: {
text: "text",
},
};
/**
* Mapping of the supported fediverse projects.
*
* The keys of this mapping can be used as keys for the fediverse.observer API,
* icon names, etc.
*/
export const supportedProjects: Record<string, ProjectPublishConfig> = {
calckey: misskeyConfig,
fedibird: mastodonConfig,
firefish: misskeyConfig,
foundkey: misskeyConfig,
friendica: {
endpoint: "compose",
params: {
text: "body",
},
},
glitchcafe: mastodonConfig,
gnusocial: {
endpoint: "notice/new",
params: {
text: "status_textarea",
},
},
hometown: mastodonConfig,
hubzilla: {
endpoint: "rpost",
params: {
text: "body",
},
},
mastodon: mastodonConfig,
meisskey: misskeyConfig,
misskey: misskeyConfig,
};

30
src/lib/response.ts Normal file
View File

@ -0,0 +1,30 @@
/*!
* This file is part of ShareFedi
* https://github.com/kytta/share2fedi
*
* SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
* SPDX-License-Identifier: AGPL-3.0-only
*/
export const json = (
body: unknown,
status: number = 200,
headers: Record<string, string> = {},
) => {
return new Response(JSON.stringify(body), {
headers: {
"Content-Type": "application/json",
...headers,
},
status,
});
};
export const error = (message: string, status: number = 400) => {
return json(
{
error: message,
},
status,
);
};

35
src/lib/url.ts Normal file
View File

@ -0,0 +1,35 @@
/*!
* This file is part of ShareFedi
* https://github.com/kytta/share2fedi
*
* SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
* SPDX-License-Identifier: AGPL-3.0-only
*/
/**
* Adds missing "https://" and ending slash to the URL
*
* @param url URL to normalize
* @return normalized URL
*/
export const normalizeURL = (url: string): string => {
if (!(url.startsWith("https://") || url.startsWith("http://"))) {
url = "https://" + url;
}
if (!url.endsWith("/")) {
url += "/";
}
return url;
};
export const getUrlDomain = (url: string | URL): string => {
if (typeof url === "string") {
url = url.trim();
if (!/^https?:\/\//.test(url)) {
url = `https://${url}`;
}
}
return new URL(url).host;
};

View File

@ -1,101 +0,0 @@
/*!
* @source: https://codeberg.org/kytta/toot/src/branch/main/src/main.js
*
* @licstart The following is the entire license notice for the
* JavaScript code in this page.
*
* toot - Cross-instance share page for Mastodon
* Copyright (C) 2020-2022 Nikita Karamov <me@kytta.dev>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* @licend The above is the entire license notice
* for the JavaScript code in this page.
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
const INSTANCE_LIST_URL = "https://api.joinmastodon.org/servers";
const $instance = document.getElementById("instance");
const $instanceDatalist = document.getElementById("instanceDatalist");
/**
* Adds missing "https://" and ending slash to the URL
*
* @param {string} url URL to normalize
* @return {string} normalized URL
*/
function normalizeUrl(url) {
if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
url = "https://" + url;
}
if (url.charAt(url.length - 1) !== "/") {
url = url + "/";
}
return url;
}
function onLoadInstancesError() {
console.error("Couldn't load instance list");
}
function onLoadInstancesSuccess() {
if (this.status >= 400) {
return onLoadInstancesError();
}
const currentInstance = $instance.value;
const instanceDomains = JSON.parse(this.responseText).map((i) => i.domain);
if (currentInstance && instanceDomains.indexOf(currentInstance) < 0) {
instanceDomains.push(currentInstance);
}
instanceDomains.sort();
for (let i = 0; i < instanceDomains.length; i++) {
const $option = document.createElement("option");
$option.value = normalizeUrl(instanceDomains[i]);
$instanceDatalist.appendChild($option);
}
}
function loadInstances() {
if ($instanceDatalist.children.length === 0) {
const request = new XMLHttpRequest();
request.addEventListener("load", onLoadInstancesSuccess);
request.addEventListener("error", onLoadInstancesError);
request.open("GET", INSTANCE_LIST_URL);
request.send();
}
}
const prefillInstance = window.localStorage.getItem("mastodon_instance");
const URLParams = window.location.search.substr(1).split("&");
for (let i = 0; i < URLParams.length; i++) {
const URLParamPair = URLParams[i].split("=");
if (URLParamPair[0] === "text") {
document.getElementById("text").value = decodeURIComponent(URLParamPair[1]);
} else if (URLParamPair[0] === "instance") {
prefillInstance = decodeURIComponent(URLParamPair[1]);
}
}
if (prefillInstance != null) {
$instance.value = normalizeUrl(prefillInstance);
}
$instance.addEventListener("focus", loadInstances);

View File

@ -0,0 +1,43 @@
/*!
* This file is part of ShareFedi
* https://github.com/kytta/share2fedi
*
* SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { getSoftwareName } from "@lib/nodeinfo";
import { type ProjectPublishConfig, supportedProjects } from "@lib/project";
import { error, json } from "@lib/response";
import type { APIRoute } from "astro";
export type Detection = {
domain: string;
project: keyof typeof supportedProjects;
} & ProjectPublishConfig;
export const GET: APIRoute = async ({ params }) => {
const domain = params.domain as string;
const softwareName = await getSoftwareName(domain);
if (softwareName === undefined) {
return error("Could not detect Fediverse project.");
}
if (!(softwareName in supportedProjects)) {
return error(`Fediverse project "${softwareName}" is not supported yet.`);
}
const publishConfig = supportedProjects[softwareName] as ProjectPublishConfig;
return json(
{
domain,
project: softwareName,
...publishConfig,
},
200,
{
"Cache-Control": "public, s-maxage=86400, max-age=604800",
},
);
};

View File

@ -0,0 +1,22 @@
/*!
* This file is part of ShareFedi
* https://github.com/kytta/share2fedi
*
* SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { APIRoute } from "astro";
import { getPopularInstanceDomains } from "@lib/instance";
import { json } from "@lib/response";
export const GET: APIRoute = async () => {
const popularInstanceDomains = await getPopularInstanceDomains();
return json(popularInstanceDomains, 200, {
"Cache-Control":
popularInstanceDomains.length > 0
? "public, s-maxage=86400, max-age=604800"
: "public, s-maxage=60, max-age=3600",
});
};

104
src/pages/index.astro Normal file
View File

@ -0,0 +1,104 @@
---
/*!
* This file is part of Share₂Fedi
* https://github.com/kytta/share2fedi
*
* SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
* SPDX-License-Identifier: AGPL-3.0-only
*/
import Layout from "@layouts/layout.astro";
import InstanceSelect from "@components/instance-select.astro";
import { getUrlDomain } from "@lib/url";
import type { Detection } from "./api/detect/[domain]";
const searchParameters = new URL(Astro.request.url).searchParams;
let text: string | null = searchParameters.get("text");
let instance: string | null = searchParameters.get("instance");
const errors = { text: "", instance: "" };
if (Astro.request.method === "POST") {
const formData = await Astro.request.formData();
text = formData.get("text") as string | null;
instance = formData.get("instance") as string | null;
if (typeof text !== "string" || text.length === 0) {
errors.text += "Please enter post text. ";
}
let detection: Detection | undefined;
if (typeof instance !== "string" || instance.length === 0) {
errors.instance += "Please enter instance domain. ";
} else {
instance = getUrlDomain(instance);
const detectResponse = await fetch(
new URL(`/api/detect/${instance}`, Astro.url),
);
const detectJson = await detectResponse.json();
if (detectJson.error) {
errors.instance += detectJson.error + " ";
} else {
detection = detectJson;
}
}
const hasErrors = Object.values(errors).some(Boolean);
if (!hasErrors && detection !== undefined) {
const { domain, endpoint, params } = detection;
const publishUrl = new URL(endpoint, `https://${domain}/`);
publishUrl.search = new URLSearchParams([
[params.text, text as string],
]).toString();
// eslint-disable-next-line unicorn/prefer-module
return Astro.redirect(publishUrl.toString(), 303);
}
}
---
<Layout>
<form
id="form"
method="POST"
>
<label>
<span data-translate="postText">Post text</span>
<textarea
name="text"
id="text"
rows="7"
placeholder="Whats on your mind?"
required
aria-invalid={Boolean(errors.text)}
aria-errormessage={errors.text ? "text-error" : undefined}
data-translate="postTextPlaceholder"
data-translate-attribute="placeholder"
>{text}</textarea
>
{
errors.text && (
<p
class="error"
id="text-error"
aria-live="assertive"
>
{errors.text}
</p>
)
}
</label>
<InstanceSelect
{instance}
errors={errors.instance}
/>
<input
type="submit"
value="Publish"
class="mt1r"
data-translate="publish"
data-translate-attribute="value"
/>
</form>
</Layout>

View File

@ -1,38 +0,0 @@
/*
* @source: https://codeberg.org/kytta/toot/src/branch/main/src/scss/_fonts.scss
*
* toot - Cross-instance share page for Mastodon
* Copyright (C) 2020-2022 Nikita Karamov <me@kytta.dev>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 400;
src: local("Roboto"), url("/fonts/Roboto-400.woff2?v=29") format("woff2"),
url("/fonts/Roboto-400.woff?v=29") format("woff");
}
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 500;
src: local("Roboto Medium"), local("Roboto-Medium"),
url("/fonts/Roboto-500.woff2?v=29") format("woff2"),
url("/fonts/Roboto-500.woff?v=29") format("woff");
}

View File

@ -1,35 +0,0 @@
/*
* @source: https://codeberg.org/kytta/toot/src/branch/main/src/scss/_variables.scss
*
* toot - Cross-instance share page for Mastodon
* Copyright (C) 2020-2022 Nikita Karamov <me@kytta.dev>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
$text-font: "Roboto", sans-serif;
$bg: #1f232b;
$text: #9baec8;
$title: #d9e1e8;
$button-bg: #2b90d9;
$button-hover-bg: #56a7e1;
$button-text: white;
$input-bg: #131419;
$border-color: #303643;

View File

@ -1,181 +0,0 @@
/*!
* @source: https://codeberg.org/kytta/toot/src/branch/main/src/scss/style.scss
*
* toot - Cross-instance share page for Mastodon
* Copyright (C) 2020-2022 Nikita Karamov <me@kytta.dev>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
@use "sass:color";
@import "fonts";
@import "variables";
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,
body {
background-color: $bg;
color: $text;
font-family: $text-font;
font-size: 16px;
font-weight: 400;
line-height: 1;
height: 100%;
width: 100%;
}
body {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
}
header {
border-bottom: 1px solid $border-color;
padding: 1.5rem 0;
text-align: center;
width: 100%;
h1 {
display: inline-block;
margin: 0 1rem 0 0;
vertical-align: middle;
}
p {
display: inline-block;
line-height: 1.2rem;
margin: 0;
text-align: left;
vertical-align: middle;
img {
vertical-align: middle;
}
}
}
main {
width: 100%;
max-width: 600px;
margin: auto;
padding: 0 0.75rem;
form {
section {
margin-bottom: 1rem;
&.remember,
&.submit {
text-align: center;
}
&.submit {
margin-top: 2rem;
}
}
label {
font-size: 14px;
margin-bottom: 8px;
display: inline-block;
}
textarea,
input {
font-size: 1rem;
border-radius: 4px;
&[type="checkbox"] {
margin-right: 8px;
}
&[type="submit"] {
display: inline-block;
text-align: center;
background-color: $button-bg;
color: $button-text;
font-weight: 500;
font-family: inherit;
height: 2.5rem;
padding: 0 1rem;
line-height: 36px;
border: 0;
cursor: pointer;
&:hover {
background-color: $button-hover-bg;
}
}
transition: background-color 300ms ease, border 300ms ease;
}
textarea,
input[type="url"] {
color: inherit;
width: 100%;
outline: 0;
font-family: inherit;
resize: vertical;
background-color: $input-bg;
border: 1px solid color.scale($input-bg, $lightness: -25%);
padding: 10px;
&:focus,
&:active {
border: 1px solid $button-bg;
background-color: color.scale($input-bg, $lightness: +5%);
}
&::placeholder {
color: inherit;
opacity: 0.3;
}
}
}
}
footer {
border-top: 1px solid $border-color;
padding: 1rem 0;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
flex-wrap: wrap;
section {
margin: 0.5rem 1rem;
a {
color: inherit;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -1 +0,0 @@
<svg viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M473.266 301.162c-6.855 35.271-61.403 73.871-124.051 81.352-32.669 3.898-64.833 7.48-99.131 5.908-56.092-2.57-100.352-13.389-100.352-13.389 0 5.46.337 10.66 1.01 15.522 7.293 55.356 54.89 58.672 99.977 60.218 45.508 1.558 86.028-11.22 86.028-11.22l1.87 41.141s-31.83 17.093-88.533 20.236c-31.268 1.719-70.092-.786-115.31-12.755C36.7 462.217 19.833 357.677 17.253 251.604c-.786-31.494-.302-61.191-.302-86.028C16.952 57.11 88.02 25.318 88.02 25.318c35.834-16.457 97.32-23.378 161.243-23.9h1.57c63.923.522 125.45 7.443 161.281 23.9 0 0 71.064 31.792 71.064 140.258 0 0 .892 80.026-9.91 135.586" fill="#3088d4" fill-rule="nonzero"/><g fill="#fff"><path d="M476.925 278.214c-4.531 1.19-9.3 1.72-14.272 1.72-15.137 0-26.834-3.956-35.088-11.868-8.256-7.915-12.386-19.439-12.386-34.576v-66.309h-22.704V141.38h22.704v-31.477h32.253v31.477h34.342c.961 7.6 1.403 15.66 1.403 24.197l-.003 1.605h-35.742v65.536c0 6.708 1.633 11.826 4.9 15.352 3.27 3.527 7.999 5.288 14.192 5.288 5.035 0 9.482-.918 13.318-2.817l-.471 5.996-2.446 21.678z"/><path d="M326.94 279.935c-13.933 0-26.492-3.012-37.672-9.033-11.182-6.02-19.91-14.404-26.19-25.155-6.276-10.75-9.417-22.922-9.417-36.51 0-13.587 3.141-25.715 9.418-36.38 6.28-10.665 15.007-19.008 26.19-25.026 11.179-6.02 23.738-9.032 37.67-9.032 14.105 0 26.747 3.011 37.927 9.032 11.182 6.018 19.91 14.361 26.19 25.026 6.276 10.665 9.417 22.793 9.417 36.38 0 13.588-3.14 25.76-9.418 36.51-6.279 10.751-15.007 19.135-26.19 25.155-11.179 6.021-23.82 9.033-37.926 9.033zm0-27.61c11.866 0 21.671-3.954 29.41-11.868 7.743-7.912 11.614-18.319 11.614-31.22 0-12.9-3.871-23.307-11.613-31.219-7.74-7.911-17.545-11.869-29.412-11.869-11.869 0-21.631 3.958-29.285 11.87-7.656 7.911-11.48 18.318-11.48 31.219 0 12.9 3.824 23.307 11.48 31.219 7.654 7.914 17.416 11.869 29.285 11.869z" fill-rule="nonzero"/><path d="M181.159 279.935c-13.933 0-26.489-3.012-37.668-9.033-11.182-6.02-19.91-14.404-26.19-25.155-6.28-10.75-9.418-22.922-9.418-36.51 0-13.587 3.139-25.715 9.418-36.38 6.28-10.665 15.008-19.008 26.19-25.026 11.18-6.02 23.735-9.032 37.668-9.032 14.105 0 26.747 3.011 37.93 9.032 11.179 6.018 19.91 14.361 26.189 25.026 6.276 10.665 9.415 22.793 9.415 36.38 0 13.588-3.139 25.76-9.415 36.51-6.28 10.751-15.01 19.135-26.19 25.155-11.182 6.021-23.824 9.033-37.93 9.033zm0-27.61c11.869 0 21.674-3.954 29.414-11.868 7.742-7.912 11.61-18.319 11.61-31.22 0-12.9-3.868-23.307-11.61-31.219-7.74-7.911-17.545-11.869-29.414-11.869-11.867 0-21.63 3.958-29.285 11.87-7.653 7.911-11.481 18.318-11.481 31.219 0 12.9 3.828 23.307 11.48 31.219 7.657 7.914 17.42 11.869 29.286 11.869z" fill-rule="nonzero"/><path d="M18.353 141.38h21.158v-31.478h32.25v31.477h36.896v25.802H71.762v65.536c0 6.708 1.635 11.826 4.902 15.352 3.268 3.527 7.998 5.288 14.192 5.288 7.222 0 13.243-1.89 18.06-5.676l9.029 22.963c-3.782 3.098-8.383 5.42-13.803 6.969-5.418 1.546-11.137 2.322-17.158 2.322-15.136 0-26.833-3.957-35.09-11.87-8.256-7.914-12.383-19.438-12.383-34.575v-66.309H16.947l.005-1.605c0-8.537.44-16.597 1.401-24.197z"/></g></svg>

Before

Width:  |  Height:  |  Size: 3.1 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 4.9 KiB

11
src/stores/i18n.ts Normal file
View File

@ -0,0 +1,11 @@
/*!
* This file is part of ShareFedi
* https://github.com/kytta/share2fedi
*
* SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { persistentAtom } from "@nanostores/persistent";
export const $locale = persistentAtom<string | undefined>("locale");

View File

@ -0,0 +1,46 @@
/*!
* This file is part of ShareFedi
* https://github.com/kytta/share2fedi
*
* SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { persistentAtom } from "@nanostores/persistent";
import { onMount, task } from "nanostores";
const UPDATE_INTERVAL_MS = 1000 * 60 * 60 * 24; // one day
export const $popularInstances = persistentAtom<string[]>(
"popularInstances",
[],
{
encode: JSON.stringify,
decode: JSON.parse,
},
);
export const $lastFetched = persistentAtom<Date>(
"popularInstancesLastFetched",
new Date(0),
{
encode: (date) => date.toISOString(),
decode: (encoded) => new Date(encoded),
},
);
onMount($popularInstances, () => {
task(async () => {
if (Date.now() - $lastFetched.get().getTime() < UPDATE_INTERVAL_MS) {
return;
}
try {
const response = await fetch("/api/instances");
$popularInstances.set(await response.json());
$lastFetched.set(new Date());
} catch (error) {
console.error("Could not fetch popular instances:", error);
}
});
});

View File

@ -0,0 +1,48 @@
/*!
* This file is part of ShareFedi
* https://github.com/kytta/share2fedi
*
* SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { persistentAtom } from "@nanostores/persistent";
import { getUrlDomain } from "@lib/url";
import { action, onMount } from "nanostores";
const OLD_LOCAL_STORAGE_KEY = "recentInstances";
const LOCAL_STORAGE_KEY = "savedInstances";
const CAPACITY = 5;
export const $savedInstances = persistentAtom<Set<string>>(
LOCAL_STORAGE_KEY,
new Set(),
{
encode: (set) => JSON.stringify([...set]),
decode: (value) => new Set(JSON.parse(value)),
},
);
onMount($savedInstances, () => {
// XXX: The conversion to a domain need to be done to support legacy
// users, who may have full URLs in their Storage
const oldItem = localStorage.getItem(OLD_LOCAL_STORAGE_KEY);
if (!oldItem) {
return;
}
$savedInstances.set(
new Set(
JSON.parse(oldItem).map((instanceUrl: string) =>
getUrlDomain(instanceUrl),
),
),
);
localStorage.removeItem(OLD_LOCAL_STORAGE_KEY);
});
export const save = action($savedInstances, "save", (store, instance) => {
store.set(
new Set([getUrlDomain(instance), ...store.get()].slice(0, CAPACITY)),
);
});

184
src/styles/main.scss Normal file
View File

@ -0,0 +1,184 @@
/*!
* This file is part of ShareFedi
* https://github.com/kytta/share2fedi
*
* SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
* SPDX-License-Identifier: AGPL-3.0-only
*/
@use "sass:math";
*,
*::before,
*::after {
box-sizing: border-box;
}
:root {
--s2f-accent-color: #40665c;
--s2f-accent-color-light: #5d8379;
--s2f-accent-color-contrast: #005e4e;
--s2f-error-color: #a12f2d;
--s2f-border-color: #ccc;
--s2f-border-width: 1px;
--s2f-input-group-bg-color: #eee;
--s2f-input-bg-color: #fff;
--s2f-input-text-color: #000;
--s2f-button-text-color: #fff;
color-scheme: light dark;
accent-color: var(--s2f-accent-color);
font-family: "Helvetica Neue", Helvetica, FreeSans, "Nimbus Sans L", Inter,
Arial, system-ui, sans-serif;
font-size: 16px;
}
html {
line-height: 1.5;
}
body {
max-width: 60em;
margin-block: 0;
margin-inline: auto;
display: flex;
flex-flow: row wrap;
> * {
flex-shrink: 0;
width: 100%;
max-width: 100%;
}
}
header {
padding: 1rem;
display: flex;
align-items: center;
justify-content: space-between;
}
main {
margin-block-end: 2rem;
}
main,
aside {
padding-block: 0;
padding-inline: 1rem;
}
hr {
height: 0;
color: inherit;
border-color: var(--s2f-border-color);
border-width: 0.5px;
}
details {
font-size: smaller;
}
summary {
font-weight: bolder;
}
a {
color: var(--s2f-accent-color-contrast);
}
b,
strong {
font-weight: bolder;
}
label {
display: block;
}
input,
textarea {
font-family: inherit;
font-size: 100%;
line-height: 1.15;
margin: 0;
padding: 0.5rem;
border-radius: 4px;
}
textarea {
resize: vertical;
resize: block;
}
input[type="text"],
textarea {
width: 100%;
color: var(--s2f-input-text-color);
background-color: var(--s2f-input-bg-color);
border: var(--s2f-border-width) solid var(--s2f-border-color);
}
input[type="checkbox"],
input[type="radio"] {
vertical-align: middle;
}
input[type="submit"] {
background-color: var(--s2f-accent-color);
color: var(--s2f-button-text-color);
font-weight: bolder;
height: 2.5rem;
padding-block: 0.5rem;
padding-inline: 1.5rem;
border: 0;
cursor: pointer;
appearance: button;
&:hover {
background-color: var(--s2f-accent-color-light);
}
}
@media (prefers-color-scheme: dark) {
:root {
--s2f-accent-color: #43776a;
--s2f-accent-color-light: #619587;
--s2f-accent-color-contrast: #a8f7e2;
--s2f-border-color: #333;
--s2f-input-group-bg-color: #111;
}
}
@media screen and (width >= 768px) {
main,
aside {
flex: 0 0 auto;
}
main {
width: math.div(200%, 3);
}
aside {
width: math.div(100%, 3);
}
}
[aria-invalid="true"],
[aria-errormessage] {
--s2f-input-text-color: var(--s2f-error-color);
--s2f-border-color: var(--s2f-error-color);
accent-color: var(--s2f-error-color);
}
p.error {
color: var(--s2f-error-color);
margin-block: 0 1rem;
margin-inline: 0;
}
.mt1r {
margin-block-start: 1rem !important;
}

22
tsconfig.json Normal file
View File

@ -0,0 +1,22 @@
// This TypeScript config is part of ShareFedi
// https://github.com/kytta/share2fedi
//
// SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
// SPDX-License-Identifier: CC0-1.0
{
"extends": "astro/tsconfigs/strictest",
"compilerOptions": {
"ignoreDeprecations": "5.0",
"baseUrl": ".",
"resolveJsonModule": true,
"paths": {
"@components/*": ["src/components/*"],
"@i18n/*": ["src/i18n/*"],
"@layouts/*": ["src/layouts/*"],
"@pages/*": ["src/pages/*"],
"@lib/*": ["src/lib/*"],
"@stores/*": ["src/stores/*"],
"@styles/*": ["src/styles/*"]
}
}
}

7
vercel.json Normal file
View File

@ -0,0 +1,7 @@
{
"framework": "astro",
"installCommand": "pnpm install",
"buildCommand": "pnpm run build",
"outputDirectory": "dist",
"devCommand": "pnpm run dev"
}