Find file
Fetching contributors…
Cannot retrieve contributors at this time
165 lines (150 sloc) 5.38 KB
Testify Design
things E {pages,templates,resources}
EVERYTHING is in redis...
Ordinary HTML
CSS classes define overrides
override content
regex out da evil chars, mon
override content
provide multiline editing
regex out any evil chars?
ONLY allows images hosted on local site
override attr:src
ONLY allows GodTube (for now)
See sample script for override (id is fe10cmnu) [override whole tag?], use substitute
Allow user to copy/paste all html, just regex for the id?
Sample script
<script type="text/javascript" src=""></script>
Examples <!-- for subs, type indicator -->
<a id="bob" class="target" class="link"> href="blahahha" </a>
Input form would say Bob (type a URL):
<object id="bob" class="target" class="link">. .... </object>
Input form would say
Persistence Structure?
Setup for each thing
resources (SET with names of resources)
pages (SET with names)
templates (SET with names)
res:name:file (ARBITRARY DATA)
res:name:type (? provide MIME type info to hanlder that pushes?)
pag:name:template (TEMPNAME)
pag:name:subs (SUBHASH)
pag:name:token (DELETION checksum)
tmp:name:html (flatfile?)
Persist (model)
Given newname, create thing --
if sadd newname == 1
set thing:name:field1 resp1
set thing:name:field2 resp2
print "error! Already exists!"
Lookup all things --
sort things asc alpha
Given pagename, give subs and template --
if sismember pages pagename == 1
get thing:pagename:template
if sismember templates platename == 1
print "error! page not found"
print "error! page not found"
Given tempname, give subs
Given name, newthing
Given name, delete thing
if sismember things name == 1
srem name
rem thing:name:field1
rem thing:name:field2
For each existing thingname
Check if its fieldname is valid (if not, DELETE)
If valid, Check it has a matching name in momma set (if not, create it)
For each category, with fields and defaults
Check name for all fields
Plug defaults in for missing fields "restored"
Process (controller)
Input list creation
given template,
get list of subs,
return html form
given page,
return html
From lookup all map, create partitioned list for appear
Appear (use enliven?)
Give resource
From a URL, return a resource
Enlive templates
Include add page
(Include gallery?)
Include backlinks
Generate (from a [lazy?] seq)
listing (with appropriate links)
HTML Template
Basic header
Ajax popup?
Home (ajaxified?) list of pages
Add page
Select template
Generate input form
(Parse CSS classes from template)
Input's Type-name map is made from template (TODO: save this to redis?)
Plug this type-name map into the input form
BASED on type, PERFORM different transformation
(client & server VALDIATE)
Enter substitutions
Save substitutions to redis
Delete page
Check auth-token
If matches, delete page
Admin mode
User submits auth token
User receives auth cookie [auth cookie saved to redis w/ expire]
TODO CSRF protect?
Regenerate next auth token
User does admin stuff
Auth cookie expires [& on server]
Add template
Generate validated input form
TODO CSRF token?
Retrieve & validate HTML
Save to redis
Add resource
Generate validated input form
TODO CSRF token?
Save resource to redis
Delete page
Delete template
Delete resource
Bg workers
Save redis stuff
Return resource file from redis (code in appear?)
"purity" checks?
expire authentication
Internal Datastructure Notes
How to call create-thing
(create-thing "resource" "super.txt" [':file, 'here] [':type,'text/plaintext] )
(get-thing "resource" "hi.txt" ":file")
'' hashiyf
(hashify-thing "page" "jeyan_test" "subs" ":key1" "val1" ":key2" "val2")
Issues with persist
No hash/set type check support
Autoboxing with "(\"aoeuaoeu\")" around stuff