From 0c54347d4da122ac0c8a44914652d60ff33df278 Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Mon, 24 Jul 2017 23:10:10 -0700 Subject: [PATCH] add proxy dnslink adder --- ext/mock_redis.rb | 5 +++++ models/site.rb | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 ext/mock_redis.rb diff --git a/ext/mock_redis.rb b/ext/mock_redis.rb new file mode 100644 index 00000000..96b346b8 --- /dev/null +++ b/ext/mock_redis.rb @@ -0,0 +1,5 @@ +class MockRedis + def publish(channel, message) + # TODO make actually useful + end +end diff --git a/models/site.rb b/models/site.rb index 9112b087..4ba595b5 100644 --- a/models/site.rb +++ b/models/site.rb @@ -730,6 +730,14 @@ class Site < Sequel::Model archives_dataset.where(ipfs_hash: ipfs_hash).first.update updated_at: Time.now end end + + add_redis_proxy_dnslink + end + + def add_redis_proxy_dnslink + if host =~ /(.+)\.neocities\.org/ && latest_archive + $redis_proxy.hset "dns-#{host}", 'TXT', "dnslink=/ipfs/#{latest_archive.ipfs_hash}" + end end def latest_archive