Don't forget to lycansubscribe 🐺
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

added support for GDPR exclusion list

+21
+1
.gitignore
··· 1 1 .env 2 + config/app.yml 2 3 log
+13
app/config.rb
··· 1 + require 'yaml' 2 + 3 + module Config 4 + CONFIG_PATH = File.expand_path(File.join(__dir__, '..', 'config', 'app.yml')) 5 + 6 + def self.config 7 + @config ||= (File.exist?(CONFIG_PATH) ? YAML.load_file(CONFIG_PATH) : {}) 8 + end 9 + 10 + def self.gdpr_exclusions 11 + config['gdpr_exclusions'] || [] 12 + end 13 + end
+2
app/models/user.rb
··· 1 1 require 'active_record' 2 2 3 + require_relative '../config' 3 4 require_relative 'import' 4 5 require_relative 'import_job' 5 6 require_relative 'like' ··· 13 14 validates_presence_of :did 14 15 validates_length_of :did, maximum: 260 15 16 validates_format_of :did, with: /\Adid:(plc:[0-9a-z]{24}|web:[0-9a-z\-]+(\.[0-9a-z\-]+)+)\Z/ 17 + validates_exclusion_of :did, in: Config.gdpr_exclusions, message: "Account is on the GDPR exclusions list" 16 18 17 19 has_many :posts 18 20 has_many :imports, dependent: :delete_all
+4
app/post_downloader.rb
··· 2 2 require 'minisky' 3 3 4 4 require_relative 'at_uri' 5 + require_relative 'config' 5 6 require_relative 'models/post' 6 7 require_relative 'models/user' 7 8 ··· 41 42 items.dup.each do |item| 42 43 if post = existing_posts.detect { |post| post.at_uri == item.post_uri } 43 44 update_item(item, post) 45 + items.delete(item) 46 + elsif Config.gdpr_exclusions.include?(AT_URI(item.post_uri).repo) 47 + item.destroy 44 48 items.delete(item) 45 49 end 46 50 end
+1
config/deploy.rb
··· 37 37 38 38 task :link_shared do 39 39 run "ln -s #{shared_path}/env #{release_path}/.env" 40 + run "if [ -e #{shared_path}/config/app.yml ]; then ln -s #{shared_path}/config/app.yml #{release_path}/config/app.yml; fi" 40 41 end 41 42 end