summaryrefslogtreecommitdiff
path: root/src/frontend.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend.erl')
-rw-r--r--src/frontend.erl16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/frontend.erl b/src/frontend.erl
index 8d0eccd..4043373 100644
--- a/src/frontend.erl
+++ b/src/frontend.erl
@@ -12,8 +12,12 @@ sendentry(SessionID, _Env, Input) ->
{error, E} ->
html("sendentry: bad input:", E);
{PropList} ->
- LogEntry = base64:decode(proplists:get_value(<<"entry">>, PropList)),
- TreeLeafHash = base64:decode(proplists:get_value(<<"treeleafhash">>, PropList)),
+ LogEntry = base64:decode(
+ proplists:get_value(
+ <<"entry">>, PropList)),
+ TreeLeafHash = base64:decode(
+ proplists:get_value(
+ <<"treeleafhash">>, PropList)),
ok = db:add(TreeLeafHash, LogEntry),
binary_to_list(
@@ -28,8 +32,10 @@ sendlog(SessionID, _Env, Input) ->
html("sendentry: bad input:", E);
{PropList} ->
Start = proplists:get_value(<<"start">>, PropList),
- Hashes = lists:map(fun (S) -> base64:decode(S) end, proplists:get_value(<<"hashes">>, PropList)),
-
+ Hashes = lists:map(fun (S) -> base64:decode(S) end,
+ proplists:get_value(
+ <<"hashes">>, PropList)),
+
Indices = lists:seq(Start, Start + length(Hashes) - 1),
lists:foreach(fun ({Hash, Index}) ->
ok = db:add_index(Hash, Index)
@@ -48,7 +54,7 @@ sendsth(SessionID, _Env, Input) ->
Treesize = proplists:get_value(<<"tree_size">>, PropList),
ok = db:set_treesize(Treesize),
-
+
ht:reset_tree([db:size() - 1]),
binary_to_list(