Class: Jekyll::ActivityPub::InstanceV2

Inherits:
InstanceV1
  • Object
show all
Includes:
Helper
Defined in:
lib/jekyll/activity_pub/instance_v2.rb

Overview

Points to site’s metadata

Instance Method Summary collapse

Methods included from Helper

#content, #generate_excerpt?, #hook_owner, #locale, #place_in_layout?, #pruned_data, #render_with_liquid?, #to_json, #to_liquid, #trigger_hooks

Methods inherited from InstanceV1

#increase_last_status!, #output_ext

Constructor Details

#initialize(site, base = '', dir = 'api/v2', name = 'instance') ⇒ InstanceV2

Initialize with default data

Parameters:

  • :site (Jekyll::Site)
  • :base (String)
  • :dir (String)
  • :name (String)


17
18
19
# File 'lib/jekyll/activity_pub/instance_v2.rb', line 17

def initialize(site, base = '', dir = 'api/v2', name = 'instance')
  super(site, base, dir, name)
end

Instance Method Details

#increase_local_posts_counter!Object



85
86
87
88
# File 'lib/jekyll/activity_pub/instance_v2.rb', line 85

def increase_local_posts_counter!
  data['contact']['account']['statuses_count'] += 1
  nil
end


21
22
23
# File 'lib/jekyll/activity_pub/instance_v2.rb', line 21

def permalink
  'api/v2/instance/'
end

#read_yamlObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/jekyll/activity_pub/instance_v2.rb', line 25

def read_yaml(*)
  self.data = {
    'domain' => hostname,
    'version' => Jekyll::ActivityPub::VERSION,
    'source_url' => 'https://0xacab.org/sutty/jekyll/jekyll-activity-pub',
    'title' => public_name,
    'description' => summary,
    'usage' => {
      'users' => {
        'active_month' => 1
      }
    },
    'thumbnail' => {
      'url' => conditional_absolute_url(avatar)
    },
    'languages' => languages,
    'configuration' => {
      'urls' => {},
      'accounts' => {},
      'statuses' => {},
      'media_attachments' => {},
      'polls' => {},
      'translation' => {},
    },
    'registrations' => {
      'enabled' => false,
      'approval_required' => false,
      'message' => nil
    },
    'contact' => {
      'email' => email,
      'account' => {
        'id' => 1,
        'username' => username,
        'acct' => username,
        'display_name' => public_name,
        'locked' => false,
        'bot' => false,
        'discoverable' => true,
        'group' => false,
        'created_at' => published.xmlschema,
        'note' => summary,
        'url' => site.config['url'],
        'avatar' => conditional_absolute_url(avatar),
        'avatar_static' => conditional_absolute_url(avatar),
        'header' => conditional_absolute_url(header),
        'header_static' => conditional_absolute_url(header),
        'followers_count' => 0,
        'following_count' => 0,
        'statuses_count' => 0,
        'last_status_at' => nil,
        'noindex' => false,
        'emojis' => [],
        'fields' => []
      },
      'rules' => []
    }
  }
end