add proxy dnslink adder

This commit is contained in:
Kyle Drake 2017-07-24 23:10:10 -07:00
parent 99cd5d1ab8
commit 0c54347d4d
2 changed files with 13 additions and 0 deletions

5
ext/mock_redis.rb Normal file
View file

@ -0,0 +1,5 @@
class MockRedis
def publish(channel, message)
# TODO make actually useful
end
end

View file

@ -730,6 +730,14 @@ class Site < Sequel::Model
archives_dataset.where(ipfs_hash: ipfs_hash).first.update updated_at: Time.now archives_dataset.where(ipfs_hash: ipfs_hash).first.update updated_at: Time.now
end end
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 end
def latest_archive def latest_archive