in_a_tavern 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +8 -0
- data/app/assets/config/in_a_tavern_manifest.js +1 -0
- data/app/assets/stylesheets/in_a_tavern/application.css +15 -0
- data/app/controllers/in_a_tavern/actor_controller.rb +7 -0
- data/app/controllers/in_a_tavern/application_controller.rb +4 -0
- data/app/controllers/in_a_tavern/inbox_controller.rb +4 -0
- data/app/controllers/in_a_tavern/webfinger_controller.rb +14 -0
- data/app/helpers/in_a_tavern/actor_helper.rb +4 -0
- data/app/helpers/in_a_tavern/application_helper.rb +4 -0
- data/app/helpers/in_a_tavern/inbox_helper.rb +4 -0
- data/app/helpers/in_a_tavern/webfinger_helper.rb +4 -0
- data/app/jobs/in_a_tavern/application_job.rb +4 -0
- data/app/models/in_a_tavern/application_record.rb +5 -0
- data/app/views/in_a_tavern/actor/show.json.erb +16 -0
- data/app/views/in_a_tavern/webfinger/show.json.erb +20 -0
- data/app/views/layouts/in_a_tavern/application.html.erb +15 -0
- data/config/routes.rb +5 -0
- data/lib/in_a_tavern/configuration.rb +42 -0
- data/lib/in_a_tavern/engine.rb +5 -0
- data/lib/in_a_tavern/version.rb +3 -0
- data/lib/in_a_tavern.rb +7 -0
- data/lib/tasks/in_a_tavern_tasks.rake +4 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e4ea03cb0d2c265e53316bfabd6166465a2c112debd161a3b258100ef9ee1919
|
4
|
+
data.tar.gz: 8aa4b761e03e83d61d2e8a0c65c3dc76d88029001b7d4c63e3d97b3e81c4105a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: daf1d26e7fd6c87a411ef643390cc3e747979787da28a0df16731da3dcaeb711adae8ac4824b7ae8fc92dc3aefa464df03a5e0ba894d699dfc9a5fb2ba458ae8
|
7
|
+
data.tar.gz: 7baf16c6193edf281724c6cd99980a61dfe623f0343d631307867f5ba587dc425d312cca9d8e2fb4ac5f8eb0edda08f65b20cacbf307fc776852702742d1c23d
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2022 Caleb Hearth
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
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
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# InATavern
|
2
|
+
Short description and motivation.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem "in_a_tavern"
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install in_a_tavern
|
22
|
+
```
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
Contribution directions go here.
|
26
|
+
|
27
|
+
## License
|
28
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
//= link_directory ../stylesheets/in_a_tavern .css
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module InATavern
|
2
|
+
class WebfingerController < ApplicationController
|
3
|
+
def show
|
4
|
+
if !params.key?(:resource)
|
5
|
+
head :bad_request
|
6
|
+
return
|
7
|
+
end
|
8
|
+
if params[:resource] != "acct:#{InATavern.config.actor}@#{request.host}"
|
9
|
+
head :not_found
|
10
|
+
return
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"@context": [
|
3
|
+
"https://www.w3.org/ns/activitystreams",
|
4
|
+
"https://w3id.org/security/v1"
|
5
|
+
],
|
6
|
+
"id": "<%= actor_url protocol: :https %>",
|
7
|
+
"type": "Person",
|
8
|
+
"preferredUsername": "<%= InATavern.config.actor %>",
|
9
|
+
"inbox": "<%= inbox_url protocol: :https %>",
|
10
|
+
|
11
|
+
"publicKey": {
|
12
|
+
"id": "https://<%= request.host %><%= InATavern.config.profile_path %>#main-key",
|
13
|
+
"owner": "<%= actor_url protocol: :https %>",
|
14
|
+
"publicKeyPem": "<%= File.read(Rails.root.join("public.pem")).gsub(/\n/, "\\n") %>"
|
15
|
+
}
|
16
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"subject": "acct:<%= InATavern.config.actor %>@<%= request.host %>",
|
3
|
+
"aliases": [ "https://<%= request.host %><%= InATavern.config.profile_path %>"],
|
4
|
+
"links": [
|
5
|
+
{
|
6
|
+
"rel": "self",
|
7
|
+
"type": "application/activity+json",
|
8
|
+
"href": "<%= actor_url %>"
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"rel": "http://webfinger.net/rel/profile-page",
|
12
|
+
"type": "text/html",
|
13
|
+
"href": "https://<%= request.host %><%= InATavern.config.profile_path %>"
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"rel": "http://ostatus.org/schema/1.0/subscribe",
|
17
|
+
"template": "https://<%= request.host %>/authorize_interaction?uri={uri}"
|
18
|
+
}
|
19
|
+
]
|
20
|
+
}
|
data/config/routes.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
module InATavern
|
2
|
+
class Configuration
|
3
|
+
# The InATavern actor is the handle of the user for this site.
|
4
|
+
#
|
5
|
+
# @return InATavern actor
|
6
|
+
attr_accessor :actor
|
7
|
+
|
8
|
+
attr_writer :profile_path
|
9
|
+
|
10
|
+
# The InATavern profile_path is the profile path of the actor.
|
11
|
+
#
|
12
|
+
# Defaults to a slash followed by the configured `actor` value.
|
13
|
+
# @return InATavern profile_path
|
14
|
+
def profile_path
|
15
|
+
@profile_path || "/#{@actor}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# @return [InATavern::Configuration] InATavern's current config
|
20
|
+
def self.config
|
21
|
+
@config ||= Configuration.new
|
22
|
+
end
|
23
|
+
|
24
|
+
# Set InATavern's config
|
25
|
+
#
|
26
|
+
# @param config [InATavern::Configuration]
|
27
|
+
def self.config=(config)
|
28
|
+
@config = config
|
29
|
+
end
|
30
|
+
|
31
|
+
# Modify InATavern's current config
|
32
|
+
#
|
33
|
+
# @yieldparam [InATavern::Configuration] config current InATavern config
|
34
|
+
# ```
|
35
|
+
# InATavern.configure do |config|
|
36
|
+
# config.actor = "conan"
|
37
|
+
# end
|
38
|
+
# ```
|
39
|
+
def self.configure
|
40
|
+
yield config
|
41
|
+
end
|
42
|
+
end
|
data/lib/in_a_tavern.rb
ADDED
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: in_a_tavern
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Caleb Hearth
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-11-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: ActivityPub on Rails for a single user
|
28
|
+
email:
|
29
|
+
- caleb@calebhearth.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- MIT-LICENSE
|
35
|
+
- README.md
|
36
|
+
- Rakefile
|
37
|
+
- app/assets/config/in_a_tavern_manifest.js
|
38
|
+
- app/assets/stylesheets/in_a_tavern/application.css
|
39
|
+
- app/controllers/in_a_tavern/actor_controller.rb
|
40
|
+
- app/controllers/in_a_tavern/application_controller.rb
|
41
|
+
- app/controllers/in_a_tavern/inbox_controller.rb
|
42
|
+
- app/controllers/in_a_tavern/webfinger_controller.rb
|
43
|
+
- app/helpers/in_a_tavern/actor_helper.rb
|
44
|
+
- app/helpers/in_a_tavern/application_helper.rb
|
45
|
+
- app/helpers/in_a_tavern/inbox_helper.rb
|
46
|
+
- app/helpers/in_a_tavern/webfinger_helper.rb
|
47
|
+
- app/jobs/in_a_tavern/application_job.rb
|
48
|
+
- app/models/in_a_tavern/application_record.rb
|
49
|
+
- app/views/in_a_tavern/actor/show.json.erb
|
50
|
+
- app/views/in_a_tavern/webfinger/show.json.erb
|
51
|
+
- app/views/layouts/in_a_tavern/application.html.erb
|
52
|
+
- config/routes.rb
|
53
|
+
- lib/in_a_tavern.rb
|
54
|
+
- lib/in_a_tavern/configuration.rb
|
55
|
+
- lib/in_a_tavern/engine.rb
|
56
|
+
- lib/in_a_tavern/version.rb
|
57
|
+
- lib/tasks/in_a_tavern_tasks.rake
|
58
|
+
homepage: https://calebhearth.com
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
metadata:
|
62
|
+
homepage_uri: https://calebhearth.com
|
63
|
+
source_code_uri: https://github.com/calebhearth/in_a_tavern
|
64
|
+
changelog_uri: https://github.com/calebhearth/in_a_tavern/tree/main/NEWS
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubygems_version: 3.3.16
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: Single user ActivityPub on Rails
|
84
|
+
test_files: []
|