Revert "Extended sub-uri support." for now....
This reverts commit 9cd08bac67.
This commit is contained in:
parent
6d4696faf0
commit
081e85f224
9 changed files with 96 additions and 123 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -18,7 +18,6 @@ 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/diaspora
|
|
||||||
spec/fixtures/users.yaml
|
spec/fixtures/users.yaml
|
||||||
|
|
||||||
# Uploded files and local files
|
# Uploded files and local files
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@
|
||||||
%li= link_to '@joindiaspora', "http://twitter.com/joindiaspora"
|
%li= link_to '@joindiaspora', "http://twitter.com/joindiaspora"
|
||||||
%li= link_to 'github', "https://github.com/diaspora/diaspora"
|
%li= link_to 'github', "https://github.com/diaspora/diaspora"
|
||||||
%li= link_to t('layouts.header.blog'), "http://blog.joindiaspora.com"
|
%li= link_to t('layouts.header.blog'), "http://blog.joindiaspora.com"
|
||||||
%li= link_to t('layouts.header.code'), "#{root_url}/source.tar.gz"
|
%li= link_to t('layouts.header.code'), "#{root_url}source.tar.gz"
|
||||||
%li= link_to t('.whats_new'), 'https://github.com/diaspora/diaspora/wiki/Changelog'
|
%li= link_to t('.whats_new'), 'https://github.com/diaspora/diaspora/wiki/Changelog'
|
||||||
|
|
||||||
-if !@landing_page && request.url.match(/joindiaspora.com/)
|
-if !@landing_page && request.url.match(/joindiaspora.com/)
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
# Url of this host, as seen from the internet.
|
# Hostname of this host, as seen from the internet.
|
||||||
pod_url: "http://localhost:3000"
|
pod_url: "http://localhost:3000"
|
||||||
|
|
||||||
# Set this to true in order to close signups. Users will still be
|
# Set this to true in order to close signups. Users will still be
|
||||||
|
|
@ -68,12 +68,12 @@ default:
|
||||||
|
|
||||||
#google analytics key, if false, it won't include the javascript
|
#google analytics key, if false, it won't include the javascript
|
||||||
google_a_site: false
|
google_a_site: false
|
||||||
|
|
||||||
#piwik integration if not set, no javascript included
|
#piwik integration if not set, no javascript included
|
||||||
piwik_id:
|
piwik_id:
|
||||||
# the site url in raw format (e.g. pikwik.examplehost.com)
|
# the site url in raw format (e.g. pikwik.examplehost.com)
|
||||||
piwik_url:
|
piwik_url:
|
||||||
|
|
||||||
|
|
||||||
#cloudfiles username and api-key, used for backups
|
#cloudfiles username and api-key, used for backups
|
||||||
cloudfiles_username: 'example'
|
cloudfiles_username: 'example'
|
||||||
|
|
|
||||||
|
|
@ -27,5 +27,3 @@ end
|
||||||
# Initialize the rails application
|
# Initialize the rails application
|
||||||
Diaspora::Application.initialize!
|
Diaspora::Application.initialize!
|
||||||
|
|
||||||
# Valid as long as thin serves the assets.
|
|
||||||
ActionController::Base.asset_host = APP_CONFIG[ :pod_url]
|
|
||||||
|
|
|
||||||
|
|
@ -8,40 +8,35 @@
|
||||||
# Specific items
|
# Specific items
|
||||||
# * pod_url: As in app_config.yml, normalized with a trailing /.
|
# * pod_url: As in app_config.yml, normalized with a trailing /.
|
||||||
# * pod_uri: An uri object derived from pod_url.
|
# * pod_uri: An uri object derived from pod_url.
|
||||||
#
|
|
||||||
if defined? APP_CONFIG
|
|
||||||
false
|
|
||||||
else
|
|
||||||
require 'uri'
|
|
||||||
|
|
||||||
def load_config_yaml filename
|
require 'uri'
|
||||||
YAML.load(File.read(filename))
|
|
||||||
end
|
|
||||||
|
|
||||||
if File.exist? "#{Rails.root}/config/app_config.yml"
|
def load_config_yaml filename
|
||||||
all_envs = load_config_yaml "#{Rails.root}/config/app_config.yml"
|
YAML.load(File.read(filename))
|
||||||
all_envs = load_config_yaml "#{Rails.root}/config/app_config.yml.example" unless all_envs
|
end
|
||||||
else
|
|
||||||
puts "WARNING: No config/app_config.yml found! Look at config/app_config.yml.example for help."
|
if File.exist? "#{Rails.root}/config/app_config.yml"
|
||||||
all_envs = load_config_yaml "#{Rails.root}/config/app_config.yml.example"
|
all_envs = load_config_yaml "#{Rails.root}/config/app_config.yml"
|
||||||
end
|
all_envs = load_config_yaml "#{Rails.root}/config/app_config.yml.example" unless all_envs
|
||||||
|
else
|
||||||
if all_envs[Rails.env.to_s]
|
puts "WARNING: No config/app_config.yml found! Look at config/app_config.yml.example for help."
|
||||||
APP_CONFIG = all_envs['default'].merge(all_envs[Rails.env.to_s]).symbolize_keys
|
all_envs = load_config_yaml "#{Rails.root}/config/app_config.yml.example"
|
||||||
else
|
end
|
||||||
APP_CONFIG = all_envs['default'].symbolize_keys
|
|
||||||
end
|
if all_envs[Rails.env.to_s]
|
||||||
|
APP_CONFIG = all_envs['default'].merge(all_envs[Rails.env.to_s]).symbolize_keys
|
||||||
begin
|
else
|
||||||
APP_CONFIG[:pod_uri] = URI.parse( APP_CONFIG[:pod_url])
|
APP_CONFIG = all_envs['default'].symbolize_keys
|
||||||
rescue
|
end
|
||||||
puts "WARNING: pod url " + APP_CONFIG[:pod_url] + " is not a legal URI"
|
|
||||||
end
|
begin
|
||||||
|
APP_CONFIG[:pod_uri] = URI.parse( APP_CONFIG[:pod_url])
|
||||||
APP_CONFIG[:pod_url] = APP_CONFIG[:pod_uri].normalize.to_s
|
rescue
|
||||||
APP_CONFIG[:pod_url].chomp!("/"); APP_CONFIG[:pod_url]+= '/'
|
puts "WARNING: pod url " + APP_CONFIG[:pod_url] + " is not a legal URI"
|
||||||
|
end
|
||||||
if APP_CONFIG[:pod_uri].host == "example.org" && Rails.env != "test"
|
|
||||||
puts "WARNING: Please modify your app_config.yml to have a proper pod_url!"
|
APP_CONFIG[:pod_url] = APP_CONFIG[:pod_uri].normalize.to_s
|
||||||
end
|
|
||||||
|
if APP_CONFIG[:pod_uri].host == "example.org" && Rails.env != "test"
|
||||||
|
puts "WARNING: Please modify your app_config.yml to have a proper pod_url!"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -3,55 +3,54 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
Diaspora::Application.routes.draw do
|
Diaspora::Application.routes.draw do
|
||||||
scope APP_CONFIG[:pod_uri].path || '' do
|
resources :status_messages, :only => [:create, :destroy, :show]
|
||||||
|
resources :comments, :only => [:create]
|
||||||
|
resources :requests, :only => [:destroy, :create]
|
||||||
|
resources :services
|
||||||
|
|
||||||
|
resources :notifications
|
||||||
|
resources :posts, :only => [:show], :path => '/p/'
|
||||||
|
|
||||||
resources :status_messages, :only => [:create, :destroy, :show]
|
|
||||||
resources :comments, :only => [:create]
|
|
||||||
resources :requests, :only => [:destroy, :create]
|
|
||||||
resources :services
|
|
||||||
|
|
||||||
resources :notifications
|
|
||||||
resources :posts, :only => [:show], :path => '/p/'
|
|
||||||
|
|
||||||
match '/people/share_with' => 'people#share_with', :as => 'share_with'
|
match '/people/share_with' => 'people#share_with', :as => 'share_with'
|
||||||
resources :people do
|
resources :people do
|
||||||
resources :status_messages
|
resources :status_messages
|
||||||
resources :photos
|
resources :photos
|
||||||
end
|
|
||||||
|
|
||||||
match '/people/by_handle' => 'people#retrieve_remote', :as => 'person_by_handle'
|
|
||||||
match '/auth/:provider/callback' => 'services#create'
|
|
||||||
match '/auth/failure' => 'services#failure'
|
|
||||||
|
|
||||||
match 'photos/make_profile_photo' => 'photos#make_profile_photo'
|
|
||||||
resources :photos, :except => [:index]
|
|
||||||
|
|
||||||
devise_for :users, :controllers => {:registrations => "registrations",
|
|
||||||
:password => "devise/passwords",
|
|
||||||
:invitations => "invitations"}
|
|
||||||
# added public route to user
|
|
||||||
match 'public/:username', :to => 'users#public'
|
|
||||||
match 'getting_started', :to => 'users#getting_started', :as => 'getting_started'
|
|
||||||
match 'getting_started_completed', :to => 'users#getting_started_completed'
|
|
||||||
match 'users/export', :to => 'users#export'
|
|
||||||
match 'users/export_photos', :to => 'users#export_photos'
|
|
||||||
match 'login', :to => 'users#sign_up'
|
|
||||||
resources :users, :except => [:create, :new, :show]
|
|
||||||
|
|
||||||
match 'aspects/move_contact', :to => 'aspects#move_contact', :as => 'move_contact'
|
|
||||||
match 'aspects/add_to_aspect', :to => 'aspects#add_to_aspect', :as => 'add_to_aspect'
|
|
||||||
match 'aspects/remove_from_aspect',:to => 'aspects#remove_from_aspect', :as => 'remove_from_aspect'
|
|
||||||
match 'aspects/manage', :to => 'aspects#manage'
|
|
||||||
resources :aspects, :except => [:edit]
|
|
||||||
|
|
||||||
#public routes
|
|
||||||
match 'webfinger', :to => 'publics#webfinger'
|
|
||||||
match 'hcard/users/:id', :to => 'publics#hcard'
|
|
||||||
match 'receive/users/:id', :to => 'publics#receive'
|
|
||||||
match 'hub', :to => 'publics#hub'
|
|
||||||
|
|
||||||
#root
|
|
||||||
root :to => 'home#show'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
match '/people/by_handle' => 'people#retrieve_remote', :as => 'person_by_handle'
|
||||||
|
match '/auth/:provider/callback' => 'services#create'
|
||||||
|
match '/auth/failure' => 'services#failure'
|
||||||
|
|
||||||
|
match 'photos/make_profile_photo' => 'photos#make_profile_photo'
|
||||||
|
resources :photos, :except => [:index]
|
||||||
|
|
||||||
|
devise_for :users, :controllers => {:registrations => "registrations",
|
||||||
|
:password => "devise/passwords",
|
||||||
|
:invitations => "invitations"}
|
||||||
|
# added public route to user
|
||||||
|
match 'public/:username', :to => 'users#public'
|
||||||
|
match 'getting_started', :to => 'users#getting_started', :as => 'getting_started'
|
||||||
|
match 'getting_started_completed', :to => 'users#getting_started_completed'
|
||||||
|
match 'users/export', :to => 'users#export'
|
||||||
|
match 'users/export_photos', :to => 'users#export_photos'
|
||||||
|
match 'login', :to => 'users#sign_up'
|
||||||
|
resources :users, :except => [:create, :new, :show]
|
||||||
|
|
||||||
|
match 'aspects/move_contact', :to => 'aspects#move_contact', :as => 'move_contact'
|
||||||
|
match 'aspects/add_to_aspect', :to => 'aspects#add_to_aspect', :as => 'add_to_aspect'
|
||||||
|
match 'aspects/remove_from_aspect',:to => 'aspects#remove_from_aspect', :as => 'remove_from_aspect'
|
||||||
|
match 'aspects/manage', :to => 'aspects#manage'
|
||||||
|
resources :aspects, :except => [:edit]
|
||||||
|
|
||||||
|
#public routes
|
||||||
|
match 'webfinger', :to => 'publics#webfinger'
|
||||||
|
match 'hcard/users/:id', :to => 'publics#hcard'
|
||||||
match '.well-known/host-meta',:to => 'publics#host_meta'
|
match '.well-known/host-meta',:to => 'publics#host_meta'
|
||||||
|
match 'receive/users/:id', :to => 'publics#receive'
|
||||||
|
match 'hub', :to => 'publics#hub'
|
||||||
|
|
||||||
|
#root
|
||||||
|
root :to => 'home#show'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,16 @@
|
||||||
#
|
#
|
||||||
# Included by script/server
|
# Included by script/server
|
||||||
#
|
#
|
||||||
|
THIN_PORT=3000
|
||||||
|
SOCKET_PORT=8080
|
||||||
|
|
||||||
# Choose one mode by uncommenting
|
# Choose one mode by uncommenting
|
||||||
export RAILS_ENV='development'
|
export RAILS_ENV='development'
|
||||||
#export RAILS_ENV='production'
|
#export RAILS_ENV='production'
|
||||||
#export RAILS_ENV='test'
|
#export RAILS_ENV='test'
|
||||||
|
|
||||||
# See thin -h for possible values. script/server sets -p <port>.
|
# See thin -h for possible values.
|
||||||
DEFAULT_THIN_ARGS="-e $RAILS_ENV"
|
DEFAULT_THIN_ARGS="-p $THIN_PORT -e $RAILS_ENV"
|
||||||
|
|
||||||
# Set to 'no' to disable server dry-run at first start
|
# Set to 'no' to disable server dry-run at first start
|
||||||
# creating generated files in public/ folder.
|
# creating generated files in public/ folder.
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Get value from APP_CONFIG
|
|
||||||
#
|
|
||||||
# Usage get_env [key ...]
|
|
||||||
|
|
||||||
path=$( readlink -fn $0) && cd $(dirname $path)/.. || exit 2
|
|
||||||
|
|
||||||
if [[ ! -e tmp/environment || tmp/environment -ot config/app_config.yml ]]
|
|
||||||
then
|
|
||||||
ruby > tmp/environment << 'EOT'
|
|
||||||
require File.join('config', 'environment.rb')
|
|
||||||
APP_CONFIG.each { |key, value| puts key.to_s + "\t" + value.to_s }
|
|
||||||
puts "pod_uri.host\t" + APP_CONFIG[:pod_uri].host.to_s
|
|
||||||
puts "pod_uri.path\t" + APP_CONFIG[:pod_uri].path.to_s
|
|
||||||
puts "pod_uri.port\t" + APP_CONFIG[:pod_uri].port.to_s
|
|
||||||
EOT
|
|
||||||
fi
|
|
||||||
|
|
||||||
for key in $@; do
|
|
||||||
awk -v key=$key '{ if ($1 == key ) print $2 }' < tmp/environment
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
@ -12,17 +12,12 @@ OS=`uname -s`
|
||||||
function init_public
|
function init_public
|
||||||
# Create all dynamically generated files in public/ folder
|
# Create all dynamically generated files in public/ folder
|
||||||
{
|
{
|
||||||
sub_uri=$(./script/get_env.sh pod_uri.path)
|
|
||||||
if [ -n "$sub_uri" ]; then
|
|
||||||
cd public; ln -sf . ${sub_uri##/}; cd ..
|
|
||||||
fi
|
|
||||||
bundle exec thin \
|
bundle exec thin \
|
||||||
-d --pid log/thin.pid --address localhost --port $THIN_PORT \
|
-d --pid log/thin.pid --address localhost --port $THIN_PORT \
|
||||||
start
|
start
|
||||||
pod_url=$(./script/get_env.sh pod_url)
|
|
||||||
for ((i = 0; i < 30; i += 1)) do
|
for ((i = 0; i < 30; i += 1)) do
|
||||||
sleep 2
|
sleep 2
|
||||||
wget -q -O tmp/server.html "$pod_url" && \
|
wget -q -O tmp/server.html http://localhost:$THIN_PORT && \
|
||||||
rm tmp/server.html && break
|
rm tmp/server.html && break
|
||||||
done
|
done
|
||||||
bundle exec thin --pid log/thin.pid stop
|
bundle exec thin --pid log/thin.pid stop
|
||||||
|
|
@ -80,8 +75,14 @@ function redis_config
|
||||||
config/redis.conf
|
config/redis.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
THIN_PORT=$(./script/get_env.sh 'pod_uri.port')
|
# Scan for -p, find out what port thin is about to use.
|
||||||
SOCKET_PORT=$(./script/get_env.sh 'socket_port')
|
args="$DEFAULT_THIN_ARGS $@"
|
||||||
|
prev_arg=''
|
||||||
|
for arg in $( echo $args | awk '{ for (i = 1; i <= NF; i++) print $i}')
|
||||||
|
do
|
||||||
|
[ "$prev_arg" = '-p' ] && THIN_PORT="$arg"
|
||||||
|
prev_arg="$arg"
|
||||||
|
done
|
||||||
|
|
||||||
# Is someone listening on the ports already? (ipv4 only test ?)
|
# Is someone listening on the ports already? (ipv4 only test ?)
|
||||||
services=$( chk_service $THIN_PORT )
|
services=$( chk_service $THIN_PORT )
|
||||||
|
|
@ -106,6 +107,8 @@ if [ -n "$services" ]; then
|
||||||
exit 64
|
exit 64
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check if Mongo is running
|
# Check if Mongo is running
|
||||||
if ! ps ax | grep -v grep | grep mongod >/dev/null
|
if ! ps ax | grep -v grep | grep mongod >/dev/null
|
||||||
then
|
then
|
||||||
|
|
@ -142,4 +145,4 @@ mkdir -p -v log/thin/
|
||||||
bundle exec ruby ./script/websocket_server.rb&
|
bundle exec ruby ./script/websocket_server.rb&
|
||||||
redis-server config/redis.conf &>log/redis-console.log &
|
redis-server config/redis.conf &>log/redis-console.log &
|
||||||
QUEUE=* bundle exec rake resque:work&
|
QUEUE=* bundle exec rake resque:work&
|
||||||
bundle exec thin start -p $THIN_PORT $@
|
bundle exec thin start $args
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue