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