mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
redirect to the Internet Archive for Geocities site paths before 404ing
This commit is contained in:
parent
9b493483b7
commit
20cbd4ebac
1 changed files with 37 additions and 0 deletions
37
app.rb
37
app.rb
|
@ -24,6 +24,42 @@ end
|
|||
|
||||
set :protection, :frame_options => "ALLOW-FROM #{$config['surf_iframe_source']}"
|
||||
|
||||
GEOCITIES_NEIGHBORHOODS = %w{
|
||||
area51
|
||||
athens
|
||||
augusta
|
||||
baja
|
||||
bourbonstreet
|
||||
capecanaveral
|
||||
capitolhill
|
||||
collegepark
|
||||
colosseum
|
||||
enchantedforest
|
||||
hollywood
|
||||
motorcity
|
||||
napavalley
|
||||
nashville
|
||||
petsburgh
|
||||
pipeline
|
||||
rainforest
|
||||
researchtriangle
|
||||
siliconvalley
|
||||
soho
|
||||
sunsetstrip
|
||||
timessquare
|
||||
televisioncity
|
||||
tokyo
|
||||
vienna
|
||||
yosemite
|
||||
}.freeze
|
||||
|
||||
def redirect_to_internet_archive_for_geocities_sites
|
||||
match = request.path.match /^\/(\w+)\/.+$/i
|
||||
if match && GEOCITIES_NEIGHBORHOODS.include?(match.captures.first.downcase)
|
||||
redirect "https://wayback.archive.org/http://geocities.com/#{request.path}"
|
||||
end
|
||||
end
|
||||
|
||||
before do
|
||||
if request.path.match /^\/api\//i
|
||||
@api = true
|
||||
|
@ -40,6 +76,7 @@ end
|
|||
|
||||
not_found do
|
||||
api_not_found if @api
|
||||
redirect_to_internet_archive_for_geocities_sites
|
||||
@title = 'Not Found'
|
||||
erb :'not_found'
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue