Skip to content

Commit

Permalink
* lib/hoodwinkd/helpers.rb: decrypt and encrypt use the SALT constan…
Browse files Browse the repository at this point in the history
…t now. red strips leading whitespace and allows an optional post-processor.

 * lib/hoodwinkd/models.rb: Session class, got the Hash class working.  Trimmed down the user class to the essentials.
 * lib/hoodwinkd/controllers.rb: serving of static content.
 * lib/hoodwinkd.rb: replenish Hashes on load.
 * lib/hoodwinkd/dial.rb: great, the whole site dialing app is checked in.
 * static: all the goods from hoodwink.d central.
  • Loading branch information
_why committed Feb 10, 2006
1 parent 5398b62 commit 2548819
Show file tree
Hide file tree
Showing 45 changed files with 4,004 additions and 24 deletions.
12 changes: 11 additions & 1 deletion lib/hoodwinkd.rb
Expand Up @@ -3,13 +3,23 @@

Camping.goes :Hoodwinkd

DOMAIN = '[\w\-\.]+\.\w+'
STATIC = File.expand_path('../../static', __FILE__)
SALT = "c4fc5ae625134d2a9cb392f05d94c0be"

require 'mimetypes_hash'
require 'hoodwinkd/helpers'
require 'hoodwinkd/models'
require 'hoodwinkd/controllers'
require 'hoodwinkd/views'

# extensions to the core
require 'hoodwinkd/dial'

def Hoodwinkd.create
unless Hoodwinkd::Models::Wink.table_exists?
unless Hoodwinkd::Models::Session.table_exists?
ActiveRecord::Schema.define(&Hoodwinkd::Models.schema)
Hoodwinkd::Models::Hash.replenish
Hoodwinkd::Models::Session.reset_column_information
end
end
18 changes: 15 additions & 3 deletions lib/hoodwinkd/controllers.rb
@@ -1,6 +1,3 @@

DOMAIN = '[^/]+\.[\w\-]+'

module Hoodwinkd::Controllers
class Setup < R "/(#{DOMAIN})/setup"
def get(domain)
Expand Down Expand Up @@ -120,4 +117,19 @@ def post(domain, permalink)
end
end
end

class Static < R '/static/(.+)'
def get(path)
path = File.join(STATIC, path.gsub(/\.+/, '.'))
if File.exists? path
type = MIME_TYPES[path[/\.\w+$/, 0]] || "text/plain"
@headers['Content-Type'] = type
src = File.read(path)
if type =~ %r!^text/!
src.gsub!(/\$(R\(.+?\))/) { eval($1) }
end
src
end
end
end
end

0 comments on commit 2548819

Please sign in to comment.