jekyll-mastodon_webfinger 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c1535439f0568c21208d168937f0729e1cec174361ebe24ce8c554d7bf15d80a
4
+ data.tar.gz: 78e1b7f75e0f0cbbe9fb33d7b0995616608d8e8b7bc42d0848492779261419d1
5
+ SHA512:
6
+ metadata.gz: 816ee6cd3ff548fd4758e2225fed8dcc443ab3ffaca62ad02886112f8ea46f29f58abd0fadfe9092a6d7791cf753fbcbbaa806ce20bb4084b095380cd815cfd4
7
+ data.tar.gz: 9b4c3681b7cd3585e32b3675a9f4efad831c4266b266c6be169af3b4b619e2f1dd6f486a57a121c96676086e4bd77c1d8412f6c653a8eccaecfa0ab558a7fbd6
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,20 @@
1
+ require:
2
+ - rubocop-rake
3
+ - rubocop-rspec
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 2.7
7
+
8
+ Style/StringLiterals:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Style/StringLiteralsInInterpolation:
13
+ Enabled: true
14
+ EnforcedStyle: double_quotes
15
+
16
+ Layout/LineLength:
17
+ Max: 120
18
+
19
+ Style/SymbolArray:
20
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ ## [Unreleased]
2
+
3
+ ## [1.0.0] - 2022-11-19
4
+
5
+ - Initial release
6
+ - Generates `/.well-known/webfinger` file that points to a Mastodon profile defined in `_config.yml`
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at philnash@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in jekyll-mastodon_webfinger.gemspec
6
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License Copyright (c) 2022 Phil Nash
2
+
3
+ Permission is hereby granted, free of
4
+ charge, to any person obtaining a copy of this software and associated
5
+ documentation files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use, copy, modify, merge,
7
+ publish, distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to the
9
+ following conditions:
10
+
11
+ The above copyright notice and this permission notice
12
+ (including the next paragraph) shall be included in all copies or substantial
13
+ portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
16
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
18
+ EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # `Jekyll::MastodonWebfinger`
2
+
3
+ This is a [Jekyll](https://jekyllrb.com/) plugin that adds a [WebFinger](https://webfinger.net/) file to your site, allowing you to use your own domain to help others discover your [Mastodon](https://joinmastodon.org/) profile.
4
+
5
+ * [What?](#what)
6
+ * [How to use](#how-to-use)
7
+ * [Drawbacks](#drawbacks)
8
+ * [Development](#development)
9
+ * [Contributing](#contributing)
10
+ * [Code of Conduct](#code-of-conduct)
11
+ * [License](#license)
12
+
13
+ ## What?
14
+
15
+ You may be tempated to run your own Mastodon instance so that you can use your own domain. But that's probably hard work.
16
+
17
+ Instead, you can use your domain to point to your profile on a Mastodon instance that you are signed up to. This uses [WebFinger](https://webfinger.net/), which is a way to attach information to an email address or other online resource. In this case you can point email addresses on your own domain to your Mastodon profile.
18
+
19
+ For example, I have a Mastodon profile at [@philnash@mastodon.social](https://mastodon.social/@philnash). If I add this plugin to my Jekyll site at https://philna.sh and set the username to `philnash` and the instance to `mastodon.social`, then you will be able to find my account by searching for "phil@philna.sh" in any Mastodon instance.
20
+
21
+ For a more in depth explanation, check out [Mastodon on your own domain without hosting a server
22
+ by Maarten Balliauw](https://blog.maartenballiauw.be/post/2022/11/05/mastodon-own-donain-without-hosting-server.html).
23
+
24
+ ## How to use
25
+
26
+ Add the gem to your Jekyll site's `Gemfile` by executing:
27
+
28
+ $ bundle add jekyll-mastodon_webfinger
29
+
30
+ Or by opening the `Gemfile`, adding:
31
+
32
+ gem "jekyll-mastodon_webfinger"
33
+
34
+ and then running `bundle install`.
35
+
36
+ Then in your Jekyll site's `_config.yml` file add your Mastodon account details. For example:
37
+
38
+ ```yml
39
+ mastodon:
40
+ username: philnash
41
+ instance: mastodon.social
42
+ ```
43
+
44
+ Also, add `jekyll/mastodon_webfinger` to the `plugins` list in `_config.yml`:
45
+
46
+ ```yml
47
+ plugins:
48
+ - jekyll/mastodon_webfinger
49
+ ```
50
+
51
+ Next time you build your Jekyll site, you will find a `/.well-known/` directory in the output with a `webfinger` file that contains the required JSON.
52
+
53
+ ### Drawbacks
54
+
55
+ Since this generates a static file, this actually acts like a catch-all email address. `@anything@yourdomain.com` will match and point to the Mastodon profile your define.
56
+
57
+ ## Development
58
+
59
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
60
+
61
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
62
+
63
+ ## Contributing
64
+
65
+ Bug reports and pull requests are welcome on GitHub at https://github.com/philnash/jekyll-mastodon_webfinger. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/philnash/jekyll-mastodon_webfinger/blob/main/CODE_OF_CONDUCT.md).
66
+
67
+ ## Code of Conduct
68
+
69
+ Everyone interacting in the Jekyll::MastodonWebfinger project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/philnash/jekyll-mastodon_webfinger/blob/main/CODE_OF_CONDUCT.md).
70
+
71
+ ## License
72
+
73
+ The gem is available as open source under the terms of the [MIT License](https://github.com/philnash/jekyll-mastodon_webfinger/blob/main/LICENSE).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/jekyll/mastodon_webfinger/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "jekyll-mastodon_webfinger"
7
+ spec.version = Jekyll::MastodonWebfinger::VERSION
8
+ spec.authors = ["Phil Nash"]
9
+ spec.email = ["philnash@gmail.com"]
10
+
11
+ spec.summary = "Use your Jekyll site and domain to forward to your Mastodon profile"
12
+ spec.description = "Allows you to use your own custom domain to point to your" \
13
+ "Mastodon profile by adding a /.well-known/webfinger file to your site output"
14
+ spec.homepage = "https://github.com/philnash/jekyll-mastodon_webfinger"
15
+ spec.required_ruby_version = ">= 2.7.0"
16
+ spec.license = "MIT"
17
+
18
+ spec.metadata["homepage_uri"] = spec.homepage
19
+ spec.metadata["source_code_uri"] = spec.homepage
20
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
21
+
22
+ # Specify which files should be added to the gem when it is released.
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(__dir__) do
25
+ `git ls-files -z`.split("\x0").reject do |f|
26
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
27
+ end
28
+ end
29
+ spec.require_paths = ["lib"]
30
+
31
+ spec.add_dependency "jekyll", ">= 3.0", "< 5.0"
32
+
33
+ spec.add_development_dependency "rake", "~> 13.0"
34
+ spec.add_development_dependency "rspec", "~> 3.0"
35
+ spec.add_development_dependency "rubocop", "~> 1.21"
36
+ spec.add_development_dependency "rubocop-rake", "~> 0.6"
37
+ spec.add_development_dependency "rubocop-rspec", "~> 2.15"
38
+ spec.add_development_dependency "simplecov", "~> 0.21"
39
+ end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module MastodonWebfinger
5
+ # A Jekyll Generator that creates a `/.well-known/webfinger` file in the
6
+ # site output that points to your Mastodon identity
7
+ class Generator < Jekyll::Generator
8
+ def generate(site)
9
+ destination = site.config["destination"]
10
+ mastodon = site.config["mastodon"]
11
+ return unless mastodon && mastodon["username"] && mastodon["instance"]
12
+
13
+ username = mastodon["username"]
14
+ instance = mastodon["instance"]
15
+
16
+ directory = create_directory(destination)
17
+ write_webfinger_file(directory, username, instance)
18
+ end
19
+
20
+ private
21
+
22
+ def create_directory(destination)
23
+ directory = File.join(destination, ".well-known")
24
+ FileUtils.mkdir_p(directory)
25
+ directory
26
+ end
27
+
28
+ def write_webfinger_file(directory, username, instance)
29
+ filename = File.join(directory, "webfinger")
30
+ File.open(filename, "w") do |file|
31
+ file.write webfinger_json(username, instance)
32
+ end
33
+ end
34
+
35
+ # rubocop:disable Metrics/MethodLength
36
+ def webfinger_json(username, instance)
37
+ {
38
+ subject: "acct:#{username}@#{instance}",
39
+ aliases: [
40
+ "https://#{instance}/@#{username}",
41
+ "https://#{instance}/users/#{username}"
42
+ ],
43
+ links: [
44
+ {
45
+ rel: "http://webfinger.net/rel/profile-page",
46
+ type: "text/html",
47
+ href: "https://#{instance}/@#{username}"
48
+ },
49
+ {
50
+ rel: "self",
51
+ type: "application/activity+json",
52
+ href: "https://#{instance}/users/#{username}"
53
+ },
54
+ {
55
+ rel: "http://ostatus.org/schema/1.0/subscribe",
56
+ template: "https://#{instance}/authorize_interaction?uri={uri}"
57
+ }
58
+ ]
59
+ }.to_json
60
+ end
61
+ # rubocop:enable Metrics/MethodLength
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module MastodonWebfinger
5
+ VERSION = "1.0.0"
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require "jekyll"
5
+ require_relative "mastodon_webfinger/version"
6
+ require_relative "mastodon_webfinger/generator"
metadata ADDED
@@ -0,0 +1,163 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-mastodon_webfinger
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Phil Nash
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-11-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: rake
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '13.0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '13.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '3.0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rubocop
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.21'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '1.21'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rubocop-rake
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '0.6'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '0.6'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rubocop-rspec
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '2.15'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '2.15'
103
+ - !ruby/object:Gem::Dependency
104
+ name: simplecov
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '0.21'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '0.21'
117
+ description: Allows you to use your own custom domain to point to yourMastodon profile
118
+ by adding a /.well-known/webfinger file to your site output
119
+ email:
120
+ - philnash@gmail.com
121
+ executables: []
122
+ extensions: []
123
+ extra_rdoc_files: []
124
+ files:
125
+ - ".rspec"
126
+ - ".rubocop.yml"
127
+ - CHANGELOG.md
128
+ - CODE_OF_CONDUCT.md
129
+ - Gemfile
130
+ - LICENSE
131
+ - README.md
132
+ - Rakefile
133
+ - jekyll-mastodon_webfinger.gemspec
134
+ - lib/jekyll/mastodon_webfinger.rb
135
+ - lib/jekyll/mastodon_webfinger/generator.rb
136
+ - lib/jekyll/mastodon_webfinger/version.rb
137
+ homepage: https://github.com/philnash/jekyll-mastodon_webfinger
138
+ licenses:
139
+ - MIT
140
+ metadata:
141
+ homepage_uri: https://github.com/philnash/jekyll-mastodon_webfinger
142
+ source_code_uri: https://github.com/philnash/jekyll-mastodon_webfinger
143
+ changelog_uri: https://github.com/philnash/jekyll-mastodon_webfinger/blob/main/CHANGELOG.md
144
+ post_install_message:
145
+ rdoc_options: []
146
+ require_paths:
147
+ - lib
148
+ required_ruby_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: 2.7.0
153
+ required_rubygems_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ requirements: []
159
+ rubygems_version: 3.3.3
160
+ signing_key:
161
+ specification_version: 4
162
+ summary: Use your Jekyll site and domain to forward to your Mastodon profile
163
+ test_files: []