Revert 'Create a separate webfinger service.' We'll come back to it when we figure out the error.
This commit is contained in:
parent
1e3d70f98b
commit
6bb132b25e
4 changed files with 1 additions and 98 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -18,7 +18,7 @@ public/stylesheets/application.css
|
||||||
public/stylesheets/sessions.css
|
public/stylesheets/sessions.css
|
||||||
public/stylesheets/ui.css
|
public/stylesheets/ui.css
|
||||||
public/stylesheets/mobile.css
|
public/stylesheets/mobile.css
|
||||||
public/well-known/host-meta
|
public/diaspora
|
||||||
spec/fixtures/users.yaml
|
spec/fixtures/users.yaml
|
||||||
|
|
||||||
# Uploded files and local files
|
# Uploded files and local files
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,6 @@
|
||||||
|
|
||||||
require ::File.expand_path('../config/environment', __FILE__)
|
require ::File.expand_path('../config/environment', __FILE__)
|
||||||
require ::File.expand_path('../lib/chrome_frame', __FILE__)
|
require ::File.expand_path('../lib/chrome_frame', __FILE__)
|
||||||
require ::File.expand_path('../lib/host-meta', __FILE__)
|
|
||||||
|
|
||||||
map "/.well-known" do
|
|
||||||
run HostMeta::File.new( "public/well-known")
|
|
||||||
end
|
|
||||||
|
|
||||||
use Rack::ChromeFrame, :minimum => 8
|
use Rack::ChromeFrame, :minimum => 8
|
||||||
run Diaspora::Application
|
run Diaspora::Application
|
||||||
|
|
|
||||||
|
|
@ -1,83 +0,0 @@
|
||||||
require 'time'
|
|
||||||
require 'rack/utils'
|
|
||||||
require 'rack/mime'
|
|
||||||
|
|
||||||
module HostMeta
|
|
||||||
|
|
||||||
#
|
|
||||||
# Serve just a 'host-meta' request from a static file.
|
|
||||||
#
|
|
||||||
class File
|
|
||||||
attr_accessor :root
|
|
||||||
attr_accessor :path
|
|
||||||
|
|
||||||
alias :to_path :path
|
|
||||||
|
|
||||||
def initialize(root)
|
|
||||||
@root = root
|
|
||||||
end
|
|
||||||
|
|
||||||
def call(env)
|
|
||||||
dup._call(env)
|
|
||||||
end
|
|
||||||
|
|
||||||
F = ::File
|
|
||||||
|
|
||||||
def _call(env)
|
|
||||||
@path_info = Rack::Utils.unescape(env["PATH_INFO"])
|
|
||||||
@path = F.join(@root, @path_info)
|
|
||||||
|
|
||||||
available = begin
|
|
||||||
@path_info == "/host-meta" && F.file?(@path) && F.readable?(@path)
|
|
||||||
rescue SystemCallError
|
|
||||||
false
|
|
||||||
end
|
|
||||||
|
|
||||||
if available
|
|
||||||
serving(env)
|
|
||||||
else
|
|
||||||
fail(404, "File not found: #{@path_info}")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def serving(env)
|
|
||||||
# NOTE:
|
|
||||||
# We check via File::size? whether this file provides size info
|
|
||||||
# via stat (e.g. /proc files often don't), otherwise we have to
|
|
||||||
# figure it out by reading the whole file into memory.
|
|
||||||
@size = F.size?(@path) || Rack::Utils.bytesize(F.read(@path))
|
|
||||||
response = [
|
|
||||||
200,
|
|
||||||
{
|
|
||||||
"Last-Modified" => F.mtime(@path).httpdate,
|
|
||||||
"Content-Type" => 'application/xml+xrd; charset=utf-8'
|
|
||||||
},
|
|
||||||
self
|
|
||||||
]
|
|
||||||
response[1]["Content-Length"] = @size.to_s
|
|
||||||
response
|
|
||||||
end
|
|
||||||
|
|
||||||
def each
|
|
||||||
F.open(@path) do |file|
|
|
||||||
yield file.read( @size)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def fail(status, body)
|
|
||||||
body += "\n"
|
|
||||||
[
|
|
||||||
status,
|
|
||||||
{
|
|
||||||
"Content-Type" => "text/plain",
|
|
||||||
"Content-Length" => body.size.to_s,
|
|
||||||
"X-Cascade" => "pass"
|
|
||||||
},
|
|
||||||
[body]
|
|
||||||
]
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -128,15 +128,6 @@ if [ ! -e public/source.tar.gz ]; then
|
||||||
exit 65
|
exit 65
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# create static public/well-known/host-meta if required
|
|
||||||
if [[ -w public &&
|
|
||||||
(! -e public/well-known/host-meta ||
|
|
||||||
public/well-known/host-meta -ot config/app_config.yml) ]]
|
|
||||||
then
|
|
||||||
bundle exec erb -r config/environment.rb app/views/publics/host_meta.erb \
|
|
||||||
2>/dev/null >public/well-known/host-meta
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Precache jammit assets
|
# Precache jammit assets
|
||||||
if [[ -w public && ! -e 'public/stylesheets/application.css' ]]; then
|
if [[ -w public && ! -e 'public/stylesheets/application.css' ]]; then
|
||||||
if [ "$INIT_PUBLIC" != 'no' ]; then
|
if [ "$INIT_PUBLIC" != 'no' ]; then
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue