Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
diaspora
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
diasporg
diaspora
Commits
89c1fd5f
Commit
89c1fd5f
authored
Sep 20, 2012
by
Jonne Haß
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
query the set url only through #pod_uri in the app
parent
2a4db54d
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
40 additions
and
21 deletions
+40
-21
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+1
-1
app/models/photo.rb
app/models/photo.rb
+1
-3
app/models/profile.rb
app/models/profile.rb
+1
-3
app/models/services/facebook.rb
app/models/services/facebook.rb
+1
-1
app/models/user.rb
app/models/user.rb
+1
-1
app/presenters/o_embed_presenter.rb
app/presenters/o_embed_presenter.rb
+1
-1
app/views/layouts/notifier.html.erb
app/views/layouts/notifier.html.erb
+1
-1
app/views/publics/host_meta.erb
app/views/publics/host_meta.erb
+1
-1
app/views/shared/_right_sections.html.haml
app/views/shared/_right_sections.html.haml
+1
-1
app/views/users/public.atom.builder
app/views/users/public.atom.builder
+1
-1
lib/tasks/db.rake
lib/tasks/db.rake
+1
-1
spec/factories.rb
spec/factories.rb
+1
-1
spec/lib/configuration/methods_spec.rb
spec/lib/configuration/methods_spec.rb
+25
-0
spec/models/person_spec.rb
spec/models/person_spec.rb
+1
-3
spec/models/profile_spec.rb
spec/models/profile_spec.rb
+1
-1
spec/support/user_methods.rb
spec/support/user_methods.rb
+1
-1
No files found.
app/helpers/application_helper.rb
View file @
89c1fd5f
...
...
@@ -21,7 +21,7 @@ module ApplicationHelper
end
def
raw_bookmarklet
(
height
=
250
,
width
=
620
)
"javascript:(function(){f='
#{
AppConfig
.
environment
.
url
}
bookmarklet?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'¬es='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=1&';a=function(){if(!window.open(f+'noui=1&jump=doclose','diasporav1','location=yes,links=no,scrollbars=no,toolbar=no,width=
#{
width
}
,height=
#{
height
}
'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()"
"javascript:(function(){f='
#{
AppConfig
.
pod_uri
.
to_s
}
bookmarklet?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'¬es='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=1&';a=function(){if(!window.open(f+'noui=1&jump=doclose','diasporav1','location=yes,links=no,scrollbars=no,toolbar=no,width=
#{
width
}
,height=
#{
height
}
'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()"
end
def
magic_bookmarklet_link
...
...
app/models/photo.rb
View file @
89c1fd5f
...
...
@@ -99,9 +99,7 @@ class Photo < ActiveRecord::Base
def
update_remote_path
unless
self
.
unprocessed_image
.
url
.
match
(
/^https?:\/\//
)
pod_url
=
AppConfig
.
environment
.
url
.
get
.
dup
pod_url
.
chop!
if
pod_url
[
-
1
,
1
]
==
'/'
remote_path
=
"
#{
pod_url
}#{
self
.
unprocessed_image
.
url
}
"
remote_path
=
"
#{
AppConfig
.
pod_uri
.
to_s
.
chomp
(
"/"
)
}#{
self
.
unprocessed_image
.
url
}
"
else
remote_path
=
self
.
unprocessed_image
.
url
end
...
...
app/models/profile.rb
View file @
89c1fd5f
...
...
@@ -185,8 +185,6 @@ class Profile < ActiveRecord::Base
end
def
absolutify_local_url
url
pod_url
=
AppConfig
.
environment
.
url
.
get
pod_url
.
chop!
if
pod_url
[
-
1
,
1
]
==
'/'
"
#{
pod_url
}#{
url
}
"
"
#{
AppConfig
.
pod_uri
.
to_s
.
chomp
(
"/"
)
}#{
url
}
"
end
end
app/models/services/facebook.rb
View file @
89c1fd5f
...
...
@@ -23,7 +23,7 @@ class Services::Facebook < Service
end
def
create_open_graph_params
(
post
)
{
:post
=>
"
#{
AppConfig
.
environment
.
url
}#{
short_post_path
(
post
)
}
"
,
:access_token
=>
self
.
access_token
}
{
:post
=>
"
#{
AppConfig
.
pod_uri
.
to_s
}#{
short_post_path
(
post
)
}
"
,
:access_token
=>
self
.
access_token
}
end
def
create_post_params
(
post
)
...
...
app/models/user.rb
View file @
89c1fd5f
...
...
@@ -395,7 +395,7 @@ class User < ActiveRecord::Base
end
def
set_person
(
person
)
person
.
url
=
AppConfig
.
environment
.
url
person
.
url
=
AppConfig
.
pod_uri
.
to_s
person
.
diaspora_handle
=
"
#{
self
.
username
}#{
User
.
diaspora_id_host
}
"
self
.
person
=
person
end
...
...
app/presenters/o_embed_presenter.rb
View file @
89c1fd5f
...
...
@@ -15,7 +15,7 @@ class OEmbedPresenter
def
as_json
(
opts
=
{})
{
:provider_name
=>
"Diaspora"
,
:provider_url
=>
AppConfig
.
environment
.
url
,
:provider_url
=>
AppConfig
.
pod_uri
.
to_s
,
:type
=>
'rich'
,
:version
=>
'1.0'
,
:title
=>
post_title
,
...
...
app/views/layouts/notifier.html.erb
View file @
89c1fd5f
...
...
@@ -28,7 +28,7 @@
<table
cellspacing=
"0"
cellpadding=
"0"
border=
"0"
align=
"center"
width=
"100%"
style=
"font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:14px;color:#333;"
>
<tr>
<td
style=
"text-align:center;padding:30px;"
>
<img
src=
"
<%=
AppConfig
.
environment
.
url
%>
assets/branding/logo_caps.png"
alt=
"DIASPORA*"
width=
"95px"
height=
"14px"
/>
<img
src=
"
<%=
AppConfig
.
pod_uri
.
to_s
%>
assets/branding/logo_caps.png"
alt=
"DIASPORA*"
width=
"95px"
height=
"14px"
/>
</td>
</tr>
</table>
...
...
app/views/publics/host_meta.erb
View file @
89c1fd5f
...
...
@@ -5,6 +5,6 @@
<Link
rel=
'lrdd'
type=
'application/xrd+xml'
template=
'
<%=
AppConfig
.
environment
.
url
%>
webfinger?q={uri}'
/>
template=
'
<%=
AppConfig
.
pod_uri
.
to_s
%>
webfinger?q={uri}'
/>
</XRD>
app/views/shared/_right_sections.html.haml
View file @
89c1fd5f
...
...
@@ -74,7 +74,7 @@
=
t
(
'aspects.index.donate'
)
.content
-
if
AppConfig
.
settings
.
paypal_hosted_button_id
.
present?
=
t
(
'aspects.index.keep_pod_running'
,
:pod
=>
URI
.
parse
(
AppConfig
.
environment
.
url
)
.
host
)
=
t
(
'aspects.index.keep_pod_running'
,
:pod
=>
AppConfig
.
pod_uri
.
host
)
%br
=
render
'shared/donatepod'
-
else
...
...
app/views/users/public.atom.builder
View file @
89c1fd5f
...
...
@@ -8,7 +8,7 @@ atom_feed({'xmlns:thr' => 'http://purl.org/syndication/thread/1.0',
:id => "#{@user.public_url}.atom",
:root_url => "#{@user.public_url}"}) do |feed|
feed.tag! :generator, 'Diaspora', :uri => "#{AppConfig.
environment.url
}"
feed.tag! :generator, 'Diaspora', :uri => "#{AppConfig.
pod_uri.to_s
}"
feed.title "#{@user.name}'s Public Feed"
feed.subtitle "Updates from #{@user.name} on Diaspora"
feed.logo "#{@user.image_url(:thumb_small)}"
...
...
lib/tasks/db.rake
View file @
89c1fd5f
...
...
@@ -70,7 +70,7 @@ namespace :db do
require
File
.
join
(
File
.
dirname
(
__FILE__
),
'..'
,
'..'
,
'config'
,
'environment'
)
Person
.
where
(
:url
=>
'example.org'
).
all
.
each
{
|
person
|
if
person
.
owner
person
.
url
=
AppConfig
.
environment
.
url
person
.
url
=
AppConfig
.
pod_uri
.
to_s
person
.
diaspora_handle
=
person
.
owner
.
diaspora_handle
person
.
save
end
...
...
spec/factories.rb
View file @
89c1fd5f
...
...
@@ -28,7 +28,7 @@ FactoryGirl.define do
factory
:person
do
sequence
(
:diaspora_handle
)
{
|
n
|
"bob-person-
#{
n
}#{
r_str
}
@example.net"
}
sequence
(
:url
)
{
|
n
|
AppConfig
.
environment
.
url
.
get
}
url
AppConfig
.
pod_uri
.
to_s
serialized_public_key
OpenSSL
::
PKey
::
RSA
.
generate
(
1024
).
public_key
.
export
after
(
:build
)
do
|
person
|
person
.
profile
=
FactoryGirl
.
build
(
:profile
,
:person
=>
person
)
unless
person
.
profile
.
first_name
.
present?
...
...
spec/lib/configuration/methods_spec.rb
View file @
89c1fd5f
...
...
@@ -10,11 +10,36 @@ describe Configuration::Methods do
end
describe
"#pod_uri"
do
before
do
@settings
.
environment
.
url
=
nil
@settings
.
instance_variable_set
(
:@pod_uri
,
nil
)
end
it
"properly parses the pod url"
do
@settings
.
environment
.
url
=
"http://example.org/"
@settings
.
pod_uri
.
scheme
.
should
==
"http"
@settings
.
pod_uri
.
host
.
should
==
"example.org"
end
it
"adds a trailing slash if there isn't one"
do
@settings
.
environment
.
url
=
"http://example.org"
@settings
.
pod_uri
.
to_s
.
should
==
"http://example.org/"
end
it
"does not add an extra trailing slash"
do
@settings
.
environment
.
url
=
"http://example.org/"
@settings
.
pod_uri
.
to_s
.
should
==
"http://example.org/"
end
it
"adds http:// on the front if it's missing"
do
@settings
.
environment
.
url
=
"example.org/"
@settings
.
pod_uri
.
to_s
.
should
==
"http://example.org/"
end
it
"does not add a prefix if there already is https:// on the front"
do
@settings
.
environment
.
url
=
"https://example.org/"
@settings
.
pod_uri
.
to_s
.
should
==
"https://example.org/"
end
end
describe
"#bare_pod_uri"
do
...
...
spec/models/person_spec.rb
View file @
89c1fd5f
...
...
@@ -132,11 +132,9 @@ describe Person do
end
it
'does not include www if it is set in app config'
do
old_url
=
AppConfig
.
environment
.
url
.
get
AppConfig
.
environment
.
url
=
'https://www.foobar.com/'
AppConfig
.
stub
(
:pod_uri
).
and_return
(
Addressable
::
URI
.
parse
(
'https://www.foobar.com/'
))
new_person
=
User
.
build
(
:username
=>
"foo123"
,
:email
=>
"foo123@example.com"
,
:password
=>
"password"
,
:password_confirmation
=>
"password"
).
person
new_person
.
diaspora_handle
.
should
==
"foo123@foobar.com"
AppConfig
.
environment
.
url
=
old_url
end
end
...
...
spec/models/profile_spec.rb
View file @
89c1fd5f
...
...
@@ -116,7 +116,7 @@ describe Profile do
before
do
@profile
=
FactoryGirl
.
build
(
:profile
)
@profile
.
image_url
=
"http://tom.joindiaspora.com/images/user/tom.jpg"
@pod_url
=
(
AppConfig
.
environment
.
url
.
get
[
-
1
,
1
]
==
'/'
?
AppConfig
.
environment
.
url
.
chop
:
AppConfig
.
environment
.
url
)
@pod_url
=
AppConfig
.
pod_uri
.
to_s
.
chomp
(
"/"
)
end
it
'ignores an empty string'
do
...
...
spec/support/user_methods.rb
View file @
89c1fd5f
class
User
include
Rails
.
application
.
routes
.
url_helpers
def
default_url_options
{
:host
=>
AppConfig
.
environment
.
url
}
{
:host
=>
AppConfig
.
pod_uri
.
host
}
end
alias_method
:share_with_original
,
:share_with
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment