Route external redirections through a different origin

pull/281/head
Thibaut 9 years ago
parent e1ec0f596c
commit ac2cbdd822

@ -3,7 +3,7 @@
DevDocs combines multiple API documentations in a fast, organized, and searchable interface.
* Created by [Thibaut Courouble](http://thibaut.me)
* Supported by [JetBrains](http://devdocs.io/s/jetbrains) and [Code School](http://devdocs.io/s/code-school)
* Supported by [JetBrains](http://out.devdocs.io/s/jetbrains) and [Code School](http://out.devdocs.io/s/code-school)
Keep track of development and community news:

@ -17,7 +17,7 @@
"Added <code class=\"_label\">shift + &darr;/&uarr;</code> shortcut for scrolling (same as <code class=\"_label\">alt + &darr;/&uarr;</code>)."
], [
"2015-07-12",
"New sponsors: <a href=\"http://devdocs.io/s/jetbrains\">JetBrains</a> and <a href=\"http://devdocs.io/s/code-school\">Code School</a>\nIf you like DevDocs, please take a moment to check out their products — they're awesome!"
"New sponsors: <a href=\"http://out.devdocs.io/s/jetbrains\">JetBrains</a> and <a href=\"http://out.devdocs.io/s/code-school\">Code School</a>\nIf you like DevDocs, please take a moment to check out their products — they're awesome!"
], [
"2015-07-05",
"New documentations: <a href=\"/drupal/\">Drupal</a>, <a href=\"/vue/\">Vue.js</a>, <a href=\"/phaser/\">Phaser</a> and <a href=\"/webpack/\">webpack</a>"

@ -29,15 +29,15 @@ app.templates.notifNews = (news) ->
app.templates.notifShare = ->
textNotif """ Hi there! """,
""" Like DevDocs? Help us reach more developers by sharing the link with your friends, on
<a href="/s/tw" target="_blank">Twitter</a>, <a href="/s/fb" target="_blank">Facebook</a>,
<a href="/s/re" target="_blank">Reddit</a>, etc.<br>Thanks :) """
<a href="http://out.devdocs.io/s/tw" target="_blank">Twitter</a>, <a href="http://out.devdocs.io/s/fb" target="_blank">Facebook</a>,
<a href="http://out.devdocs.io/s/re" target="_blank">Reddit</a>, etc.<br>Thanks :) """
app.templates.notifThanks = ->
textNotif """ Hi there! """,
""" <p class="_notif-text">Like DevDocs? Check out these awesome companies who are making it possible:
<ul class="_notif-list">
<li><a href="http://devdocs.io/s/jetbrains" target="_blank">JetBrains</a> We make software development a more productive and enjoyable experience through smart IDEs and code editors.
<li><a href="http://devdocs.io/s/code-school" target="_blank">Code School</a> Learn new skills from the comfort of your own browser. Offering more than 45 courses covering JavaScript, HTML/CSS, Ruby, Git, and iOS for only $29/month.
<li><a href="http://out.devdocs.io/s/jetbrains" target="_blank">JetBrains</a> We make software development a more productive and enjoyable experience through smart IDEs and code editors.
<li><a href="http://out.devdocs.io/s/code-school" target="_blank">Code School</a> Learn new skills from the comfort of your own browser. Offering more than 45 courses covering JavaScript, HTML/CSS, Ruby, Git, and iOS for only $29/month.
</ul>
<p class="_notif-text">Have a great day :) """

@ -13,7 +13,7 @@ app.templates.aboutPage = -> """
<p>DevDocs combines multiple API documentations in a fast, organized, and searchable interface.
<ul>
<li>Created and maintained by <a href="http://thibaut.me">Thibaut Courouble</a>
<li>Supported by <a href="http://devdocs.io/s/jetbrains">JetBrains</a> and <a href="http://devdocs.io/s/code-school">Code School</a>
<li>Supported by <a href="http://out.devdocs.io/s/jetbrains">JetBrains</a> and <a href="http://out.devdocs.io/s/code-school">Code School</a>
<li>Free and <a href="https://github.com/Thibaut/devdocs">open source</a>
<iframe class="_github-btn" src="https://ghbtns.com/github-btn.html?user=Thibaut&repo=devdocs&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="100" height="20"></iframe>
</ul>
@ -30,8 +30,8 @@ app.templates.aboutPage = -> """
<p><strong>Special thanks to:</strong>
<ul>
<li><a href="http://devdocs.io/s/maxcdn">MaxCDN</a> and <a href="http://get.gaug.es/?utm_source=devdocs&utm_medium=referral&utm_campaign=sponsorships" title="Real Time Web Analytics">Gauges</a> for offering a free account to DevDocs
<li><a href="http://devdocs.io/s/shopify">Shopify</a> for supporting DevDocs in the past
<li><a href="http://out.devdocs.io/s/maxcdn">MaxCDN</a> and <a href="http://get.gaug.es/?utm_source=devdocs&utm_medium=referral&utm_campaign=sponsorships" title="Real Time Web Analytics">Gauges</a> for offering a free account to DevDocs
<li><a href="http://out.devdocs.io/s/shopify">Shopify</a> for supporting DevDocs in the past
<li><a href="https://www.heroku.com">Heroku</a> and <a href="http://newrelic.com">New Relic</a> for providing awesome free service
<li>Daniel Bruce for the <a href="http://www.entypo.com">Entypo</a> pictograms
<li><a href="http://www.jeremykratz.com/">Jeremy Kratz</a> for the C/C++ logo

@ -3,7 +3,7 @@ jetBrainsLink = (className) ->
path = "/#{type}" if type
"""
<a href="http://devdocs.io/s/jetbrains#{path || ''}" class="#{className}">
<a href="http://out.devdocs.io/s/jetbrains#{path || ''}" class="#{className}">
<span class="_logo-thx _jetbrains-logo">JetBrains</span>
<span class="_logo-info">#{JETBRAINS_INFO[type || 'default']}</span>
</a>
@ -29,7 +29,7 @@ jetBrainsType = ->
'web'
codeSchoolLink = (className) -> """
<a href="http://devdocs.io/s/code-school" class="#{className}">
<a href="http://out.devdocs.io/s/code-school" class="#{className}">
<span class="_logo-thx _code-school-logo">Code School</span>
<span class="_logo-info">With more than 45 courses covering JavaScript, HTML/CSS, Ruby, Git, and iOS, Code School pairs experienced instructors with engaging content. Start learning at codeschool.com.</span>
</a>

@ -172,6 +172,15 @@ class App < Sinatra::Application
halt erb :unsupported if unsupported_browser?
end
OUT_HOST = 'out.devdocs.io'.freeze
before do
if request.host == OUT_HOST && !request.path.start_with?('/s/')
query_string = "?#{request.query_string}" unless request.query_string.empty?
redirect "http://devdocs.io#{request.path}#{query_string}", 302
end
end
get '/manifest.appcache' do
content_type 'text/cache-manifest'
expires 0, :'no-cache'

Loading…
Cancel
Save