Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed application favicon.
Ufff... this took far longer than it should. (Part of) the problem
was that the browsers (or at least Chrome) quite aggresively
cache favicons. So maybe I had it right for a long time and
was getting default MLstate favicon because of that.
  • Loading branch information
akoprow committed Mar 31, 2011
1 parent 98f4dfb commit ee573dc
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/main.opa
Expand Up @@ -9,19 +9,23 @@ package mlstate.twopenny
* {1 Server definition, URL dispatching}
**/

twopenny_page((title, body))(_conn) =
Resource.full_page(title, body,
<link rel="icon" type="image/png" href="./img/favicon.png" />,
{success}, [])
twopenny_page((title, body))(_conn_id) =
Resource.html(title, body)

resources = @static_include_directory("img")

urls : Parser.general_parser(connexion_id -> resource) =
parser
| "user/" user=(.*) ->
| "/favicon." .* -> _conn_id ->
@static_resource("./img/favicon.png")
| result={Server.resource_map(resources)} -> _conn_id ->
result
| "/user/" user=(.*) ->
Text.to_string(user)
|> User.mk_ref(_)
|> Pages.user_page(_)
|> twopenny_page(_)
| "label/" label=(.*) ->
| "/label/" label=(.*) ->
Text.to_string(label)
|> Label.mk_ref(_)
|> Pages.label_page(_)
Expand All @@ -30,9 +34,7 @@ urls : Parser.general_parser(connexion_id -> resource) =
Pages.main_page()
|> twopenny_page(_)

resources = @static_include_directory("img")

/**
* The Twopenny server
*/
server = Server.make(Resource.add_auto_server(resources, urls))
server = Server.make(urls)

0 comments on commit ee573dc

Please sign in to comment.